From 635d79c357ae7b37b512fe1a2c344679923caacb Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 14 Jun 2023 13:57:56 -0400 Subject: [PATCH 01/16] Implement first round of resetting logic per ticket --- src/store/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/store/index.js b/src/store/index.js index bd8ccffe7..ec015d9a6 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1779,6 +1779,8 @@ export const actions = { if (!deepEqual(supportingItems, context.state.order.lineItems.supportingItems)) { context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); + + context.commit(storeMutations.RESET_SCHEDULE); } context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems); @@ -1857,12 +1859,36 @@ export const actions = { context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + + context.commit(storeMutations.RESET_SCHEDULE); } context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo); }, saveServiceLocation(context, serviceLocationInfo) { + if (context.state.order.serviceLocationInfo) { + if (serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode) { + context.commit(storeMutations.RESET_SCHEDULE); + } + + if ( + !deepEqual( + serviceLocationInfo.provider, + context.state.order.serviceLocationInfo.provider + ) + ) { + context.commit(storeMutations.RESET_SCHEDULE); + } + + if ( + serviceLocationInfo.appointmentType !== + context.state.order.serviceLocationInfo.appointmentType + ) { + context.commit(storeMutations.RESET_SCHEDULE); + } + } + context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocationInfo); }, @@ -1887,6 +1913,8 @@ export const actions = { if (!deepEqual(parts, context.state.order.lineItems.glassParts)) { context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); + + context.commit(storeMutations.RESET_SCHEDULE); } context.commit(storeMutations.UPDATE_GLASS_PARTS, parts); From c27b3d612c54f21f83a0faab38144e1f6c63ad1c Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 14 Jun 2023 14:06:17 -0400 Subject: [PATCH 02/16] Catch missed path for resetting when zip changes --- src/store/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/store/index.js b/src/store/index.js index ec015d9a6..1ec9a264d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1869,6 +1869,10 @@ export const actions = { saveServiceLocation(context, serviceLocationInfo) { if (context.state.order.serviceLocationInfo) { if (serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode) { + context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); + context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); + context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + context.commit(storeMutations.RESET_SCHEDULE); } From c92ff4d1b518bba4a2b84178ecb9c01049931c06 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 14 Jun 2023 14:06:17 -0400 Subject: [PATCH 03/16] Revert "Catch missed path for resetting when zip changes" This reverts commit c27b3d612c54f21f83a0faab38144e1f6c63ad1c. --- src/store/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 1ec9a264d..ec015d9a6 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1869,10 +1869,6 @@ export const actions = { saveServiceLocation(context, serviceLocationInfo) { if (context.state.order.serviceLocationInfo) { if (serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode) { - context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); - context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); - context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); - context.commit(storeMutations.RESET_SCHEDULE); } From 8348781ca7e109431292de0b6490ce0169f0319b Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 15 Jun 2023 14:55:06 -0400 Subject: [PATCH 04/16] Consolidated if statements --- src/store/index.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index ec015d9a6..99a28e212 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1868,22 +1868,14 @@ export const actions = { saveServiceLocation(context, serviceLocationInfo) { if (context.state.order.serviceLocationInfo) { - if (serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode) { - context.commit(storeMutations.RESET_SCHEDULE); - } - if ( + serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode || !deepEqual( serviceLocationInfo.provider, context.state.order.serviceLocationInfo.provider - ) - ) { - context.commit(storeMutations.RESET_SCHEDULE); - } - - if ( + ) || serviceLocationInfo.appointmentType !== - context.state.order.serviceLocationInfo.appointmentType + context.state.order.serviceLocationInfo.appointmentType ) { context.commit(storeMutations.RESET_SCHEDULE); } From 9b75367894a99da601a44ce2fa85d61a231ab5fa Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 20 Jun 2023 15:09:00 -0400 Subject: [PATCH 05/16] Update with better cascading logic. --- src/constants/store-actions.js | 1 + src/store/index.js | 35 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index ebffdebde..392e7b59e 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -54,6 +54,7 @@ const storeActions = { RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies", RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies", RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies", + RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES: "resetServiceLocationAndDependencies", RESET_STATE: "resetState", // SAVE COMPONENT STATE diff --git a/src/store/index.js b/src/store/index.js index 99a28e212..7ad5c4457 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -343,7 +343,7 @@ export const mutations = { //early bird fee used on schedule page also needs reset when schedule is reset const supportingItems = state.order.lineItems.supportingItems; - const removeEarlyBirdIndex = supportingItems.findIndex( + const removeEarlyBirdIndex = supportingItems?.findIndex( (item) => item.partType == PREMIUM_FEE_PART_TYPE ); @@ -726,6 +726,15 @@ export const actions = { resetPartsAndDependencies(context) { context.commit(storeMutations.RESET_GLASS_PARTS_STATE); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); + + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + }, + + resetServiceLocationAndDependencies(context) { + context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); + context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); + + context.commit(storeMutations.RESET_SCHEDULE); }, resetState(context) { @@ -1777,10 +1786,7 @@ export const actions = { saveSupportingItems(context, supportingItems) { if (!deepEqual(supportingItems, context.state.order.lineItems.supportingItems)) { - context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); - context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); - - context.commit(storeMutations.RESET_SCHEDULE); + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); } context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems); @@ -1856,26 +1862,24 @@ export const actions = { context.state.order.serviceLocation && serviceZipCodeInfo.zipCode !== context.state.order.serviceLocation.zipCode ) { - context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); - context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); - context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); - context.commit(storeMutations.RESET_SCHEDULE); + context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); } context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo); }, saveServiceLocation(context, serviceLocationInfo) { - if (context.state.order.serviceLocationInfo) { + if (context.state.order.serviceLocation) { if ( - serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode || + serviceLocationInfo.zipCode !== context.state.order.serviceLocation.zipCode || !deepEqual( serviceLocationInfo.provider, - context.state.order.serviceLocationInfo.provider + context.state.order.serviceLocation.provider ) || serviceLocationInfo.appointmentType !== - context.state.order.serviceLocationInfo.appointmentType + context.state.order.serviceLocation.appointmentType ) { context.commit(storeMutations.RESET_SCHEDULE); } @@ -1903,10 +1907,7 @@ export const actions = { saveGlassParts(context, parts) { if (!deepEqual(parts, context.state.order.lineItems.glassParts)) { - context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); - context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); - - context.commit(storeMutations.RESET_SCHEDULE); + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); } context.commit(storeMutations.UPDATE_GLASS_PARTS, parts); From 902c55d0d4637565b9d2de4b5e57330e6e7edd82 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Tue, 20 Jun 2023 15:16:04 -0400 Subject: [PATCH 06/16] CSR-1151 use generic verbiage for transition to heritage --- .../loading-modal/loading-modal.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/fmg-components/loading-modal/loading-modal.vue b/src/fmg-components/loading-modal/loading-modal.vue index 9622435cf..8cdf25384 100644 --- a/src/fmg-components/loading-modal/loading-modal.vue +++ b/src/fmg-components/loading-modal/loading-modal.vue @@ -13,19 +13,19 @@

- Finding shops near you + Tidying up the shop . . .

- Looking for dates + Getting all the glass shined up . . .

- Searching for times + Planning your new view of the road . . . @@ -164,19 +164,19 @@ export default { transform: translateX(-600px); } 55% { - transform: translateX(-1110px); + transform: translateX(-1195px); } 66% { - transform: translateX(-1110px); + transform: translateX(-1195px); } 77% { - transform: translateX(-1600px); + transform: translateX(-1750px); } 88% { - transform: translateX(-1600px); + transform: translateX(-1750px); } 100% { - transform: translateX(-2050px); + transform: translateX(-2200px); } } From 11fd5a5e67b79e83f122a8bf10b03a5a9654f67b Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 20 Jun 2023 15:25:07 -0400 Subject: [PATCH 07/16] Patch directly failing tests --- src/store/store.spec.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 262cb263a..334118c23 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -575,13 +575,16 @@ describe("Actions", () => { // Arrange const context = state; const commit = jest.fn(); + const dispatch = jest.fn(); context.commit = commit; + context.dispatch = dispatch; // Act await actions.resetPartsAndDependencies(context); expect(commit).toBeCalledWith(storeMutations.RESET_GLASS_PARTS_STATE); + expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); }); it("resetState action", async () => { @@ -966,14 +969,17 @@ describe("Actions", () => { }; const commit = jest.fn(); + const dispatch = jest.fn(); context.commit = commit; + context.dispatch = dispatch; // Act actions.saveGlassParts(context, { glassParts: {} }); // Assert expect(commit).toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, { glassParts: {} }); + expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); }); it("clearVin, should call mutation", () => { From f30527c64fdab6373e3fd779d22027e746436463 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 20 Jun 2023 15:48:37 -0400 Subject: [PATCH 08/16] Add tests for SaveSupportingItems --- src/store/store.spec.js | 75 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 334118c23..e35e463c6 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -982,6 +982,81 @@ describe("Actions", () => { expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); }); + it("saveSupportingItems, should call mutations", () => { + // Arrange + const context = { + state: state, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + // Act + actions.saveSupportingItems(context, []); + + // Assert + expect(commit).toBeCalledWith(storeMutations.UPDATE_SUPPORTING_ITEMS, []); + }); + + it("saveSupportingItems, should call reset logic when value is new", () => { + // Arrange + const context = { + state: { + order: { + lineItems: { + supportingItems: [ + "TestValue1", + "TestValue2" + ], + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + // Act + actions.saveSupportingItems(context, [ "TestValue3", "TestValue4", "TestValue5" ]); + + // Assert + expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + }); + + it("saveSupportingItems, should not call reset logic when value is the same", () => { + // Arrange + const context = { + state: { + order: { + lineItems: { + supportingItems: [ + "TestValue1", + "TestValue2" + ], + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + // Act + actions.saveSupportingItems(context, [ "TestValue1", "TestValue2" ]); + + // Assert + expect(dispatch).not.toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + }); + it("clearVin, should call mutation", () => { // Arrange const context = state; From 74af79a8f3e2cd26d09dada93e7bfa88efbce258 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 20 Jun 2023 16:11:51 -0400 Subject: [PATCH 09/16] Add tests for serviceZipCodeInfo and serviceLocation save methods --- src/store/store.spec.js | 314 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 314 insertions(+) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index e35e463c6..8bb15311a 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -936,6 +936,84 @@ describe("Actions", () => { ); }); + it("saveServiceZipCodeInfo, should call mutation and save zip code to state", () => { + // Arrange + const context = state; + const commit = jest.fn(); + context.commit = commit; + + const serviceZipCodeInfo = { + zipCode: "43212", + }; + + // Act + actions.saveServiceLocation(context, serviceZipCodeInfo); + + // Assert + expect(commit).toBeCalledWith(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo); + expect(state.order.serviceLocation.zipCode).toEqual("43212"); + }); + + it("saveServiceZipCodeInfo, should reset if zip code is different", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + zipCode: "43212", + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceZipCodeInfo = { + zipCode: "43202", + }; + + // Act + actions.saveServiceZipCodeInfo(context, serviceZipCodeInfo); + + // Assert + expect(dispatch).toHaveBeenCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + }); + + it("saveServiceZipCodeInfo, should not reset if zip code is the same", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + zipCode: "43212", + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceZipCodeInfo = { + zipCode: "43212", + }; + + // Act + actions.saveServiceZipCodeInfo(context, serviceZipCodeInfo); + + // Assert + expect(dispatch).not.toHaveBeenCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + expect(commit).not.toHaveBeenCalledWith(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + }); + it("saveServiceLocation, should call mutation and save service address to state", () => { // Arrange const context = state; @@ -962,6 +1040,242 @@ describe("Actions", () => { expect(state.order.serviceLocation.zipCodeCtu).toEqual("01820"); }); + it("saveServiceLocation, should reset if zipcode is different", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceLocation = { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43202", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }; + + // Act + actions.saveServiceLocation(context, serviceLocation); + + // Assert + expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE); + }); + + it("saveServiceLocation, should reset if provider is different", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceLocation = { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "22222", + address: { + streetAddress: "321 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }; + + // Act + actions.saveServiceLocation(context, serviceLocation); + + // Assert + expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE); + }); + + it("saveServiceLocation, should reset if appointment type is different", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceLocation = { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Inshop", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }; + + // Act + actions.saveServiceLocation(context, serviceLocation); + + // Assert + expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE); + }); + + it("saveServiceLocation, should not reset if parameters are the same", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceLocation = { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }; + + // Act + actions.saveServiceLocation(context, serviceLocation); + + // Assert + expect(commit).not.toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE); + }); + it("saveGlassParts, should call mutation", () => { // Arrange const context = { From 98d8d68aee5f3fefa98ed3ad8cd6f534508de9a3 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 20 Jun 2023 16:22:38 -0400 Subject: [PATCH 10/16] Formatting --- src/store/store.spec.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 8bb15311a..847701e67 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -980,7 +980,9 @@ describe("Actions", () => { actions.saveServiceZipCodeInfo(context, serviceZipCodeInfo); // Assert - expect(dispatch).toHaveBeenCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + expect(dispatch).toHaveBeenCalledWith( + storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES + ); expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); }); @@ -1010,8 +1012,12 @@ describe("Actions", () => { actions.saveServiceZipCodeInfo(context, serviceZipCodeInfo); // Assert - expect(dispatch).not.toHaveBeenCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); - expect(commit).not.toHaveBeenCalledWith(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + expect(dispatch).not.toHaveBeenCalledWith( + storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES + ); + expect(commit).not.toHaveBeenCalledWith( + storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS + ); }); it("saveServiceLocation, should call mutation and save service address to state", () => { @@ -1321,10 +1327,7 @@ describe("Actions", () => { state: { order: { lineItems: { - supportingItems: [ - "TestValue1", - "TestValue2" - ], + supportingItems: ["TestValue1", "TestValue2"], }, }, }, @@ -1337,7 +1340,7 @@ describe("Actions", () => { context.dispatch = dispatch; // Act - actions.saveSupportingItems(context, [ "TestValue3", "TestValue4", "TestValue5" ]); + actions.saveSupportingItems(context, ["TestValue3", "TestValue4", "TestValue5"]); // Assert expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); @@ -1349,10 +1352,7 @@ describe("Actions", () => { state: { order: { lineItems: { - supportingItems: [ - "TestValue1", - "TestValue2" - ], + supportingItems: ["TestValue1", "TestValue2"], }, }, }, @@ -1365,10 +1365,12 @@ describe("Actions", () => { context.dispatch = dispatch; // Act - actions.saveSupportingItems(context, [ "TestValue1", "TestValue2" ]); + actions.saveSupportingItems(context, ["TestValue1", "TestValue2"]); // Assert - expect(dispatch).not.toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + expect(dispatch).not.toBeCalledWith( + storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES + ); }); it("clearVin, should call mutation", () => { From 20d7917b7c5c984185f5ebc058ef9c1edc4db1ea Mon Sep 17 00:00:00 2001 From: Matt Caimi Date: Wed, 21 Jun 2023 10:17:47 -0400 Subject: [PATCH 11/16] CSR-1439 email provided ga event --- src/global-methods.js | 20 +++++++++++++++++--- src/mixins/analytics-mixin.js | 4 ++++ src/router/index.js | 8 ++++++++ src/store/index.js | 2 ++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/global-methods.js b/src/global-methods.js index 45bbc467c..756b58dc8 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -1,13 +1,21 @@ import axios from "axios"; import analyticsMixIn from "@/mixins/analytics-mixin.js"; import store from "@/store"; +import router from "@/router"; import { applicationConfig } from "@/constants/application-config.js"; import { GaCategories, GaActions, GaLabels } from "@/constants/analytics"; import { headerKeys } from "@/constants/header-keys"; export default { - callHttpClient({ method, endpoint, payload, logApiCall = true, isFormData = false }) { + callHttpClient({ + method, + endpoint, + payload, + logApiCall = true, + isFormData = false, + additionalSuccessEventDataHandler, + }) { return new Promise((resolve, reject) => { const cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; let payloadAndAnalyticsData = {}; @@ -31,10 +39,16 @@ export default { }).then( (response) => { if (logApiCall) { + let additionalEventData = ""; + if (additionalSuccessEventDataHandler) { + additionalEventData = "_" + additionalSuccessEventDataHandler(response); + } + const pageName = analyticsMixIn.methods.getPageName(); + const nextPageName = router.getNextPage() || pageName; analyticsMixIn.methods.pushEventToGA( GaCategories.API_RESPONSE, - GaActions.RESULT, - `${GaLabels.SUCCESS}_${endpoint}`, + `${nextPageName}_${endpoint}`, + `${GaLabels.SUCCESS}${additionalEventData}`, true ); } diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 29eb76c3d..75f22edcb 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -23,6 +23,10 @@ import { applicationConfig } from "../constants/application-config"; export default { methods: { + getPageName() { + return getPageNameByQueryString(); + }, + logPageView(pageEvent) { const currentPageName = getPageNameByQueryString(); var payload = { diff --git a/src/router/index.js b/src/router/index.js index 15ba52647..1d410c3cb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -222,6 +222,12 @@ router.overrideNavigation = ( next(); }; +router.getNextPage = () => nextPageName; + +// PRIVATE VARIABLES + +var nextPageName; + // PRIVATE FUNCTIONS // Navigate to the next route, depending on the scenario. @@ -245,6 +251,8 @@ async function navigate( if (destinationFmgPageValue !== undefined) { // We're always pushing the same path, just changing query strings. Make sure our optional query strings get combined with our fmgPage one. + nextPageName = destinationFmgPageValue; + // Update page data to the store for next page if provided. Otherwise, keep existing page data or set to empty object const existingPageDataForPage = store.getters.pageData(destinationFmgPageValue); baseMixin.methods.savePageDataToStore( diff --git a/src/store/index.js b/src/store/index.js index 7ad5c4457..c81346f16 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1391,6 +1391,8 @@ export const actions = { eon: order.eon, }, }, + additionalSuccessEventDataHandler: (response) => + "Email provided: " + (order.customer.emailAddress ? "true" : "false"), }); }, From 1f8b7d940d0b0eb30313f83d561204f48b7afbcf Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 21 Jun 2023 10:23:41 -0400 Subject: [PATCH 12/16] Tech review changes --- src/store/index.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 7ad5c4457..4d959170b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -341,14 +341,14 @@ export const mutations = { state.order.schedule.routeCode = null; state.order.schedule.jobMaxMinutes = null; - //early bird fee used on schedule page also needs reset when schedule is reset + //premium appointment fee used on schedule page also needs reset when schedule is reset const supportingItems = state.order.lineItems.supportingItems; - const removeEarlyBirdIndex = supportingItems?.findIndex( + const premiumAppointmentFeeIndex = supportingItems?.findIndex( (item) => item.partType == PREMIUM_FEE_PART_TYPE ); - if (removeEarlyBirdIndex >= 0) { - supportingItems.splice(removeEarlyBirdIndex, 1); + if (premiumAppointmentFeeIndex >= 0) { + supportingItems.splice(premiumAppointmentFeeIndex, 1); state.order.lineItems.supportingItems = supportingItems; } }, @@ -369,7 +369,6 @@ export const mutations = { state.order.serviceLocation.address2 = null; state.order.serviceLocation.city = null; state.order.serviceLocation.state = null; - state.order.serviceLocation.zipCode = null; state.order.serviceLocation.isVehicleProtected = null; }, // Misc Mutations @@ -712,15 +711,16 @@ export const actions = { // Dependency Actions resetDamageAndDependencies(context) { context.commit(storeMutations.RESET_DAMAGE_STATE); - context.commit(storeMutations.RESET_GLASS_PARTS_STATE); - context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); + + context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); + context.commit(storeMutations.UPDATE_VAPS, null); }, resetRegistrationAndDependencies(context) { context.commit(storeMutations.RESET_REGISTRATION_STATE); - context.commit(storeMutations.RESET_GLASS_PARTS_STATE); - context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); + + context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }, resetPartsAndDependencies(context) { @@ -1606,7 +1606,6 @@ export const actions = { if (!isSelectedGlassAvailableForVehicle) { context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); } //Save new values @@ -1632,7 +1631,6 @@ export const actions = { if (!isSelectedGlassAvailableForVehicle) { context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); } //Save new values @@ -1658,6 +1656,8 @@ export const actions = { ); if (havePartQuestionAnswersChanged) { + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + context.commit(storeMutations.UPDATE_GLASS_PARTS, null); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null); @@ -1705,6 +1705,8 @@ export const actions = { previouslySelectedPartNumbers !== currentlySelectedPartNumbers; if (haveSelectedVehiclePartsChanged) { + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + context.commit(storeMutations.UPDATE_GLASS_PARTS, null); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null); @@ -1736,6 +1738,8 @@ export const actions = { ); if (haveMoldingQuestionAnswersChanged) { + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + context.commit(storeMutations.UPDATE_GLASS_PARTS, null); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null); @@ -1765,6 +1769,8 @@ export const actions = { ); if (haveCapabilityQuestionAnswersChanged) { + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + context.commit(storeMutations.UPDATE_GLASS_PARTS, null); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); } @@ -1897,7 +1903,6 @@ export const actions = { if (vehicleInfo.vin !== context.state.order.vehicle.vin) { if (!isSelectedGlassAvailableForVehicle) { context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); } //Save new values From 99ae8bcb106be84a24ae545e2eb9010fad415c20 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 21 Jun 2023 10:31:17 -0400 Subject: [PATCH 13/16] Update unit tests. --- src/store/store.spec.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 847701e67..9d9cdfcf4 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -547,28 +547,32 @@ describe("Actions", () => { // Arrange const context = state; const commit = jest.fn(); + const dispatch = jest.fn(); context.commit = commit; + context.dispatch = dispatch; // Act await actions.resetDamageAndDependencies(context); expect(commit).toBeCalledWith(storeMutations.RESET_DAMAGE_STATE); - expect(commit).toBeCalledWith(storeMutations.RESET_GLASS_PARTS_STATE); + expect(dispatch).toBeCalledWith(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }); it("resetRegistrationAndDependencies action", async () => { // Arrange const context = state; const commit = jest.fn(); + const dispatch = jest.fn(); context.commit = commit; + context.dispatch = dispatch; // Act await actions.resetRegistrationAndDependencies(context); expect(commit).toBeCalledWith(storeMutations.RESET_REGISTRATION_STATE); - expect(commit).toBeCalledWith(storeMutations.RESET_GLASS_PARTS_STATE); + expect(dispatch).toBeCalledWith(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }); it("resetPartsAndDependencies action", async () => { From 89ba15c5384f4a2cb675491e536d3c7a0903dd95 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 21 Jun 2023 10:35:58 -0400 Subject: [PATCH 14/16] Formatting. --- src/store/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 4d959170b..4b3272eac 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -711,7 +711,7 @@ export const actions = { // Dependency Actions resetDamageAndDependencies(context) { context.commit(storeMutations.RESET_DAMAGE_STATE); - + context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); context.commit(storeMutations.UPDATE_VAPS, null); @@ -719,7 +719,7 @@ export const actions = { resetRegistrationAndDependencies(context) { context.commit(storeMutations.RESET_REGISTRATION_STATE); - + context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }, From add3e87c23551f79bdea908c56f9e9c9bd2a068e Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Wed, 21 Jun 2023 15:53:54 -0400 Subject: [PATCH 15/16] Re-insert secondary modal close button to address accessibility issue. --- .../funnel-header/menu-modal/menu-modal.vue | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/fmg-components/funnel-header/menu-modal/menu-modal.vue b/src/fmg-components/funnel-header/menu-modal/menu-modal.vue index 55ff95c48..cfd8dc035 100644 --- a/src/fmg-components/funnel-header/menu-modal/menu-modal.vue +++ b/src/fmg-components/funnel-header/menu-modal/menu-modal.vue @@ -21,6 +21,19 @@ aria-hidden="true" v-on="{ 'show.bs.modal': show, 'hide.bs.modal': hide }" :style="`height: calc(100% - ${currentFooterAndHeaderHeight}px);`"> +