Merge pull request #371 from Safelite/feature/digital/SSR-581
Feature/digital/ssr 581
This commit is contained in:
commit
e5ceaf69f5
2 changed files with 349 additions and 365 deletions
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<Form
|
<Form
|
||||||
ref="theForm"
|
ref="theForm"
|
||||||
v-slot="{ meta }"
|
v-slot="{ meta }"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
@invalid-submit="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">
|
||||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||||
|
|
@ -13,16 +13,16 @@ v-slot="{ meta }"
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="pb-1 mt-4">
|
<div class="pb-1 mt-4">
|
||||||
<h5
|
<h5
|
||||||
v-html="coverageStatementSubHeader"
|
class="text-center text-black"
|
||||||
class="text-center text-black">
|
v-html="coverageStatementSubHeader">
|
||||||
</h5>
|
</h5>
|
||||||
<div
|
<div
|
||||||
v-html="explanatoryText"
|
class="body-text text-center mt-4"
|
||||||
class="body-text text-center mt-4">
|
v-html="explanatoryText">
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-html="secondaryText"
|
class="text-center mt-4 fw-bold text-black"
|
||||||
class="text-center mt-4 fw-bold text-black">
|
v-html="secondaryText">
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="verifiedDeductible"
|
v-if="verifiedDeductible"
|
||||||
|
|
@ -41,33 +41,33 @@ v-slot="{ meta }"
|
||||||
<span class="text-success fw-bold">{{ formattedDeductible }}</span>
|
<span class="text-success fw-bold">{{ formattedDeductible }}</span>
|
||||||
</div>
|
</div>
|
||||||
<alert
|
<alert
|
||||||
ref="verifiedITACAlert"
|
|
||||||
v-if="verifiedITAC"
|
v-if="verifiedITAC"
|
||||||
|
ref="verifiedITACAlert"
|
||||||
class="mb-4"
|
class="mb-4"
|
||||||
cmsWidgetName="VerifiedITACAlert"
|
cmsWidgetName="VerifiedITACAlert"
|
||||||
:manualHeadline="verifiedITACAlertHeader"
|
:manualHeadline="verifiedITACAlertHeader"
|
||||||
:manualCopy="verifiedITACAlertBody"
|
:manualCopy="verifiedITACAlertBody"
|
||||||
alertClass="alert-success"
|
alertClass="alert-success"
|
||||||
v-bind:isDismissible="false">
|
:isDismissible="false">
|
||||||
</alert>
|
</alert>
|
||||||
<div
|
<div
|
||||||
v-html="nextStepsHeader"
|
class="fw-bold text-black mb-2"
|
||||||
class="fw-bold text-black mb-2">
|
v-html="nextStepsHeader">
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-html="nextStepsBody"
|
class="body-text"
|
||||||
class="body-text">
|
v-html="nextStepsBody">
|
||||||
</div>
|
</div>
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
v-if="displayQuote"
|
v-if="displayQuote"
|
||||||
|
id="coverage-button-question"
|
||||||
|
v-model="selectedProvider"
|
||||||
cmsWidgetName="ServiceProviderQuestion"
|
cmsWidgetName="ServiceProviderQuestion"
|
||||||
:questionText="questionText"
|
:questionText="questionText"
|
||||||
:answers="answersFromCms"
|
:answers="answersFromCms"
|
||||||
buttonTypeString="listButton"
|
buttonTypeString="listButton"
|
||||||
isRequired
|
isRequired
|
||||||
v-model="selectedProvider"
|
:validationRules="rules.selectionRequired">
|
||||||
validationRules="selection-required"
|
|
||||||
id="coverage-button-question">
|
|
||||||
</buttonQuestion>
|
</buttonQuestion>
|
||||||
</div>
|
</div>
|
||||||
<siteFooter
|
<siteFooter
|
||||||
|
|
@ -83,370 +83,347 @@ v-slot="{ meta }"
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<recalModal ref="RecalModal" cmsWidgetName="RecalModal" />
|
<recalModal
|
||||||
<contentGroupModal ref="DeductibleModal" cmsWidgetName="DeductibleModal" class="deductible-modal"/>
|
ref="RecalModal"
|
||||||
|
cmsWidgetName="RecalModal" />
|
||||||
|
<contentGroupModal
|
||||||
|
ref="DeductibleModal"
|
||||||
|
cmsWidgetName="DeductibleModal"
|
||||||
|
class="deductible-modal" />
|
||||||
</Form>
|
</Form>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// Import Component
|
// Import Component
|
||||||
import baseFormMixin from '@/mixins/base-form-mixin';
|
import { Form } from 'vee-validate';
|
||||||
import { Form, defineRule } from 'vee-validate';
|
import siteFooter from '@/iss-components/site-footer/site-footer';
|
||||||
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
import siteHeader from '@/iss-components/site-header/site-header';
|
||||||
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
import recalModal from '@/layouts/coverage-statement/recal-modal/recal-modal';
|
||||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
import alert from '@/ux-components/alert/alert';
|
||||||
import textBlock from "@/digital-components/text-block/text-block";
|
|
||||||
import recalModal from '@/layouts/coverage-statement/recal-modal/recal-modal.vue';
|
|
||||||
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 Supporting Files
|
// Import Supporting Files
|
||||||
import { fetchCmsContentForPage, setupModalLinks } from '@/helpers/cms-content-helper.js';
|
import { fetchCmsContentForPage, setupModalLinks, processIfStatements } from '@/helpers/cms-content-helper.js';
|
||||||
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
import { settleAllPromises } from '@/helpers/layout-helper.js';
|
||||||
import { getDamageString } from '@/helpers/damage-helper.js';
|
import { getDamageString } from '@/helpers/damage-helper.js';
|
||||||
import { useMainStore } from "@/store";
|
import { useMainStore } from '@/store/index.js';
|
||||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin.js';
|
||||||
import { processIfStatements } from '@/helpers/cms-content-helper';
|
import globalRules from '@/constants/global-rules.js';
|
||||||
import { required } from "@/helpers/validation-rules";
|
import baseFormMixin from '@/mixins/base-form-mixin.js';
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
|
||||||
defineRule("selection-required", required(errorMessages.OPTION_REQUIRED));
|
|
||||||
|
|
||||||
const store = useMainStore();
|
const store = useMainStore();
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'coverage-statement',
|
name: 'coverage-statement',
|
||||||
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
components: {
|
||||||
async beforeRouteEnter(to, from, next) {
|
siteFooter,
|
||||||
|
siteHeader,
|
||||||
|
// eslint-disable-next-line vue/no-reserved-component-names
|
||||||
|
Form,
|
||||||
|
recalModal,
|
||||||
|
alert,
|
||||||
|
contentGroupModal,
|
||||||
|
buttonQuestion
|
||||||
|
},
|
||||||
|
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
||||||
|
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 store.getSupportingItems();
|
||||||
|
|
||||||
// Settle promises and get results
|
// Settle promises and get results
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
{
|
{
|
||||||
resultKey: 'cmsContent',
|
resultKey: 'cmsContent',
|
||||||
promise: cmsContentPromise,
|
promise: cmsContentPromise
|
||||||
|
},
|
||||||
|
{
|
||||||
|
resultKey: 'supportingItems',
|
||||||
|
promise: supportingItemsPromise
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
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 clonedGlassParts = store.order.lineItems.glassParts
|
||||||
|
? JSON.parse(JSON.stringify(store.order.lineItems.glassParts))
|
||||||
|
: [];
|
||||||
|
const availableLineItems = [
|
||||||
|
...resultMap.supportingItems,
|
||||||
|
...clonedGlassParts
|
||||||
|
];
|
||||||
|
|
||||||
|
const pricingResults = await store.getPriceOrderItems(availableLineItems);
|
||||||
|
|
||||||
|
// Call the "next" function to complete the transition to this page.
|
||||||
|
next((vm) => {
|
||||||
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
vm.pricedGlassParts = clonedGlassParts;
|
||||||
|
vm.supportingItems = resultMap.supportingItems;
|
||||||
|
vm.availableLineItems = pricingResults;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isVerified: store.order.payment.insuranceCoverage.isVerified,
|
||||||
|
supportingItems: [],
|
||||||
|
pricedGlassParts: [],
|
||||||
|
availableLineItems: [],
|
||||||
|
selectedProvider: '',
|
||||||
|
deductibleText: 'Your deductible is:',
|
||||||
|
rules: {
|
||||||
|
selectionRequired: globalRules.OPTION_REQUIRED
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
verifiedITACAlertHeader() {
|
||||||
|
return this.getCmsContent('VerifiedITACAlert',
|
||||||
|
'HeadlineText');
|
||||||
},
|
},
|
||||||
{
|
verifiedITACAlertBody() {
|
||||||
resultKey: 'supportingItems',
|
return this.getCmsContent('VerifiedITACAlert',
|
||||||
promise: supportingItemsPromise,
|
'BodyText').replaceAll('{custom:costSavings}', this.costSavings);
|
||||||
},
|
},
|
||||||
];
|
coverageStatementSubHeader() {
|
||||||
|
const subheader = this.getSubheaderTextFromCms('SiteSubHeaderWidget');
|
||||||
|
return subheader;
|
||||||
|
},
|
||||||
|
secondaryText() {
|
||||||
|
const secondaryText = this.getSecondaryTextFromCms('SiteSubHeaderWidget');
|
||||||
|
return secondaryText;
|
||||||
|
},
|
||||||
|
explanatoryText() {
|
||||||
|
const explanatoryText = this.getExplantoryTextFromCms('ExplanatoryTextWidget');
|
||||||
|
return explanatoryText;
|
||||||
|
},
|
||||||
|
nextStepsHeader() {
|
||||||
|
const header = this.getHeaderTextFromCms('NextStepsWidget');
|
||||||
|
return header;
|
||||||
|
},
|
||||||
|
nextStepsBody() {
|
||||||
|
const body = this.getBodyTextFromCms('NextStepsWidget').replaceAll('{custom:damage}', this.damageText);
|
||||||
|
return body;
|
||||||
|
},
|
||||||
|
continueWithSchedulingBodyText() {
|
||||||
|
return this.getCmsContent('continueWithSchedulingCopy', 'BodyText');
|
||||||
|
},
|
||||||
|
unverifiedADASNextStepsBodyText() {
|
||||||
|
return this.getCmsContent('UnverifiedADASNextStepsWidget', 'BodyText').replaceAll('{custom:damage}', this.damageText);
|
||||||
|
},
|
||||||
|
unverifiedNonADASNextStepsBodyText() {
|
||||||
|
return this.getCmsContent('UnverifiedNonADASNextStepsWidget', 'BodyText').replaceAll('{custom:damage}', this.damageText);
|
||||||
|
},
|
||||||
|
unverifiedNonADASRepairBodyText() {
|
||||||
|
return this.getCmsContent('UnverifiedNonADASRepairWidget', 'BodyText');
|
||||||
|
},
|
||||||
|
damageText() {
|
||||||
|
const damageString = getDamageString();
|
||||||
|
return damageString === 'match' ? '' : damageString;
|
||||||
|
},
|
||||||
|
vehicleDeductible() {
|
||||||
|
if (this.coverageVerified) {
|
||||||
|
if (store.order.damage.isRepair) {
|
||||||
|
const repairDeductible = store.order.policy.deductible.repair;
|
||||||
|
return repairDeductible;
|
||||||
|
}
|
||||||
|
|
||||||
if (useMainStore().isClaimRegistrationRequired){
|
const replaceDeductible = store.order.policy.deductible.replace;
|
||||||
const registerClaimResponse = await useMainStore().registerClaim();
|
return replaceDeductible;
|
||||||
promiseResultMap.push({
|
}
|
||||||
resultKey: 'registerClaim',
|
return null;
|
||||||
promise: registerClaimResponse,
|
},
|
||||||
});
|
formattedDeductible() {
|
||||||
|
return this.getDeductibleString(this.vehicleDeductible);
|
||||||
|
},
|
||||||
|
isDeductibleZero() {
|
||||||
|
if (this.coverageVerified && this.verifiedDeductible) {
|
||||||
|
return this.vehicleDeductible === 0;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
deductibleOverZero() {
|
||||||
|
if (this.coverageVerified && this.verifiedDeductible) {
|
||||||
|
return !this.isDeductibleZero;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
coverageVerified() {
|
||||||
|
return this.isVerified;
|
||||||
|
},
|
||||||
|
coverageUnverified() {
|
||||||
|
return !this.isVerified;
|
||||||
|
},
|
||||||
|
verifiedNoComp() {
|
||||||
|
return this.coverageVerified ? store.order.policy.noCoverage : false;
|
||||||
|
},
|
||||||
|
verifiedITAC() {
|
||||||
|
return this.coverageVerified
|
||||||
|
&& !this.verifiedNoComp
|
||||||
|
&& this.vehicleDeductible > this.totalServicePrice;
|
||||||
|
},
|
||||||
|
verifiedDeductible() {
|
||||||
|
return this.coverageVerified
|
||||||
|
&& !this.verifiedNoComp
|
||||||
|
&& this.totalServicePrice > this.vehicleDeductible;
|
||||||
|
},
|
||||||
|
ADASReplace() {
|
||||||
|
if (!store.order.damage.isRepair) {
|
||||||
|
const parts = store.order.lineItems.glassParts;
|
||||||
|
|
||||||
|
if (parts != null && parts.filter((part) =>
|
||||||
|
part.requiresRecalibration).length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
nonADASReplace() {
|
||||||
|
return !this.ADASReplace;
|
||||||
|
},
|
||||||
|
nonADASRepair() {
|
||||||
|
return store.order.damage.isRepair;
|
||||||
|
},
|
||||||
|
totalServicePrice() {
|
||||||
|
let total = 0;
|
||||||
|
this.availableLineItems.forEach((lineItem) => {
|
||||||
|
total += this.getTotalLineItemPrice(lineItem);
|
||||||
|
});
|
||||||
|
return total;
|
||||||
|
},
|
||||||
|
formattedServicePrice() {
|
||||||
|
return this.getServicePriceString(this.totalServicePrice);
|
||||||
|
},
|
||||||
|
costSavings() {
|
||||||
|
const savings = this.getITACCostSavings(this.vehicleDeductible, this.totalServicePrice);
|
||||||
|
const formattedSavings = parseFloat(savings).toFixed(2);
|
||||||
|
return `$${formattedSavings}`;
|
||||||
|
},
|
||||||
|
questionText() {
|
||||||
|
return this.getCmsContent('ServiceProviderQuestion', 'QuestionText');
|
||||||
|
},
|
||||||
|
answersFromCms() {
|
||||||
|
return this.getCmsContent('ServiceProviderQuestion', 'Answers');
|
||||||
|
},
|
||||||
|
displayQuote() {
|
||||||
|
return this.verifiedITAC || this.verifiedNoComp;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
selectedProvider() {
|
||||||
|
if (this.selectedProvider === 'Safelite') {
|
||||||
|
this.$refs.siteFooter.updateButtonText('Continue with Safelite');
|
||||||
|
} else {
|
||||||
|
this.$refs.siteFooter.updateButtonText('Continue');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
setupModalLinks(this);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
arePagePrerequisitesValid() {
|
||||||
|
if (useMainStore().vehicle.vin) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
async forwardButtonAction() {
|
||||||
|
return this.navigateForward();
|
||||||
|
},
|
||||||
|
async navigateForward() {
|
||||||
|
if (this.coverageUnverified || this.verifiedDeductible) {
|
||||||
|
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD,
|
||||||
|
this.$route);
|
||||||
|
} else if (this.verifiedITAC || this.verifiedNoComp) {
|
||||||
|
if (this.selectedProvider === 'Safelite') {
|
||||||
|
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE,
|
||||||
|
this.$route);
|
||||||
|
} else if (store.issConfig.enableTPAFlow) {
|
||||||
|
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_THIRD_PARTY,
|
||||||
|
this.$route);
|
||||||
|
} else {
|
||||||
|
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
||||||
|
this.$route);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openModalAction(modalName) {
|
||||||
|
this.$refs[modalName.args].openModal();
|
||||||
|
},
|
||||||
|
processIfStatements,
|
||||||
|
getHeaderTextFromCms(cmsWidgetName) {
|
||||||
|
const header = this.getCmsContent(cmsWidgetName, 'HeaderText');
|
||||||
|
return this.processIfStatements(header, 'custom', this.getCustomValueFromString);
|
||||||
|
},
|
||||||
|
getSubheaderTextFromCms(cmsWidgetName) {
|
||||||
|
const subHeader = this.getCmsContent(cmsWidgetName, 'SubHeaderText');
|
||||||
|
return this.processIfStatements(subHeader, 'custom', this.getCustomValueFromString);
|
||||||
|
},
|
||||||
|
getBodyTextFromCms(cmsWidgetName) {
|
||||||
|
const bodyText = this.getCmsContent(cmsWidgetName, 'BodyText');
|
||||||
|
return this.processIfStatements(bodyText, 'custom', this.getCustomValueFromString);
|
||||||
|
},
|
||||||
|
getSecondaryTextFromCms(cmsWidgetName) {
|
||||||
|
const secondaryText = this.getCmsContent(cmsWidgetName, 'SecondaryText');
|
||||||
|
return this.processIfStatements(secondaryText, 'custom', this.getCustomValueFromString);
|
||||||
|
},
|
||||||
|
getExplantoryTextFromCms(cmsWidgetName) {
|
||||||
|
const explanatoryText = this.getCmsContent(cmsWidgetName, 'BodyText');
|
||||||
|
return this.processIfStatements(explanatoryText, 'custom', this.getCustomValueFromString);
|
||||||
|
},
|
||||||
|
getCustomValueFromString(str) {
|
||||||
|
switch (str) {
|
||||||
|
case 'coverageUnverified':
|
||||||
|
return this.coverageUnverified;
|
||||||
|
case 'verifiedDeductible':
|
||||||
|
return this.verifiedDeductible;
|
||||||
|
case 'verifiedITAC':
|
||||||
|
return this.verifiedITAC;
|
||||||
|
case 'verifiedNoComp':
|
||||||
|
return this.verifiedNoComp;
|
||||||
|
case 'ADASReplace':
|
||||||
|
return this.ADASReplace;
|
||||||
|
case 'nonADASReplace':
|
||||||
|
return this.nonADASReplace;
|
||||||
|
case 'nonADASRepair':
|
||||||
|
return this.nonADASRepair;
|
||||||
|
case 'deductibleOverZero':
|
||||||
|
return this.deductibleOverZero;
|
||||||
|
case 'isDeductibleZero':
|
||||||
|
return this.isDeductibleZero;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getTotalLineItemPrice(lineItem) {
|
||||||
|
return lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice;
|
||||||
|
},
|
||||||
|
getDeductibleString(deductible) {
|
||||||
|
const formattedDeductibleFloat = parseFloat(deductible).toFixed(2);
|
||||||
|
return `$${formattedDeductibleFloat}`;
|
||||||
|
},
|
||||||
|
getServicePriceString(price) {
|
||||||
|
const formattedPriceFloat = parseFloat(price).toFixed(2);
|
||||||
|
return `$${formattedPriceFloat}`;
|
||||||
|
},
|
||||||
|
getITACCostSavings(vehicleDeductible, totalServicePrice) {
|
||||||
|
const savings = vehicleDeductible - totalServicePrice;
|
||||||
|
return savings;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
|
||||||
|
|
||||||
const clonedGlassParts = store.order.lineItems.glassParts
|
|
||||||
? JSON.parse(JSON.stringify(store.order.lineItems.glassParts))
|
|
||||||
: [];
|
|
||||||
const availableLineItems = [
|
|
||||||
...resultMap.supportingItems,
|
|
||||||
...clonedGlassParts,
|
|
||||||
];
|
|
||||||
|
|
||||||
const pricingResults = await store.getPriceOrderItems(availableLineItems);
|
|
||||||
|
|
||||||
// Call the "next" function to complete the transition to this page.
|
|
||||||
next((vm) => {
|
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
|
||||||
vm.pricedGlassParts = clonedGlassParts;
|
|
||||||
vm.supportingItems = resultMap.supportingItems;
|
|
||||||
vm.availableLineItems = pricingResults;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
siteFooter,
|
|
||||||
siteHeader,
|
|
||||||
siteSubHeader,
|
|
||||||
Form,
|
|
||||||
textBlock,
|
|
||||||
recalModal,
|
|
||||||
alert,
|
|
||||||
contentGroupModal,
|
|
||||||
buttonQuestion
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
setupModalLinks(this);
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isVerified: store.order.payment.insuranceCoverage.isVerified,
|
|
||||||
supportingItems: [],
|
|
||||||
pricedGlassParts: [],
|
|
||||||
availableLineItems: [],
|
|
||||||
selectedProvider: "",
|
|
||||||
deductibleText: "Your deductible is:",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
verifiedITACAlertHeader() {
|
|
||||||
return this.getCmsContent(
|
|
||||||
"VerifiedITACAlert",
|
|
||||||
"HeadlineText"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
verifiedITACAlertBody() {
|
|
||||||
return this.getCmsContent(
|
|
||||||
"VerifiedITACAlert",
|
|
||||||
"BodyText"
|
|
||||||
).replaceAll("{custom:costSavings}", this.costSavings);
|
|
||||||
},
|
|
||||||
coverageStatementSubHeader() {
|
|
||||||
const subheader = this.getSubheaderTextFromCms("SiteSubHeaderWidget");
|
|
||||||
return subheader;
|
|
||||||
},
|
|
||||||
secondaryText() {
|
|
||||||
const secondaryText = this.getSecondaryTextFromCms("SiteSubHeaderWidget");
|
|
||||||
return secondaryText;
|
|
||||||
},
|
|
||||||
explanatoryText() {
|
|
||||||
const explanatoryText = this.getExplantoryTextFromCms("ExplanatoryTextWidget");
|
|
||||||
return explanatoryText;
|
|
||||||
},
|
|
||||||
nextStepsHeader() {
|
|
||||||
const header = this.getHeaderTextFromCms("NextStepsWidget");
|
|
||||||
return header;
|
|
||||||
},
|
|
||||||
nextStepsBody() {
|
|
||||||
let body = this.getBodyTextFromCms("NextStepsWidget").replaceAll("{custom:damage}", this.damageText);
|
|
||||||
return body;
|
|
||||||
},
|
|
||||||
continueWithSchedulingBodyText() {
|
|
||||||
return this.getCmsContent("continueWithSchedulingCopy", "BodyText");
|
|
||||||
},
|
|
||||||
unverifiedADASNextStepsBodyText() {
|
|
||||||
return this.getCmsContent("UnverifiedADASNextStepsWidget", "BodyText").replaceAll("{custom:damage}", this.damageText);
|
|
||||||
},
|
|
||||||
unverifiedNonADASNextStepsBodyText() {
|
|
||||||
return this.getCmsContent("UnverifiedNonADASNextStepsWidget", "BodyText").replaceAll("{custom:damage}", this.damageText);
|
|
||||||
},
|
|
||||||
unverifiedNonADASRepairBodyText() {
|
|
||||||
return this.getCmsContent("UnverifiedNonADASRepairWidget", "BodyText");
|
|
||||||
},
|
|
||||||
damageText() {
|
|
||||||
var damageString = getDamageString();
|
|
||||||
return damageString == "match" ? "" : damageString;
|
|
||||||
},
|
|
||||||
vehicleDeductible() {
|
|
||||||
if (this.coverageVerified) {
|
|
||||||
if (store.order.damage.isRepair) {
|
|
||||||
const repairDeductible = store.order.policy.deductible.repair
|
|
||||||
return repairDeductible;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const replaceDeductible = store.order.policy.deductible.replace;
|
|
||||||
return replaceDeductible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
formattedDeductible() {
|
|
||||||
return this.getDeductibleString(this.vehicleDeductible);
|
|
||||||
},
|
|
||||||
isDeductibleZero() {
|
|
||||||
if (this.coverageVerified && this.verifiedDeductible) {
|
|
||||||
return this.vehicleDeductible === 0;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
deductibleOverZero() {
|
|
||||||
if (this.coverageVerified && this.verifiedDeductible) {
|
|
||||||
return !this.isDeductibleZero;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
coverageVerified() {
|
|
||||||
return this.isVerified;
|
|
||||||
},
|
|
||||||
coverageUnverified() {
|
|
||||||
return !this.isVerified;
|
|
||||||
},
|
|
||||||
verifiedNoComp() {
|
|
||||||
if (this.coverageVerified) {
|
|
||||||
return store.order.policy.noCoverage;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
verifiedITAC() {
|
|
||||||
if (this.coverageVerified && !this.verifiedNoComp) {
|
|
||||||
if (this.vehicleDeductible > this.totalServicePrice) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
verifiedDeductible() {
|
|
||||||
if (this.coverageVerified && !this.verifiedNoComp) {
|
|
||||||
if (this.totalServicePrice > this.vehicleDeductible) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
ADASReplace() {
|
|
||||||
if (!store.order.damage.isRepair) {
|
|
||||||
let parts = store.order.lineItems.glassParts;
|
|
||||||
|
|
||||||
if (parts != null && parts.filter(part => part.requiresRecalibration).length > 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
nonADASReplace() {
|
|
||||||
if (!store.order.damage.isRepair) {
|
|
||||||
return !this.ADASReplace;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
nonADASRepair() {
|
|
||||||
if (store.order.damage.isRepair) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
totalServicePrice() {
|
|
||||||
let total = 0;
|
|
||||||
this.availableLineItems.forEach((lineItem) => {
|
|
||||||
total += this.getTotalLineItemPrice(lineItem);
|
|
||||||
})
|
|
||||||
return total;
|
|
||||||
},
|
|
||||||
formattedServicePrice() {
|
|
||||||
return this.getServicePriceString(this.totalServicePrice);
|
|
||||||
},
|
|
||||||
costSavings() {
|
|
||||||
const savings = this.getITACCostSavings(this.vehicleDeductible, this.totalServicePrice);
|
|
||||||
const formattedSavings = parseFloat(savings).toFixed(2);
|
|
||||||
return '$' + formattedSavings;
|
|
||||||
},
|
|
||||||
questionText() {
|
|
||||||
return this.getCmsContent("ServiceProviderQuestion", "QuestionText");
|
|
||||||
},
|
|
||||||
answersFromCms() {
|
|
||||||
return this.getCmsContent("ServiceProviderQuestion", "Answers");
|
|
||||||
},
|
|
||||||
displayQuote() {
|
|
||||||
if (this.verifiedITAC || this.verifiedNoComp) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
arePagePrerequisitesValid() {
|
|
||||||
if (useMainStore().vehicle.vin) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
async forwardButtonAction() {
|
|
||||||
return await this.navigateForward();
|
|
||||||
|
|
||||||
},
|
|
||||||
async navigateForward() {
|
|
||||||
if (this.coverageUnverified || this.verifiedDeductible) {
|
|
||||||
this.$router.navigate(
|
|
||||||
this.navigationScenarios.CLICKED_FORWARD,
|
|
||||||
this.$route
|
|
||||||
)
|
|
||||||
}
|
|
||||||
else if (this.verifiedITAC || this.verifiedNoComp) {
|
|
||||||
if (this.selectedProvider === "Safelite") {
|
|
||||||
this.$router.navigate(
|
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE,
|
|
||||||
this.$route
|
|
||||||
)
|
|
||||||
}
|
|
||||||
else if (store.issConfig.enableTPAFlow){
|
|
||||||
this.$router.navigate(
|
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITH_THIRD_PARTY,
|
|
||||||
this.$route
|
|
||||||
)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.$router.navigate(
|
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
|
||||||
this.$route
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
openModalAction(modalName) {
|
|
||||||
this.$refs[modalName.args].openModal();
|
|
||||||
},
|
|
||||||
processIfStatements,
|
|
||||||
getHeaderTextFromCms(cmsWidgetName) {
|
|
||||||
const header = this.getCmsContent(cmsWidgetName, 'HeaderText');
|
|
||||||
return this.processIfStatements(header, "custom", this.getCustomValueFromString);
|
|
||||||
},
|
|
||||||
getSubheaderTextFromCms(cmsWidgetName) {
|
|
||||||
const subHeader = this.getCmsContent(cmsWidgetName, 'SubHeaderText');
|
|
||||||
return this.processIfStatements(subHeader, "custom", this.getCustomValueFromString);
|
|
||||||
},
|
|
||||||
getBodyTextFromCms(cmsWidgetName) {
|
|
||||||
const bodyText = this.getCmsContent(cmsWidgetName, "BodyText");
|
|
||||||
return this.processIfStatements(bodyText, "custom", this.getCustomValueFromString);
|
|
||||||
},
|
|
||||||
getSecondaryTextFromCms(cmsWidgetName) {
|
|
||||||
const secondaryText = this.getCmsContent(cmsWidgetName, "SecondaryText");
|
|
||||||
return this.processIfStatements(secondaryText, "custom", this.getCustomValueFromString);
|
|
||||||
},
|
|
||||||
getExplantoryTextFromCms(cmsWidgetName) {
|
|
||||||
const explanatoryText = this.getCmsContent(cmsWidgetName, "BodyText");
|
|
||||||
return this.processIfStatements(explanatoryText, "custom", this.getCustomValueFromString);
|
|
||||||
},
|
|
||||||
getCustomValueFromString(str) {
|
|
||||||
switch (str) {
|
|
||||||
case 'coverageUnverified':
|
|
||||||
return this.coverageUnverified;
|
|
||||||
case 'verifiedDeductible':
|
|
||||||
return this.verifiedDeductible;
|
|
||||||
case 'verifiedITAC':
|
|
||||||
return this.verifiedITAC;
|
|
||||||
case 'verifiedNoComp':
|
|
||||||
return this.verifiedNoComp;
|
|
||||||
case 'ADASReplace':
|
|
||||||
return this.ADASReplace;
|
|
||||||
case 'nonADASReplace':
|
|
||||||
return this.nonADASReplace;
|
|
||||||
case 'nonADASRepair':
|
|
||||||
return this.nonADASRepair;
|
|
||||||
case 'deductibleOverZero':
|
|
||||||
return this.deductibleOverZero
|
|
||||||
case 'isDeductibleZero':
|
|
||||||
return this.isDeductibleZero
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getTotalLineItemPrice(lineItem) {
|
|
||||||
return lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice;
|
|
||||||
},
|
|
||||||
getDeductibleString(deductible) {
|
|
||||||
const formattedDeductibleFloat = parseFloat(deductible).toFixed(2);
|
|
||||||
return '$' + formattedDeductibleFloat;
|
|
||||||
},
|
|
||||||
getServicePriceString(price) {
|
|
||||||
const formattedPriceFloat = parseFloat(price).toFixed(2);
|
|
||||||
return '$' + formattedPriceFloat;
|
|
||||||
},
|
|
||||||
getITACCostSavings(vehicleDeductible, totalServicePrice) {
|
|
||||||
const savings = vehicleDeductible - totalServicePrice;
|
|
||||||
return savings;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
selectedProvider() {
|
|
||||||
if (this.selectedProvider === "Safelite") {
|
|
||||||
this.$refs.siteFooter.updateButtonText('Continue with Safelite');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.$refs.siteFooter.updateButtonText('Continue');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ const getDefaultState = () =>
|
||||||
damageState: null,
|
damageState: null,
|
||||||
damageCity: null,
|
damageCity: null,
|
||||||
isDamageGlassOnly: null,
|
isDamageGlassOnly: null,
|
||||||
|
policyLookupSuccessful: null,
|
||||||
noCoverage: null,
|
noCoverage: null,
|
||||||
deductible: {
|
deductible: {
|
||||||
repair: null, // numerical value; how much customer owes on deductible in repair case
|
repair: null, // numerical value; how much customer owes on deductible in repair case
|
||||||
|
|
@ -349,6 +350,7 @@ export const useMainStore = defineStore({
|
||||||
getCoveragePolicyInfo({ accountNumber, policyNumber, dateOfLoss, zipCode }) {
|
getCoveragePolicyInfo({ accountNumber, policyNumber, dateOfLoss, zipCode }) {
|
||||||
// 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 { policy } = this.order;
|
||||||
try {
|
try {
|
||||||
const response = globalMethods.callHttpClient({
|
const response = globalMethods.callHttpClient({
|
||||||
method: endpoints.CoveragePolicyInfo.method,
|
method: endpoints.CoveragePolicyInfo.method,
|
||||||
|
|
@ -360,9 +362,14 @@ export const useMainStore = defineStore({
|
||||||
zipCode,
|
zipCode,
|
||||||
correlationId: placeHolderCorrelationId
|
correlationId: placeHolderCorrelationId
|
||||||
}
|
}
|
||||||
|
}).then((r) => {
|
||||||
|
const responsePolicy = response.policies?.[0];
|
||||||
|
policy.policyLookupSuccessful = !!responsePolicy;
|
||||||
|
return r;
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
} catch (responseError) {
|
} catch (responseError) {
|
||||||
|
policy.policyLookupSuccessful = false;
|
||||||
return {
|
return {
|
||||||
error: {
|
error: {
|
||||||
status: responseError.status
|
status: responseError.status
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue