diff --git a/src/layouts/address-lookup/address-lookup.spec.js b/src/layouts/address-lookup/address-lookup.spec.js index 506803c7d..2f17cd220 100644 --- a/src/layouts/address-lookup/address-lookup.spec.js +++ b/src/layouts/address-lookup/address-lookup.spec.js @@ -192,7 +192,7 @@ describe("address-lookup.vue", () => { await wrapper.vm.backButtonAction(); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled(); }); @@ -285,7 +285,7 @@ describe("address-lookup.vue", () => { await wrapper.vm.forwardButtonAction(); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, undefined, {}, {}, carsFound); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, undefined, {}, {}, carsFound); }); test("if the car entered matches one of the vehicles found but the zip is NOT serviceable, do not navigate forward", async () => { @@ -365,7 +365,7 @@ describe("address-lookup.vue", () => { await wrapper.vm.navigateForward(carsFound); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, undefined, {}, { "displayVehicleChangeAlert": true }); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, undefined, {}, { "displayVehicleChangeAlert": true }); }); @@ -626,7 +626,9 @@ function setupMocks({ isZipValid = true, isZipServiceable = true, lookupVinbyAdd ], router: { navigate: jest.fn(), - navigate: jest.fn() + navigate: jest.fn(), + navigateWithSaving: jest.fn(), + navigateWithoutSaving: jest.fn(), }, store: { getters: { diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index cbbfe0323..ed1ffd3db 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -140,7 +140,7 @@ export default { }, backButtonAction() { // route to move backwards - this.$router.navigate( + this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_BACK, this.$route ); @@ -309,11 +309,11 @@ export default { // If a different vehicle is found than the one entered and the selected glass is not available for that vehicle then navigate back to "vehicle-damage" // display vehicle changed alert on that page. if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle && matchingCars.length === 1) { - this.$router.navigate(this.navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, this.$route, {}, {[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true}); + this.$router.navigateWithSaving(this.navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, this.$route, {}, {[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true}); } else if (matchingCars.length === 1) { await this.navigateForwardWithSingleCarMatch(); } else { - this.$router.navigate(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, this.$route, {}, {}, carsFound); + this.$router.navigateWithSaving(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, this.$route, {}, {}, carsFound); } }, diff --git a/src/layouts/address-vehicles/address-vehicles.spec.js b/src/layouts/address-vehicles/address-vehicles.spec.js index bce1a118c..8b1893765 100644 --- a/src/layouts/address-vehicles/address-vehicles.spec.js +++ b/src/layouts/address-vehicles/address-vehicles.spec.js @@ -53,7 +53,7 @@ describe("addressVehicles.vue", () => { test("Should navigate to CLICKED_BACK if backButtonAction is run", async () => { // Arrange const { wrapper } = setupMocks({}); - wrapper.vm.$router.navigate = jest.fn(); + wrapper.vm.$router.navigateWithoutSaving = jest.fn(); // Act await wrapper.setData({ @@ -62,7 +62,7 @@ describe("addressVehicles.vue", () => { wrapper.vm.backButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toBeCalled(); + expect(wrapper.vm.$router.navigateWithoutSaving).toBeCalled(); wrapper.unmount(); }); @@ -111,7 +111,7 @@ describe("addressVehicles.vue", () => { wrapper.vm.$refs.funnelFooter.updateButtonText = jest.fn(); wrapper.vm.$refs.funnelFooter.removeLoader = jest.fn(); wrapper.vm.lookupVin = jest.fn(() => Promise.reject(lookupVinResponse)); - wrapper.vm.$router.navigate = jest.fn(); + wrapper.vm.$router.navigateWithSaving = jest.fn(); wrapper.vm.updateCustomerInfo = jest.fn().mockImplementation(()=> {}); // Act @@ -131,7 +131,7 @@ describe("addressVehicles.vue", () => { // Arrange const { wrapper } = setupMocks({}); wrapper.vm.$refs.funnelFooter.updateButtonText = jest.fn(); - wrapper.vm.$router.navigate = jest.fn(); + wrapper.vm.$router.navigateWithSaving = jest.fn(); // Act await wrapper.setData({ @@ -142,7 +142,7 @@ describe("addressVehicles.vue", () => { await wrapper.vm.navigateForward(); //Assert - expect(wrapper.vm.$router.navigate).toBeCalledTimes(1); + expect(wrapper.vm.$router.navigateWithSaving).toBeCalledTimes(1); wrapper.unmount(); }); diff --git a/src/layouts/address-vehicles/address-vehicles.vue b/src/layouts/address-vehicles/address-vehicles.vue index b0669e720..081b83fe9 100644 --- a/src/layouts/address-vehicles/address-vehicles.vue +++ b/src/layouts/address-vehicles/address-vehicles.vue @@ -162,7 +162,7 @@ export default { return false; }, backButtonAction() { - this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); + this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); }, async forwardButtonAction() { @@ -184,7 +184,7 @@ export default { }, async navigateForward() { if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { - this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD,this.$route,{},{[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true },); + this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD,this.$route,{},{[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true },); } else { await this.navigateForwardWithSingleCarMatch(); } diff --git a/src/layouts/estimate/estimate.spec.js b/src/layouts/estimate/estimate.spec.js index 984a40fec..2b52d3f3e 100644 --- a/src/layouts/estimate/estimate.spec.js +++ b/src/layouts/estimate/estimate.spec.js @@ -76,7 +76,7 @@ describe("estimate.vue", () => { expect(arePagePrerequisitesValid).toBe(false); }); - test("After selecting provide my home address on ForwardButtonAction triggers a router.navigate", async () => { + test("After selecting provide my home address on ForwardButtonAction triggers a router.navigateWithSaving", async () => { //Arrange const { wrapper } = setupMocks({}); @@ -88,11 +88,11 @@ describe("estimate.vue", () => { wrapper.vm.forwardButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); }); - test("After selecting provide my manual vin on ForwardButtonAction triggers a router.navigate", async () => { + test("After selecting provide my manual vin on ForwardButtonAction triggers a router.navigateWithSaving", async () => { //Arrange const { wrapper } = setupMocks({}); @@ -104,11 +104,11 @@ describe("estimate.vue", () => { await wrapper.vm.forwardButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); }); - test("BackButtonAction triggers a router.navigate change", async () => { + test("BackButtonAction triggers a router.navigateWithoutSaving change", async () => { //Arrange const { wrapper } = setupMocks({}); @@ -124,10 +124,10 @@ describe("estimate.vue", () => { wrapper.vm.backButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled(); }); - test("Provide my license plate on ForwardButtonAction triggers a router.navigate", async () => { + test("Provide my license plate on ForwardButtonAction triggers a router.navigateWithSaving", async () => { //Arrange const { wrapper } = setupMocks({}); @@ -139,7 +139,7 @@ describe("estimate.vue", () => { wrapper.vm.forwardButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); }); @@ -152,6 +152,8 @@ function setupMocks({ mountOptionsMockData = { router: { navigate: jest.fn(), + navigateWithSaving: jest.fn(), + navigateWithoutSaving: jest.fn(), }, }, }) { diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 85f277482..26649942a 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -87,7 +87,7 @@ export default { }, backButtonAction() { // route to move backwards - this.$router.navigate( + this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_BACK, this.$route ); @@ -95,19 +95,19 @@ export default { async forwardButtonAction() { if (this.selectedVinLookupMethod === vinLookupMethodSelections.MANUALVIN) { await this.dispatchStoreAction(storeActions.CLEAR_VIN); - return this.$router.navigate( + return this.$router.navigateWithSaving( this.navigationScenarios.SELECTED_MANUAL_VIN, this.$route ); } if (this.selectedVinLookupMethod === vinLookupMethodSelections.LICENSEPLATE) { - return this.$router.navigate( + return this.$router.navigateWithSaving( this.navigationScenarios.SELECTED_LICENSE_PLATE, this.$route ); } if (this.selectedVinLookupMethod === vinLookupMethodSelections.HOMEADDRESS) { - return this.$router.navigate( + return this.$router.navigateWithSaving( this.navigationScenarios.SELECTED_HOME_ADDRESS, this.$route ); diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 7bfc02eba..ca9c235b0 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -87,7 +87,7 @@ describe("license-plate-lookup.vue", () => { }); describe("navigation", () => { - test("BackButtonAction triggers a router.navigate change", async () => { + test("BackButtonAction triggers a router.navigateWithoutSaving change", async () => { //Arrange const { wrapper } = setupMocks({}); @@ -103,7 +103,7 @@ describe("license-plate-lookup.vue", () => { wrapper.vm.backButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled(); }); describe("on forwardButtonAction click", () => { @@ -212,7 +212,7 @@ describe("license-plate-lookup.vue", () => { }); describe("navigateForward", () => { - test("navigate should be called if isCarIdDifferent is true and isSelectedGlassAvailableForVehicle is false when navigateForward is called", async () => { + test("navigateWithSaving should be called if isCarIdDifferent is true and isSelectedGlassAvailableForVehicle is false when navigateForward is called", async () => { // Arrange const { wrapper } = setupMocks({}); @@ -232,7 +232,7 @@ describe("license-plate-lookup.vue", () => { await wrapper.vm.navigateForward(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); }); test("navigateForwardWithSingleCarMatch should be called if isCarIdDifferent is false or isSelectedGlassAvailableForVehicle is true when navigateForward is called", async () => { @@ -549,6 +549,8 @@ function setupMocks({ ...mountOptionsMockData, router: { navigate: jest.fn(), + navigateWithoutSaving: jest.fn(), + navigateWithSaving: jest.fn() }, store: { getters: { diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 667bac7fc..1b163ef30 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -177,7 +177,7 @@ export default { }, backButtonAction() { // route to move backwards - this.$router.navigate( + this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_BACK, this.$route ); @@ -298,7 +298,7 @@ export default { }, async navigateForward() { if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { - this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true }); + this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true }); } else { await this.navigateForwardWithSingleCarMatch(); } diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index f575c9240..67ffe5745 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -125,7 +125,7 @@ export default { }, backButtonAction() { // route to move backwards - this.$router.navigate( + this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_BACK, this.$route ); @@ -156,7 +156,7 @@ export default { if (hasCapabilityQuestions) { // if has capability questions // go to capability-questions page - this.$router.navigate(this.navigationScenarios.HAS_CAPABILITY_QUESTIONS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore}); + this.$router.navigateWithSaving(this.navigationScenarios.HAS_CAPABILITY_QUESTIONS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore}); } else { // if single parts only const collectedGlassParts = this.reducedGlassPartsArray(glassNameAndPartsForStore); diff --git a/src/layouts/reveal/reveal.vue b/src/layouts/reveal/reveal.vue index 4280b099f..9ef10d61d 100644 --- a/src/layouts/reveal/reveal.vue +++ b/src/layouts/reveal/reveal.vue @@ -40,7 +40,7 @@ export default { methods: { backButtonAction() { // route to move backwards - this.$router.navigate( + this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_BACK, this.$route ); diff --git a/src/layouts/vehicle-damage/vehicle-damage.spec.js b/src/layouts/vehicle-damage/vehicle-damage.spec.js index 80ac7e6d9..7791dff37 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.spec.js +++ b/src/layouts/vehicle-damage/vehicle-damage.spec.js @@ -57,7 +57,7 @@ jest.mock("@/store", () => ({ describe("vehicle-damage.vue", () => { describe("navigation", () => { - test("BackButtonAction triggers a router.navigate change", async () => { + test("BackButtonAction triggers a router.navigateWithoutSaving change", async () => { //Arrange const { wrapper } = setupMocks({}); @@ -73,7 +73,7 @@ describe("vehicle-damage.vue", () => { wrapper.vm.backButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled(); }); @@ -118,7 +118,7 @@ describe("vehicle-damage.vue", () => { const { wrapper } = setupMocks({ pageHeaderWidgetHeaderText: "", mountOptionsMockData: { - router: { navigate: jest.fn(), }, + router: { navigate: jest.fn(), navigateWithSaving: jest.fn(), }, actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },], store: { getters: { @@ -158,7 +158,7 @@ describe("vehicle-damage.vue", () => { await wrapper.vm.forwardButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace); expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(storeActions.GET_DAMAGE_OPTIONS, {"carId": "C00000000"}); }); @@ -217,7 +217,7 @@ describe("vehicle-damage.vue", () => { const { wrapper } = setupMocks({ pageHeaderWidgetHeaderText: "", mountOptionsMockData: { - router: { navigate: jest.fn(), }, + router: { navigate: jest.fn(), navigateWithSaving: jest.fn(), }, actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },], store: { getters: { @@ -248,7 +248,7 @@ describe("vehicle-damage.vue", () => { await wrapper.vm.forwardButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace); expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(storeActions.GET_DAMAGE_OPTIONS, {"carId": "C00000000"}); }); @@ -690,6 +690,8 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo var mountOptionsMockDataDefault = { router: { navigate: jest.fn(), + navigateWithoutSaving: jest.fn(), + navigateWithSaving: jest.fn(), }, route: { params: { diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 23d317815..2b9f08db3 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -170,7 +170,7 @@ export default { backButtonAction() { // route to move backwards - this.$router.navigate( + this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_BACK, this.$route ); @@ -293,10 +293,10 @@ export default { // If vin already exists, navigate directly to vin-lookup if(store.getters.vehicle.vin) { - this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route); + this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route); } else { - this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, this.$route); + this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, this.$route); } }, diff --git a/src/layouts/vehicle-make/vehicle-make.spec.js b/src/layouts/vehicle-make/vehicle-make.spec.js index 4884ebf29..c5ec3cba9 100644 --- a/src/layouts/vehicle-make/vehicle-make.spec.js +++ b/src/layouts/vehicle-make/vehicle-make.spec.js @@ -58,13 +58,14 @@ describe("vehicle-make.vue", () => { }); describe("vehicle-make.vue", () => { - test("BackButtonAction triggers a router.navigate change", async (done) => { + test("BackButtonAction triggers a router.navigateWithoutSaving change", async (done) => { //Arrange const { wrapper, apiPromise } = setupMocks({ pageHeaderWidgetHeaderText: "Select a make to get started", mountOptionsMockData: { router: { navigate: jest.fn(), + navigateWithoutSaving: jest.fn(), }, }, }); @@ -81,7 +82,7 @@ describe("vehicle-make.vue", () => { //Assert apiPromise.finally(() => { - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled(); done(); }); }); diff --git a/src/layouts/vehicle-make/vehicle-make.vue b/src/layouts/vehicle-make/vehicle-make.vue index 309e74863..3b3121dad 100644 --- a/src/layouts/vehicle-make/vehicle-make.vue +++ b/src/layouts/vehicle-make/vehicle-make.vue @@ -70,7 +70,7 @@ export default { methods: { backButtonAction() { // route to move backwards - this.$router.navigate( + this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_BACK, this.$route ); @@ -86,7 +86,7 @@ export default { watch: { selectedMake(make) { this.dispatchStoreAction(storeActions.SAVE_VEHICLE_MAKE, make, false); - this.$router.navigate( + this.$router.navigateWithSaving( this.navigationScenarios.SELECTED_MAKE, this.$route ); diff --git a/src/layouts/vehicle-model/vehicle-model.spec.js b/src/layouts/vehicle-model/vehicle-model.spec.js index 2f4adc030..a1853969e 100644 --- a/src/layouts/vehicle-model/vehicle-model.spec.js +++ b/src/layouts/vehicle-model/vehicle-model.spec.js @@ -56,13 +56,14 @@ describe("vehicle-model.vue", () => { }); describe("vehicle-model.vue", () => { - test("BackButtonAction triggers a router.navigate change", async (done) => { + test("BackButtonAction triggers a router.navigateWithoutSaving change", async (done) => { //Arrange const { wrapper, apiPromise } = setupMocks({ pageHeaderWidgetHeaderText: "Select a model to get started", mountOptionsMockData: { router: { navigate: jest.fn(), + navigateWithoutSaving: jest.fn() }, }, }); @@ -77,7 +78,7 @@ describe("vehicle-model.vue", () => { await nextTick(); //Assert apiPromise.finally(() => { - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled(); done(); }); }); diff --git a/src/layouts/vehicle-model/vehicle-model.vue b/src/layouts/vehicle-model/vehicle-model.vue index 455f3d8b3..2db7e34c8 100644 --- a/src/layouts/vehicle-model/vehicle-model.vue +++ b/src/layouts/vehicle-model/vehicle-model.vue @@ -71,7 +71,7 @@ export default { methods: { backButtonAction() { // route to move backwards - this.$router.navigate( + this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_BACK, this.$route ); @@ -87,7 +87,7 @@ export default { watch: { selectedModel(model) { this.dispatchStoreAction(storeActions.SAVE_VEHICLE_MODEL, model, false); - this.$router.navigate( + this.$router.navigateWithSaving( this.navigationScenarios.SELECTED_MODEL, this.$route ); diff --git a/src/layouts/vehicle-parts/vehicle-parts.spec.js b/src/layouts/vehicle-parts/vehicle-parts.spec.js index 2e9110d7a..14c83cfdb 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.spec.js +++ b/src/layouts/vehicle-parts/vehicle-parts.spec.js @@ -78,7 +78,9 @@ describe("vehicle-parts.vue", () => { { mountOptionsMockData: { router: { - navigate: jest.fn() + navigate: jest.fn(), + navigateWithSaving: jest.fn(), + navigateWithoutSaving: jest.fn(), }, route: { query: { @@ -116,7 +118,9 @@ describe("vehicle-parts.vue", () => { const { wrapper } = setupMocks({ mountOptionsMockData: { router: { - navigate: jest.fn() + navigate: jest.fn(), + navigateWithSaving: jest.fn(), + navigateWithoutSaving: jest.fn(), }, route: { query: { @@ -153,7 +157,9 @@ describe("vehicle-parts.vue", () => { const { wrapper } = setupMocks({ mountOptionsMockData: { router: { - navigate: jest.fn() + navigate: jest.fn(), + navigateWithSaving: jest.fn(), + navigateWithoutSaving: jest.fn(), }, route: { query: { @@ -180,13 +186,15 @@ describe("vehicle-parts.vue", () => { expect(wrapper.vm.glassParts).toEqual({ "Rear-Stationary": { "Rear": ['DB12209YPYNOEM'] } }); }); - test("User had part questions > BackButtonAction triggers a router.navigate change with correct scenario", async () => { + test("User had part questions > BackButtonAction triggers a router.navigateWithoutSaving change with correct scenario", async () => { //Arrange const { wrapper } = setupMocks({ mountOptionsMockData: { router: { navigate: jest.fn(), - navigate: jest.fn() + navigate: jest.fn(), + navigateWithSaving: jest.fn(), + navigateWithoutSaving: jest.fn(), }, route: { query: { @@ -228,17 +236,19 @@ describe("vehicle-parts.vue", () => { wrapper.vm.backButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS, wrapper.vm.$route); + expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS, wrapper.vm.$route); }); - test("User did not have part questions > BackButtonAction triggers a router.navigate change with correct scenario", async () => { + test("User did not have part questions > BackButtonAction triggers a router.navigateWithoutSaving change with correct scenario", async () => { //Arrange const { wrapper } = setupMocks({ mountOptionsMockData: { router: { navigate: jest.fn(), - navigate: jest.fn() + navigate: jest.fn(), + navigateWithSaving: jest.fn(), + navigateWithoutSaving: jest.fn(), }, route: { query: { @@ -267,11 +277,11 @@ describe("vehicle-parts.vue", () => { wrapper.vm.backButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_VIN_LOOKUP, wrapper.vm.$route); + expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_VIN_LOOKUP, wrapper.vm.$route); }); - test("ForwardButtonAction triggers a router.navigate change if there are child part questions", async () => { + test("ForwardButtonAction triggers a router.navigateWithSaving change if there are child part questions", async () => { //Arrange store.getters.pageData.mockReturnValueOnce({ @@ -317,7 +327,9 @@ describe("vehicle-parts.vue", () => { const { wrapper } = setupMocks({ mountOptionsMockData: { router: { - navigate: jest.fn() + navigate: jest.fn(), + navigateWithSaving: jest.fn(), + navigateWithoutSaving: jest.fn(), }, route: { query: { @@ -344,10 +356,10 @@ describe("vehicle-parts.vue", () => { await wrapper.vm.forwardButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); }); - test("ForwardButtonAction triggers a router.navigate change if there are capability questions", async () => { + test("ForwardButtonAction triggers a router.navigateWithSaving change if there are capability questions", async () => { //Arrange store.getters.pageData.mockReturnValueOnce({ @@ -375,7 +387,9 @@ describe("vehicle-parts.vue", () => { const { wrapper } = setupMocks({ mountOptionsMockData: { router: { - navigate: jest.fn() + navigate: jest.fn(), + navigateWithSaving: jest.fn(), + navigateWithoutSaving: jest.fn(), }, route: { query: { @@ -408,7 +422,7 @@ describe("vehicle-parts.vue", () => { await wrapper.vm.forwardButtonAction(); //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled(); }); test("ForwardButtonAction saves selected parts to store if no molding or capability questions", async () => { @@ -421,7 +435,9 @@ describe("vehicle-parts.vue", () => { const { wrapper } = setupMocks({ mountOptionsMockData: { router: { - navigate: jest.fn() + navigate: jest.fn(), + navigateWithSaving: jest.fn(), + navigateWithoutSaving: jest.fn(), }, route: { query: { diff --git a/src/layouts/vehicle-style/vehicle-style.spec.js b/src/layouts/vehicle-style/vehicle-style.spec.js index 1f7f24e07..1dd3a6774 100644 --- a/src/layouts/vehicle-style/vehicle-style.spec.js +++ b/src/layouts/vehicle-style/vehicle-style.spec.js @@ -66,13 +66,15 @@ describe("vehicle-style.vue", () => { }); describe("vehicle-style.vue", () => { - test("BackButtonAction triggers a router.navigate change", async (done) => { + test("BackButtonAction triggers a router.navigateWithoutSaving change", async (done) => { //Arrange const { wrapper, apiPromise } = setupMocks({ pageHeaderWidgetHeaderText: "Select a style to get started", mountOptionsMockData: { router: { navigate: jest.fn(), + navigateWithSaving: jest.fn(), + navigateWithoutSaving: jest.fn(), }, }, }); @@ -89,7 +91,7 @@ describe("vehicle-style.vue", () => { //Assert apiPromise.finally(() => { - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled(); done(); }); }); diff --git a/src/layouts/vehicle-style/vehicle-style.vue b/src/layouts/vehicle-style/vehicle-style.vue index 588c95ee2..b017fa6ce 100644 --- a/src/layouts/vehicle-style/vehicle-style.vue +++ b/src/layouts/vehicle-style/vehicle-style.vue @@ -100,7 +100,7 @@ export default { methods: { backButtonAction() { // route to move backwards - this.$router.navigate( + this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_BACK, this.$route ); @@ -128,7 +128,7 @@ export default { selectedStyle(style) { this.dispatchStoreAction(storeActions.SAVE_VEHICLE_STYLE, style, false); this.setVehicle().then(() => { - this.$router.navigate( + this.$router.navigateWithSaving( this.navigationScenarios.SELECTED_STYLE, this.$route ); diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index 8d70f88d8..fe9f6f30c 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -90,7 +90,7 @@ export default { selectedYear(year) { const parsedYear = parseInt(year); this.dispatchStoreAction(storeActions.SAVE_VEHICLE_YEAR, parsedYear); - this.$router.navigate( + this.$router.navigateWithSaving( this.navigationScenarios.SELECTED_YEAR, this.$route ); diff --git a/src/layouts/vin-lookup/vin-lookup.spec.js b/src/layouts/vin-lookup/vin-lookup.spec.js index d71b1fd1f..60188bae8 100644 --- a/src/layouts/vin-lookup/vin-lookup.spec.js +++ b/src/layouts/vin-lookup/vin-lookup.spec.js @@ -155,7 +155,7 @@ describe("vin-lookup.vue", () => { const { wrapper } = setupMocks({ customMountOptions: { router: { - navigate: jest.fn() + navigateWithSaving: jest.fn() } } }); @@ -169,8 +169,8 @@ describe("vin-lookup.vue", () => { await wrapper.vm.navigateForward(); //Assert - expect(wrapper.vm.$router.navigate).toBeCalledTimes(1); - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, wrapper.vm.$route, expect.anything(), expect.anything()); + expect(wrapper.vm.$router.navigateWithSaving).toBeCalledTimes(1); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, wrapper.vm.$route, expect.anything(), expect.anything()); }) test("carId matches => navigateForwardWithSingleCarMatch", async () => { diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 84c17cfd9..21d06ff56 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -211,10 +211,10 @@ export default { }, backButtonAction() { if (this.$store.getters.vehicle.vin) { - this.$router.navigate(this.navigationScenarios.CLICKED_BACK_WITH_VIN, this.$route); + this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK_WITH_VIN, this.$route); } else { - this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); + this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); } }, @@ -331,7 +331,7 @@ export default { }, async navigateForward(){ if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { - this.$router.navigate(this.navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, this.$route, {}, { [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true }); + this.$router.navigateWithSaving(this.navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, this.$route, {}, { [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true }); } else { await this.navigateForwardWithSingleCarMatch(); } diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 1e6330a60..380805751 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -75,16 +75,16 @@ export default { const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions); if (hasPartQuestions && this.currentPageComesBeforePage(currentPage, fmgPageValues.PART_QUESTIONS)) { - self.$router.navigate(self.navigationScenarios.HAS_PART_QUESTIONS, self.$route, {}, {}, {partsOrQuestions: partsOrQuestions}); + self.$router.navigateWithSaving(self.navigationScenarios.HAS_PART_QUESTIONS, self.$route, {}, {}, {partsOrQuestions: partsOrQuestions}); } else if (hasGlassLocationWithMultipleParts && this.currentPageComesBeforePage(currentPage, fmgPageValues.VEHICLE_PARTS)) { // if multiple parts on any glass // go to vehicle-parts page and pass the partsData - self.$router.navigate(self.navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE,self.$route,{},{},{partsOrQuestions: partsOrQuestions}); + self.$router.navigateWithSaving(self.navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE,self.$route,{},{},{partsOrQuestions: partsOrQuestions}); } else if (hasChildPartQuestions && this.currentPageComesBeforePage(currentPage, fmgPageValues.MOLDING_QUESTIONS)) { // if any childpart questions // go to molding-questions page and pass the partsData - self.$router.navigate(self.navigationScenarios.HAS_MOLDING_QUESTIONS,self.$route,{},{},{partsOrQuestions: partsOrQuestions}); + self.$router.navigateWithSaving(self.navigationScenarios.HAS_MOLDING_QUESTIONS,self.$route,{},{},{partsOrQuestions: partsOrQuestions}); } else if (hasCapabilityQuestions && this.currentPageComesBeforePage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS)) { // if has capability questions // go to capability-questions page and pass the partsData @@ -103,7 +103,7 @@ export default { }) }); - self.$router.navigate(self.navigationScenarios.HAS_CAPABILITY_QUESTIONS, self.$route, {}, {}, { partsOrQuestions, capabilityQuestions }); + self.$router.navigateWithSaving(self.navigationScenarios.HAS_CAPABILITY_QUESTIONS, self.$route, {}, {}, { partsOrQuestions, capabilityQuestions }); } else { // if single parts only const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions); @@ -139,7 +139,7 @@ export default { backNavigationScenario = navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS; } - this.$router.navigate( + this.$router.navigateWithoutSaving( backNavigationScenario, this.$route ); diff --git a/src/mixins/vehicle-questions-mixin.spec.js b/src/mixins/vehicle-questions-mixin.spec.js index 52b6ac787..954349c53 100644 --- a/src/mixins/vehicle-questions-mixin.spec.js +++ b/src/mixins/vehicle-questions-mixin.spec.js @@ -192,8 +192,8 @@ describe("vehicle-questions-mixin", () => { await wrapper.vm.navigateForward(partsOrQuestions); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1); - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions }); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions }); }); test("multiple glass locations have part questions => go to parts-questions", async () => { @@ -300,8 +300,8 @@ describe("vehicle-questions-mixin", () => { await wrapper.vm.navigateForward(partsOrQuestions); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1); - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions }); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions }); }); test("multiple glass locations selected, one has part question => go to parts-questions", async () => { @@ -400,8 +400,8 @@ describe("vehicle-questions-mixin", () => { await wrapper.vm.navigateForward(partsOrQuestions); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1); - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions }); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions }); }); test("a selected glass location has part questions and multiple parts => go to parts-questions", async () => { @@ -548,8 +548,8 @@ describe("vehicle-questions-mixin", () => { await wrapper.vm.navigateForward(partsOrQuestions); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1); - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions }); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions }); }); }); @@ -590,8 +590,8 @@ describe("vehicle-questions-mixin", () => { await wrapper.vm.navigateForward(partsOrQuestions); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1); - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, { partsOrQuestions }); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, { partsOrQuestions }); }); test("multiple glass locations selected, one of them has multiple parts => go to vehicle parts", async () => { @@ -696,8 +696,8 @@ describe("vehicle-questions-mixin", () => { await wrapper.vm.navigateForward(partsOrQuestions); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1); - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, { partsOrQuestions }); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, { partsOrQuestions }); }); test("multiple glass locations selected, multiple have multiple parts => go to vehicle-parts", async () => { @@ -868,8 +868,8 @@ describe("vehicle-questions-mixin", () => { await wrapper.vm.navigateForward(partsOrQuestions); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1); - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, { partsOrQuestions }); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, { partsOrQuestions }); }); }); @@ -921,8 +921,8 @@ describe("vehicle-questions-mixin", () => { await wrapper.vm.navigateForward(partsOrQuestions); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1); - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.HAS_MOLDING_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions }); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_MOLDING_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions }); }); }); @@ -956,8 +956,8 @@ describe("vehicle-questions-mixin", () => { await wrapper.vm.navigateForward(partsOrQuestions); // Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1); - expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.HAS_CAPABILITY_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions, capabilityQuestions: [] }); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); + expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_CAPABILITY_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions, capabilityQuestions: [] }); }); }); @@ -1117,7 +1117,7 @@ function setupMocks({ fmgPage = fmgPageValues.VIN_LOOKUP }) { const mocks = getMountOptions({ router: { - navigate: jest.fn() + navigate: jest.fn(), navigateWithSaving: jest.fn(), navigateWithSaving: jest.fn() }, store: { commit: jest.fn(), diff --git a/src/mixins/vin-pages-mixin.spec.js b/src/mixins/vin-pages-mixin.spec.js index 4759eb5dc..e95fea92f 100644 --- a/src/mixins/vin-pages-mixin.spec.js +++ b/src/mixins/vin-pages-mixin.spec.js @@ -41,7 +41,14 @@ function setupMocks({ partsOrQuestions = [] }) { ], }); - const mocks = getMountOptions({}); + const mocks = getMountOptions({ + router: { + navigate: jest.fn(), navigateWithSaving: jest.fn(), navigateWithoutSaving: jest.fn(), + }, + store: { + commit: jest.fn() + } + }); const mockVinComponent = { components: { loadingModal }, diff --git a/src/router/index.js b/src/router/index.js index 46e26baad..fbb82c398 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -132,6 +132,13 @@ router.afterEach((to, from) => { // Update lastPageVisited in the store store.commit(storeMutations.UPDATE_LAST_PAGE_VISITED, to.name); + // If saving on navigation is requested, check for saved SessionId or EmailAddress to determine if saving is appropriate + if (eval(to.params.isSavingNavigation)) { + if (store.getters.applicationUser.savedSessionId || store.getters.order.customer?.emailAddress) { + saveOrder(); + } + } + // Push page view to GA analyticsMixin.methods.pushPageViewToGA(); @@ -140,8 +147,12 @@ router.afterEach((to, from) => { }); -router.navigate = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData) => { - navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData); +router.navigateWithoutSaving = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) => { + navigate(scenario, currentRoute, false, optionalQuery, optionalParams, optionalPageData); +} + +router.navigateWithSaving = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) => { + navigate(scenario, currentRoute, true, optionalQuery, optionalParams, optionalPageData); } router.navigateToExternalUrl = (url, optionalQuery = {}) => { @@ -157,7 +168,7 @@ router.overrideNavigation = (scenario, currentRoute, next, optionalQuery = {}, o // PRIVATE FUNCTIONS // Navigate to the next route, depending on the scenario. -async function navigate(scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData) { +async function navigate(scenario, currentRoute, isSavingNavigation, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) { if (!scenario) { console.error("No scenario provided. Please review the routing table."); return; @@ -174,10 +185,7 @@ async function navigate(scenario, currentRoute, optionalQuery = {}, optionalPara const existingPageDataForPage = store.getters.pageData(destinationFmgPageValue); baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData ? optionalPageData : existingPageDataForPage ?? {}); - // if cookie and referralNumber/Date exists OR an emailAddress has been saved - if ((getFunnelCookie()?.ReferralNumber && getFunnelCookie()?.ReferralDate) || store.getters.order.customer?.emailAddress) { - saveOrder(); - } + optionalParams.isSavingNavigation = isSavingNavigation; router.push({ name: "root",