Merge pull request #781 from Safelite/defect/digital/SSR-1410
SSR-1410 Fix zipCodeCtu missing causing errors on coverage-statement
This commit is contained in:
commit
928a5a4997
2 changed files with 20 additions and 9 deletions
|
|
@ -119,7 +119,6 @@ import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin.js';
|
||||||
import globalRules from '@/constants/global-rules.js';
|
import globalRules from '@/constants/global-rules.js';
|
||||||
import baseFormMixin from '@/mixins/base-form-mixin.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';
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
|
||||||
import bailoutMessage from '@/constants/bailoutMessage';
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
import widgetFields from '@/constants/cms-widget-fields.js';
|
import widgetFields from '@/constants/cms-widget-fields.js';
|
||||||
import { formatAmountInDollars } from '@/helpers/text-helper.js';
|
import { formatAmountInDollars } from '@/helpers/text-helper.js';
|
||||||
|
|
@ -145,9 +144,11 @@ export default {
|
||||||
},
|
},
|
||||||
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
const store = useMainStore();
|
||||||
|
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to?.query?.issPage);
|
const cmsContentPromise = fetchCmsContentForPage(to?.query?.issPage);
|
||||||
const supportingItemsPromise = await useMainStore().getSupportingItems();
|
const supportingItemsPromise = store.getSupportingItems();
|
||||||
|
|
||||||
// Settle promises and get results
|
// Settle promises and get results
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
|
|
@ -161,15 +162,24 @@ export default {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const { vehicle, isITAC, isDeductible, serviceLocation } = store;
|
||||||
|
if ((isITAC || isDeductible)
|
||||||
|
&& vehicle.policyVehicleId >= 0) {
|
||||||
|
promiseResultMap.push({
|
||||||
|
resultKey: 'getFinalDeductible',
|
||||||
|
promise: store.getFinalDeductible()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const { vehicle, isPolicyLookupSuccessful, isITAC, isDeductible } = useMainStore();
|
if (!serviceLocation.zipCodeCtu) {
|
||||||
if (isPolicyLookupSuccessful && vehicle.policyVehicleId >= 0) {
|
promiseResultMap.push({
|
||||||
if (isITAC || isDeductible) {
|
resultKey: 'validateZip',
|
||||||
await useMainStore().getFinalDeductible();
|
promise: store.validateZip({ zip: store.order.policy.policyZipCode })
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
next(async (vm) => {
|
next(async (vm) => {
|
||||||
showIssLoadingModal(true);
|
showIssLoadingModal(true);
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
|
|
||||||
|
|
@ -263,6 +263,7 @@ export const useMainStore = defineStore({
|
||||||
lineItems: (state) => state.order.lineItems,
|
lineItems: (state) => state.order.lineItems,
|
||||||
payment: (state) => state.order.payment,
|
payment: (state) => state.order.payment,
|
||||||
policy: (state) => state.order.policy,
|
policy: (state) => state.order.policy,
|
||||||
|
serviceLocation: (state) => state.order.serviceLocation,
|
||||||
hasExactlyOneChip: () => state.order.damage.numberOfChips === 1,
|
hasExactlyOneChip: () => state.order.damage.numberOfChips === 1,
|
||||||
isPolicyVehicle: () => state.order.vehicle.policyVehicleId != null,
|
isPolicyVehicle: () => state.order.vehicle.policyVehicleId != null,
|
||||||
hasWindshieldReplacement: (s) => {
|
hasWindshieldReplacement: (s) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue