From d4db6c821c839ab54a6d5e89ea3a2d9f98ae9f26 Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Fri, 21 Jul 2023 18:00:06 +0530 Subject: [PATCH 1/6] CSR-1529 zipcode GA event --- src/constants/analytics.js | 4 ++- src/layouts/vehicle-damage/vehicle-damage.vue | 35 ++++++++++++++++--- src/store/index.js | 4 ++- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/constants/analytics.js b/src/constants/analytics.js index b5b24660d..8fa8dcd93 100644 --- a/src/constants/analytics.js +++ b/src/constants/analytics.js @@ -12,6 +12,7 @@ const GaEvents = { const GaCategories = { API_RESPONSE: "Api_Response", EVOX: "Evox", + FUNNEL_ENTRY: "funnel_entry", }; const GaActions = { @@ -20,6 +21,7 @@ const GaActions = { VIF: "vif", SUBMITTED: "Submitted", DISPLAYED: "Displayed", + ZIP_CODE_PROVIDED: "zip_code_provided", }; const GaLabels = { @@ -27,7 +29,7 @@ const GaLabels = { ERROR: "Error", LICENSE_PLATE_LOOKUP: "License_Plate_Look_Up", VIN_LOOKUP: "Vin_Look_Up", - ADDRESS_LOOKUP: "Address_Look_up", + ADDRESS_LOOKUP: "Address_Look_up", }; const ValueToLogTypes = { diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index ae89a61e6..bcede49af 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -81,7 +81,7 @@ import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper"; import store from "@/store"; import baseMixin from "@/mixins/base-mixin"; - +import { queryStrings } from "@/constants/query-strings"; // DEFINE VALIDATION RULES defineRule("replace-options-required", required(errorMessages.REPLACE_OPTIONS_REQUIRED)); @@ -90,9 +90,22 @@ export default { async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); + const queryString = window.location.search; + const urlParams = new URLSearchParams(queryString); + const lowerCaseParams = new URLSearchParams(); + for (const [name, value] of urlParams) { + lowerCaseParams.append(name.toLowerCase(), value); + } + + const zip = lowerCaseParams.get(queryStrings.ZIP_CODE) + ? lowerCaseParams.get(queryStrings.ZIP_CODE) + : store.getters.order.serviceLocation.zipCode; + const damageOptionsPromise = baseMixin.methods.dispatchStoreAction( storeActions.GET_DAMAGE_OPTIONS, - { carId: store.getters.vehicle.carId } + { carId: store.getters.vehicle.carId, + zipCode:zip, + } ); // Settle promises and get results @@ -122,7 +135,7 @@ export default { ); vm.$refs.backGlassOptions.initializeComponent( resultMap.damageOptions.backGlassOptions.availableReplacementOptions - ); + ); }); }, data() { @@ -134,7 +147,8 @@ export default { selectedPassengerSideReplaceOptions: this.getPassengerSideReplaceOptionsFromStore(), }, selectedWindshieldOptions: this.getWindshieldOptionsFromStore(), - selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(), + selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(), + serviceZipCode: this.getZipFromStore() ?? this.$route.query.zipcode, }; }, mounted() { @@ -156,9 +170,21 @@ export default { this.$store.getters.vehicle.carId, true ); + } + if(this.serviceZipCode){ + this.pushEventToGA( + this.GaCategories.FUNNEL_ENTRY, + this.GaActions.ZIP_CODE_PROVIDED, + this.serviceZipCode, + true + ); } }, + getZipFromStore() { + return this.$store.getters.order.serviceLocation.zipCode; + }, + backButtonAction() { // route to move backwards this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); @@ -415,6 +441,7 @@ export default { return selectedGlassToReplace; }, + }, computed: { isWindshieldDamageLocation() { diff --git a/src/store/index.js b/src/store/index.js index c3c9fc8a0..5a39763d8 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -740,11 +740,13 @@ export const actions = { }); }, - getDamageOptions(context, { carId }) { + getDamageOptions(context, { carId,zipCode }) { return globalMethods.callHttpClient({ methods: endpoints.GetDamageOptions.method, endpoint: `${endpoints.GetDamageOptions.url}/${carId}`, payload: {}, + additionalSuccessEventDataHandler: (response) => + "QueryStringZip: " + zipCode, }); }, From 32f11ba277446549d14bc5935f9ee0f8aa9a338b Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Mon, 24 Jul 2023 11:49:16 +0530 Subject: [PATCH 2/6] Update vehicle-damage.spec.js added zip code to get damage options --- .../vehicle-damage/vehicle-damage.spec.js | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/layouts/vehicle-damage/vehicle-damage.spec.js b/src/layouts/vehicle-damage/vehicle-damage.spec.js index 28b85bf00..da384cc6d 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.spec.js +++ b/src/layouts/vehicle-damage/vehicle-damage.spec.js @@ -52,6 +52,7 @@ jest.mock("@/store", () => ({ damage: { glassToReplace: [], }, + order: {serviceLocation: {zipCode: "11111",},}, }, })); @@ -133,6 +134,7 @@ describe("vehicle-damage.vue", () => { getters: { vehicle: {}, payment: { insuranceCoverage: { isVerified: false } }, + order: {serviceLocation: {zipCode: "11111",},}, }, }, }, @@ -175,7 +177,7 @@ describe("vehicle-damage.vue", () => { expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace); expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith( storeActions.GET_DAMAGE_OPTIONS, - { carId: "C00000000" } + { carId: "C00000000", zipCode:"11111" } ); }); @@ -241,6 +243,7 @@ describe("vehicle-damage.vue", () => { getters: { vehicle: {}, payment: { insuranceCoverage: { isVerified: false } }, + order: {serviceLocation: {zipCode: "11111",},}, }, }, }, @@ -270,11 +273,10 @@ describe("vehicle-damage.vue", () => { expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace); expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith( storeActions.GET_DAMAGE_OPTIONS, - { carId: "C00000000" } + { carId: "C00000000", zipCode:"11111" } ); }); }); - describe("alert", () => { test("when displayVehicleChangeAlert router params is true, the alert: 'vehicleChangeAlert' should be rendered", () => { // Arrange & Act @@ -321,7 +323,6 @@ describe("vehicle-damage.vue", () => { expect(wrapper.findComponent({ ref: "vehicleChangeAlert" }).exists()).toBe(false); }); }); - describe("glass selections and corresponding variables", () => { test("isWindshieldDamageLocation is true when windshield is selected", async () => { //Arrange @@ -453,7 +454,6 @@ describe("vehicle-damage.vue", () => { expect(wrapper.vm.isPassengerSideReplace).toEqual(true); }); }); - describe("state validations", () => { test("CarId set, arePagePrerequisitesValid should be true ", async () => { //Arrange @@ -474,7 +474,6 @@ describe("vehicle-damage.vue", () => { expect(arePagePrerequisitesValid).toBe(true); }); }); - describe("input validations", () => { // THE FOLLOWING TEST IS NOT NECESSARILY REQUIRED FOR COVERAGE // BUT KEEP FOR AN EXAMPLE OF A VALIDATION TEST @@ -501,7 +500,6 @@ describe("vehicle-damage.vue", () => { }); }); }); - describe("get glass options from store", () => { const damageLocations = [ ["Windshield", [damageLocationsSelected.WINDSHIELD]], @@ -528,6 +526,7 @@ describe("vehicle-damage.vue", () => { eventBusItem: jest.fn(), damage: { glassToReplace: [{ glassLocation: damageLocation }] }, isRepair: true, + order: {serviceLocation: {zipCode: "11111",},}, }; var glassSelections = wrapper.vm.getDamageLocationsFromStore(); @@ -605,6 +604,7 @@ describe("vehicle-damage.vue", () => { isRepair: isRepair, numberOfChips: 2, }, + order: {serviceLocation: {zipCode: "11111",},}, }; var windshieldSelections = wrapper.vm.getWindshieldOptionsFromStore(); @@ -641,6 +641,7 @@ describe("vehicle-damage.vue", () => { glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }], }, isRepair: true, + order: {serviceLocation: {zipCode: "11111",},}, }; var glassSelections = wrapper.vm.getDriverSideReplaceOptionsFromStore(); @@ -677,6 +678,7 @@ describe("vehicle-damage.vue", () => { glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }], }, isRepair: true, + order: {serviceLocation: {zipCode: "11111",},}, }; var glassSelections = wrapper.vm.getPassengerSideReplaceOptionsFromStore(); @@ -711,6 +713,7 @@ describe("vehicle-damage.vue", () => { glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }], }, isRepair: true, + order: {serviceLocation: {zipCode: "11111",},}, }; var glassSelections = wrapper.vm.getRearReplaceOptionsFromStore(); @@ -720,7 +723,6 @@ describe("vehicle-damage.vue", () => { } ); }); - describe("hide back button", () => { test("if claim registration is delayed => should hide back button", () => { // Arrange @@ -744,6 +746,7 @@ describe("vehicle-damage.vue", () => { getters: { vehicle: {}, payment: { insuranceCoverage: { isVerified: true } }, + order: {serviceLocation: {zipCode: "11111",},}, }, }, }, @@ -784,6 +787,7 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo isVerified: false, }, }, + order: {serviceLocation: {zipCode: "11111",},}, }, }, }; From 62eda36f75b48631a4c2a4c96dd1b76bc39c1656 Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Mon, 24 Jul 2023 11:54:53 +0530 Subject: [PATCH 3/6] Update vehicle-damage.spec.js formatting --- .../vehicle-damage/vehicle-damage.spec.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/layouts/vehicle-damage/vehicle-damage.spec.js b/src/layouts/vehicle-damage/vehicle-damage.spec.js index da384cc6d..30e144310 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.spec.js +++ b/src/layouts/vehicle-damage/vehicle-damage.spec.js @@ -52,7 +52,7 @@ jest.mock("@/store", () => ({ damage: { glassToReplace: [], }, - order: {serviceLocation: {zipCode: "11111",},}, + order: { serviceLocation: { zipCode: "11111" } }, }, })); @@ -134,7 +134,7 @@ describe("vehicle-damage.vue", () => { getters: { vehicle: {}, payment: { insuranceCoverage: { isVerified: false } }, - order: {serviceLocation: {zipCode: "11111",},}, + order: { serviceLocation: { zipCode: "11111" } }, }, }, }, @@ -177,7 +177,7 @@ describe("vehicle-damage.vue", () => { expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace); expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith( storeActions.GET_DAMAGE_OPTIONS, - { carId: "C00000000", zipCode:"11111" } + { carId: "C00000000", zipCode: "11111" } ); }); @@ -243,7 +243,7 @@ describe("vehicle-damage.vue", () => { getters: { vehicle: {}, payment: { insuranceCoverage: { isVerified: false } }, - order: {serviceLocation: {zipCode: "11111",},}, + order: { serviceLocation: { zipCode: "11111" } }, }, }, }, @@ -273,7 +273,7 @@ describe("vehicle-damage.vue", () => { expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace); expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith( storeActions.GET_DAMAGE_OPTIONS, - { carId: "C00000000", zipCode:"11111" } + { carId: "C00000000", zipCode: "11111" } ); }); }); @@ -526,7 +526,7 @@ describe("vehicle-damage.vue", () => { eventBusItem: jest.fn(), damage: { glassToReplace: [{ glassLocation: damageLocation }] }, isRepair: true, - order: {serviceLocation: {zipCode: "11111",},}, + order: { serviceLocation: { zipCode: "11111" } }, }; var glassSelections = wrapper.vm.getDamageLocationsFromStore(); @@ -604,7 +604,7 @@ describe("vehicle-damage.vue", () => { isRepair: isRepair, numberOfChips: 2, }, - order: {serviceLocation: {zipCode: "11111",},}, + order: { serviceLocation: { zipCode: "11111" } }, }; var windshieldSelections = wrapper.vm.getWindshieldOptionsFromStore(); @@ -641,7 +641,7 @@ describe("vehicle-damage.vue", () => { glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }], }, isRepair: true, - order: {serviceLocation: {zipCode: "11111",},}, + order: { serviceLocation: { zipCode: "11111" } }, }; var glassSelections = wrapper.vm.getDriverSideReplaceOptionsFromStore(); @@ -678,7 +678,7 @@ describe("vehicle-damage.vue", () => { glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }], }, isRepair: true, - order: {serviceLocation: {zipCode: "11111",},}, + order: { serviceLocation: { zipCode: "11111" } }, }; var glassSelections = wrapper.vm.getPassengerSideReplaceOptionsFromStore(); @@ -713,7 +713,7 @@ describe("vehicle-damage.vue", () => { glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }], }, isRepair: true, - order: {serviceLocation: {zipCode: "11111",},}, + order: { serviceLocation: { zipCode: "11111" } }, }; var glassSelections = wrapper.vm.getRearReplaceOptionsFromStore(); @@ -746,7 +746,7 @@ describe("vehicle-damage.vue", () => { getters: { vehicle: {}, payment: { insuranceCoverage: { isVerified: true } }, - order: {serviceLocation: {zipCode: "11111",},}, + order: { serviceLocation: { zipCode: "11111" } }, }, }, }, @@ -787,7 +787,7 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo isVerified: false, }, }, - order: {serviceLocation: {zipCode: "11111",},}, + order: { serviceLocation: { zipCode: "11111" } }, }, }, }; From a244865c5e19340643532ddde1b1e2190aa6c0f8 Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Mon, 24 Jul 2023 11:57:54 +0530 Subject: [PATCH 4/6] Update vehicle-damage.vue formatting --- src/layouts/vehicle-damage/vehicle-damage.vue | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index bcede49af..6ea4fe81d 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -91,11 +91,11 @@ export default { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const queryString = window.location.search; - const urlParams = new URLSearchParams(queryString); - const lowerCaseParams = new URLSearchParams(); - for (const [name, value] of urlParams) { - lowerCaseParams.append(name.toLowerCase(), value); - } + const urlParams = new URLSearchParams(queryString); + const lowerCaseParams = new URLSearchParams(); + for (const [name, value] of urlParams) { + lowerCaseParams.append(name.toLowerCase(), value); + } const zip = lowerCaseParams.get(queryStrings.ZIP_CODE) ? lowerCaseParams.get(queryStrings.ZIP_CODE) @@ -103,9 +103,7 @@ export default { const damageOptionsPromise = baseMixin.methods.dispatchStoreAction( storeActions.GET_DAMAGE_OPTIONS, - { carId: store.getters.vehicle.carId, - zipCode:zip, - } + { carId: store.getters.vehicle.carId, zipCode: zip } ); // Settle promises and get results @@ -135,7 +133,7 @@ export default { ); vm.$refs.backGlassOptions.initializeComponent( resultMap.damageOptions.backGlassOptions.availableReplacementOptions - ); + ); }); }, data() { @@ -147,8 +145,8 @@ export default { selectedPassengerSideReplaceOptions: this.getPassengerSideReplaceOptionsFromStore(), }, selectedWindshieldOptions: this.getWindshieldOptionsFromStore(), - selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(), - serviceZipCode: this.getZipFromStore() ?? this.$route.query.zipcode, + selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(), + serviceZipCode: this.getZipFromStore() ?? this.$route.query.zipcode, }; }, mounted() { @@ -170,8 +168,8 @@ export default { this.$store.getters.vehicle.carId, true ); - } - if(this.serviceZipCode){ + } + if (this.serviceZipCode) { this.pushEventToGA( this.GaCategories.FUNNEL_ENTRY, this.GaActions.ZIP_CODE_PROVIDED, @@ -441,7 +439,6 @@ export default { return selectedGlassToReplace; }, - }, computed: { isWindshieldDamageLocation() { From ca7ffbd7f6296c0998824effd1802f2dec18ef3d Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Mon, 24 Jul 2023 12:05:39 +0530 Subject: [PATCH 5/6] formatting --- src/constants/analytics.js | 2 +- src/store/index.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/constants/analytics.js b/src/constants/analytics.js index 8fa8dcd93..2b0fc1a8f 100644 --- a/src/constants/analytics.js +++ b/src/constants/analytics.js @@ -29,7 +29,7 @@ const GaLabels = { ERROR: "Error", LICENSE_PLATE_LOOKUP: "License_Plate_Look_Up", VIN_LOOKUP: "Vin_Look_Up", - ADDRESS_LOOKUP: "Address_Look_up", + ADDRESS_LOOKUP: "Address_Look_up", }; const ValueToLogTypes = { diff --git a/src/store/index.js b/src/store/index.js index 5a39763d8..abefc2b5d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -740,13 +740,12 @@ export const actions = { }); }, - getDamageOptions(context, { carId,zipCode }) { + getDamageOptions(context, { carId, zipCode }) { return globalMethods.callHttpClient({ methods: endpoints.GetDamageOptions.method, endpoint: `${endpoints.GetDamageOptions.url}/${carId}`, payload: {}, - additionalSuccessEventDataHandler: (response) => - "QueryStringZip: " + zipCode, + additionalSuccessEventDataHandler: (response) => "QueryStringZip: " + zipCode, }); }, From 1efb2a6faa9ac048311ed626abe434d57358bda8 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Mon, 24 Jul 2023 09:59:46 -0400 Subject: [PATCH 6/6] CSR-1546 | Make date-picker work with arrow keys --- src/digital-components/date-picker/date-picker.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/digital-components/date-picker/date-picker.vue b/src/digital-components/date-picker/date-picker.vue index 1af8f525b..3e4146280 100644 --- a/src/digital-components/date-picker/date-picker.vue +++ b/src/digital-components/date-picker/date-picker.vue @@ -44,7 +44,8 @@ type="radio" name="day-of-month" v-model="selectedDate" - @click="fireDateClickedEvent" + @click="fireDateSelectedEvent" + @keypress.enter="fireDateSelectedEvent" :value="date.inputValue" :id="`${month.monthLabel}-${date.dateNum.toString()}`" />