Addressing merge conflicts
This commit is contained in:
commit
d16dd2f56e
9 changed files with 222 additions and 268 deletions
|
|
@ -46,8 +46,7 @@ export default {
|
|||
const fieldOptions = {
|
||||
type: inputType,
|
||||
validateOnValueUpdate: false,
|
||||
validateOnMount: false,
|
||||
validateOnBlur: false
|
||||
validateOnMount: false
|
||||
};
|
||||
|
||||
const { handleChange, meta, errors }
|
||||
|
|
|
|||
|
|
@ -162,7 +162,8 @@ function mapStringToModal(str) {
|
|||
const params = linkToReplace.substring((dynamicStrings.MODAL_LINK).length + 2, linkToReplace.length - 1);
|
||||
const splitParams = params.split(',');
|
||||
|
||||
const bodyText = '<button modalTarget="' + splitParams[0] + '" class="modal-text" aria-label="Modal window"><span>' + splitParams[1] + '</span></button>';
|
||||
const bodyText
|
||||
= `<a href="#" modalTarget="${splitParams[0]}" class="modal-text" aria-label="Modal window">${splitParams[1]}</a>`;
|
||||
|
||||
let returnVal = str.replace(linkToReplace, bodyText);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,8 +56,7 @@ export default {
|
|||
}, 10);
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
false);
|
||||
},
|
||||
hideModal() {
|
||||
this.isModalVisible = false;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
|||
|
||||
// Mock our module for promises
|
||||
jest.mock('@/helpers/layout-helper.js', () => ({
|
||||
settleAllPromises: jest.fn(),
|
||||
settleAllPromises: jest.fn()
|
||||
}));
|
||||
|
||||
// Mock fetchCmsContentForPage, setupModalLinks, and processIfStatements
|
||||
|
|
@ -1162,6 +1162,7 @@ describe('coverageStatement.vue', () => {
|
|||
});
|
||||
});
|
||||
describe.only('claim registration api call', () => {
|
||||
// TODO fix test to actually work
|
||||
it('claim registration not required => method not called', async () => {
|
||||
// Arrange
|
||||
const wrapper = setupMocks({});
|
||||
|
|
@ -1170,12 +1171,12 @@ describe('coverageStatement.vue', () => {
|
|||
store.isClaimRegistrationRequired = false;
|
||||
|
||||
const to = {
|
||||
query: { issPage: getRandomString(4,10) }
|
||||
query: { issPage: getRandomString(4, 10) }
|
||||
};
|
||||
const next = jest.fn();
|
||||
|
||||
// SUT
|
||||
coverageStatement.beforeRouteEnter.call(wrapper.vm, to, undefined, next)
|
||||
coverageStatement.beforeRouteEnter.call(wrapper.vm, to, undefined, next);
|
||||
|
||||
// Assert
|
||||
expect(store.registerClaim).not.toHaveBeenCalled();
|
||||
|
|
@ -1185,8 +1186,7 @@ describe('coverageStatement.vue', () => {
|
|||
// Arrange
|
||||
const sellingPrice = getRandomInt(50, 100);
|
||||
const deductible = sellingPrice - 1;
|
||||
const { wrapper } = setupMocks({
|
||||
});
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
await wrapper.setData({
|
||||
availableLineItems: [
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ import { useMainStore } from '@/store/index.js';
|
|||
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin.js';
|
||||
import globalRules from '@/constants/global-rules.js';
|
||||
import baseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
||||
|
||||
export default {
|
||||
name: 'coverage-statement',
|
||||
|
|
@ -137,7 +137,6 @@ export default {
|
|||
async beforeRouteEnter(to, from, next) {
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||
|
||||
const supportingItemsPromise = await useMainStore().getSupportingItems();
|
||||
|
||||
// Settle promises and get results
|
||||
|
|
@ -153,7 +152,6 @@ export default {
|
|||
];
|
||||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
||||
const clonedGlassParts = useMainStore().order.lineItems.glassParts
|
||||
? JSON.parse(JSON.stringify(useMainStore().order.lineItems.glassParts))
|
||||
: [];
|
||||
|
|
@ -214,6 +212,9 @@ export default {
|
|||
nextStepsBody() {
|
||||
return this.getBodyTextFromCms('NextStepsWidget')?.replaceAll('{custom:damage}', this.damageText);
|
||||
},
|
||||
continueWithSchedulingBodyText() {
|
||||
return this.getCmsContent('continueWithSchedulingCopy', 'BodyText');
|
||||
},
|
||||
unverifiedADASNextStepsBodyText() {
|
||||
return this.getCmsContent('UnverifiedADASNextStepsWidget', 'BodyText')?.replaceAll('{custom:damage}', this.damageText);
|
||||
},
|
||||
|
|
@ -269,7 +270,7 @@ export default {
|
|||
},
|
||||
isADAS() {
|
||||
const parts = useMainStore().order.lineItems.glassParts;
|
||||
return parts != null && parts.find((part) => part.requiresRecalibration);
|
||||
return parts !== null && !!parts.find((part) => part.requiresRecalibration);
|
||||
},
|
||||
isRepair() {
|
||||
return useMainStore().order.damage.isRepair;
|
||||
|
|
@ -308,23 +309,16 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
async mounted() {
|
||||
this.$refs.loadingModal.showModal();
|
||||
setupModalLinks(this);
|
||||
const vm = this;
|
||||
if (this.policyLookupSuccessful
|
||||
&& useMainStore().isClaimRegistrationRequired
|
||||
&& this.coveredAndServicePriceAboveOrEqualDeductible) {
|
||||
useMainStore().registerClaim().then((r) => {
|
||||
vm.$refs.loadingModal.hideModal();
|
||||
return r;
|
||||
}, (r) => {
|
||||
vm.$refs.loadingModal.hideModal();
|
||||
return r;
|
||||
});
|
||||
} else {
|
||||
vm.$refs.loadingModal.hideModal();
|
||||
await useMainStore().registerClaim().catch(() => {});
|
||||
}
|
||||
vm.$refs.loadingModal.hideModal();
|
||||
},
|
||||
methods: {
|
||||
arePagePrerequisitesValid() {
|
||||
|
|
@ -348,8 +342,7 @@ export default {
|
|||
this.$router.navigate(navigationScenarios.CLICKED_FORWARD_WITH_TPA_DISABLED,
|
||||
this.$route);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.$router.navigate(navigationScenarios.CLICKED_FORWARD_WITH_INVALID_STATE,
|
||||
this.$route);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -445,8 +445,7 @@ const routingTable = function (store) {
|
|||
{
|
||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_INVALID_STATE,
|
||||
destinationIssPageValue: issPageValues.BAILOUT_PAGE
|
||||
},
|
||||
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,162 +13,146 @@ import { coverageStatuses } from '@/constants/coverage-statuses';
|
|||
|
||||
const storeId = 'main';
|
||||
|
||||
const getDefaultState = () =>
|
||||
({
|
||||
order: {
|
||||
vehicle: {
|
||||
year: null,
|
||||
make: null,
|
||||
model: null,
|
||||
style: null,
|
||||
carId: null,
|
||||
category: null,
|
||||
vin: null,
|
||||
imageUrl: null,
|
||||
imageVifNumber: null,
|
||||
imageColor: null,
|
||||
registration: {
|
||||
licensePlate: null,
|
||||
address: null,
|
||||
city: null,
|
||||
state: null,
|
||||
zipCode: null,
|
||||
firstName: null,
|
||||
lastName: null
|
||||
}
|
||||
},
|
||||
damage: {
|
||||
isRepair: null,
|
||||
numberOfChips: null,
|
||||
glassToReplace: null,
|
||||
partQuestionAnswers: null,
|
||||
moldingQuestionAnswers: null,
|
||||
capabilityQuestionAnswers: null
|
||||
},
|
||||
policy: {
|
||||
policyNumber: null,
|
||||
policyZipCode: null,
|
||||
dateOfLoss: null,
|
||||
damageCause: null,
|
||||
damageState: null,
|
||||
damageCity: null,
|
||||
isDamageGlassOnly: null,
|
||||
policyLookupSuccessful: null,
|
||||
noCoverage: null,
|
||||
deductible: {
|
||||
repair: null, // numerical value; how much customer owes on deductible in repair case
|
||||
replace: null // numerical value; how much customer owes on deductible in replace case,
|
||||
}
|
||||
},
|
||||
customer: {
|
||||
address: {
|
||||
streetAddress: null,
|
||||
streetAddress2: null,
|
||||
city: null,
|
||||
state: null,
|
||||
zipCode: null
|
||||
},
|
||||
firstName: null,
|
||||
lastName: null,
|
||||
emailAddress: null,
|
||||
phoneNumber: null
|
||||
},
|
||||
serviceLocation: {
|
||||
const getDefaultState = () => ({
|
||||
order: {
|
||||
vehicle: {
|
||||
year: null,
|
||||
make: null,
|
||||
model: null,
|
||||
style: null,
|
||||
carId: null,
|
||||
category: null,
|
||||
vin: null,
|
||||
imageUrl: null,
|
||||
imageVifNumber: null,
|
||||
imageColor: null,
|
||||
registration: {
|
||||
licensePlate: null,
|
||||
address: null,
|
||||
city: null,
|
||||
state: null,
|
||||
zipCode: null,
|
||||
zipCodeCtu: null
|
||||
},
|
||||
lineItems: {
|
||||
glassParts: null,
|
||||
otherParts: null,
|
||||
supportingItems: null,
|
||||
vaps: null
|
||||
},
|
||||
payment: {
|
||||
isInsurance: true,
|
||||
insuranceCoverage: {
|
||||
isVerified: false,
|
||||
coverageStatus: coverageStatuses.PENDING
|
||||
}
|
||||
},
|
||||
referralNumber: null,
|
||||
referralDate: null,
|
||||
contactInfo: {
|
||||
firstName: null,
|
||||
lastName: null,
|
||||
emailAddress: null,
|
||||
phoneNumber: null,
|
||||
requestTextUpdates: false,
|
||||
notesForTechnician: ''
|
||||
lastName: null
|
||||
}
|
||||
},
|
||||
applicationUser: {
|
||||
experiments: [],
|
||||
eventBus: [],
|
||||
pageData: {},
|
||||
savedSessionTimeout: getDateForSavedSessionTimeout(),
|
||||
saveSessionPromise: null,
|
||||
savedSessionId: null,
|
||||
crmCustomerId: null,
|
||||
lastPageVisited: null,
|
||||
triggeredSiteEntry: false
|
||||
damage: {
|
||||
isRepair: null,
|
||||
numberOfChips: null,
|
||||
glassToReplace: null,
|
||||
partQuestionAnswers: null,
|
||||
moldingQuestionAnswers: null,
|
||||
capabilityQuestionAnswers: null
|
||||
},
|
||||
issConfig: {
|
||||
clientName: 'Generic Insurance', // this is the default and will be overriden by the client's name
|
||||
clientDisplayName: 'Generic Insurance', // this is the default and will be overridden by the client's name or client display name.
|
||||
styleSheet: '', // Stylesheet used by the client.
|
||||
accountNumber: 0, // Account number used by the client.
|
||||
isCoverageEnabled: false, // Indicates if we should be calling coverage on this flow.
|
||||
isClaimRegistrationRequired: false, // Indicates if the claim registration call needs to be made for a client to complete coverage verification.
|
||||
isAuthenticated: false, // Indicates if user is authenticated or not.
|
||||
enableTPAFlow: false, // Indicates if the TPA flow is supported for this client.
|
||||
successReturnURL: null, // Client URL to return the user to upon a successfull flow completetion (order submission).
|
||||
failureReturnURL: null, // Client URL to return the user to when they encounter an error or bailout and are unable to complete the flow.
|
||||
disabledFields: { // Fields that are disabled and read only if sent over from a client.
|
||||
policyNumber: null,
|
||||
policyZipCode: null
|
||||
policy: {
|
||||
policyNumber: null,
|
||||
policyZipCode: null,
|
||||
dateOfLoss: null,
|
||||
damageCause: null,
|
||||
damageState: null,
|
||||
damageCity: null,
|
||||
isDamageGlassOnly: null,
|
||||
policyLookupSuccessful: null,
|
||||
noCoverage: null,
|
||||
deductible: {
|
||||
repair: null, // numerical value; how much customer owes on deductible in repair case
|
||||
replace: null // numerical value; how much customer owes on deductible in replace case,
|
||||
}
|
||||
},
|
||||
customer: {
|
||||
address: {
|
||||
streetAddress: null,
|
||||
streetAddress2: null,
|
||||
city: null,
|
||||
state: null,
|
||||
zipCode: null
|
||||
},
|
||||
firstName: null,
|
||||
lastName: null,
|
||||
emailAddress: null,
|
||||
phoneNumber: null
|
||||
},
|
||||
serviceLocation: {
|
||||
address: null,
|
||||
city: null,
|
||||
state: null,
|
||||
zipCode: null,
|
||||
zipCodeCtu: null
|
||||
},
|
||||
lineItems: {
|
||||
glassParts: null,
|
||||
otherParts: null,
|
||||
supportingItems: null,
|
||||
vaps: null
|
||||
},
|
||||
payment: {
|
||||
isInsurance: true,
|
||||
insuranceCoverage: {
|
||||
isVerified: false,
|
||||
coverageStatus: coverageStatuses.PENDING
|
||||
}
|
||||
},
|
||||
referralNumber: null,
|
||||
referralDate: null,
|
||||
contactInfo: {
|
||||
firstName: null,
|
||||
lastName: null,
|
||||
emailAddress: null,
|
||||
phoneNumber: null,
|
||||
requestTextUpdates: false,
|
||||
notesForTechnician: ''
|
||||
}
|
||||
});
|
||||
},
|
||||
applicationUser: {
|
||||
experiments: [],
|
||||
eventBus: [],
|
||||
pageData: {},
|
||||
savedSessionTimeout: getDateForSavedSessionTimeout(),
|
||||
saveSessionPromise: null,
|
||||
savedSessionId: null,
|
||||
crmCustomerId: null,
|
||||
lastPageVisited: null,
|
||||
triggeredSiteEntry: false
|
||||
},
|
||||
issConfig: {
|
||||
clientName: 'Generic Insurance', // this is the default and will be overriden by the client's name
|
||||
clientDisplayName: 'Generic Insurance', // this is the default and will be overridden by the client's name or client display name.
|
||||
styleSheet: '', // Stylesheet used by the client.
|
||||
accountNumber: 0, // Account number used by the client.
|
||||
isCoverageEnabled: false, // Indicates if we should be calling coverage on this flow.
|
||||
isClaimRegistrationRequired: false, // Indicates if the claim registration call needs to be made for a client to complete coverage verification.
|
||||
isAuthenticated: false, // Indicates if user is authenticated or not.
|
||||
enableTPAFlow: false, // Indicates if the TPA flow is supported for this client.
|
||||
successReturnURL: null, // Client URL to return the user to upon a successfull flow completetion (order submission).
|
||||
failureReturnURL: null, // Client URL to return the user to when they encounter an error or bailout and are unable to complete the flow.
|
||||
disabledFields: { // Fields that are disabled and read only if sent over from a client.
|
||||
policyNumber: null,
|
||||
policyZipCode: null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export const state = getDefaultState();
|
||||
|
||||
export const useMainStore = defineStore({
|
||||
id: storeId,
|
||||
state: () =>
|
||||
state,
|
||||
state: () => state,
|
||||
getters: {
|
||||
hasRecalibrationPart: (state) =>
|
||||
getHasRecalibrationPart(state),
|
||||
vehicle: (state) =>
|
||||
state.order.vehicle,
|
||||
damage: (state) =>
|
||||
state.order.damage,
|
||||
lineItems: (state) =>
|
||||
state.order.lineItems,
|
||||
payment: (state) =>
|
||||
state.order.payment,
|
||||
policy: (state) =>
|
||||
state.order.policy,
|
||||
hasAnyNonWindshieldGlassParts: (state) =>
|
||||
!state.order.policy.isDamageGlassOnly,
|
||||
isClaimRegistrationRequired: (state) =>
|
||||
state.issConfig.isClaimRegistrationRequired,
|
||||
eventBusItem: (state) =>
|
||||
(eventCategory, eventSubCategory) => {
|
||||
const matchedEvent = state.applicationUser.eventBus.find(({ category, subCategory }) =>
|
||||
category === eventCategory && subCategory === eventSubCategory);
|
||||
return matchedEvent?.eventValue;
|
||||
},
|
||||
eventBus: (state) =>
|
||||
state.applicationUser.eventBus,
|
||||
applicationUserObj: (state) =>
|
||||
state.applicationUser,
|
||||
pageData: (state) =>
|
||||
(page) =>
|
||||
state.applicationUser.pageData[page],
|
||||
hasRecalibrationPart: (state) => getHasRecalibrationPart(state),
|
||||
vehicle: (state) => state.order.vehicle,
|
||||
damage: (state) => state.order.damage,
|
||||
lineItems: (state) => state.order.lineItems,
|
||||
payment: (state) => state.order.payment,
|
||||
policy: (state) => state.order.policy,
|
||||
hasAnyNonWindshieldGlassParts: (state) => !state.order.policy.isDamageGlassOnly,
|
||||
isClaimRegistrationRequired: (state) => state.issConfig.isClaimRegistrationRequired,
|
||||
eventBusItem: (state) => (eventCategory, eventSubCategory) => {
|
||||
const matchedEvent = state.applicationUser.eventBus.find(({ category, subCategory }) => category === eventCategory && subCategory === eventSubCategory);
|
||||
return matchedEvent?.eventValue;
|
||||
},
|
||||
eventBus: (state) => state.applicationUser.eventBus,
|
||||
applicationUserObj: (state) => state.applicationUser,
|
||||
pageData: (state) => (page) => state.applicationUser.pageData[page],
|
||||
customerData: (state) => {
|
||||
if (state.order.vehicle.registration.address) {
|
||||
const { registration } = state.order.vehicle;
|
||||
|
|
@ -196,59 +180,54 @@ export const useMainStore = defineStore({
|
|||
lastName: state.order.customer.lastName
|
||||
};
|
||||
},
|
||||
contactInfo: (s) =>
|
||||
({
|
||||
firstName: s.order.contactInfo.firstName ?? s.order.customer.firstName,
|
||||
lastName: s.order.contactInfo.lastName ?? s.order.customer.lastName,
|
||||
emailAddress: s.order.contactInfo.emailAddress ?? s.order.customer.emailAddress,
|
||||
phoneNumber: s.order.contactInfo.phoneNumber ?? s.order.customer.phoneNumber,
|
||||
requestTextUpdates: s.order.contactInfo.requestTextUpdates ?? false,
|
||||
notesForTechnician: s.order.contactInfo.notesForTechnician
|
||||
}),
|
||||
experimentOrder: (state) =>
|
||||
({
|
||||
issVehicleYear: state.order.vehicle.year,
|
||||
issVehicleMake: state.order.vehicle.make,
|
||||
issVehicleModel: state.order.vehicle.model,
|
||||
issVehicleStyle: state.order.vehicle.style,
|
||||
issIsRepair: state.order.damage.isRepair,
|
||||
issNumberOfChips: state.order.damage.numberOfChips,
|
||||
issCarId: state.order.vehicle.carId,
|
||||
issServiceCity: state.order.serviceLocation.city,
|
||||
issServiceState: state.order.serviceLocation.state,
|
||||
issServiceZipCode: state.order.serviceLocation.zipCode,
|
||||
issParentAccountNumber: state.order.accountNumber,
|
||||
issIsCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
|
||||
issHasRecalibrationPart: getHasRecalibrationPart(state),
|
||||
issSelectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
||||
issSelectedWindshieldGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||
'glassLocation').includes(damageLocationsSelected.WINDSHIELD),
|
||||
issSelectedBackGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||
'glassLocation').includes(damageLocationsSelected.REAR),
|
||||
issSelectedDriverSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||
'glassLocation').includes(damageLocationsSelected.DRIVER),
|
||||
issSelectedPassengerSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||
'glassLocation').includes(damageLocationsSelected.PASSENGER),
|
||||
issOrderPartNumbers: [
|
||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts,
|
||||
'partNumber'),
|
||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts,
|
||||
'partNumber')
|
||||
],
|
||||
contactInfo: (s) => ({
|
||||
firstName: s.order.contactInfo.firstName ?? s.order.customer.firstName,
|
||||
lastName: s.order.contactInfo.lastName ?? s.order.customer.lastName,
|
||||
emailAddress: s.order.contactInfo.emailAddress ?? s.order.customer.emailAddress,
|
||||
phoneNumber: s.order.contactInfo.phoneNumber ?? s.order.customer.phoneNumber,
|
||||
requestTextUpdates: s.order.contactInfo.requestTextUpdates ?? false,
|
||||
notesForTechnician: s.order.contactInfo.notesForTechnician
|
||||
}),
|
||||
experimentOrder: (state) => ({
|
||||
issVehicleYear: state.order.vehicle.year,
|
||||
issVehicleMake: state.order.vehicle.make,
|
||||
issVehicleModel: state.order.vehicle.model,
|
||||
issVehicleStyle: state.order.vehicle.style,
|
||||
issIsRepair: state.order.damage.isRepair,
|
||||
issNumberOfChips: state.order.damage.numberOfChips,
|
||||
issCarId: state.order.vehicle.carId,
|
||||
issServiceCity: state.order.serviceLocation.city,
|
||||
issServiceState: state.order.serviceLocation.state,
|
||||
issServiceZipCode: state.order.serviceLocation.zipCode,
|
||||
issParentAccountNumber: state.order.accountNumber,
|
||||
issIsCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
|
||||
issHasRecalibrationPart: getHasRecalibrationPart(state),
|
||||
issSelectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
||||
issSelectedWindshieldGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||
'glassLocation').includes(damageLocationsSelected.WINDSHIELD),
|
||||
issSelectedBackGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||
'glassLocation').includes(damageLocationsSelected.REAR),
|
||||
issSelectedDriverSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||
'glassLocation').includes(damageLocationsSelected.DRIVER),
|
||||
issSelectedPassengerSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||
'glassLocation').includes(damageLocationsSelected.PASSENGER),
|
||||
issOrderPartNumbers: [
|
||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts,
|
||||
'partNumber'),
|
||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts,
|
||||
'partNumber')
|
||||
],
|
||||
|
||||
issOrderPartTypes: [
|
||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts,
|
||||
'recalibrationType'),
|
||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts,
|
||||
'recalibrationType')
|
||||
]
|
||||
}),
|
||||
experimentSettings: (state) =>
|
||||
state.applicationUser.experiments
|
||||
.map((x) =>
|
||||
x.settings)
|
||||
.reduce((r, c) =>
|
||||
Object.assign(r, c), {}) ?? {}
|
||||
issOrderPartTypes: [
|
||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts,
|
||||
'recalibrationType'),
|
||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts,
|
||||
'recalibrationType')
|
||||
]
|
||||
}),
|
||||
experimentSettings: (state) => state.applicationUser.experiments
|
||||
.map((x) => x.settings)
|
||||
.reduce((r, c) => Object.assign(r, c), {}) ?? {}
|
||||
},
|
||||
actions:
|
||||
{
|
||||
|
|
@ -448,7 +427,7 @@ export const useMainStore = defineStore({
|
|||
}, (error) => {
|
||||
this.order.payment.insuranceCoverage.isVerified = false;
|
||||
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
||||
return reject(error.response);
|
||||
return reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
@ -549,12 +528,10 @@ export const useMainStore = defineStore({
|
|||
getPartFromCapabilityQuestionAnswer(glassLocation) {
|
||||
const pageData = this.pageData(issPageValues.CAPABILITY_QUESTIONS);
|
||||
|
||||
const part = pageData.partsOrQuestions.find((x) =>
|
||||
x.glassLocation === glassLocation)
|
||||
const part = pageData.partsOrQuestions.find((x) => x.glassLocation === glassLocation)
|
||||
.parts[0];
|
||||
const { capabilityQuestionAnswers } = this.order.damage;
|
||||
const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find((x) =>
|
||||
x.glassLocation === glassLocation);
|
||||
const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find((x) => x.glassLocation === glassLocation);
|
||||
|
||||
return globalMethods.callHttpClient({
|
||||
method: endpoints.GetPartFromCapabilityAnswer.method,
|
||||
|
|
@ -654,10 +631,9 @@ export const useMainStore = defineStore({
|
|||
},
|
||||
|
||||
getServiceabilityDetails({ serviceZipCode }) {
|
||||
const lineItemsWithOnlyPartNumbers = this.order.lineItems.glassParts.map((glassPart) =>
|
||||
({
|
||||
partNumber: glassPart.partNumber
|
||||
}));
|
||||
const lineItemsWithOnlyPartNumbers = this.order.lineItems.glassParts.map((glassPart) => ({
|
||||
partNumber: glassPart.partNumber
|
||||
}));
|
||||
const lineItems = buildQueryStringParameterFromArrayOfComplexObjects(lineItemsWithOnlyPartNumbers,
|
||||
'lineItems');
|
||||
|
||||
|
|
@ -705,8 +681,7 @@ export const useMainStore = defineStore({
|
|||
&& this.order.damage.glassToReplace
|
||||
.slice()
|
||||
.sort()
|
||||
.every((obj, index) =>
|
||||
obj.glassLocation === selectedGlassPassedInSorted[index].glassLocation
|
||||
.every((obj, index) => obj.glassLocation === selectedGlassPassedInSorted[index].glassLocation
|
||||
&& obj.glassName === selectedGlassPassedInSorted[index].glassName);
|
||||
const isWindshieldRepairTheSame
|
||||
= isWindshieldRepair === this.order.damage.isRepair;
|
||||
|
|
@ -955,8 +930,7 @@ export const useMainStore = defineStore({
|
|||
'result');
|
||||
const havePartQuestionAnswersChanged
|
||||
= sortedPreviousResultsArray?.length !== sortedPartQuestionAnswersArray.length
|
||||
|| !sortedPreviousResultsArray?.every((x, i) =>
|
||||
x.result === sortedPartQuestionAnswersArray[i].result);
|
||||
|| !sortedPreviousResultsArray?.every((x, i) => x.result === sortedPartQuestionAnswersArray[i].result);
|
||||
|
||||
if (havePartQuestionAnswersChanged) {
|
||||
this.updateGlassParts(null);
|
||||
|
|
@ -980,8 +954,7 @@ export const useMainStore = defineStore({
|
|||
'result');
|
||||
const haveMoldingQuestionAnswersChanged
|
||||
= sortedPreviousResultsArray?.length !== sortedMoldingQuestionAnswersArray.length
|
||||
|| !sortedPreviousResultsArray?.every((x, i) =>
|
||||
x.result === sortedMoldingQuestionAnswersArray[i].result);
|
||||
|| !sortedPreviousResultsArray?.every((x, i) => x.result === sortedMoldingQuestionAnswersArray[i].result);
|
||||
|
||||
if (haveMoldingQuestionAnswersChanged) {
|
||||
this.updateGlassParts(null);
|
||||
|
|
@ -1001,8 +974,7 @@ export const useMainStore = defineStore({
|
|||
'result');
|
||||
const haveCapabilityQuestionAnswersChanged
|
||||
= sortedPreviousResultsArray?.length !== sortedCapabilityQuestionAnswersArray.length
|
||||
|| !sortedPreviousResultsArray?.every((x, i) =>
|
||||
x.result === sortedCapabilityQuestionAnswersArray[i].result);
|
||||
|| !sortedPreviousResultsArray?.every((x, i) => x.result === sortedCapabilityQuestionAnswersArray[i].result);
|
||||
|
||||
if (haveCapabilityQuestionAnswersChanged) {
|
||||
this.updateGlassParts(null);
|
||||
|
|
@ -1028,8 +1000,7 @@ export const useMainStore = defineStore({
|
|||
this.applicationUser.eventBus.push(event);
|
||||
},
|
||||
removeEventFromBus(eventData) {
|
||||
const matchedEvent = this.applicationUser.eventBus.find(({ category, subCategory }) =>
|
||||
category === eventData.category && subCategory === eventData.subCategory);
|
||||
const matchedEvent = this.applicationUser.eventBus.find(({ category, subCategory }) => category === eventData.category && subCategory === eventData.subCategory);
|
||||
const itemIndex = this.applicationUser.eventBus.indexOf(matchedEvent);
|
||||
|
||||
// If the item exists, remove it.
|
||||
|
|
@ -1087,11 +1058,10 @@ export const useMainStore = defineStore({
|
|||
endpoint: endpoints.LogPageView.url,
|
||||
payload,
|
||||
logApiCall: false
|
||||
}).then((response) =>
|
||||
response,
|
||||
(error) => {
|
||||
console.log(`Analytics Service Error: ${error.data}`);
|
||||
});
|
||||
}).then((response) => response,
|
||||
(error) => {
|
||||
console.log(`Analytics Service Error: ${error.data}`);
|
||||
});
|
||||
},
|
||||
logCustomEvent({ userId, sessionKey, pageName, sessionId, category, action, label, value, shouldUseSessionId, experimentsForUser }) {
|
||||
if (pageName == null || pageName.length === 0) { pageName = 'none'; }
|
||||
|
|
@ -1115,11 +1085,10 @@ export const useMainStore = defineStore({
|
|||
endpoint: endpoints.LogCustomEvent.url,
|
||||
payload,
|
||||
logApiCall: false
|
||||
}).then((response) =>
|
||||
response,
|
||||
(error) => {
|
||||
console.log(`Analytics Service Error: ${error.data}`);
|
||||
});
|
||||
}).then((response) => response,
|
||||
(error) => {
|
||||
console.log(`Analytics Service Error: ${error.data}`);
|
||||
});
|
||||
},
|
||||
initializeSession({ userId, sessionId, userAgent, referrer }) {
|
||||
const payload = {
|
||||
|
|
@ -1138,11 +1107,10 @@ export const useMainStore = defineStore({
|
|||
endpoint: endpoints.InitializeSession.url,
|
||||
payload,
|
||||
logApiCall: false
|
||||
}).then((response) =>
|
||||
response,
|
||||
(error) => {
|
||||
console.log(`Analytics Service Error: ${error.data}`);
|
||||
});
|
||||
}).then((response) => response,
|
||||
(error) => {
|
||||
console.log(`Analytics Service Error: ${error.data}`);
|
||||
});
|
||||
},
|
||||
|
||||
updateLastPageVisited(lastPageVisited) {
|
||||
|
|
@ -1339,9 +1307,7 @@ function getHasRecalibrationPart(state) {
|
|||
}
|
||||
|
||||
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
||||
return (array ?? []).map((x) =>
|
||||
x[propertyName]).filter((x) =>
|
||||
x);
|
||||
return (array ?? []).map((x) => x[propertyName]).filter((x) => x);
|
||||
}
|
||||
|
||||
function sortArrayOfObjectsByPropertyValue(arrayOfObjects, propertyName) {
|
||||
|
|
@ -1401,8 +1367,7 @@ function addPricesToLineItems(lineItems, pricingLineItems) {
|
|||
addPricesToLineItems(lineItem.childParts, pricingLineItems);
|
||||
}
|
||||
|
||||
const lineItemIndex = pricingLineItems.findIndex((pricingLineItem) =>
|
||||
pricingLineItem.partNumber === lineItem.partNumber);
|
||||
const lineItemIndex = pricingLineItems.findIndex((pricingLineItem) => pricingLineItem.partNumber === lineItem.partNumber);
|
||||
|
||||
if (lineItemIndex > -1) {
|
||||
const pricedLineItem = pricingLineItems[lineItemIndex];
|
||||
|
|
|
|||
|
|
@ -405,10 +405,14 @@ describe('Store', () => {
|
|||
|
||||
it('Call to client returns exception, resulting in object with error property being returned', async () => {
|
||||
// Arrange
|
||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.reject());
|
||||
expect.assertions(4);
|
||||
const error = 'this is the error';
|
||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.reject(error));
|
||||
|
||||
// Act
|
||||
await store.registerClaim();
|
||||
await store.registerClaim().catch((e) => {
|
||||
expect(e).toEqual(error);
|
||||
});
|
||||
|
||||
// Asserts
|
||||
expect(globalMethods.callHttpClient).toHaveBeenCalled();
|
||||
|
|
|
|||
|
|
@ -65,18 +65,12 @@ body {
|
|||
}
|
||||
|
||||
.modal-text {
|
||||
display: contents !important;
|
||||
display: inline;
|
||||
color: $blue;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
background-color: inherit;
|
||||
padding: 0;
|
||||
text-underline-offset: 5px;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
font-weight: 500;
|
||||
span {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue