Merge branch 'develop' into feature/CSR-941

This commit is contained in:
Matt Sykes 2022-12-09 09:31:39 -05:00
commit 261ba7294e
26 changed files with 215 additions and 96 deletions

View file

@ -60,11 +60,16 @@ export default {
return this.getCmsContent(this.cmsWidgetName, "FooterText"); return this.getCmsContent(this.cmsWidgetName, "FooterText");
}, },
}, },
methods: {
setupModalEventListener() {
const modal = document.querySelector("#" + this.cmsWidgetName);
modal.addEventListener("hidden.bs.modal", (event) => {
this.$refs.buttonMain.resetButtonStyle();
});
},
},
mounted() { mounted() {
const modal = document.querySelector("#" + this.cmsWidgetName); this.setupModalEventListener();
modal.addEventListener("hidden.bs.modal", (event) => {
this.$refs.buttonMain.resetButtonStyle();
});
}, },
components: { components: {
buttonMain, buttonMain,

View file

@ -66,6 +66,9 @@ const storeActions = {
SAVE_MOLDING_QUESTION_ANSWERS: "saveMoldingQuestionAnswers", SAVE_MOLDING_QUESTION_ANSWERS: "saveMoldingQuestionAnswers",
SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers", SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers",
SAVE_QUOTE_PAGE_SELECTIONS: "saveQuotePageSelections", SAVE_QUOTE_PAGE_SELECTIONS: "saveQuotePageSelections",
SAVE_PAYMENT_TYPE: "savePaymentType",
SAVE_SUPPORTING_ITEMS: "saveSupportingItems",
SAVE_VAPS: "saveVaps",
}; };
export { storeActions }; export { storeActions };

View file

@ -54,8 +54,6 @@ const storeMutations = {
RESET_DAMAGE_STATE: "resetDamageState", RESET_DAMAGE_STATE: "resetDamageState",
RESET_REGISTRATION_STATE: "resetRegistrationState", RESET_REGISTRATION_STATE: "resetRegistrationState",
RESET_GLASS_PARTS_STATE: "resetGlassPartsState", RESET_GLASS_PARTS_STATE: "resetGlassPartsState",
RESET_SUPPORTING_ITEMS_STATE: "resetSupportingItemsState",
RESET_VAPS_STATE: "resetVapsState",
RESET_STATE: "resetState", RESET_STATE: "resetState",
RESET_SAVE_SESSION_PROMISE: "resetSaveSessionPromise", RESET_SAVE_SESSION_PROMISE: "resetSaveSessionPromise",

View file

@ -78,7 +78,7 @@ const tintMap = {
// Returns undefined if no items are found. // Returns undefined if no items are found.
export function getTintImage(glassLocation, colorString) { export function getTintImage(glassLocation, colorString) {
// Windshield glass has special images, all other glass uses the same though. // Windshield glass has special images, all other glass uses the same though.
if (glassLocation.toLowerCase() !== "windshield") { if (glassLocation?.toLowerCase() !== "windshield") {
glassLocation = "other"; glassLocation = "other";
} }

View file

@ -37,7 +37,9 @@ export function getDamageString() {
export function getIsWindshieldOnly() { export function getIsWindshieldOnly() {
const damageLocations = store.getters.damage.glassToReplace; const damageLocations = store.getters.damage.glassToReplace;
const returnString = const returnString =
damageLocations.length === 1 && damageLocations[0]?.glassLocation === "Windshield" damageLocations &&
damageLocations.length === 1 &&
damageLocations[0]?.glassLocation === "Windshield"
? "windshield" ? "windshield"
: "glass"; : "glass";
return returnString; return returnString;

View file

@ -43,16 +43,21 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita
Used to navigate to the heritage funnel with the correct query string and url. Used to navigate to the heritage funnel with the correct query string and url.
*/ */
export async function navigateToHeritageFunnel(shouldSaveSession = true) { export async function navigateToHeritageFunnel({ shouldSaveSession = true, loadingModal }) {
// Create the order (or save existing order) when navigating to Heritage Funnel. // Create the order (or save existing order) when navigating to Heritage Funnel.
if (shouldSaveSession) { if (shouldSaveSession) {
await saveSession(); await saveSession();
} }
if (loadingModal && loadingModal.showModal) {
loadingModal.showModal();
}
router.navigateToExternalUrl(externalUrls.HERITAGE_FUNNEL, { router.navigateToExternalUrl(externalUrls.HERITAGE_FUNNEL, {
corid: store.getters.order.referralCorrelationId, corid: store.getters.order.referralCorrelationId,
src: "concept-funnel", src: "concept-funnel",
conceptsqid: store.getters.applicationUser.savedSessionId, conceptsqid: store.getters.applicationUser.savedSessionId,
isInsurance: store.getters.payment.isInsurance,
}); });
} }

View file

@ -377,7 +377,7 @@ describe("navigateToHeritageFunnel", () => {
router.navigateToExternalUrl = jest.fn(); router.navigateToExternalUrl = jest.fn();
// Act // Act
await navigateToHeritageFunnel(); await navigateToHeritageFunnel({});
// Assert // Assert
expect(saveSessionFunction).toHaveBeenCalled(); expect(saveSessionFunction).toHaveBeenCalled();
@ -424,7 +424,7 @@ describe("navigateToHeritageFunnel", () => {
router.navigateToExternalUrl = jest.fn(); router.navigateToExternalUrl = jest.fn();
// Act // Act
await navigateToHeritageFunnel(); await navigateToHeritageFunnel({});
// Assert // Assert
expect(router.navigateToExternalUrl).toHaveBeenCalled(); expect(router.navigateToExternalUrl).toHaveBeenCalled();
@ -436,7 +436,7 @@ describe("navigateToHeritageFunnel", () => {
); );
}); });
test("should not save session, but should still navigate", async () => { test("shouldSaveSession is false => should not save session, but should still navigate", async () => {
// Arrange // Arrange
const mockReferralNumber = "2"; const mockReferralNumber = "2";
const mockCorrelationId = "55"; const mockCorrelationId = "55";
@ -462,7 +462,7 @@ describe("navigateToHeritageFunnel", () => {
router.navigateToExternalUrl = jest.fn(); router.navigateToExternalUrl = jest.fn();
// Act // Act
await navigateToHeritageFunnel(false); await navigateToHeritageFunnel({ shouldSaveSession: false });
// Assert // Assert
expect(saveSessionFunction).not.toHaveBeenCalled(); expect(saveSessionFunction).not.toHaveBeenCalled();

View file

@ -30,7 +30,14 @@ export async function loadSessionIfPresent() {
} }
// Loads session including referral if there is a cookie, and it doesn't indicate it needs a state reset. // Loads session including referral if there is a cookie, and it doesn't indicate it needs a state reset.
return (await loadSession(funnelCookie.SavedSessionId)).data; return (
await loadSession(
funnelCookie.SavedSessionId,
funnelCookie.ReferralNumber,
funnelCookie.ReferralParentAccountNumber,
funnelCookie.ReferralCorrelationId
)
).data;
} }
/* /*
@ -61,13 +68,16 @@ export async function saveSession() {
Calls API to load session given the referral number, referralDate, and referralCorrelationId Calls API to load session given the referral number, referralDate, and referralCorrelationId
and returns the response. and returns the response.
*/ */
async function loadSession(savedSessionId) { async function loadSession(savedSessionId, referralNumber, accountNumber, referralCorrelationId) {
// await the saveSessionPromise in the store to make sure we're loading up to date information // await the saveSessionPromise in the store to make sure we're loading up to date information
await store.getters.applicationUser.saveSessionPromise; await store.getters.applicationUser.saveSessionPromise;
const response = await baseMixin.methods.dispatchStoreAction( const response = await baseMixin.methods.dispatchStoreAction(
storeActions.LOAD_SESSION, storeActions.LOAD_SESSION,
{ {
savedSessionId: savedSessionId?.toString(), savedSessionId: savedSessionId?.toString(),
referralNumber,
accountNumber,
referralCorrelationId,
}, },
false false
); );
@ -84,12 +94,12 @@ async function saveSessionHelper() {
await baseMixin.methods.dispatchStoreAction( await baseMixin.methods.dispatchStoreAction(
storeActions.UPDATE_STORE_WITH_SAVE_SESSION_RESPONSE, storeActions.UPDATE_STORE_WITH_SAVE_SESSION_RESPONSE,
{ {
referralNumber: savedSessionInfo.data.referralNumber.toString(), referralNumber: savedSessionInfo.data.referralNumber?.toString(),
referralCorrelationId: savedSessionInfo.data.referralCorrelationId, referralCorrelationId: savedSessionInfo.data.referralCorrelationId,
referralDate: savedSessionInfo.data.referralDate, referralDate: savedSessionInfo.data.referralDate,
accountNumber: savedSessionInfo.data.accountNumber.toString(), accountNumber: savedSessionInfo.data.accountNumber?.toString(),
savedSessionId: savedSessionInfo.data.savedSessionId, savedSessionId: savedSessionInfo.data.savedSessionId,
crmCustomerId: savedSessionInfo.data.crmCustomerId.toString(), crmCustomerId: savedSessionInfo.data.crmCustomerId?.toString(),
}, },
false false
); );

View file

@ -103,6 +103,7 @@ const baseStoreGettersDamage = () => {
store.getters = { store.getters = {
pageData: baseStoreGettersPageData, pageData: baseStoreGettersPageData,
damage: baseStoreGettersDamage, damage: baseStoreGettersDamage,
payment: { insuranceCoverage: {} },
}; };
store.commit = jest.fn(); store.commit = jest.fn();
@ -111,6 +112,7 @@ afterEach(() => {
store.getters = { store.getters = {
pageData: baseStoreGettersPageData, pageData: baseStoreGettersPageData,
damage: baseStoreGettersDamage, damage: baseStoreGettersDamage,
payment: { insuranceCoverage: {} },
}; };
}); });

View file

@ -1,6 +1,7 @@
<template> <template>
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }"> <Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
<div class="page-container-grouped-styles"> <div class="page-container-grouped-styles">
<loadingModal ref="loadingModal" />
<funnelHeader cmsWidgetName="FunnelHeaderWidget" /> <funnelHeader cmsWidgetName="FunnelHeaderWidget" />
<vehicleBanner cmsWidgetName="VehicleBannerWidget" /> <vehicleBanner cmsWidgetName="VehicleBannerWidget" />
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" /> <funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
@ -91,6 +92,7 @@ import buttonQuestion from "@/common-components/button-question/button-question"
import alert from "@/ux-components/alert/alert"; import alert from "@/ux-components/alert/alert";
import textboxQuestion from "@/common-components/textbox-question/textbox-question"; import textboxQuestion from "@/common-components/textbox-question/textbox-question";
import textBlock from "@/common-components/text-block/text-block"; import textBlock from "@/common-components/text-block/text-block";
import loadingModal from "@/common-components/loading-modal/loading-modal.vue";
//Supporting Files //Supporting Files
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
@ -206,7 +208,12 @@ export default {
} }
this.displayNonServiceableZipAlert = false; this.displayNonServiceableZipAlert = false;
if (this.isRepair) { const payment = this.$store.getters.payment;
const vehicleChangedDuringPolicyLookupInHeritage =
payment.isInsurance && payment.insuranceCoverage.coverageStatus;
if (vehicleChangedDuringPolicyLookupInHeritage) {
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
} else if (this.isRepair) {
return this.$router.navigateWithSaving( return this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS, this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
this.$route this.$route
@ -293,6 +300,7 @@ export default {
alert, alert,
textboxQuestion, textboxQuestion,
textBlock, textBlock,
loadingModal,
}, },
}; };
</script> </script>

View file

@ -115,6 +115,7 @@ afterEach(() => {
store.getters = { store.getters = {
pageData: baseStoreGettersPageData, pageData: baseStoreGettersPageData,
damage: baseStoreGettersDamage, damage: baseStoreGettersDamage,
payment: { insuranceCoverage: {} },
}; };
}); });

View file

@ -220,6 +220,9 @@ describe("partQuestions.vue...", () => {
describe("forwardButtonAction", () => { describe("forwardButtonAction", () => {
test("Should clear out answerData", async () => { test("Should clear out answerData", async () => {
// Arrange // Arrange
store.getters.payment = {
insuranceCoverage: null,
};
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
await wrapper.setData({ await wrapper.setData({

View file

@ -1,6 +1,7 @@
<template> <template>
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }"> <Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
<div class="page-container-grouped-styles"> <div class="page-container-grouped-styles">
<loadingModal ref="loadingModal" />
<funnelHeader cmsWidgetName="FunnelHeaderWidget" /> <funnelHeader cmsWidgetName="FunnelHeaderWidget" />
<vehicleBanner <vehicleBanner
cmsWidgetName="VehicleBannerWidget" cmsWidgetName="VehicleBannerWidget"
@ -21,10 +22,11 @@
ref="servicePackage" ref="servicePackage"
cashCmsWidgetName="CashServicePackageQuestionWidget" cashCmsWidgetName="CashServicePackageQuestionWidget"
insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget" insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget"
v-model="selectedPackage"
groupName="ServicePackageQuestion" groupName="ServicePackageQuestion"
:availableLineItems="availableLineItems" :availableLineItems="availableLineItems"
:isInsuranceSelected="isInsuranceSelected" /> :isInsuranceSelected="isInsuranceSelected"
@vapsItemsSelected="vapsItemsSelectedAction" />
<textBlock <textBlock
cmsWidgetName="quoteDisclaimer" cmsWidgetName="quoteDisclaimer"
justifyText="left" justifyText="left"
@ -55,6 +57,7 @@ import cashOrInsuranceQuestion from "./cash-or-insurance-question/cash-or-insura
import servicePackageQuestion from "./service-package-question/service-package-question"; import servicePackageQuestion from "./service-package-question/service-package-question";
import textBlock from "@/common-components/text-block/text-block"; import textBlock from "@/common-components/text-block/text-block";
import modal from "@/common-components/modal/modal"; import modal from "@/common-components/modal/modal";
import loadingModal from "@/common-components/loading-modal/loading-modal.vue";
import baseMixin from "@/mixins/base-mixin.js"; import baseMixin from "@/mixins/base-mixin.js";
import vehicleQuestionsMixin from "../../mixins/vehicle-questions-mixin"; import vehicleQuestionsMixin from "../../mixins/vehicle-questions-mixin";
import { settleAllPromises } from "@/helpers/layout-helper"; import { settleAllPromises } from "@/helpers/layout-helper";
@ -62,6 +65,7 @@ import { storeActions } from "@/constants/store-actions";
import store from "@/store"; import store from "@/store";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { Form } from "vee-validate"; import { Form } from "vee-validate";
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
export default { export default {
name: "quote", name: "quote",
@ -109,6 +113,7 @@ export default {
// 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(cmsContent); vm.setCmsContent(cmsContent);
vm.supportingItems = resultMap.supportingItems; vm.supportingItems = resultMap.supportingItems;
vm.availableLineItems = pricingResults; vm.availableLineItems = pricingResults;
vm.isInsuranceSelected = vm.getDefaultIsInsuranceSelectedValue(); vm.isInsuranceSelected = vm.getDefaultIsInsuranceSelectedValue();
@ -117,17 +122,18 @@ export default {
data() { data() {
return { return {
isInsuranceSelected: null, isInsuranceSelected: null,
selectedPackage: null, selectedVaps: null,
availableLineItems: null, availableLineItems: null,
supportingItems: null, supportingItems: null,
}; };
}, },
methods: { methods: {
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
//SET THESE AS PAGE PREREQS return (
//return store.getters.order.serviceLocation.zipCode && store.getters.order.serviceLocation.zipCodeCtu store.getters.order.damage.isRepair ||
return true; (store.getters.order.lineItems?.glassParts != null &&
//return store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0); store.getters.order.lineItems.glassParts.length > 0)
);
}, },
getDefaultIsInsuranceSelectedValue() { getDefaultIsInsuranceSelectedValue() {
const defaultIsInsuranceSelectedValue = this.$store.getters.order.payment.isInsurance; const defaultIsInsuranceSelectedValue = this.$store.getters.order.payment.isInsurance;
@ -139,21 +145,26 @@ export default {
: null; : null;
} }
}, },
vapsItemsSelectedAction(vapsItemsSelected) {
this.selectedVaps = vapsItemsSelected;
},
backButtonAction() { backButtonAction() {
vehicleQuestionsMixin.methods.navigateBack(this); vehicleQuestionsMixin.methods.navigateBack(this);
}, },
async forwardButtonAction() { forwardButtonAction() {
await this.dispatchStoreAction( this.dispatchStoreAction(
this.storeActions.SAVE_QUOTE_PAGE_SELECTIONS, this.storeActions.SAVE_PAYMENT_TYPE,
{ this.isInsuranceSelected,
isInsuranceSelected: this.isInsuranceSelected,
vapsItemsToAdd: this.selectedPackage,
supportingItemsToAdd: this.supportingItems,
},
false false
); );
this.dispatchStoreAction(
this.storeActions.SAVE_SUPPORTING_ITEMS,
this.supportingItems,
false
);
this.dispatchStoreAction(this.storeActions.SAVE_VAPS, this.selectedVaps, false);
//return this.navigateForward(); navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
}, },
}, },
components: { components: {
@ -166,6 +177,7 @@ export default {
cashOrInsuranceQuestion, cashOrInsuranceQuestion,
servicePackageQuestion, servicePackageQuestion,
modal, modal,
loadingModal,
}, },
}; };
</script> </script>

View file

@ -58,7 +58,7 @@ describe("service-package-question.vue", () => {
await nextTick(); await nextTick();
// Assert // Assert
expect(wrapper.emitted()["update:modelValue"][0][0]).toEqual([ expect(wrapper.emitted()["vapsItemsSelected"][0][0]).toEqual([
{ {
description: null, description: null,
partNumber: "RAIN DEFENSE", partNumber: "RAIN DEFENSE",

View file

@ -25,7 +25,6 @@ const packageNames = {
export default { export default {
name: "servicePackageQuestion", name: "servicePackageQuestion",
props: { props: {
modelValue: String,
groupName: String, groupName: String,
cashCmsWidgetName: String, cashCmsWidgetName: String,
insuranceCmsWidgetName: String, insuranceCmsWidgetName: String,
@ -46,7 +45,7 @@ export default {
}, },
selectedPackageName(newValue) { selectedPackageName(newValue) {
const VapsProductsInSelectedPackage = this.getVapsLineItemsForSelectedPackage(newValue); const VapsProductsInSelectedPackage = this.getVapsLineItemsForSelectedPackage(newValue);
this.$emit("update:modelValue", VapsProductsInSelectedPackage); this.$emit("vapsItemsSelected", VapsProductsInSelectedPackage);
}, },
}, },
computed: { computed: {
@ -315,9 +314,10 @@ export default {
return !!partTypeMatches.length; return !!partTypeMatches.length;
}, },
glassToReplaceContainsGlassLocation(glassLocation) { glassToReplaceContainsGlassLocation(glassLocation) {
const glassLocationMatches = this.$store.getters.order.damage.glassToReplace.filter( const glassLocationMatches =
(glassToReplace) => glassToReplace.glassLocation === glassLocation this.$store.getters.order.damage.glassToReplace?.filter(
); (glassToReplace) => glassToReplace.glassLocation === glassLocation
) ?? [];
return !!glassLocationMatches.length; return !!glassLocationMatches.length;
}, },
}, },

View file

@ -75,7 +75,7 @@ describe("vehicle-damage.vue", () => {
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled(); expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled();
}); });
test("Replace several pieces of glass on ForwardButtonAction triggers a router.navigate and saves selections to store", async () => { test("Replace several pieces of glass on first pass through concept on ForwardButtonAction triggers a router.navigate and saves selections to store", async () => {
//Arrange //Arrange
const partsData = { const partsData = {
partsOrQuestions: [ partsOrQuestions: [

View file

@ -328,8 +328,28 @@ export default {
}, },
navigateForward() { navigateForward() {
const payment = this.$store.getters.payment;
console.log(payment);
const vehicleChangedDuringPolicyLookupInHeritage =
payment.isInsurance &&
payment.insuranceCoverage.coverageStatus &&
payment.insuranceCoverage.coverageStatus !== "";
if (vehicleChangedDuringPolicyLookupInHeritage) {
if (store.getters.damage.isRepair) {
this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE,
this.$route
);
} else {
this.$router.navigateWithSaving(
this.navigationScenarios
.CLICKED_FORWARD_WITH_REPLACE_AND_VERIFIED_INSURANCE,
this.$route
);
}
}
// If vin already exists, navigate directly to vin-lookup // If vin already exists, navigate directly to vin-lookup
if (store.getters.vehicle.vin) { else if (store.getters.vehicle.vin) {
this.$router.navigateWithSaving( this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.navigationScenarios.CLICKED_FORWARD_WITH_VIN,
this.$route this.$route

View file

@ -248,7 +248,9 @@ describe("vehicle-parts.vue", () => {
(c) => c(wrapper.vm) (c) => c(wrapper.vm)
); );
wrapper.vm.navigateBack(); store.dispatch = jest.fn(() => {});
await wrapper.vm.navigateBack();
//Assert //Assert
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
@ -294,7 +296,8 @@ describe("vehicle-parts.vue", () => {
(c) => c(wrapper.vm) (c) => c(wrapper.vm)
); );
wrapper.vm.navigateBack(); store.dispatch = jest.fn(() => {});
await wrapper.vm.navigateBack();
//Assert //Assert
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
@ -456,6 +459,7 @@ describe("vehicle-parts.vue", () => {
store.getters.pageData.mockReturnValueOnce(basePartResponse); store.getters.pageData.mockReturnValueOnce(basePartResponse);
store.getters.lineItems = { glassParts: {} }; store.getters.lineItems = { glassParts: {} };
store.getters.vehicle = { carId: "TEST_CAR_ID" }; store.getters.vehicle = { carId: "TEST_CAR_ID" };
store.getters.payment = { insuranceCoverage: {} };
const { wrapper } = setupMocks({ const { wrapper } = setupMocks({
mountOptionsMockData: { mountOptionsMockData: {
@ -538,6 +542,7 @@ function setupMocks({ pageHeaderWidgetHeaderText = {}, mountOptionsMockData = {}
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent; wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
wrapper.vm.$refs.funnelFooter.removeLoader = jest.fn(); wrapper.vm.$refs.funnelFooter.removeLoader = jest.fn();
wrapper.vm.$refs.loadingModal.showModal = jest.fn();
// wrapper.vm.$refs.onSubmit = jest.fn(); // wrapper.vm.$refs.onSubmit = jest.fn();
// wrapper.vm.$refs.onInvalidSubmit = jest.fn(); // wrapper.vm.$refs.onInvalidSubmit = jest.fn();

View file

@ -1,6 +1,7 @@
<template> <template>
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm"> <Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm">
<div class="page-container-grouped-styles vehicle-parts"> <div class="page-container-grouped-styles vehicle-parts">
<loadingModal ref="loadingModal" />
<funnelHeader ref="funnelHeader" cmsWidgetName="FunnelHeaderWidget" /> <funnelHeader ref="funnelHeader" cmsWidgetName="FunnelHeaderWidget" />
<vehicleBanner <vehicleBanner
ref="vehicleBanner" ref="vehicleBanner"
@ -50,6 +51,7 @@ import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header"; import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
import funnelFooter from "@/common-components/funnel-footer/funnel-footer"; import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
import alert from "@/ux-components/alert/alert"; import alert from "@/ux-components/alert/alert";
import loadingModal from "@/common-components/loading-modal/loading-modal.vue";
// Supporting Files // Supporting Files
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { settleAllPromises } from "@/helpers/layout-helper"; import { settleAllPromises } from "@/helpers/layout-helper";
@ -224,6 +226,7 @@ export default {
funnelSubHeader, funnelSubHeader,
funnelFooter, funnelFooter,
alert, alert,
loadingModal,
}, },
}; };
</script> </script>

View file

@ -1,6 +1,7 @@
<template> <template>
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }"> <Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
<div class="page-container-grouped-styles"> <div class="page-container-grouped-styles">
<loadingModal ref="loadingModal" />
<funnelHeader cmsWidgetName="FunnelHeaderWidget" /> <funnelHeader cmsWidgetName="FunnelHeaderWidget" />
<vehicleBanner <vehicleBanner
cmsWidgetName="VehicleBannerWidget" cmsWidgetName="VehicleBannerWidget"
@ -117,6 +118,7 @@ import alert from "@/ux-components/alert/alert";
import textboxQuestion from "@/common-components/textbox-question/textbox-question"; import textboxQuestion from "@/common-components/textbox-question/textbox-question";
import vinInformation from "@/layouts/vin-lookup/vin-information/vin-information"; import vinInformation from "@/layouts/vin-lookup/vin-information/vin-information";
import textBlock from "@/common-components/text-block/text-block"; import textBlock from "@/common-components/text-block/text-block";
import loadingModal from "@/common-components/loading-modal/loading-modal.vue";
// Supporting files // Supporting files
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
@ -462,6 +464,7 @@ export default {
vinInformation, vinInformation,
textBlock, textBlock,
Form, Form,
loadingModal,
}, },
}; };
</script> </script>

View file

@ -449,8 +449,10 @@ export default {
// save to store lineItems.glassParts // save to store lineItems.glassParts
self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts); self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
shouldGoToHeritageQuote const payment = store.getters.payment;
? navigateToHeritageFunnel() shouldGoToHeritageQuote ||
(payment.isInsurance && payment.insuranceCoverage.isVerified)
? navigateToHeritageFunnel({ loadingModal: self.$refs.loadingModal })
: self.$router.navigateWithSaving( : self.$router.navigateWithSaving(
self.navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, self.navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
self.$route self.$route
@ -458,8 +460,7 @@ export default {
} }
}, },
// Can't use `this` because navigateForward is also called from quote // Can't use `this` because navigateForward is also called from quote
navigateBack(vm) { async navigateBack(vm) {
console.log("VQM = = navigateBack() run ");
const self = vm ?? this; const self = vm ?? this;
const partsOrQuestions = ( const partsOrQuestions = (
self.$store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS) ?? self.$store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS) ??
@ -472,6 +473,8 @@ export default {
this.hasGlassLocationWithMultipleParts(partsOrQuestions); this.hasGlassLocationWithMultipleParts(partsOrQuestions);
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions); const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions); const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
const skipVinLookup = await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE);
let backNavigationScenario = self.$store.getters.vehicle.vin let backNavigationScenario = self.$store.getters.vehicle.vin
? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS ? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS
: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS; : navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS;
@ -498,6 +501,8 @@ export default {
this.currentPageComesAfterPage(currentPage, fmgPageValues.PART_QUESTIONS) this.currentPageComesAfterPage(currentPage, fmgPageValues.PART_QUESTIONS)
) { ) {
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS; backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS;
} else if (skipVinLookup) {
backNavigationScenario = navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE;
} }
self.$router.navigateWithoutSaving(backNavigationScenario, self.$route); self.$router.navigateWithoutSaving(backNavigationScenario, self.$route);

View file

@ -3,6 +3,7 @@ import { shallowMount } from "@vue/test-utils";
import { setupMocksForJsFiles, getMountOptions } from "@/helpers/unit-test-helper.js"; import { setupMocksForJsFiles, getMountOptions } from "@/helpers/unit-test-helper.js";
import { fmgPageValues } from "@/router/router-constants/fmgPage-values"; import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
import { storeMutations } from "@/constants/store-mutations"; import { storeMutations } from "@/constants/store-mutations";
import store from "@/store";
import { storeActions } from "@/constants/store-actions"; import { storeActions } from "@/constants/store-actions";
import { navigationScenarios } from "../router/router-constants/navigation-scenarios"; import { navigationScenarios } from "../router/router-constants/navigation-scenarios";
import { getters } from "@/store"; import { getters } from "@/store";
@ -2259,12 +2260,13 @@ describe("vehicle-questions-mixin", () => {
"current page is quote, there are no questions, and we don't have their vin => go to estimate" "current page is quote, there are no questions, and we don't have their vin => go to estimate"
); );
test("current page is quote, there are no questions, and we have their vin => go to vin-lookup", () => { test("current page is quote, there are no questions, and we have their vin => go to vin-lookup", async () => {
// Arrange // Arrange
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE, hasVin: true }); const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE, hasVin: true });
// Act // Act
wrapper.vm.navigateBack(); store.dispatch = jest.fn(() => {});
await wrapper.vm.navigateBack();
// Assert // Assert
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
@ -2273,13 +2275,14 @@ describe("vehicle-questions-mixin", () => {
); );
}); });
test("current page is quote and there are capability questions => go to capability questions", () => { test("current page is quote and there are capability questions => go to capability questions", async () => {
// Arrange // Arrange
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE }); const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true); wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
// Act // Act
wrapper.vm.navigateBack(); store.dispatch = jest.fn(() => {});
await wrapper.vm.navigateBack();
// Assert // Assert
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
@ -2288,14 +2291,14 @@ describe("vehicle-questions-mixin", () => {
); );
}); });
test("current page is quote and there are part questions and molding questions => go to molding questions", () => { test("current page is quote and there are part questions and molding questions => go to molding questions", async () => {
// Arrange // Arrange
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE }); const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true); wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true); wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true);
// Act // Act
wrapper.vm.navigateBack(); await wrapper.vm.navigateBack();
// Assert // Assert
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
@ -2304,7 +2307,7 @@ describe("vehicle-questions-mixin", () => {
); );
}); });
test("current page is molding questions and there are part questions, multiple parts to choose, and capability questions => go to vehicle-parts", () => { test("current page is molding questions and there are part questions, multiple parts to choose, and capability questions => go to vehicle-parts", async () => {
// Arrange // Arrange
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS }); const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true); wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
@ -2313,7 +2316,8 @@ describe("vehicle-questions-mixin", () => {
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true); wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
// Act // Act
wrapper.vm.navigateBack(); store.dispatch = jest.fn(() => {});
await wrapper.vm.navigateBack();
// Assert // Assert
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
@ -2322,7 +2326,7 @@ describe("vehicle-questions-mixin", () => {
); );
}); });
test("current page is molding questions and there are part questions and capability questions => go to part-questions", () => { test("current page is molding questions and there are part questions and capability questions => go to part-questions", async () => {
// Arrange // Arrange
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS }); const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true); wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
@ -2331,7 +2335,8 @@ describe("vehicle-questions-mixin", () => {
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true); wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
// Act // Act
wrapper.vm.navigateBack(); store.dispatch = jest.fn(() => {});
await wrapper.vm.navigateBack();
// Assert // Assert
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(

View file

@ -51,7 +51,7 @@ const routes = [
} }
if (getFunnelCookie()?.SuppressConceptFunnel) { if (getFunnelCookie()?.SuppressConceptFunnel) {
await navigateToHeritageFunnel(false); await navigateToHeritageFunnel({ shouldSaveSession: false });
return next(false); return next(false);
} }
@ -66,6 +66,7 @@ const routes = [
// clear the saveSessionPromise - if it exists in the vuex store but a new instance was created // clear the saveSessionPromise - if it exists in the vuex store but a new instance was created
// the saveSessionPromise will no longer point to a valid promise // the saveSessionPromise will no longer point to a valid promise
baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
const loadSessionResponse = await loadSessionIfPresent(); const loadSessionResponse = await loadSessionIfPresent();
const pageToRedirectTo = await getPageToRouteExistingOrderTo( const pageToRedirectTo = await getPageToRouteExistingOrderTo(
to, to,

View file

@ -20,6 +20,10 @@ const navigationScenarios = {
// Vin selection // Vin selection
CLICKED_BACK_WITH_VIN: "CLICKED_BACK_WITH_VIN", CLICKED_BACK_WITH_VIN: "CLICKED_BACK_WITH_VIN",
CLICKED_FORWARD_WITH_VIN: "CLICKED_FORWARD_WITH_VIN", CLICKED_FORWARD_WITH_VIN: "CLICKED_FORWARD_WITH_VIN",
CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE:
"CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE",
CLICKED_FORWARD_WITH_REPLACE_AND_VERIFIED_INSURANCE:
"CLICKED_FORWARD_WITH_REPLACE_AND_VERIFIED_INSURANCE",
CLICKED_FORWARD_WITHOUT_VIN: "CLICKED_FORWARD_WITHOUT_VIN", CLICKED_FORWARD_WITHOUT_VIN: "CLICKED_FORWARD_WITHOUT_VIN",
CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES: "CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES", CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES: "CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES",
SELECTED_VIN_WITH_MISMATCHED_GLASS: "SELECTED_VIN_WITH_MISMATCHED_GLASS", SELECTED_VIN_WITH_MISMATCHED_GLASS: "SELECTED_VIN_WITH_MISMATCHED_GLASS",
@ -40,6 +44,7 @@ const navigationScenarios = {
CLICKED_BACK_WITH_CAPABILITY_QUESTIONS: "CLICKED_BACK_WITH_CAPABILITY_QUESTIONS", CLICKED_BACK_WITH_CAPABILITY_QUESTIONS: "CLICKED_BACK_WITH_CAPABILITY_QUESTIONS",
CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS: "CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS", CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS: "CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS",
CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS: "CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS", CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS: "CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS",
CLICKED_BACK_TO_GO_TO_ESTIMATE: "CLICKED_BACK_TO_GO_TO_ESTIMATE",
}; };
export { navigationScenarios }; export { navigationScenarios };

View file

@ -67,6 +67,16 @@ const routingTable = function (store) {
scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
destinationFmgPageValue: fmgPageValues.ESTIMATE, destinationFmgPageValue: fmgPageValues.ESTIMATE,
}, },
{
scenario:
navigationScenarios.CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE,
destinationFmgPageValue: fmgPageValues.ESTIMATE,
},
{
scenario:
navigationScenarios.CLICKED_FORWARD_WITH_REPLACE_AND_VERIFIED_INSURANCE,
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
},
], ],
}, },
{ {
@ -286,6 +296,10 @@ const routingTable = function (store) {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE, destinationFmgPageValue: fmgPageValues.QUOTE,
}, },
{
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE,
destinationFmgPageValue: fmgPageValues.ESTIMATE,
},
], ],
}, },
{ {
@ -319,6 +333,10 @@ const routingTable = function (store) {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE, destinationFmgPageValue: fmgPageValues.QUOTE,
}, },
{
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE,
destinationFmgPageValue: fmgPageValues.ESTIMATE,
},
], ],
}, },
{ {
@ -348,6 +366,10 @@ const routingTable = function (store) {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE, destinationFmgPageValue: fmgPageValues.QUOTE,
}, },
{
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE,
destinationFmgPageValue: fmgPageValues.ESTIMATE,
},
], ],
}, },
{ {
@ -377,6 +399,10 @@ const routingTable = function (store) {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE, destinationFmgPageValue: fmgPageValues.QUOTE,
}, },
{
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE,
destinationFmgPageValue: fmgPageValues.ESTIMATE,
},
], ],
}, },
{ {

View file

@ -9,6 +9,7 @@ import { applicationConfig } from "@/constants/application-config";
import { experimentTriggers } from "@/constants/experiments"; import { experimentTriggers } from "@/constants/experiments";
import { damageLocationsSelected } from "@/constants/damage-locations-selected"; import { damageLocationsSelected } from "@/constants/damage-locations-selected";
import { fmgPageValues } from "@/router/router-constants/fmgPage-values"; import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
import router from "@/router";
// Export State // Export State
const getDefaultState = () => { const getDefaultState = () => {
@ -63,6 +64,7 @@ const getDefaultState = () => {
isInsurance: null, isInsurance: null,
insuranceCoverage: { insuranceCoverage: {
isVerified: null, isVerified: null,
coverageStatus: null,
}, },
}, },
referralNumber: null, referralNumber: null,
@ -82,12 +84,6 @@ const getDefaultState = () => {
experiments: [], experiments: [],
triggeredSiteEntry: false, triggeredSiteEntry: false,
}, },
// gaClickInformation: {
// currentlySelectedValues: {},
// firedGaClickEventValues: {},
// lastFocusedInputGroup: "",
// wasLastFocusedInputMultiselect: undefined,
// },
}; };
}; };
@ -298,12 +294,6 @@ export const mutations = {
state.applicationUser.pageData[fmgPageValues.MOLDING_QUESTIONS] = null; state.applicationUser.pageData[fmgPageValues.MOLDING_QUESTIONS] = null;
state.applicationUser.pageData[fmgPageValues.CAPABILITY_QUESTIONS] = null; state.applicationUser.pageData[fmgPageValues.CAPABILITY_QUESTIONS] = null;
}, },
resetSupportingItemsState(state) {
state.order.lineItems.supportingItems = null;
},
resetVapsState(state) {
state.order.lineItems.vaps = null;
},
resetState(state) { resetState(state) {
Object.assign(state, getDefaultState()); Object.assign(state, getDefaultState());
}, },
@ -368,6 +358,8 @@ export const mutations = {
state.order.payment.isInsurance = sessionInformation.order.payment.isInsurance; state.order.payment.isInsurance = sessionInformation.order.payment.isInsurance;
state.order.payment.insuranceCoverage.isVerified = state.order.payment.insuranceCoverage.isVerified =
sessionInformation?.order.payment.insuranceCoverage.isVerified; sessionInformation?.order.payment.insuranceCoverage.isVerified;
state.order.payment.insuranceCoverage.coverageStatus =
sessionInformation?.insuranceInfo?.coverageStatus;
state.order.customer.emailAddress = sessionInformation.order.customer.emailAddress; state.order.customer.emailAddress = sessionInformation.order.customer.emailAddress;
state.order.existingPromoCode = sessionInformation.order.existingPromoCode; state.order.existingPromoCode = sessionInformation.order.existingPromoCode;
@ -588,19 +580,17 @@ export const actions = {
resetDamageAndDependencies(context) { resetDamageAndDependencies(context) {
context.commit(storeMutations.RESET_DAMAGE_STATE); context.commit(storeMutations.RESET_DAMAGE_STATE);
context.commit(storeMutations.RESET_GLASS_PARTS_STATE); context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
context.commit(storeMutations.RESET_VAPS_STATE); context.commit(storeMutations.UPDATE_VAPS, null);
}, },
resetRegistrationAndDependencies(context) { resetRegistrationAndDependencies(context) {
context.commit(storeMutations.RESET_REGISTRATION_STATE); context.commit(storeMutations.RESET_REGISTRATION_STATE);
context.commit(storeMutations.RESET_GLASS_PARTS_STATE); context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
context.commit(storeMutations.RESET_VAPS_STATE);
}, },
resetPartsAndDependencies(context) { resetPartsAndDependencies(context) {
context.commit(storeMutations.RESET_GLASS_PARTS_STATE); context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
context.commit(storeMutations.RESET_VAPS_STATE);
}, },
resetState(context) { resetState(context) {
context.commit(storeMutations.RESET_STATE); context.commit(storeMutations.RESET_STATE);
@ -1036,12 +1026,21 @@ export const actions = {
}, },
}); });
}, },
loadSession(context, { savedSessionId }) { loadSession(context, { savedSessionId, referralNumber, referralCorrelationId, accountNumber }) {
const order = context.state.order;
return globalMethods return globalMethods
.callHttpClient({ .callHttpClient({
method: endpoints.LoadSession.method, method: endpoints.LoadSession.method,
endpoint: endpoint: `${
endpoints.LoadSession.url + "?savedSessionId=" + savedSessionId?.toString(), endpoints.LoadSession.url
}?savedSessionId=${savedSessionId?.toString()}&referralNumber=${
referralNumber && referralNumber !== "" ? referralNumber : order.referralNumber
}&accountNumber=${accountNumber}&referralCorrelationId=${
referralCorrelationId !== ""
? referralCorrelationId
: order.referralCorrelationId
}`,
}) })
.then((response) => { .then((response) => {
// Flatten location and name properties // Flatten location and name properties
@ -1172,6 +1171,7 @@ export const actions = {
if (isDamageChanging) { if (isDamageChanging) {
//Reset dependent state when changing //Reset dependent state when changing
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
context.commit(storeMutations.UPDATE_VAPS, null);
// Save new values // Save new values
context.commit(storeMutations.UPDATE_IS_REPAIR, isWindshieldRepair); context.commit(storeMutations.UPDATE_IS_REPAIR, isWindshieldRepair);
@ -1263,7 +1263,7 @@ export const actions = {
if (havePartQuestionAnswersChanged) { if (havePartQuestionAnswersChanged) {
context.commit(storeMutations.UPDATE_GLASS_PARTS, null); context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null); context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null); context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
context.commit(storeMutations.UPDATE_PAGE_DATA, { context.commit(storeMutations.UPDATE_PAGE_DATA, {
@ -1309,7 +1309,7 @@ export const actions = {
if (haveSelectedVehiclePartsChanged) { if (haveSelectedVehiclePartsChanged) {
context.commit(storeMutations.UPDATE_GLASS_PARTS, null); context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null); context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null); context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
context.commit(storeMutations.UPDATE_PAGE_DATA, { context.commit(storeMutations.UPDATE_PAGE_DATA, {
@ -1339,7 +1339,7 @@ export const actions = {
if (haveMoldingQuestionAnswersChanged) { if (haveMoldingQuestionAnswersChanged) {
context.commit(storeMutations.UPDATE_GLASS_PARTS, null); context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null); context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
context.commit(storeMutations.UPDATE_PAGE_DATA, { context.commit(storeMutations.UPDATE_PAGE_DATA, {
page: fmgPageValues.CAPABILITY_QUESTIONS, page: fmgPageValues.CAPABILITY_QUESTIONS,
@ -1367,7 +1367,7 @@ export const actions = {
if (haveCapabilityQuestionAnswersChanged) { if (haveCapabilityQuestionAnswersChanged) {
context.commit(storeMutations.UPDATE_GLASS_PARTS, null); context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
} }
//Save new values //Save new values
@ -1376,16 +1376,14 @@ export const actions = {
capabilityQuestionAnswers capabilityQuestionAnswers
); );
}, },
// Quote Page savePaymentType(context, isInsurance) {
saveQuotePageSelections( context.commit(storeMutations.UPDATE_IS_INSURANCE, isInsurance);
context, },
{ isInsuranceSelected, vapsItemsToAdd, supportingItemsToAdd } saveSupportingItems(context, supportingItems) {
) { context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems);
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); },
context.commit(storeMutations.RESET_VAPS_STATE); saveVaps(context, vaps) {
context.commit(storeMutations.UPDATE_IS_INSURANCE, isInsuranceSelected); context.commit(storeMutations.UPDATE_VAPS, vaps);
context.commit(storeMutations.UPDATE_VAPS, vapsItemsToAdd);
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItemsToAdd);
}, },
// Price order actions // Price order actions
// PLACEHOLDER, WILL CHANGE WHEN PRICING END POINT IS IMPLEMENTED // PLACEHOLDER, WILL CHANGE WHEN PRICING END POINT IS IMPLEMENTED
@ -1420,7 +1418,6 @@ export const actions = {
clearVin(context) { clearVin(context) {
context.commit(storeMutations.UPDATE_VEHICLE_VIN, null); context.commit(storeMutations.UPDATE_VEHICLE_VIN, null);
}, },
isVinOptionalVehicle(context) { isVinOptionalVehicle(context) {
switch (context.state.order.vehicle.make.toLowerCase()) { switch (context.state.order.vehicle.make.toLowerCase()) {
case "mercedes benz": case "mercedes benz":