diff --git a/src/common-components/modal/modal.vue b/src/common-components/modal/modal.vue index 9a8e6c211..e965b3e3f 100644 --- a/src/common-components/modal/modal.vue +++ b/src/common-components/modal/modal.vue @@ -60,11 +60,16 @@ export default { 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() { - const modal = document.querySelector("#" + this.cmsWidgetName); - modal.addEventListener("hidden.bs.modal", (event) => { - this.$refs.buttonMain.resetButtonStyle(); - }); + this.setupModalEventListener(); }, components: { buttonMain, diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 0dcaf6d3f..c4df053dc 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -66,6 +66,9 @@ const storeActions = { SAVE_MOLDING_QUESTION_ANSWERS: "saveMoldingQuestionAnswers", SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers", SAVE_QUOTE_PAGE_SELECTIONS: "saveQuotePageSelections", + SAVE_PAYMENT_TYPE: "savePaymentType", + SAVE_SUPPORTING_ITEMS: "saveSupportingItems", + SAVE_VAPS: "saveVaps", }; export { storeActions }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 3978aaefd..baad1dedc 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -54,8 +54,6 @@ const storeMutations = { RESET_DAMAGE_STATE: "resetDamageState", RESET_REGISTRATION_STATE: "resetRegistrationState", RESET_GLASS_PARTS_STATE: "resetGlassPartsState", - RESET_SUPPORTING_ITEMS_STATE: "resetSupportingItemsState", - RESET_VAPS_STATE: "resetVapsState", RESET_STATE: "resetState", RESET_SAVE_SESSION_PROMISE: "resetSaveSessionPromise", diff --git a/src/constants/tint-mapper.js b/src/constants/tint-mapper.js index 308b9a92d..fab6d508f 100644 --- a/src/constants/tint-mapper.js +++ b/src/constants/tint-mapper.js @@ -78,7 +78,7 @@ const tintMap = { // Returns undefined if no items are found. export function getTintImage(glassLocation, colorString) { // Windshield glass has special images, all other glass uses the same though. - if (glassLocation.toLowerCase() !== "windshield") { + if (glassLocation?.toLowerCase() !== "windshield") { glassLocation = "other"; } diff --git a/src/helpers/damage-helper.js b/src/helpers/damage-helper.js index 85cadca60..22e312939 100644 --- a/src/helpers/damage-helper.js +++ b/src/helpers/damage-helper.js @@ -37,7 +37,9 @@ export function getDamageString() { export function getIsWindshieldOnly() { const damageLocations = store.getters.damage.glassToReplace; const returnString = - damageLocations.length === 1 && damageLocations[0]?.glassLocation === "Windshield" + damageLocations && + damageLocations.length === 1 && + damageLocations[0]?.glassLocation === "Windshield" ? "windshield" : "glass"; return returnString; diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index dd84c8b35..d489b3f20 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -43,16 +43,21 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita 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. if (shouldSaveSession) { await saveSession(); } + if (loadingModal && loadingModal.showModal) { + loadingModal.showModal(); + } + router.navigateToExternalUrl(externalUrls.HERITAGE_FUNNEL, { corid: store.getters.order.referralCorrelationId, src: "concept-funnel", conceptsqid: store.getters.applicationUser.savedSessionId, + isInsurance: store.getters.payment.isInsurance, }); } diff --git a/src/helpers/heritage-integration/navigation-helper.spec.js b/src/helpers/heritage-integration/navigation-helper.spec.js index 430f1df22..f9b3b1017 100644 --- a/src/helpers/heritage-integration/navigation-helper.spec.js +++ b/src/helpers/heritage-integration/navigation-helper.spec.js @@ -377,7 +377,7 @@ describe("navigateToHeritageFunnel", () => { router.navigateToExternalUrl = jest.fn(); // Act - await navigateToHeritageFunnel(); + await navigateToHeritageFunnel({}); // Assert expect(saveSessionFunction).toHaveBeenCalled(); @@ -424,7 +424,7 @@ describe("navigateToHeritageFunnel", () => { router.navigateToExternalUrl = jest.fn(); // Act - await navigateToHeritageFunnel(); + await navigateToHeritageFunnel({}); // Assert 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 const mockReferralNumber = "2"; const mockCorrelationId = "55"; @@ -462,7 +462,7 @@ describe("navigateToHeritageFunnel", () => { router.navigateToExternalUrl = jest.fn(); // Act - await navigateToHeritageFunnel(false); + await navigateToHeritageFunnel({ shouldSaveSession: false }); // Assert expect(saveSessionFunction).not.toHaveBeenCalled(); diff --git a/src/helpers/heritage-integration/order-helper.js b/src/helpers/heritage-integration/order-helper.js index 9a24e9c24..f18cd44de 100644 --- a/src/helpers/heritage-integration/order-helper.js +++ b/src/helpers/heritage-integration/order-helper.js @@ -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. - 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 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 store.getters.applicationUser.saveSessionPromise; const response = await baseMixin.methods.dispatchStoreAction( storeActions.LOAD_SESSION, { savedSessionId: savedSessionId?.toString(), + referralNumber, + accountNumber, + referralCorrelationId, }, false ); @@ -84,12 +94,12 @@ async function saveSessionHelper() { await baseMixin.methods.dispatchStoreAction( storeActions.UPDATE_STORE_WITH_SAVE_SESSION_RESPONSE, { - referralNumber: savedSessionInfo.data.referralNumber.toString(), + referralNumber: savedSessionInfo.data.referralNumber?.toString(), referralCorrelationId: savedSessionInfo.data.referralCorrelationId, referralDate: savedSessionInfo.data.referralDate, - accountNumber: savedSessionInfo.data.accountNumber.toString(), + accountNumber: savedSessionInfo.data.accountNumber?.toString(), savedSessionId: savedSessionInfo.data.savedSessionId, - crmCustomerId: savedSessionInfo.data.crmCustomerId.toString(), + crmCustomerId: savedSessionInfo.data.crmCustomerId?.toString(), }, false ); diff --git a/src/layouts/capability-questions/capability-questions.spec.js b/src/layouts/capability-questions/capability-questions.spec.js index 31fc63af8..f29be44e6 100644 --- a/src/layouts/capability-questions/capability-questions.spec.js +++ b/src/layouts/capability-questions/capability-questions.spec.js @@ -103,6 +103,7 @@ const baseStoreGettersDamage = () => { store.getters = { pageData: baseStoreGettersPageData, damage: baseStoreGettersDamage, + payment: { insuranceCoverage: {} }, }; store.commit = jest.fn(); @@ -111,6 +112,7 @@ afterEach(() => { store.getters = { pageData: baseStoreGettersPageData, damage: baseStoreGettersDamage, + payment: { insuranceCoverage: {} }, }; }); diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index c195b9967..93eb923f3 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -1,6 +1,7 @@