Merge pull request #378 from Safelite/defect/digital/SSR-613
Defect/digital/ssr 613
This commit is contained in:
commit
6d4372f025
14 changed files with 409 additions and 430 deletions
|
|
@ -162,7 +162,8 @@ function mapStringToModal(str) {
|
||||||
const params = linkToReplace.substring((dynamicStrings.MODAL_LINK).length + 2, linkToReplace.length - 1);
|
const params = linkToReplace.substring((dynamicStrings.MODAL_LINK).length + 2, linkToReplace.length - 1);
|
||||||
const splitParams = params.split(',');
|
const splitParams = params.split(',');
|
||||||
|
|
||||||
const bodyText = `<a modalTarget="${splitParams[0]}" class="modal-text" aria-label="Modal window">${splitParams[1]}</a>`;
|
const bodyText
|
||||||
|
= `<a href="#" modalTarget="${splitParams[0]}" class="modal-text" aria-label="Modal window">${splitParams[1]}</a>`;
|
||||||
|
|
||||||
let returnVal = str.replace(linkToReplace, bodyText);
|
let returnVal = str.replace(linkToReplace, bodyText);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,16 @@ describe('loadingModal', () => {
|
||||||
expect(wrapper.vm.isModalVisible).toEqual(true);
|
expect(wrapper.vm.isModalVisible).toEqual(true);
|
||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
test('hideModal sets modal invisible', async () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
wrapper.vm.isModalVisible = true;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.hideModal();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.isModalVisible).toEqual(false);
|
||||||
|
wrapper.unmount();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -16,32 +16,10 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="text-container slide">
|
<div class="text-container slide">
|
||||||
<p>
|
<p
|
||||||
Finding shops near you
|
v-for="text in textSlides"
|
||||||
<span class="dot-1">.</span>
|
:key="text">
|
||||||
<span class="dot-2">.</span>
|
{{ text }}
|
||||||
<span class="dot-3">.</span>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Looking for dates
|
|
||||||
<span class="dot-1">.</span>
|
|
||||||
<span class="dot-2">.</span>
|
|
||||||
<span class="dot-3">.</span>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Searching for times
|
|
||||||
<span class="dot-1">.</span>
|
|
||||||
<span class="dot-2">.</span>
|
|
||||||
<span class="dot-3">.</span>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Nearly there
|
|
||||||
<span class="dot-1">.</span>
|
|
||||||
<span class="dot-2">.</span>
|
|
||||||
<span class="dot-3">.</span>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Finishing up
|
|
||||||
<span class="dot-1">.</span>
|
<span class="dot-1">.</span>
|
||||||
<span class="dot-2">.</span>
|
<span class="dot-2">.</span>
|
||||||
<span class="dot-3">.</span>
|
<span class="dot-3">.</span>
|
||||||
|
|
@ -56,7 +34,10 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'modal',
|
name: 'loading-modal',
|
||||||
|
props: {
|
||||||
|
textSlides: Array
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isModalVisible: false
|
isModalVisible: false
|
||||||
|
|
@ -76,6 +57,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
false);
|
false);
|
||||||
|
},
|
||||||
|
hideModal() {
|
||||||
|
this.isModalVisible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="`page-container-grouped-styles questions-page`">
|
<div :class="`page-container-grouped-styles questions-page`">
|
||||||
<div class="fade-on-route-transition position-relative">
|
<div class="fade-on-route-transition position-relative">
|
||||||
<loadingModal ref="loadingModal" />
|
<loadingModal
|
||||||
|
ref="loadingModal"
|
||||||
|
:textSlides="loadingText" />
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
<div class="select-car">
|
<div class="select-car">
|
||||||
<div class="container-fluid pb-2">
|
<div class="container-fluid pb-2">
|
||||||
|
|
@ -77,6 +79,7 @@ export default {
|
||||||
questionsData: Array,
|
questionsData: Array,
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
modelValue: Object,
|
modelValue: Object,
|
||||||
|
loadingText: Array,
|
||||||
index: Number
|
index: Number
|
||||||
},
|
},
|
||||||
emits: ['update:modelValue', 'forwardButtonAction', 'back-click'],
|
emits: ['update:modelValue', 'forwardButtonAction', 'back-click'],
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@
|
||||||
@invalidSubmit="onInvalidSubmit">
|
@invalidSubmit="onInvalidSubmit">
|
||||||
<div class="page-container-grouped-styles">
|
<div class="page-container-grouped-styles">
|
||||||
<div class="fade-on-route-transition position-relative">
|
<div class="fade-on-route-transition position-relative">
|
||||||
|
<loadingModal
|
||||||
|
ref="loadingModal"
|
||||||
|
:textSlides="loadingText" />
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
<div class="select-car">
|
<div class="select-car">
|
||||||
<div class="container-fluid pb-2">
|
<div class="container-fluid pb-2">
|
||||||
|
|
@ -102,6 +105,7 @@ import recalModal from '@/layouts/coverage-statement/recal-modal/recal-modal';
|
||||||
import alert from '@/ux-components/alert/alert';
|
import alert from '@/ux-components/alert/alert';
|
||||||
import contentGroupModal from '@/iss-components/content-group-modal/content-group-modal';
|
import contentGroupModal from '@/iss-components/content-group-modal/content-group-modal';
|
||||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
import buttonQuestion from '@/digital-components/button-question/button-question';
|
||||||
|
import loadingModal from '@/iss-components/loading-modal/loading-modal';
|
||||||
|
|
||||||
// Import Supporting Files
|
// Import Supporting Files
|
||||||
import { fetchCmsContentForPage, setupModalLinks, processIfStatements } from '@/helpers/cms-content-helper.js';
|
import { fetchCmsContentForPage, setupModalLinks, processIfStatements } from '@/helpers/cms-content-helper.js';
|
||||||
|
|
@ -111,8 +115,7 @@ import { useMainStore } from '@/store/index.js';
|
||||||
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin.js';
|
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';
|
||||||
const store = useMainStore();
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'coverage-statement',
|
name: 'coverage-statement',
|
||||||
|
|
@ -124,14 +127,15 @@ export default {
|
||||||
recalModal,
|
recalModal,
|
||||||
alert,
|
alert,
|
||||||
contentGroupModal,
|
contentGroupModal,
|
||||||
buttonQuestion
|
buttonQuestion,
|
||||||
|
loadingModal
|
||||||
},
|
},
|
||||||
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, _from, next) {
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||||
|
|
||||||
const supportingItemsPromise = await store.getSupportingItems();
|
const supportingItemsPromise = await useMainStore().getSupportingItems();
|
||||||
|
|
||||||
// Settle promises and get results
|
// Settle promises and get results
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
|
|
@ -145,44 +149,34 @@ export default {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
if (useMainStore().policy.policyLookupSuccessful
|
|
||||||
&& useMainStore().isClaimRegistrationRequired
|
|
||||||
&& !useMainStore().policy.noCoverage) {
|
|
||||||
const registerClaimResponse = await useMainStore().registerClaim();
|
|
||||||
promiseResultMap.push({
|
|
||||||
resultKey: 'registerClaim',
|
|
||||||
promise: registerClaimResponse
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
const clonedGlassParts = useMainStore().order.lineItems.glassParts
|
||||||
const clonedGlassParts = store.order.lineItems.glassParts
|
? JSON.parse(JSON.stringify(useMainStore().order.lineItems.glassParts))
|
||||||
? JSON.parse(JSON.stringify(store.order.lineItems.glassParts))
|
|
||||||
: [];
|
: [];
|
||||||
const availableLineItems = [
|
const availableLineItems = [
|
||||||
...resultMap.supportingItems,
|
...resultMap.supportingItems,
|
||||||
...clonedGlassParts
|
...clonedGlassParts
|
||||||
];
|
];
|
||||||
|
|
||||||
const pricingResults = await store.getPriceOrderItems(availableLineItems);
|
const pricingResults = await useMainStore().getPriceOrderItems(availableLineItems);
|
||||||
|
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.pricedGlassParts = clonedGlassParts;
|
|
||||||
vm.supportingItems = resultMap.supportingItems;
|
|
||||||
vm.availableLineItems = pricingResults;
|
vm.availableLineItems = pricingResults;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isVerified: store.order.payment.insuranceCoverage.isVerified,
|
|
||||||
supportingItems: [],
|
|
||||||
pricedGlassParts: [],
|
|
||||||
availableLineItems: [],
|
availableLineItems: [],
|
||||||
selectedProvider: '',
|
selectedProvider: '',
|
||||||
deductibleText: 'Your deductible is:',
|
deductibleText: 'Your deductible is:',
|
||||||
|
// TODO update when design team gives appropriate text
|
||||||
|
loadingText: [
|
||||||
|
'Connecting to your insurance company',
|
||||||
|
'Nearly there',
|
||||||
|
'Finishing up'
|
||||||
|
],
|
||||||
rules: {
|
rules: {
|
||||||
selectionRequired: globalRules.OPTION_REQUIRED
|
selectionRequired: globalRules.OPTION_REQUIRED
|
||||||
}
|
}
|
||||||
|
|
@ -198,24 +192,19 @@ export default {
|
||||||
'BodyText').replaceAll('{custom:costSavings}', this.costSavings);
|
'BodyText').replaceAll('{custom:costSavings}', this.costSavings);
|
||||||
},
|
},
|
||||||
coverageStatementSubHeader() {
|
coverageStatementSubHeader() {
|
||||||
const subheader = this.getSubheaderTextFromCms('SiteSubHeaderWidget');
|
return this.getSubheaderTextFromCms('SiteSubHeaderWidget');
|
||||||
return subheader;
|
|
||||||
},
|
},
|
||||||
secondaryText() {
|
secondaryText() {
|
||||||
const secondaryText = this.getSecondaryTextFromCms('SiteSubHeaderWidget');
|
return this.getSecondaryTextFromCms('SiteSubHeaderWidget');
|
||||||
return secondaryText;
|
|
||||||
},
|
},
|
||||||
explanatoryText() {
|
explanatoryText() {
|
||||||
const explanatoryText = this.getExplantoryTextFromCms('ExplanatoryTextWidget');
|
return this.getExplantoryTextFromCms('ExplanatoryTextWidget');
|
||||||
return explanatoryText;
|
|
||||||
},
|
},
|
||||||
nextStepsHeader() {
|
nextStepsHeader() {
|
||||||
const header = this.getHeaderTextFromCms('NextStepsWidget');
|
return this.getHeaderTextFromCms('NextStepsWidget');
|
||||||
return header;
|
|
||||||
},
|
},
|
||||||
nextStepsBody() {
|
nextStepsBody() {
|
||||||
const body = this.getBodyTextFromCms('NextStepsWidget').replaceAll('{custom:damage}', this.damageText);
|
return this.getBodyTextFromCms('NextStepsWidget').replaceAll('{custom:damage}', this.damageText);
|
||||||
return body;
|
|
||||||
},
|
},
|
||||||
continueWithSchedulingBodyText() {
|
continueWithSchedulingBodyText() {
|
||||||
return this.getCmsContent('continueWithSchedulingCopy', 'BodyText');
|
return this.getCmsContent('continueWithSchedulingCopy', 'BodyText');
|
||||||
|
|
@ -234,66 +223,51 @@ export default {
|
||||||
return damageString === 'match' ? '' : damageString;
|
return damageString === 'match' ? '' : damageString;
|
||||||
},
|
},
|
||||||
vehicleDeductible() {
|
vehicleDeductible() {
|
||||||
if (this.coverageVerified) {
|
if (useMainStore().order.damage.isRepair) {
|
||||||
if (store.order.damage.isRepair) {
|
const repairDeductible = useMainStore().order.policy.deductible.repair;
|
||||||
const repairDeductible = store.order.policy.deductible.repair;
|
return repairDeductible;
|
||||||
return repairDeductible;
|
|
||||||
}
|
|
||||||
|
|
||||||
const replaceDeductible = store.order.policy.deductible.replace;
|
|
||||||
return replaceDeductible;
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
const replaceDeductible = useMainStore().order.policy.deductible.replace;
|
||||||
|
return replaceDeductible;
|
||||||
},
|
},
|
||||||
formattedDeductible() {
|
formattedDeductible() {
|
||||||
return this.getDeductibleString(this.vehicleDeductible);
|
return this.getDeductibleString(this.vehicleDeductible);
|
||||||
},
|
},
|
||||||
isDeductibleZero() {
|
isDeductibleZero() {
|
||||||
if (this.coverageVerified && this.verifiedDeductible) {
|
return this.vehicleDeductible === 0;
|
||||||
return this.vehicleDeductible === 0;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
},
|
||||||
deductibleOverZero() {
|
policyLookupSuccessful() {
|
||||||
if (this.coverageVerified && this.verifiedDeductible) {
|
return useMainStore().order.policy.policyLookupSuccessful;
|
||||||
return !this.isDeductibleZero;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
},
|
||||||
coverageVerified() {
|
registerClaimSuccessful() {
|
||||||
return this.isVerified;
|
return useMainStore().payment.insuranceCoverage.isVerified;
|
||||||
},
|
|
||||||
coverageUnverified() {
|
|
||||||
return !this.isVerified;
|
|
||||||
},
|
},
|
||||||
verifiedNoComp() {
|
verifiedNoComp() {
|
||||||
return this.coverageVerified ? store.order.policy.noCoverage : false;
|
return this.policyLookupSuccessful ? useMainStore().order.policy.noCoverage : false;
|
||||||
},
|
},
|
||||||
verifiedITAC() {
|
verifiedITAC() {
|
||||||
return this.coverageVerified
|
return this.policyLookupSuccessful
|
||||||
&& !this.verifiedNoComp
|
&& !this.verifiedNoComp
|
||||||
&& this.vehicleDeductible > this.totalServicePrice;
|
&& this.vehicleDeductible > this.totalServicePrice;
|
||||||
},
|
},
|
||||||
|
coveredAndServicePriceAboveOrEqualDeductible() {
|
||||||
|
return !this.verifiedNoComp && this.totalServicePrice >= this.vehicleDeductible;
|
||||||
|
},
|
||||||
verifiedDeductible() {
|
verifiedDeductible() {
|
||||||
return this.coverageVerified
|
return useMainStore().isClaimRegistrationRequired
|
||||||
&& !this.verifiedNoComp
|
? this.registerClaimSuccessful && this.coveredAndServicePriceAboveOrEqualDeductible
|
||||||
&& this.totalServicePrice > this.vehicleDeductible;
|
: this.policyLookupSuccessful && this.coveredAndServicePriceAboveOrEqualDeductible;
|
||||||
},
|
},
|
||||||
ADASReplace() {
|
unverified() {
|
||||||
if (!store.order.damage.isRepair) {
|
return !this.verifiedDeductible && !this.verifiedITAC && !this.verifiedNoComp;
|
||||||
const parts = store.order.lineItems.glassParts;
|
|
||||||
|
|
||||||
if (parts != null && parts.filter((part) => part.requiresRecalibration).length > 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
nonADASReplace() {
|
isADAS() {
|
||||||
return !this.ADASReplace;
|
const parts = useMainStore().order.lineItems.glassParts;
|
||||||
|
return parts !== null && !!parts.find((part) => part.requiresRecalibration);
|
||||||
},
|
},
|
||||||
nonADASRepair() {
|
isRepair() {
|
||||||
return store.order.damage.isRepair;
|
return useMainStore().order.damage.isRepair;
|
||||||
},
|
},
|
||||||
totalServicePrice() {
|
totalServicePrice() {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
|
|
@ -329,34 +303,42 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
async mounted() {
|
||||||
|
this.$refs.loadingModal.showModal();
|
||||||
setupModalLinks(this);
|
setupModalLinks(this);
|
||||||
|
const vm = this;
|
||||||
|
if (this.policyLookupSuccessful
|
||||||
|
&& useMainStore().isClaimRegistrationRequired
|
||||||
|
&& this.coveredAndServicePriceAboveOrEqualDeductible) {
|
||||||
|
await useMainStore().registerClaim().catch(() => {});
|
||||||
|
}
|
||||||
|
vm.$refs.loadingModal.hideModal();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
if (useMainStore().vehicle.vin) {
|
return !!useMainStore().vehicle.vin;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
return this.navigateForward();
|
return this.navigateForward();
|
||||||
},
|
},
|
||||||
async navigateForward() {
|
async navigateForward() {
|
||||||
if (this.coverageUnverified || this.verifiedDeductible) {
|
if (this.unverified || this.verifiedDeductible) {
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD,
|
this.$router.navigate(navigationScenarios.CLICKED_FORWARD,
|
||||||
this.$route);
|
this.$route);
|
||||||
} else if (this.verifiedITAC || this.verifiedNoComp) {
|
} else if (this.verifiedITAC || this.verifiedNoComp) {
|
||||||
if (this.selectedProvider === 'Safelite') {
|
if (this.selectedProvider === 'Safelite') {
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE,
|
this.$router.navigate(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE,
|
||||||
this.$route);
|
this.$route);
|
||||||
} else if (store.issConfig.enableTPAFlow) {
|
} else if (useMainStore().issConfig.enableTPAFlow) {
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_THIRD_PARTY,
|
this.$router.navigate(navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED,
|
||||||
this.$route);
|
this.$route);
|
||||||
} else {
|
} else {
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
this.$router.navigate(navigationScenarios.CLICKED_FORWARD_WITH_TPA_DISABLED,
|
||||||
this.$route);
|
this.$route);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.$router.navigate(navigationScenarios.CLICKED_FORWARD_WITH_INVALID_STATE,
|
||||||
|
this.$route);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
openModalAction(modalName) {
|
openModalAction(modalName) {
|
||||||
|
|
@ -386,7 +368,7 @@ export default {
|
||||||
getCustomValueFromString(str) {
|
getCustomValueFromString(str) {
|
||||||
switch (str) {
|
switch (str) {
|
||||||
case 'coverageUnverified':
|
case 'coverageUnverified':
|
||||||
return this.coverageUnverified;
|
return this.unverified;
|
||||||
case 'verifiedDeductible':
|
case 'verifiedDeductible':
|
||||||
return this.verifiedDeductible;
|
return this.verifiedDeductible;
|
||||||
case 'verifiedITAC':
|
case 'verifiedITAC':
|
||||||
|
|
@ -394,15 +376,15 @@ export default {
|
||||||
case 'verifiedNoComp':
|
case 'verifiedNoComp':
|
||||||
return this.verifiedNoComp;
|
return this.verifiedNoComp;
|
||||||
case 'ADASReplace':
|
case 'ADASReplace':
|
||||||
return this.ADASReplace;
|
return !this.isRepair && this.isADAS;
|
||||||
case 'nonADASReplace':
|
case 'nonADASReplace':
|
||||||
return this.nonADASReplace;
|
return !this.isRepair && !this.isADAS;
|
||||||
case 'nonADASRepair':
|
case 'nonADASRepair':
|
||||||
return this.nonADASRepair;
|
return this.isRepair;
|
||||||
case 'deductibleOverZero':
|
case 'deductibleOverZero':
|
||||||
return this.deductibleOverZero;
|
return this.verifiedDeductible && !this.isDeductibleZero; // TODO what if deductible is negative?
|
||||||
case 'isDeductibleZero':
|
case 'isDeductibleZero':
|
||||||
return this.isDeductibleZero;
|
return this.verifiedDeductible && this.isDeductibleZero;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -419,8 +401,7 @@ export default {
|
||||||
return `$${formattedPriceFloat}`;
|
return `$${formattedPriceFloat}`;
|
||||||
},
|
},
|
||||||
getITACCostSavings(vehicleDeductible, totalServicePrice) {
|
getITACCostSavings(vehicleDeductible, totalServicePrice) {
|
||||||
const savings = vehicleDeductible - totalServicePrice;
|
return vehicleDeductible - totalServicePrice;
|
||||||
return savings;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -218,12 +218,6 @@ export default {
|
||||||
color: $black;
|
color: $black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-link a{
|
|
||||||
color: $blue-700;
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: 24px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
.question-text {
|
.question-text {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: .5rem;
|
margin-bottom: .5rem;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<loadingModal ref="loadingModal" />
|
<loadingModal
|
||||||
|
ref="loadingModal"
|
||||||
|
:textSlides="loadingText" />
|
||||||
<contentGroupModal
|
<contentGroupModal
|
||||||
ref="RainDefenseModal"
|
ref="RainDefenseModal"
|
||||||
cmsWidgetName="RainDefenseModal" />
|
cmsWidgetName="RainDefenseModal" />
|
||||||
|
|
@ -133,6 +135,13 @@ export default {
|
||||||
availableLineItems: [],
|
availableLineItems: [],
|
||||||
supportingItems: [],
|
supportingItems: [],
|
||||||
pricedGlassParts: [],
|
pricedGlassParts: [],
|
||||||
|
loadingText: [
|
||||||
|
'Finding shops near you',
|
||||||
|
'Looking for dates',
|
||||||
|
'Searching for times',
|
||||||
|
'Nearly there',
|
||||||
|
'Finishing up'
|
||||||
|
],
|
||||||
rules: {
|
rules: {
|
||||||
optionRequired: globalRules.OPTION_REQUIRED
|
optionRequired: globalRules.OPTION_REQUIRED
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,6 @@ export default {
|
||||||
forwardButtonAction() {
|
forwardButtonAction() {
|
||||||
switch (this.selectedVinLookupMethod) {
|
switch (this.selectedVinLookupMethod) {
|
||||||
case vinLookupMethodSelections.MANUALVIN:
|
case vinLookupMethodSelections.MANUALVIN:
|
||||||
useMainStore().updateVehicleVin(null);
|
|
||||||
this.$router.navigate(this.navigationScenarios.SELECTED_MANUAL_VIN, this.$route);
|
this.$router.navigate(this.navigationScenarios.SELECTED_MANUAL_VIN, this.$route);
|
||||||
break;
|
break;
|
||||||
case vinLookupMethodSelections.LICENSEPLATE:
|
case vinLookupMethodSelections.LICENSEPLATE:
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ export default {
|
||||||
// because the form itself actually passes its client-side validation.
|
// because the form itself actually passes its client-side validation.
|
||||||
// SSR-189 Scenario #4.
|
// SSR-189 Scenario #4.
|
||||||
this.$refs.siteFooter.enableForwardAction();
|
this.$refs.siteFooter.enableForwardAction();
|
||||||
this.bailout = true
|
this.bailout = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.bailout) {
|
if (this.bailout) {
|
||||||
|
|
@ -190,8 +190,8 @@ export default {
|
||||||
|
|
||||||
let isSelectedGlassAvailableForVehicle = true;
|
let isSelectedGlassAvailableForVehicle = true;
|
||||||
if (this.isCarIdDifferentFromTheStore) {
|
if (this.isCarIdDifferentFromTheStore) {
|
||||||
isSelectedGlassAvailableForVehicle =
|
isSelectedGlassAvailableForVehicle
|
||||||
await isGlassAvailableForCarId(this.vehicleFromLookup.carId);
|
= await isGlassAvailableForCarId(this.vehicleFromLookup.carId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// navigate back to vehicle-damage
|
// navigate back to vehicle-damage
|
||||||
|
|
|
||||||
|
|
@ -429,6 +429,22 @@ const routingTable = function (store) {
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD,
|
scenario: navigationScenarios.CLICKED_FORWARD,
|
||||||
destinationIssPageValue: issPageValues.PROVIDER_PREFERENCE
|
destinationIssPageValue: issPageValues.PROVIDER_PREFERENCE
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE,
|
||||||
|
destinationIssPageValue: issPageValues.SERVICE_LOCATION
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED,
|
||||||
|
destinationIssPageValue: issPageValues.TPA_SEARCH
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_TPA_DISABLED,
|
||||||
|
destinationIssPageValue: issPageValues.BAILOUT_PAGE
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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 storeId = 'main';
|
||||||
|
|
||||||
const getDefaultState = () =>
|
const getDefaultState = () => ({
|
||||||
({
|
order: {
|
||||||
order: {
|
vehicle: {
|
||||||
vehicle: {
|
year: null,
|
||||||
year: null,
|
make: null,
|
||||||
make: null,
|
model: null,
|
||||||
model: null,
|
style: null,
|
||||||
style: null,
|
carId: null,
|
||||||
carId: null,
|
category: null,
|
||||||
category: null,
|
vin: null,
|
||||||
vin: null,
|
imageUrl: null,
|
||||||
imageUrl: null,
|
imageVifNumber: null,
|
||||||
imageVifNumber: null,
|
imageColor: null,
|
||||||
imageColor: null,
|
registration: {
|
||||||
registration: {
|
licensePlate: null,
|
||||||
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: {
|
|
||||||
address: null,
|
address: null,
|
||||||
city: null,
|
city: null,
|
||||||
state: null,
|
state: null,
|
||||||
zipCode: 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,
|
firstName: null,
|
||||||
lastName: null,
|
lastName: null
|
||||||
emailAddress: null,
|
|
||||||
phoneNumber: null,
|
|
||||||
requestTextUpdates: false,
|
|
||||||
notesForTechnician: ''
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
applicationUser: {
|
damage: {
|
||||||
experiments: [],
|
isRepair: null,
|
||||||
eventBus: [],
|
numberOfChips: null,
|
||||||
pageData: {},
|
glassToReplace: null,
|
||||||
savedSessionTimeout: getDateForSavedSessionTimeout(),
|
partQuestionAnswers: null,
|
||||||
saveSessionPromise: null,
|
moldingQuestionAnswers: null,
|
||||||
savedSessionId: null,
|
capabilityQuestionAnswers: null
|
||||||
crmCustomerId: null,
|
|
||||||
lastPageVisited: null,
|
|
||||||
triggeredSiteEntry: false
|
|
||||||
},
|
},
|
||||||
issConfig: {
|
policy: {
|
||||||
clientName: 'Generic Insurance', // this is the default and will be overriden by the client's name
|
policyNumber: null,
|
||||||
clientDisplayName: 'Generic Insurance', // this is the default and will be overridden by the client's name or client display name.
|
policyZipCode: null,
|
||||||
styleSheet: '', // Stylesheet used by the client.
|
dateOfLoss: null,
|
||||||
accountNumber: 0, // Account number used by the client.
|
damageCause: null,
|
||||||
isCoverageEnabled: false, // Indicates if we should be calling coverage on this flow.
|
damageState: null,
|
||||||
isClaimRegistrationRequired: false, // Indicates if the claim registration call needs to be made for a client to complete coverage verification.
|
damageCity: null,
|
||||||
isAuthenticated: false, // Indicates if user is authenticated or not.
|
isDamageGlassOnly: null,
|
||||||
enableTPAFlow: false, // Indicates if the TPA flow is supported for this client.
|
policyLookupSuccessful: null,
|
||||||
successReturnURL: null, // Client URL to return the user to upon a successfull flow completetion (order submission).
|
noCoverage: null,
|
||||||
failureReturnURL: null, // Client URL to return the user to when they encounter an error or bailout and are unable to complete the flow.
|
deductible: {
|
||||||
disabledFields: { // Fields that are disabled and read only if sent over from a client.
|
repair: null, // numerical value; how much customer owes on deductible in repair case
|
||||||
policyNumber: null,
|
replace: null // numerical value; how much customer owes on deductible in replace case,
|
||||||
policyZipCode: null
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
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 state = getDefaultState();
|
||||||
|
|
||||||
export const useMainStore = defineStore({
|
export const useMainStore = defineStore({
|
||||||
id: storeId,
|
id: storeId,
|
||||||
state: () =>
|
state: () => state,
|
||||||
state,
|
|
||||||
getters: {
|
getters: {
|
||||||
hasRecalibrationPart: (state) =>
|
hasRecalibrationPart: (state) => getHasRecalibrationPart(state),
|
||||||
getHasRecalibrationPart(state),
|
vehicle: (state) => state.order.vehicle,
|
||||||
vehicle: (state) =>
|
damage: (state) => state.order.damage,
|
||||||
state.order.vehicle,
|
lineItems: (state) => state.order.lineItems,
|
||||||
damage: (state) =>
|
payment: (state) => state.order.payment,
|
||||||
state.order.damage,
|
policy: (state) => state.order.policy,
|
||||||
lineItems: (state) =>
|
hasAnyNonWindshieldGlassParts: (state) => !state.order.policy.isDamageGlassOnly,
|
||||||
state.order.lineItems,
|
isClaimRegistrationRequired: (state) => state.issConfig.isClaimRegistrationRequired,
|
||||||
payment: (state) =>
|
eventBusItem: (state) => (eventCategory, eventSubCategory) => {
|
||||||
state.order.payment,
|
const matchedEvent = state.applicationUser.eventBus.find(({ category, subCategory }) => category === eventCategory && subCategory === eventSubCategory);
|
||||||
policy: (state) =>
|
return matchedEvent?.eventValue;
|
||||||
state.order.policy,
|
},
|
||||||
hasAnyNonWindshieldGlassParts: (state) =>
|
eventBus: (state) => state.applicationUser.eventBus,
|
||||||
!state.order.policy.isDamageGlassOnly,
|
applicationUserObj: (state) => state.applicationUser,
|
||||||
isClaimRegistrationRequired: (state) =>
|
pageData: (state) => (page) => state.applicationUser.pageData[page],
|
||||||
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) => {
|
customerData: (state) => {
|
||||||
if (state.order.vehicle.registration.address) {
|
if (state.order.vehicle.registration.address) {
|
||||||
const { registration } = state.order.vehicle;
|
const { registration } = state.order.vehicle;
|
||||||
|
|
@ -196,59 +180,54 @@ export const useMainStore = defineStore({
|
||||||
lastName: state.order.customer.lastName
|
lastName: state.order.customer.lastName
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
contactInfo: (s) =>
|
contactInfo: (s) => ({
|
||||||
({
|
firstName: s.order.contactInfo.firstName ?? s.order.customer.firstName,
|
||||||
firstName: s.order.contactInfo.firstName ?? s.order.customer.firstName,
|
lastName: s.order.contactInfo.lastName ?? s.order.customer.lastName,
|
||||||
lastName: s.order.contactInfo.lastName ?? s.order.customer.lastName,
|
emailAddress: s.order.contactInfo.emailAddress ?? s.order.customer.emailAddress,
|
||||||
emailAddress: s.order.contactInfo.emailAddress ?? s.order.customer.emailAddress,
|
phoneNumber: s.order.contactInfo.phoneNumber ?? s.order.customer.phoneNumber,
|
||||||
phoneNumber: s.order.contactInfo.phoneNumber ?? s.order.customer.phoneNumber,
|
requestTextUpdates: s.order.contactInfo.requestTextUpdates ?? false,
|
||||||
requestTextUpdates: s.order.contactInfo.requestTextUpdates ?? false,
|
notesForTechnician: s.order.contactInfo.notesForTechnician
|
||||||
notesForTechnician: s.order.contactInfo.notesForTechnician
|
}),
|
||||||
}),
|
experimentOrder: (state) => ({
|
||||||
experimentOrder: (state) =>
|
issVehicleYear: state.order.vehicle.year,
|
||||||
({
|
issVehicleMake: state.order.vehicle.make,
|
||||||
issVehicleYear: state.order.vehicle.year,
|
issVehicleModel: state.order.vehicle.model,
|
||||||
issVehicleMake: state.order.vehicle.make,
|
issVehicleStyle: state.order.vehicle.style,
|
||||||
issVehicleModel: state.order.vehicle.model,
|
issIsRepair: state.order.damage.isRepair,
|
||||||
issVehicleStyle: state.order.vehicle.style,
|
issNumberOfChips: state.order.damage.numberOfChips,
|
||||||
issIsRepair: state.order.damage.isRepair,
|
issCarId: state.order.vehicle.carId,
|
||||||
issNumberOfChips: state.order.damage.numberOfChips,
|
issServiceCity: state.order.serviceLocation.city,
|
||||||
issCarId: state.order.vehicle.carId,
|
issServiceState: state.order.serviceLocation.state,
|
||||||
issServiceCity: state.order.serviceLocation.city,
|
issServiceZipCode: state.order.serviceLocation.zipCode,
|
||||||
issServiceState: state.order.serviceLocation.state,
|
issParentAccountNumber: state.order.accountNumber,
|
||||||
issServiceZipCode: state.order.serviceLocation.zipCode,
|
issIsCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
|
||||||
issParentAccountNumber: state.order.accountNumber,
|
issHasRecalibrationPart: getHasRecalibrationPart(state),
|
||||||
issIsCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
|
issSelectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
||||||
issHasRecalibrationPart: getHasRecalibrationPart(state),
|
issSelectedWindshieldGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||||
issSelectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
'glassLocation').includes(damageLocationsSelected.WINDSHIELD),
|
||||||
issSelectedWindshieldGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
issSelectedBackGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||||
'glassLocation').includes(damageLocationsSelected.WINDSHIELD),
|
'glassLocation').includes(damageLocationsSelected.REAR),
|
||||||
issSelectedBackGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
issSelectedDriverSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||||
'glassLocation').includes(damageLocationsSelected.REAR),
|
'glassLocation').includes(damageLocationsSelected.DRIVER),
|
||||||
issSelectedDriverSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
issSelectedPassengerSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
||||||
'glassLocation').includes(damageLocationsSelected.DRIVER),
|
'glassLocation').includes(damageLocationsSelected.PASSENGER),
|
||||||
issSelectedPassengerSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace,
|
issOrderPartNumbers: [
|
||||||
'glassLocation').includes(damageLocationsSelected.PASSENGER),
|
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts,
|
||||||
issOrderPartNumbers: [
|
'partNumber'),
|
||||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts,
|
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts,
|
||||||
'partNumber'),
|
'partNumber')
|
||||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts,
|
],
|
||||||
'partNumber')
|
|
||||||
],
|
|
||||||
|
|
||||||
issOrderPartTypes: [
|
issOrderPartTypes: [
|
||||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts,
|
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts,
|
||||||
'recalibrationType'),
|
'recalibrationType'),
|
||||||
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts,
|
...getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts,
|
||||||
'recalibrationType')
|
'recalibrationType')
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
experimentSettings: (state) =>
|
experimentSettings: (state) => state.applicationUser.experiments
|
||||||
state.applicationUser.experiments
|
.map((x) => x.settings)
|
||||||
.map((x) =>
|
.reduce((r, c) => Object.assign(r, c), {}) ?? {}
|
||||||
x.settings)
|
|
||||||
.reduce((r, c) =>
|
|
||||||
Object.assign(r, c), {}) ?? {}
|
|
||||||
},
|
},
|
||||||
actions:
|
actions:
|
||||||
{
|
{
|
||||||
|
|
@ -363,7 +342,7 @@ export const useMainStore = defineStore({
|
||||||
correlationId: placeHolderCorrelationId
|
correlationId: placeHolderCorrelationId
|
||||||
}
|
}
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
const responsePolicy = response.policies?.[0];
|
const responsePolicy = r.data.policies?.[0];
|
||||||
policy.policyLookupSuccessful = !!responsePolicy;
|
policy.policyLookupSuccessful = !!responsePolicy;
|
||||||
return r;
|
return r;
|
||||||
});
|
});
|
||||||
|
|
@ -381,71 +360,75 @@ export const useMainStore = defineStore({
|
||||||
// TODO: replace place holder correlationId with the real thing
|
// TODO: replace place holder correlationId with the real thing
|
||||||
const placeHolderCorrelationId = '00000000-0000-0000-0000-000000000000';
|
const placeHolderCorrelationId = '00000000-0000-0000-0000-000000000000';
|
||||||
const nonNumberCharRegex = /[^0-9]/g;
|
const nonNumberCharRegex = /[^0-9]/g;
|
||||||
const order = this.order;
|
const { order } = this;
|
||||||
globalMethods.callHttpClient({
|
return new Promise((resolve, reject) => {
|
||||||
method: endpoints.RegisterClaim.method,
|
globalMethods.callHttpClient({
|
||||||
endpoint: endpoints.RegisterClaim.url,
|
method: endpoints.RegisterClaim.method,
|
||||||
payload:
|
endpoint: endpoints.RegisterClaim.url,
|
||||||
{
|
payload:
|
||||||
correlationId: placeHolderCorrelationId,
|
{
|
||||||
accountNumber: this.issConfig.accountNumber?.toString() ?? '',
|
correlationId: placeHolderCorrelationId,
|
||||||
insured: {
|
accountNumber: this.issConfig.accountNumber?.toString() ?? '',
|
||||||
firstName: this.order.customer.firstName,
|
insured: {
|
||||||
lastName: this.order.customer.lastName,
|
firstName: this.order.customer.firstName,
|
||||||
address: {
|
lastName: this.order.customer.lastName,
|
||||||
addressLine1: this.order.customer.address.streetAddress,
|
address: {
|
||||||
addressLine2: this.order.customer.address.streetAddress2,
|
addressLine1: this.order.customer.address.streetAddress,
|
||||||
city: this.order.customer.address.city,
|
addressLine2: this.order.customer.address.streetAddress2,
|
||||||
state: this.order.customer.address.state,
|
city: this.order.customer.address.city,
|
||||||
zipCode: this.order.customer.address.zipCode,
|
state: this.order.customer.address.state,
|
||||||
country: 'US' // TODO set from store
|
zipCode: this.order.customer.address.zipCode,
|
||||||
|
country: 'US' // TODO set from store
|
||||||
|
},
|
||||||
|
homePhone: {
|
||||||
|
number: this.order.customer.phoneNumber?.replaceAll(nonNumberCharRegex, '') ?? ''
|
||||||
|
}
|
||||||
},
|
},
|
||||||
homePhone: {
|
driver: {
|
||||||
number: this.order.customer.phoneNumber?.replaceAll(nonNumberCharRegex, '') ?? ''
|
firstName: this.order.customer.firstName,
|
||||||
|
lastName: this.order.customer.lastName
|
||||||
|
},
|
||||||
|
caller: {
|
||||||
|
homePhone: {}
|
||||||
|
},
|
||||||
|
policyInfo: {
|
||||||
|
policyNumber: this.order.policy.policyNumber,
|
||||||
|
safelitePolicy: {
|
||||||
|
policies: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lossInfo: {
|
||||||
|
dateOfLoss: this.order.policy.dateOfLoss,
|
||||||
|
location: {
|
||||||
|
city: this.order.policy.damageCity,
|
||||||
|
state: this.order.policy.damageState,
|
||||||
|
country: 'US' // TODO set from store
|
||||||
|
},
|
||||||
|
vehicle: {
|
||||||
|
year: this.order.vehicle.year?.toString() ?? '',
|
||||||
|
make: this.order.vehicle.make,
|
||||||
|
model: this.order.vehicle.model,
|
||||||
|
vin: this.order.vehicle.vin
|
||||||
|
},
|
||||||
|
damageDescription: this.order.policy.damageCause
|
||||||
}
|
}
|
||||||
},
|
|
||||||
driver: {
|
|
||||||
firstName: this.order.customer.firstName,
|
|
||||||
lastName: this.order.customer.lastName
|
|
||||||
},
|
|
||||||
caller: {
|
|
||||||
homePhone: {}
|
|
||||||
},
|
|
||||||
policyInfo: {
|
|
||||||
policyNumber: this.order.policy.policyNumber,
|
|
||||||
safelitePolicy: {
|
|
||||||
policies: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
lossInfo: {
|
|
||||||
dateOfLoss: this.order.policy.dateOfLoss,
|
|
||||||
location: {
|
|
||||||
city: this.order.policy.damageCity,
|
|
||||||
state: this.order.policy.damageState,
|
|
||||||
country: 'US' // TODO set from store
|
|
||||||
},
|
|
||||||
vehicle: {
|
|
||||||
year: this.order.vehicle.year?.toString() ?? '',
|
|
||||||
make: this.order.vehicle.make,
|
|
||||||
model: this.order.vehicle.model,
|
|
||||||
vin: this.order.vehicle.vin
|
|
||||||
},
|
|
||||||
damageDescription: this.order.policy.damageCause
|
|
||||||
}
|
}
|
||||||
}
|
}).then((response) => {
|
||||||
}).then((response) => {
|
const registerClaimFailed = response.data.isError;
|
||||||
const registerClaimFailed = response.data.isError;
|
order.payment.insuranceCoverage.isVerified = !registerClaimFailed;
|
||||||
order.payment.insuranceCoverage.isVerified = !registerClaimFailed;
|
if (registerClaimFailed) {
|
||||||
if (registerClaimFailed) {
|
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
||||||
|
} else if (this.policy.noCoverage) {
|
||||||
|
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.NO_COMP;
|
||||||
|
} else {
|
||||||
|
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED;
|
||||||
|
}
|
||||||
|
return resolve(response);
|
||||||
|
}, (error) => {
|
||||||
|
this.order.payment.insuranceCoverage.isVerified = false;
|
||||||
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
||||||
} else if (this.policy.noCoverage) {
|
return reject(error);
|
||||||
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.NO_COMP;
|
});
|
||||||
} else {
|
|
||||||
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED;
|
|
||||||
}
|
|
||||||
}, (error) => {
|
|
||||||
this.order.payment.insuranceCoverage.isVerified = false;
|
|
||||||
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async lookupVinByPlate(licensePlate, licenseState) {
|
async lookupVinByPlate(licensePlate, licenseState) {
|
||||||
|
|
@ -545,12 +528,10 @@ export const useMainStore = defineStore({
|
||||||
getPartFromCapabilityQuestionAnswer(glassLocation) {
|
getPartFromCapabilityQuestionAnswer(glassLocation) {
|
||||||
const pageData = this.pageData(issPageValues.CAPABILITY_QUESTIONS);
|
const pageData = this.pageData(issPageValues.CAPABILITY_QUESTIONS);
|
||||||
|
|
||||||
const part = pageData.partsOrQuestions.find((x) =>
|
const part = pageData.partsOrQuestions.find((x) => x.glassLocation === glassLocation)
|
||||||
x.glassLocation === glassLocation)
|
|
||||||
.parts[0];
|
.parts[0];
|
||||||
const { capabilityQuestionAnswers } = this.order.damage;
|
const { capabilityQuestionAnswers } = this.order.damage;
|
||||||
const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find((x) =>
|
const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find((x) => x.glassLocation === glassLocation);
|
||||||
x.glassLocation === glassLocation);
|
|
||||||
|
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetPartFromCapabilityAnswer.method,
|
method: endpoints.GetPartFromCapabilityAnswer.method,
|
||||||
|
|
@ -650,10 +631,9 @@ export const useMainStore = defineStore({
|
||||||
},
|
},
|
||||||
|
|
||||||
getServiceabilityDetails({ serviceZipCode }) {
|
getServiceabilityDetails({ serviceZipCode }) {
|
||||||
const lineItemsWithOnlyPartNumbers = this.order.lineItems.glassParts.map((glassPart) =>
|
const lineItemsWithOnlyPartNumbers = this.order.lineItems.glassParts.map((glassPart) => ({
|
||||||
({
|
partNumber: glassPart.partNumber
|
||||||
partNumber: glassPart.partNumber
|
}));
|
||||||
}));
|
|
||||||
const lineItems = buildQueryStringParameterFromArrayOfComplexObjects(lineItemsWithOnlyPartNumbers,
|
const lineItems = buildQueryStringParameterFromArrayOfComplexObjects(lineItemsWithOnlyPartNumbers,
|
||||||
'lineItems');
|
'lineItems');
|
||||||
|
|
||||||
|
|
@ -701,8 +681,7 @@ export const useMainStore = defineStore({
|
||||||
&& this.order.damage.glassToReplace
|
&& this.order.damage.glassToReplace
|
||||||
.slice()
|
.slice()
|
||||||
.sort()
|
.sort()
|
||||||
.every((obj, index) =>
|
.every((obj, index) => obj.glassLocation === selectedGlassPassedInSorted[index].glassLocation
|
||||||
obj.glassLocation === selectedGlassPassedInSorted[index].glassLocation
|
|
||||||
&& obj.glassName === selectedGlassPassedInSorted[index].glassName);
|
&& obj.glassName === selectedGlassPassedInSorted[index].glassName);
|
||||||
const isWindshieldRepairTheSame
|
const isWindshieldRepairTheSame
|
||||||
= isWindshieldRepair === this.order.damage.isRepair;
|
= isWindshieldRepair === this.order.damage.isRepair;
|
||||||
|
|
@ -951,8 +930,7 @@ export const useMainStore = defineStore({
|
||||||
'result');
|
'result');
|
||||||
const havePartQuestionAnswersChanged
|
const havePartQuestionAnswersChanged
|
||||||
= sortedPreviousResultsArray?.length !== sortedPartQuestionAnswersArray.length
|
= sortedPreviousResultsArray?.length !== sortedPartQuestionAnswersArray.length
|
||||||
|| !sortedPreviousResultsArray?.every((x, i) =>
|
|| !sortedPreviousResultsArray?.every((x, i) => x.result === sortedPartQuestionAnswersArray[i].result);
|
||||||
x.result === sortedPartQuestionAnswersArray[i].result);
|
|
||||||
|
|
||||||
if (havePartQuestionAnswersChanged) {
|
if (havePartQuestionAnswersChanged) {
|
||||||
this.updateGlassParts(null);
|
this.updateGlassParts(null);
|
||||||
|
|
@ -976,8 +954,7 @@ export const useMainStore = defineStore({
|
||||||
'result');
|
'result');
|
||||||
const haveMoldingQuestionAnswersChanged
|
const haveMoldingQuestionAnswersChanged
|
||||||
= sortedPreviousResultsArray?.length !== sortedMoldingQuestionAnswersArray.length
|
= sortedPreviousResultsArray?.length !== sortedMoldingQuestionAnswersArray.length
|
||||||
|| !sortedPreviousResultsArray?.every((x, i) =>
|
|| !sortedPreviousResultsArray?.every((x, i) => x.result === sortedMoldingQuestionAnswersArray[i].result);
|
||||||
x.result === sortedMoldingQuestionAnswersArray[i].result);
|
|
||||||
|
|
||||||
if (haveMoldingQuestionAnswersChanged) {
|
if (haveMoldingQuestionAnswersChanged) {
|
||||||
this.updateGlassParts(null);
|
this.updateGlassParts(null);
|
||||||
|
|
@ -997,8 +974,7 @@ export const useMainStore = defineStore({
|
||||||
'result');
|
'result');
|
||||||
const haveCapabilityQuestionAnswersChanged
|
const haveCapabilityQuestionAnswersChanged
|
||||||
= sortedPreviousResultsArray?.length !== sortedCapabilityQuestionAnswersArray.length
|
= sortedPreviousResultsArray?.length !== sortedCapabilityQuestionAnswersArray.length
|
||||||
|| !sortedPreviousResultsArray?.every((x, i) =>
|
|| !sortedPreviousResultsArray?.every((x, i) => x.result === sortedCapabilityQuestionAnswersArray[i].result);
|
||||||
x.result === sortedCapabilityQuestionAnswersArray[i].result);
|
|
||||||
|
|
||||||
if (haveCapabilityQuestionAnswersChanged) {
|
if (haveCapabilityQuestionAnswersChanged) {
|
||||||
this.updateGlassParts(null);
|
this.updateGlassParts(null);
|
||||||
|
|
@ -1024,8 +1000,7 @@ export const useMainStore = defineStore({
|
||||||
this.applicationUser.eventBus.push(event);
|
this.applicationUser.eventBus.push(event);
|
||||||
},
|
},
|
||||||
removeEventFromBus(eventData) {
|
removeEventFromBus(eventData) {
|
||||||
const matchedEvent = this.applicationUser.eventBus.find(({ category, subCategory }) =>
|
const matchedEvent = this.applicationUser.eventBus.find(({ category, subCategory }) => category === eventData.category && subCategory === eventData.subCategory);
|
||||||
category === eventData.category && subCategory === eventData.subCategory);
|
|
||||||
const itemIndex = this.applicationUser.eventBus.indexOf(matchedEvent);
|
const itemIndex = this.applicationUser.eventBus.indexOf(matchedEvent);
|
||||||
|
|
||||||
// If the item exists, remove it.
|
// If the item exists, remove it.
|
||||||
|
|
@ -1083,11 +1058,10 @@ export const useMainStore = defineStore({
|
||||||
endpoint: endpoints.LogPageView.url,
|
endpoint: endpoints.LogPageView.url,
|
||||||
payload,
|
payload,
|
||||||
logApiCall: false
|
logApiCall: false
|
||||||
}).then((response) =>
|
}).then((response) => response,
|
||||||
response,
|
(error) => {
|
||||||
(error) => {
|
console.log(`Analytics Service Error: ${error.data}`);
|
||||||
console.log(`Analytics Service Error: ${error.data}`);
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
logCustomEvent({ userId, sessionKey, pageName, sessionId, category, action, label, value, shouldUseSessionId, experimentsForUser }) {
|
logCustomEvent({ userId, sessionKey, pageName, sessionId, category, action, label, value, shouldUseSessionId, experimentsForUser }) {
|
||||||
if (pageName == null || pageName.length === 0) { pageName = 'none'; }
|
if (pageName == null || pageName.length === 0) { pageName = 'none'; }
|
||||||
|
|
@ -1111,11 +1085,10 @@ export const useMainStore = defineStore({
|
||||||
endpoint: endpoints.LogCustomEvent.url,
|
endpoint: endpoints.LogCustomEvent.url,
|
||||||
payload,
|
payload,
|
||||||
logApiCall: false
|
logApiCall: false
|
||||||
}).then((response) =>
|
}).then((response) => response,
|
||||||
response,
|
(error) => {
|
||||||
(error) => {
|
console.log(`Analytics Service Error: ${error.data}`);
|
||||||
console.log(`Analytics Service Error: ${error.data}`);
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
initializeSession({ userId, sessionId, userAgent, referrer }) {
|
initializeSession({ userId, sessionId, userAgent, referrer }) {
|
||||||
const payload = {
|
const payload = {
|
||||||
|
|
@ -1134,11 +1107,10 @@ export const useMainStore = defineStore({
|
||||||
endpoint: endpoints.InitializeSession.url,
|
endpoint: endpoints.InitializeSession.url,
|
||||||
payload,
|
payload,
|
||||||
logApiCall: false
|
logApiCall: false
|
||||||
}).then((response) =>
|
}).then((response) => response,
|
||||||
response,
|
(error) => {
|
||||||
(error) => {
|
console.log(`Analytics Service Error: ${error.data}`);
|
||||||
console.log(`Analytics Service Error: ${error.data}`);
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
updateLastPageVisited(lastPageVisited) {
|
updateLastPageVisited(lastPageVisited) {
|
||||||
|
|
@ -1335,9 +1307,7 @@ function getHasRecalibrationPart(state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
||||||
return (array ?? []).map((x) =>
|
return (array ?? []).map((x) => x[propertyName]).filter((x) => x);
|
||||||
x[propertyName]).filter((x) =>
|
|
||||||
x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortArrayOfObjectsByPropertyValue(arrayOfObjects, propertyName) {
|
function sortArrayOfObjectsByPropertyValue(arrayOfObjects, propertyName) {
|
||||||
|
|
@ -1397,8 +1367,7 @@ function addPricesToLineItems(lineItems, pricingLineItems) {
|
||||||
addPricesToLineItems(lineItem.childParts, pricingLineItems);
|
addPricesToLineItems(lineItem.childParts, pricingLineItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
const lineItemIndex = pricingLineItems.findIndex((pricingLineItem) =>
|
const lineItemIndex = pricingLineItems.findIndex((pricingLineItem) => pricingLineItem.partNumber === lineItem.partNumber);
|
||||||
pricingLineItem.partNumber === lineItem.partNumber);
|
|
||||||
|
|
||||||
if (lineItemIndex > -1) {
|
if (lineItemIndex > -1) {
|
||||||
const pricedLineItem = pricingLineItems[lineItemIndex];
|
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 () => {
|
it('Call to client returns exception, resulting in object with error property being returned', async () => {
|
||||||
// Arrange
|
// 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
|
// Act
|
||||||
await store.registerClaim();
|
await store.registerClaim().catch((e) => {
|
||||||
|
expect(e).toEqual(error);
|
||||||
|
});
|
||||||
|
|
||||||
// Asserts
|
// Asserts
|
||||||
expect(globalMethods.callHttpClient).toHaveBeenCalled();
|
expect(globalMethods.callHttpClient).toHaveBeenCalled();
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@ $limu-button-color: #A9E3E9;
|
||||||
color: $limu-link !important;
|
color: $limu-link !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-text {
|
||||||
|
color: $limu-link !important;
|
||||||
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
&.btn-override[aria-disabled="false"]{
|
&.btn-override[aria-disabled="false"]{
|
||||||
&.btn-primary {
|
&.btn-primary {
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,9 @@ body {
|
||||||
display: inline;
|
display: inline;
|
||||||
color: $blue;
|
color: $blue;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-decoration: underline;
|
border: none;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 24px;
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue