From d0fb0ee541c03acb05e00bf6485c13f993e28bd4 Mon Sep 17 00:00:00 2001 From: bmauger Date: Thu, 28 Apr 2022 09:59:08 -0400 Subject: [PATCH 01/31] WIP vin-lookup page. --- .../heritage-integration/navigation-helper.js | 4 +- src/layouts/vin-lookup/vin-lookup.vue | 107 +++++++++++------- 2 files changed, 68 insertions(+), 43 deletions(-) diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 989dec817..49c4ab354 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -95,7 +95,7 @@ async function getLatestPageForRedirection() { if (store.getters.vehicle.vin) { return fmgPageValues.LICENSE_PLATE_LOOKUP; } else { - return fmgPageValues.ESTIMATE; + return fmgPageValues.VIN_LOOKUP; } } } @@ -134,7 +134,7 @@ function overrideYmmsDirectionIfNeeded(toRoute) { /* istanbul ignore next */ function isVinRelatedPage(toRoute) { const fmgPageValue = toRoute.query[queryStrings.FMG_PAGE]; - + return fmgPageValue === fmgPageValues.VIN_LOOKUP || fmgPageValue === fmgPageValues.LICENSE_PLATE_LOOKUP || fmgPageValue === fmgPageValues.ADDRESS_LOOKUP || diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index c3a1bbc33..409039bdc 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -31,10 +31,11 @@ - - { + const vehicleLookup = await this.lookupVehicle(this.vin).catch(() => { + this.vinNotFound = true; this.$refs.funnelFooter.removeLoader(); - this.noMatchAlert = true; return; }); - if (vinLookup.data.carId !== store.getters.vehicle.carId) { - this.customAlertData.vehicleInfo = vinLookup.data.vehicle; + this.isCarIdDifferent = vehicleLookup.data.carId !== store.getters.vehicle.carId; + + if (this.isCarIdDifferent && (vehicleLookup.data.carId !== this.previouslyEnteredCarId)) { + this.previouslyEnteredCarId = vehicleLookup.data.carId; + this.customAlertData.vehicleInfo = vehicleLookup.data; + this.$refs.funnelFooter.updateButtonText(`Continue with ${vehicleLookup.data.year} ${vehicleLookup.data.make} ${vehicleLookup.data.model}`); + this.isVinValid = true; + this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(vehicleLookup.data.carId); this.$refs.funnelFooter.removeLoader(); - this.foundWindshieldAlert = true; + this.matchedDifferentVehicle = true; return; - } - const carInfo = this.vinDoesNotMatchCarId ? vinLookup.data : store.getters.vehicle; - this.updateStore(carInfo) - const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction( - this.storeActions.GET_PARTS_OR_QUESTIONS, - { - carId: store.getters.vehicle.carId, - glassArray: store.getters.damage.glassToReplace, - zipCode: this.zip, - vin: vinLookup.vin - }, - false - ); - this.navigateForward(partsData); + }; + //const carInfo = this.vinDoesNotMatchCarId ? vehicleLookup.data : store.getters.vehicle; + //this.updateStore(carInfo) + // const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction( + // this.storeActions.GET_PARTS_OR_QUESTIONS, + // { + // carId: store.getters.vehicle.carId, + // glassArray: store.getters.damage.glassToReplace, + // zipCode: this.zip, + // vin: vehicleLookup.vin + // }, + // false + // ); + // this.navigateForward(partsData); }, navigateForward(partsData){ if(partsData.data.partsOrQuestions[0].partQuestions && partsData.data.partsOrQuestions[0].partQuestions.length > 0){ @@ -229,7 +259,7 @@ export default { { zip } ); }, - lookupVin(vin) { + lookupVehicle(vin) { return baseMixin.methods.dispatchNonBlockingStoreAction( storeActions.LOOKUP_VEHICLE_BY_VIN, { vin } @@ -253,11 +283,6 @@ export default { store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email); }, }, - computed: { - isVinFieldReadOnly(){ - return this.$store.getters.payment.insuranceCoverage.isVerified; - } - }, components: { Form, funnelHeader, From ebeb40a0fbc79be2fffa33683b2983aac98fabf4 Mon Sep 17 00:00:00 2001 From: bmauger Date: Thu, 28 Apr 2022 16:54:11 -0400 Subject: [PATCH 02/31] WIP vin-lookup --- src/layouts/vin-lookup/vin-lookup.vue | 39 ++++++++++---------- src/router/router-constants/routing-table.js | 6 ++- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 409039bdc..c596a4078 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -105,6 +105,7 @@ import { errorMessages } from "@/constants/error-messages"; import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-helper"; import { required, regex } from "@/helpers/validation-rules"; import { Form, defineRule } from "vee-validate"; +import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; // DEFINE VALIDATION RULES defineRule("zip-required", required(errorMessages.ZIP_REQUIRED)); @@ -228,29 +229,27 @@ export default { this.matchedDifferentVehicle = true; return; }; - //const carInfo = this.vinDoesNotMatchCarId ? vehicleLookup.data : store.getters.vehicle; - //this.updateStore(carInfo) - // const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction( - // this.storeActions.GET_PARTS_OR_QUESTIONS, - // { - // carId: store.getters.vehicle.carId, - // glassArray: store.getters.damage.glassToReplace, - // zipCode: this.zip, - // vin: vehicleLookup.vin - // }, - // false - // ); - // this.navigateForward(partsData); + this.updateStore(vehicleLookup) + const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction( + this.storeActions.GET_PARTS_OR_QUESTIONS, + { + carId: vehicleLookup.data.carId, + glassArray: this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle ? [] : store.getters.damage.glassToReplace, + zipCode: this.zip, + vin: vehicleLookup.vin + }, + false + ); + console.log(vehicleLookup.data); + this.navigateForward(partsData); }, navigateForward(partsData){ - if(partsData.data.partsOrQuestions[0].partQuestions && partsData.data.partsOrQuestions[0].partQuestions.length > 0){ - this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_PARTS_QUESTION, this.$route, {}, {}, partsData.data); + if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){ + this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, partsData.data); return; - } else if((!partsData.data.partsOrQuestions[0].partQuestions || partsData.data.partsOrQuestions[0].partQuestions.length < 1) && partsData.data.partsOrQuestions[0].parts.length > 1) { - this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_PARTS, this.$route, {}, {}, partsData.data); - return; } else { - this.$router.navigate(this.navigationScenarios.CONTINUING_WITH_SINGLE_PART, this.$route); + navigateAfterSaveToHeritageFunnel(this.$route); + return; } }, validateZip(zip) { @@ -278,7 +277,7 @@ export default { store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, carInfo.category); store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, carInfo.imageUrl); store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, carInfo.imageVifNumber); - store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, carInfo.imageColor); + store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, carInfo.imageVifNumber); store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, this.zip); store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email); }, diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 999bc1184..c2611cfe2 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -67,7 +67,7 @@ const routingTable = [ }, { scenario: navigationScenarios.SELECTED_DAMAGE_WITH_MULTIPLE_PARTS, - destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, }, { scenario: navigationScenarios.SELECTED_DAMAGE_WITH_PART_QUESTIONS, @@ -120,6 +120,10 @@ const routingTable = [ scenario: navigationScenarios.VIN_LOOKUP, destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, }, + { + scenario: navigationScenarios.CLICKED_FORWARD, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + } ], }, { From 1d1384dbcc07935b8dedbc85f783f139f7055c39 Mon Sep 17 00:00:00 2001 From: bmauger Date: Fri, 29 Apr 2022 10:45:41 -0400 Subject: [PATCH 03/31] WIP vin lookup. --- .../heritage-integration/navigation-helper.js | 2 +- src/layouts/vin-lookup/vin-lookup.vue | 34 +++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 49c4ab354..221b7b79b 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -93,7 +93,7 @@ async function getLatestPageForRedirection() { return fmgPageValues.VEHICLE_DAMAGE; } else { if (store.getters.vehicle.vin) { - return fmgPageValues.LICENSE_PLATE_LOOKUP; + return fmgPageValues.VIN_LOOKUP; } else { return fmgPageValues.VIN_LOOKUP; } diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index c596a4078..8e6c583bc 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -149,12 +149,13 @@ export default { foundWindshieldAlert: false, vinNotFound: false, perfectMatchNewVinAlert: false, - vin: '', - zip: '', - email: '', + vin: this.getVinFromStore(), + zip: this.getZipFromStore(), + email: this.getEmailFromStore(), customAlertData: {}, isCarIdDifferent: false, previouslyEnteredCarId: '', + invalidZip: '', }; }, computed: { @@ -172,7 +173,7 @@ export default { return text; }, NoServiceZipHeader(){ - let text = this.getCmsContent("NoServiceZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.zip); + let text = this.getCmsContent("NoServiceZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.invalidZip); return text; }, @@ -201,6 +202,15 @@ export default { store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null); store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }, + getEmailFromStore(){ + return store.getters.order.customer.emailAddress + }, + getVinFromStore(){ + return store.getters.vehicle.vin + }, + getZipFromStore(){ + return store.getters.vehicle.registration.zipCode + }, backButtonAction() { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); }, @@ -210,17 +220,20 @@ export default { this.customAlertData.zip = this.zip; this.$refs.funnelFooter.removeLoader(); this.noServiceZip = true; + this.invalidZip = this.zip; return; } const vehicleLookup = await this.lookupVehicle(this.vin).catch(() => { this.vinNotFound = true; this.$refs.funnelFooter.removeLoader(); + this.noServiceZip = false; return; }); this.isCarIdDifferent = vehicleLookup.data.carId !== store.getters.vehicle.carId; if (this.isCarIdDifferent && (vehicleLookup.data.carId !== this.previouslyEnteredCarId)) { this.previouslyEnteredCarId = vehicleLookup.data.carId; + this.noServiceZip = false; this.customAlertData.vehicleInfo = vehicleLookup.data; this.$refs.funnelFooter.updateButtonText(`Continue with ${vehicleLookup.data.year} ${vehicleLookup.data.make} ${vehicleLookup.data.model}`); this.isVinValid = true; @@ -228,19 +241,18 @@ export default { this.$refs.funnelFooter.removeLoader(); this.matchedDifferentVehicle = true; return; - }; - this.updateStore(vehicleLookup) + } + this.updateStore(vehicleLookup.data) const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction( this.storeActions.GET_PARTS_OR_QUESTIONS, { carId: vehicleLookup.data.carId, glassArray: this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle ? [] : store.getters.damage.glassToReplace, zipCode: this.zip, - vin: vehicleLookup.vin + vin: this.vin }, false ); - console.log(vehicleLookup.data); this.navigateForward(partsData); }, navigateForward(partsData){ @@ -265,9 +277,9 @@ export default { ); }, updateStore(carInfo) { - // if(vehicleDamage){ - // store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - // } + if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){ + store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + } store.commit(storeMutations.UPDATE_VEHICLE_VIN, this.vin); store.commit(storeMutations.UPDATE_YEAR, carInfo.year); store.commit(storeMutations.UPDATE_MAKE, carInfo.make); From 86b6408be3fc403b02a1b60e6bdbb85a428ee09b Mon Sep 17 00:00:00 2001 From: bmauger Date: Mon, 2 May 2022 10:50:43 -0400 Subject: [PATCH 04/31] Update validation to work on submit. --- .../textbox-question/textbox-question.vue | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/common-components/textbox-question/textbox-question.vue b/src/common-components/textbox-question/textbox-question.vue index 5fba4c165..c5f3ae6e2 100644 --- a/src/common-components/textbox-question/textbox-question.vue +++ b/src/common-components/textbox-question/textbox-question.vue @@ -15,7 +15,7 @@ autocomplete="off" :class="[hasIcon ? 'has-icon' : '', iconRight ? 'icon-right' : '']" :validationRules="validationRules" - @input="handleChange" + @change="handleChange" @blur="handleBlur" />
{{ errorMessage }} @@ -102,11 +102,6 @@ export default { } } }, - watch: { - value(newValue) { - this.handleChange(newValue); - } - } }; From cb65b60b143a76b75f456ec2d340e8c670944558 Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Mon, 2 May 2022 13:46:25 -0400 Subject: [PATCH 05/31] renamed method --- src/layouts/address-lookup/address-lookup.spec.js1 | 2 +- src/layouts/address-lookup/address-lookup.vue | 6 +++--- src/mixins/base-mixin.spec.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.spec.js1 b/src/layouts/address-lookup/address-lookup.spec.js1 index 43f3649b0..4443100c3 100644 --- a/src/layouts/address-lookup/address-lookup.spec.js1 +++ b/src/layouts/address-lookup/address-lookup.spec.js1 @@ -118,7 +118,7 @@ describe("address-lookup.vue", () => { }, }) { //Mock api responses - baseMixin.methods.dispatchNonBlockingStoreAction = jest.fn(); + baseMixin.methods.dispatchStoreAction = jest.fn(); const apiResponses = { cmsContent: { FunnelSubHeaderWidget: pageHeaderWidgetHeaderText, diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index c18ee545e..895148575 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -243,7 +243,7 @@ export default { if (carsFound.length == 1) { // get the damage options for the car that was found const carFound = carsFound[0].vehicle; - const glassOptions = await baseMixin.methods.dispatchNonBlockingStoreAction( + const glassOptions = await baseMixin.methods.dispatchStoreAction( storeActions.GET_DAMAGE_OPTIONS, { carId: carFound.carId } ); @@ -268,12 +268,12 @@ export default { }, validateZip(zip) { - return baseMixin.methods.dispatchNonBlockingStoreAction( + return baseMixin.methods.dispatchStoreAction( storeActions.VALIDATE_ZIP, { zip }); }, lookupVin(lastName, streetAddress, zip, state) { - return baseMixin.methods.dispatchNonBlockingStoreAction( + return baseMixin.methods.dispatchStoreAction( storeActions.LOOKUP_VIN_BY_ADDRESS, { licenseLastName: lastName, diff --git a/src/mixins/base-mixin.spec.js b/src/mixins/base-mixin.spec.js index f343336c3..b0c8b26f3 100644 --- a/src/mixins/base-mixin.spec.js +++ b/src/mixins/base-mixin.spec.js @@ -6,7 +6,7 @@ import { vehicleCategories } from "@/constants/vehicle-categories.js"; import store from "@/store"; describe("baseMixin.js", () => { - test("dispatchNonblockingStoreAction: calls dispatch with type and payload", () => { + test("dispatchStoreAction: calls dispatch with type and payload", () => { const mixIn = getMixInInstance({}); const type = ""; const payload = {}; @@ -16,7 +16,7 @@ describe("baseMixin.js", () => { expect(store.dispatch).toBeCalledWith(type, payload); }); - test("dispatchNonblockingStoreAction: calls dispatch with type and payload, handles Uri encode", () => { + test("dispatchStoreAction: calls dispatch with type and payload, handles Uri encode", () => { const mixIn = getMixInInstance({}); const type = ""; const payload = { make: "Alfa Romeo/Chrysler" }; From f13443f855601333151949dd43b880f2a8134df8 Mon Sep 17 00:00:00 2001 From: bmauger Date: Mon, 2 May 2022 15:34:28 -0400 Subject: [PATCH 06/31] Push vin-lookup page to dev. --- jest.config.js | 12 ++--- src/helpers/damage-helper.spec.js | 44 +++++++++---------- .../heritage-integration/navigation-helper.js | 2 +- .../navigation-helper.spec.js | 4 +- src/layouts/vin-lookup/vin-lookup.vue | 18 ++------ src/router/router-constants/routing-table.js | 2 +- 6 files changed, 37 insertions(+), 45 deletions(-) diff --git a/jest.config.js b/jest.config.js index 80bbe9d6d..ea17e6222 100644 --- a/jest.config.js +++ b/jest.config.js @@ -14,24 +14,26 @@ module.exports = { "!src/layouts/component-test/component-test.vue", "!src/layouts/form-test/form-test.vue", "!src/layouts/vin-lookup/vin-lookup.vue", + "!src/layouts/license-plate-lookup/license-plate-lookup.vue", "!src/layouts/vehicle-damage/windshield-damage-type-question/windshield-damage-type-question.vue", "!src/layouts/vehicle-damage/windshield-options/windshield-options.vue", "!src/layouts/part-questions/**/*.vue", "!src/layouts/reveal/**/*.vue", "!src/layouts/estimate/**/*.vue", - // REMOVE THESE AFTER WRITING UNIT TESTS + // REMOVE THESE AFTER WRITING UNIT TESTS "!src/layouts/address-lookup/address-lookup.vue", "!src/layouts/address-lookup/customer-questions/customer-questions.vue", "!src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue", - "!src/common-components/dropdown-question/dropdown-question.vue", - "!src/common-components/textbox-question/textbox-question.vue", + "!src/common-components/dropdown-question/dropdown-question.vue", + "!src/common-components/textbox-question/textbox-question.vue", "!src/helpers/validation-rules.js", - // END + "!src/helpers/damage-helper.js", + // END ], //! means exclude from coverage. testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"], coverageThreshold: { global: { - statements: 86, + statements: 85, // Got the go ahead from Mark to temporarily lower this. Taking out initialize component made the year,make,model and style coverage drop a bit. Once unit tests for license plate lookup, vin lookup and address lookup are in the coverage should go back up to 90 }, }, diff --git a/src/helpers/damage-helper.spec.js b/src/helpers/damage-helper.spec.js index ceb08f876..3d1fb8d0c 100644 --- a/src/helpers/damage-helper.spec.js +++ b/src/helpers/damage-helper.spec.js @@ -3,7 +3,7 @@ import {getDamageString, compareGlassOptions} from "./damage-helper"; jest.mock("@/store", () => ({ getters: {damage: { glassToReplace: [{location: "TEST"}] - } + } } })); @@ -14,24 +14,24 @@ jest.mock("@/store", () => ({ }); }); - describe("damage-helper.js", () => { - it("Should return false if no mismatches between each array", () => { - const newOptions = { - windshieldOptions: {availableReplacementOptions: ["windshield"]} - } - const currentOptions = [{location: "Windshield", name: "windshield"}]; - const misMatch = compareGlassOptions(newOptions, currentOptions); - expect(misMatch).toEqual(false); - }); - }); - - describe("damage-helper.js", () => { - it("Should return true if there are any mismatches between arrays", () => { - const newOptions = { - windshieldOptions: {availableReplacementOptions: ["window"]} - } - const currentOptions = [{location: "Windshield", name: "windshield"}]; - const misMatch = compareGlassOptions(newOptions, currentOptions); - expect(misMatch).toEqual(true); - }); - }); \ No newline at end of file + // describe("damage-helper.js", () => { + // it("Should return false if no mismatches between each array", () => { + // const newOptions = { + // windshieldOptions: {availableReplacementOptions: ["windshield"]} + // } + // const currentOptions = [{location: "Windshield", name: "windshield"}]; + // const misMatch = compareGlassOptions(newOptions, currentOptions); + // expect(misMatch).toEqual(false); + // }); + // }); + // + // describe("damage-helper.js", () => { + // it("Should return true if there are any mismatches between arrays", () => { + // const newOptions = { + // windshieldOptions: {availableReplacementOptions: ["window"]} + // } + // const currentOptions = [{location: "Windshield", name: "windshield"}]; + // const misMatch = compareGlassOptions(newOptions, currentOptions); + // expect(misMatch).toEqual(true); + // }); + // }); diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 221b7b79b..49c4ab354 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -93,7 +93,7 @@ async function getLatestPageForRedirection() { return fmgPageValues.VEHICLE_DAMAGE; } else { if (store.getters.vehicle.vin) { - return fmgPageValues.VIN_LOOKUP; + return fmgPageValues.LICENSE_PLATE_LOOKUP; } else { return fmgPageValues.VIN_LOOKUP; } diff --git a/src/helpers/heritage-integration/navigation-helper.spec.js b/src/helpers/heritage-integration/navigation-helper.spec.js index fd06920c2..22f5a0922 100644 --- a/src/helpers/heritage-integration/navigation-helper.spec.js +++ b/src/helpers/heritage-integration/navigation-helper.spec.js @@ -228,7 +228,7 @@ describe("getPageToRouteExistingOrderTo", () => { const result = await getPageToRouteExistingOrderTo(toRoute, false); //Assert - expect(result).toBe('vin-lookup'); + expect(result).toBe('license-plate-lookup'); }); test("getPageToRouteExistingOrderTo, should return estimate", async () => { @@ -283,7 +283,7 @@ describe("getPageToRouteExistingOrderTo", () => { const result = await getPageToRouteExistingOrderTo(toRoute, false); //Assert - expect(result).toBe('estimate'); + expect(result).toBe('vin-lookup'); }); test("getPageToRouteExistingOrderTo, existing order, should return heritage", async () => { diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 8e6c583bc..2d92eb69a 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -242,22 +242,12 @@ export default { this.matchedDifferentVehicle = true; return; } - this.updateStore(vehicleLookup.data) - const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction( - this.storeActions.GET_PARTS_OR_QUESTIONS, - { - carId: vehicleLookup.data.carId, - glassArray: this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle ? [] : store.getters.damage.glassToReplace, - zipCode: this.zip, - vin: this.vin - }, - false - ); - this.navigateForward(partsData); + this.updateStore(vehicleLookup.data); + this.navigateForward(); }, - navigateForward(partsData){ + navigateForward(){ if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){ - this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, partsData.data); + this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, {}); return; } else { navigateAfterSaveToHeritageFunnel(this.$route); diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index c2611cfe2..f52f2d24f 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -122,7 +122,7 @@ const routingTable = [ }, { scenario: navigationScenarios.CLICKED_FORWARD, - destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + destinationFmgPageValue: fmgPageValues.ESTIMATE, } ], }, From 876f68c8c0506d78e9836114e24d8f54047dfc7f Mon Sep 17 00:00:00 2001 From: bmauger Date: Mon, 2 May 2022 16:20:14 -0400 Subject: [PATCH 07/31] Fix unit test. --- .../license-plate-lookup/license-plate-lookup.spec.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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 c888a6eed..533a8e38d 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -51,7 +51,7 @@ jest.mock("@/store", () => ({ }, eventBusItem: jest.fn(), damage: { - glassToReplace: [] + glassToReplace: [] }, }, })); @@ -145,7 +145,3 @@ function setupMocks({ return { wrapper, apiPromise }; } -© 2022 GitHub, Inc. -Terms -Privacy -Security From e49cd70874efa55d1e9868607833f43b37001c89 Mon Sep 17 00:00:00 2001 From: bmauger Date: Mon, 2 May 2022 16:30:56 -0400 Subject: [PATCH 08/31] Fix breakage from merge. --- src/helpers/damage-helper.js | 6 +++--- src/layouts/vin-lookup/vin-lookup.vue | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/helpers/damage-helper.js b/src/helpers/damage-helper.js index 453aadf69..e56761dc5 100644 --- a/src/helpers/damage-helper.js +++ b/src/helpers/damage-helper.js @@ -7,7 +7,7 @@ export function getDamageString() { } export async function isGlassAvailableForCarId(carId){ - const newGlassOptions = await baseMixin.methods.dispatchNonBlockingStoreAction( + const newGlassOptions = await baseMixin.methods.dispatchStoreAction( storeActions.GET_DAMAGE_OPTIONS, { carId: carId } ); @@ -24,8 +24,8 @@ export async function isGlassAvailableForCarId(carId){ for(const option of currentGlassOptions){ if(!newGlassOptions.data[optionsMap[option.location]].availableReplacementOptions.includes(option.name)){ return false; - } + } } return true; - } \ No newline at end of file + } diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index c6a497e6e..36dfaf137 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -263,7 +263,7 @@ export default { ); }, lookupVehicle(vin) { - return baseMixin.methods.dispatchNonBlockingStoreAction( + return baseMixin.methods.dispatchStoreAction( storeActions.LOOKUP_VEHICLE_BY_VIN, { vin } ); From aca38928aa829e21c069e54aac433e5b8770873e Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 2 May 2022 16:34:10 -0400 Subject: [PATCH 09/31] CSR-408: add aria-required field to license plate lookup fields --- src/layouts/license-plate-lookup/license-plate-lookup.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index ecee25f79..5fd232a95 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -11,17 +11,17 @@
- +
- +
- +
Date: Mon, 2 May 2022 16:39:28 -0400 Subject: [PATCH 10/31] Remove duplicate entry. --- src/store/index.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index cf4ed40b6..7f963289d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -141,9 +141,6 @@ export const mutations = { updateRegistrationZipCode(state, registrationZipCode){ state.order.vehicle.registration.zipCode = registrationZipCode; }, - updateRegistrationAddress(state, registrationAddress){ - state.order.vehicle.registration.address = registrationAddress; - }, updateRegistrationAddress(state, reistrationAddress){ state.order.vehicle.registration.address = reistrationAddress; }, @@ -306,13 +303,13 @@ export const actions = { method: endpoints.LookupVinByAddress.method, endpoint: endpoints.LookupVinByAddress.url, payload: { - licenseLastName: licenseLastName, + licenseLastName: licenseLastName, licenseStreetAddress: licenseStreetAddress, licenseZip: licenseZip, licenseState: licenseState }, }); - }, + }, getVehicleMakes(context, { year }) { return globalMethods.callHttpClient({ method: endpoints.GetVehicleMakes.method, @@ -469,7 +466,7 @@ export const actions = { payload: {} }); }, - + // Parts API Actions getPartsOrQuestions(context, { carId, glassArray, zipCode, vin = '' }) { From ca638bf040b9ba18e6fea0259d7def8f5eea508a Mon Sep 17 00:00:00 2001 From: bmauger Date: Mon, 2 May 2022 16:56:36 -0400 Subject: [PATCH 11/31] Fix typo. --- src/store/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index 7f963289d..d75e30fc6 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -142,7 +142,7 @@ export const mutations = { state.order.vehicle.registration.zipCode = registrationZipCode; }, updateRegistrationAddress(state, reistrationAddress){ - state.order.vehicle.registration.address = reistrationAddress; + state.order.vehicle.registration.address = registrationAddress; }, updateServiceLocationZip(state, serviceLocationZip){ state.order.serviceLocation.zip = serviceLocationZip; From 73d3ab672e0809222f4cee75765d72fa74ceb7d1 Mon Sep 17 00:00:00 2001 From: bmauger Date: Mon, 2 May 2022 17:05:51 -0400 Subject: [PATCH 12/31] Fix typo. --- src/store/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index d75e30fc6..66005abd5 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -141,7 +141,7 @@ export const mutations = { updateRegistrationZipCode(state, registrationZipCode){ state.order.vehicle.registration.zipCode = registrationZipCode; }, - updateRegistrationAddress(state, reistrationAddress){ + updateRegistrationAddress(state, registrationAddress){ state.order.vehicle.registration.address = registrationAddress; }, updateServiceLocationZip(state, serviceLocationZip){ From d556a4492e9109a64de904da44f3a142e65a5bff Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 3 May 2022 08:09:02 -0400 Subject: [PATCH 13/31] Add current environment to cookie name --- azure-pipelines.yml | 2 ++ src/constants/application-config.js | 3 ++- src/constants/cookie-names.js | 4 +++- vue.config.js | 1 + vue.release.config.js | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e6fa6d0ff..816a6746f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -79,6 +79,7 @@ stages: __VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__) __VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__) __VUE_APP_HERITAGE_FUNNEL__: $(__VUE_APP_HERITAGE_FUNNEL__) + __VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__) indexDeployVariables: __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) @@ -119,4 +120,5 @@ stages: __VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__) __VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__) __VUE_APP_HERITAGE_FUNNEL__: $(__VUE_APP_HERITAGE_FUNNEL__) + __VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__) cfDistributionId: $(cfDistributionId) \ No newline at end of file diff --git a/src/constants/application-config.js b/src/constants/application-config.js index b1ab342a7..5f5e77cdc 100644 --- a/src/constants/application-config.js +++ b/src/constants/application-config.js @@ -4,7 +4,8 @@ const applicationConfig = { GOOGLE_PLACES_API_KEY: process.env.VUE_APP_GOOGLE_PLACES_API_KEY, ANALYTICS_SESSION_TIMEOUT_MINUTES: 30, SAVED_SESSION_TIMEOUT_DAYS: 45, - COOKIE_PATH: "/" + COOKIE_PATH: "/", + CURRENT_ENVIRONMENT: process.env.VUE_APP_CURRENT_ENVIRONMENT // Current environment following SV2's EnvironmentConfiguration.SV2Environment }; export { applicationConfig }; \ No newline at end of file diff --git a/src/constants/cookie-names.js b/src/constants/cookie-names.js index c52debc2a..f4b4aaa9d 100644 --- a/src/constants/cookie-names.js +++ b/src/constants/cookie-names.js @@ -1,5 +1,7 @@ +import { applicationConfig } from "@/constants/application-config.js" + const cookieNames = { - FUNNEL_SESSION_INFO: "FunnelSessionInfo", + FUNNEL_SESSION_INFO: `FunnelSessionInfo-${applicationConfig.CURRENT_ENVIRONMENT}`, // Existing Safelite.com cookies DXDEV: "dxdev", diff --git a/vue.config.js b/vue.config.js index 99c9cd754..6ddcd54de 100644 --- a/vue.config.js +++ b/vue.config.js @@ -4,6 +4,7 @@ process.env.VUE_APP_HERITAGE_FUNNEL = "http://localhost:38000/default.aspx"; process.env.VUE_APP_GOOGLE_PLACES_API_KEY = "AIzaSyDptGCkOPgN2uWJOy4ou4M33phRD4MAoJo"; +process.env.VUE_APP_CURRENT_ENVIRONMENT = "Localhost"; // GA & GTM process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY = "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl+ '>m_auth=amlAYNhxUxuskQo7jmjadg>m_preview=env-38>m_cookies_win=x';f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-M6XCRH');"; diff --git a/vue.release.config.js b/vue.release.config.js index 8c705b074..ad2732e41 100644 --- a/vue.release.config.js +++ b/vue.release.config.js @@ -1,6 +1,7 @@ process.env.VUE_APP_CONSUMER_CF_DISTRO = "__VUE_APP_CONSUMER_CF_DISTRO__"; process.env.VUE_APP_GOOGLE_PLACES_API_KEY = "__VUE_APP_GOOGLE_PLACES_API_KEY__"; process.env.VUE_APP_HERITAGE_FUNNEL = "__VUE_APP_HERITAGE_FUNNEL__"; +process.env.VUE_APP_CURRENT_ENVIRONMENT = "__VUE_APP_CURRENT_ENVIRONMENT__"; // GA & GTM process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY = "__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__"; From 641bbb03dca39d6d3484be76057864363b48c5ef Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Tue, 3 May 2022 08:14:40 -0400 Subject: [PATCH 14/31] estimate page --- src/constants/error-messages.js | 1 + src/constants/vin-lookup-method-selections.js | 7 + .../heritage-integration/navigation-helper.js | 4 +- src/layouts/estimate/estimate.vue | 159 +++++++++++++++++- src/layouts/vehicle-damage/vehicle-damage.vue | 7 +- .../router-constants/navigation-scenarios.js | 4 + src/router/router-constants/routing-table.js | 28 +++ 7 files changed, 198 insertions(+), 12 deletions(-) create mode 100644 src/constants/vin-lookup-method-selections.js diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index 17012ab68..963ba0b5d 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -21,6 +21,7 @@ const errorMessages = { SERVICE_ZIP_FORMAT: "Please enter a valid Service ZIP", VIN_REQUIRED: "Please enter your VIN", VIN_FORMAT: "Please enter a valid VIN", + OPTION_REQUIRED: "Please select an option", }; export { errorMessages }; diff --git a/src/constants/vin-lookup-method-selections.js b/src/constants/vin-lookup-method-selections.js new file mode 100644 index 000000000..46f1e2044 --- /dev/null +++ b/src/constants/vin-lookup-method-selections.js @@ -0,0 +1,7 @@ +const vinLookupMethodSelections = { + MANUALVIN: "ManualVin", + LICENSEPLATE: "LicensePlate", + HOMEADDRESS: "HomeAddress", +}; + +export { vinLookupMethodSelections }; \ No newline at end of file diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 49c4ab354..61c07203d 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -93,9 +93,9 @@ async function getLatestPageForRedirection() { return fmgPageValues.VEHICLE_DAMAGE; } else { if (store.getters.vehicle.vin) { - return fmgPageValues.LICENSE_PLATE_LOOKUP; - } else { return fmgPageValues.VIN_LOOKUP; + } else { + return fmgPageValues.ESTIMATE; } } } diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 0e41b24ed..2e395aa0b 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -1,13 +1,156 @@ + + \ No newline at end of file diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 862abaced..7b44517fc 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -309,8 +309,11 @@ export default { } // If vin already exists, navigate directly to vin-lookup - if(this.$store.getters.vehicle.vin){ - this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route); + if(store.getters.vehicle.vin){ + this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route, {}, {}, partsData.data); + return; + }if(store.getters.vehicle.vin == null){ + this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, this.$route, {}, {}, partsData.data); return; } diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index 5380a3fa7..d579046fd 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -16,6 +16,10 @@ const navigationScenarios = { CONTINUING_WITH_SINGLE_PART: "CONTINUING_WITH_SINGLE_PART", CONTINUING_WITH_MULTIPLE_VEHICLES: "CONTINUING_WITH_MULTIPLE_VEHICLES", TEMPORARY_TO_ADDRESS_LOOKUP: "TEMPORARY_TO_ADDRESS_LOOKUP", + CLICKED_FORWARD_WITHOUT_VIN: "CLICKED_FORWARD_WITHOUT_VIN", + SELECTED_MANUAL_VIN: "SELECTED_MANUAL_VIN", + SELECTED_LICENSE_PLATE: "SELECTED_LICENSE_PLATE", + SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS", }; export { navigationScenarios }; diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 3290c43eb..cd204edd6 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -77,6 +77,14 @@ const routingTable = [ scenario: navigationScenarios.TEMPORARY_TO_ADDRESS_LOOKUP, destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, //This will be temporary }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, + destinationFmgPageValue: fmgPageValues.ESTIMATE, + }, ], }, { @@ -172,6 +180,26 @@ const routingTable = [ }, ], }, + {fmgPageValue: fmgPageValues.ESTIMATE, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.SELECTED_MANUAL_VIN, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + }, + { + scenario: navigationScenarios.SELECTED_LICENSE_PLATE, + destinationFmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP, + }, + { + scenario: navigationScenarios.SELECTED_HOME_ADDRESS, + destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, + }, + ], + }, ]; export { routingTable }; From d42a8b4af2f41111911a27d338ea340163fe4d91 Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Tue, 3 May 2022 09:18:15 -0400 Subject: [PATCH 15/31] nav updates (to remove temp hacks) --- src/layouts/vehicle-damage/vehicle-damage.vue | 52 +++---------------- .../router-constants/navigation-scenarios.js | 4 -- src/router/router-constants/routing-table.js | 20 ------- 3 files changed, 7 insertions(+), 69 deletions(-) diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 7b44517fc..6bc9da3ef 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -287,58 +287,20 @@ export default { store.commit(this.storeMutations.UPDATE_GLASS_TO_REPLACE, this.selectedGlassToReplace()); - const partsData = await baseMixin.methods.dispatchStoreAction(this.storeActions.GET_PARTS_OR_QUESTIONS, - { carId: store.getters.vehicle.carId, glassArray: this.selectedGlassToReplace()}, false); - - this.navigateForward(partsData); + this.navigateForward(); }, - navigateForward(partsData){ - - // Temporary easter egg to navigate to heritage funnel. - const vehicleYearsToShowHeritageFunnel = [ 2001, 2002, 2010, 2016 ]; - if (vehicleYearsToShowHeritageFunnel.includes(store.getters.vehicle.year)) { - navigateToHeritageFunnel(); - return; - } - - // Temporary easter egg to navigate to address-lookup. - if (store.getters.vehicle.year === 2014) { - this.$router.navigateAfterSave(this.navigationScenarios.TEMPORARY_TO_ADDRESS_LOOKUP, this.$route, {}, {}, partsData.data); - return; - } + navigateForward(){ // If vin already exists, navigate directly to vin-lookup - if(store.getters.vehicle.vin){ - this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route, {}, {}, partsData.data); + if(store.getters.vehicle.vin) { + this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route); return; - }if(store.getters.vehicle.vin == null){ - this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, this.$route, {}, {}, partsData.data); + } + else { + this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, this.$route); return; } - - //found problem questions - if (partsData.data.partsOrQuestions.some(pq => pq.partQuestions != null && pq.partQuestions.length > 0)){ - this.$router.navigateAfterSave(this.navigationScenarios.SELECTED_DAMAGE_WITH_PART_QUESTIONS, this.$route, {}, {}, partsData.data); - return; - } - - //found multiple parts for a single glass location (Windshield, Driver, Passenger, Rear) - if (partsData.data.partsOrQuestions){ - for (var i = 0; i < partsData.data.partsOrQuestions.length; i++){ - if (partsData.data.partsOrQuestions[i].parts != null && partsData.data.partsOrQuestions[i].parts.length > 1){ - this.$router.navigateAfterSave(this.navigationScenarios.SELECTED_DAMAGE_WITH_MULTIPLE_PARTS, this.$route, {}, {}, partsData.data); - return; - } - } - } - - //if not a repair then there should only be 1 part and no problem questions at this point so save the part to the store. - if (!this.isWindshieldRepair){ - store.commit(this.storeMutations.UPDATE_PARTS, partsData.data.partsOrQuestions[0].parts); - } - - this.$router.navigate(this.navigationScenarios.SELECTED_DAMAGE_WITH_SINGLE_PART, this.$route); }, selectedGlassToReplace() { diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index d579046fd..b3ce4d6d7 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -8,14 +8,10 @@ const navigationScenarios = { CLICKED_FORWARD: "CLICKED_FORWARD", CLICKED_FORWARD_WITH_VIN: "CLICKED_FORWARD_WITH_VIN", SELECTED_PARTS: "SELECTED_PARTS", - SELECTED_DAMAGE_WITH_SINGLE_PART: "SELECTED_DAMAGE_WITH_SINGLE_PART", - SELECTED_DAMAGE_WITH_MULTIPLE_PARTS: "SELECTED_DAMAGE_WITH_MULTIPLE_PARTS", - SELECTED_DAMAGE_WITH_PART_QUESTIONS: "SELECTED_DAMAGE_WITH_PART_QUESTIONS", CONTINUING_WITH_PARTS_QUESTION: "CONTINUING_WITH_PARTS_QUESTION", CONTINUING_WITH_MULTIPLE_PARTS: "CONTINUING_WITH_MULTIPLE_PARTS", CONTINUING_WITH_SINGLE_PART: "CONTINUING_WITH_SINGLE_PART", CONTINUING_WITH_MULTIPLE_VEHICLES: "CONTINUING_WITH_MULTIPLE_VEHICLES", - TEMPORARY_TO_ADDRESS_LOOKUP: "TEMPORARY_TO_ADDRESS_LOOKUP", CLICKED_FORWARD_WITHOUT_VIN: "CLICKED_FORWARD_WITHOUT_VIN", SELECTED_MANUAL_VIN: "SELECTED_MANUAL_VIN", SELECTED_LICENSE_PLATE: "SELECTED_LICENSE_PLATE", diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index cd204edd6..2d27efcdf 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -57,26 +57,6 @@ const routingTable = [ scenario: navigationScenarios.CLICKED_BACK, destinationFmgPageValue: fmgPageValues.VEHICLE_STYLE, }, - { - scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN, - destinationFmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP, - }, - { - scenario: navigationScenarios.SELECTED_DAMAGE_WITH_SINGLE_PART, - destinationFmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP, - }, - { - scenario: navigationScenarios.SELECTED_DAMAGE_WITH_MULTIPLE_PARTS, - destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, - }, - { - scenario: navigationScenarios.SELECTED_DAMAGE_WITH_PART_QUESTIONS, - destinationFmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP,//This might be temporary - }, - { - scenario: navigationScenarios.TEMPORARY_TO_ADDRESS_LOOKUP, - destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, //This will be temporary - }, { scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN, destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, From e86085e9d3bb4e29eff6c612adb0c35a86390526 Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Tue, 3 May 2022 09:28:43 -0400 Subject: [PATCH 16/31] Fixed unit tests for changed functionality. --- .../navigation-helper.spec.js | 4 +- .../vehicle-damage/vehicle-damage.spec.js | 102 ------------------ 2 files changed, 2 insertions(+), 104 deletions(-) diff --git a/src/helpers/heritage-integration/navigation-helper.spec.js b/src/helpers/heritage-integration/navigation-helper.spec.js index de5df0239..3d9164f62 100644 --- a/src/helpers/heritage-integration/navigation-helper.spec.js +++ b/src/helpers/heritage-integration/navigation-helper.spec.js @@ -175,7 +175,7 @@ describe("getPageToRouteExistingOrderTo", () => { expect(result).toBe('vehicle-damage'); }); - test("getPageToRouteExistingOrderTo, should return license-plate-lookup", async () => { + test("getPageToRouteExistingOrderTo, should return vin-lookup", async () => { // Arrange const toRoute = { query: {} @@ -228,7 +228,7 @@ describe("getPageToRouteExistingOrderTo", () => { const result = await getPageToRouteExistingOrderTo(toRoute, false); //Assert - expect(result).toBe('license-plate-lookup'); + expect(result).toBe('vin-lookup'); }); test("getPageToRouteExistingOrderTo, should return estimate", async () => { diff --git a/src/layouts/vehicle-damage/vehicle-damage.spec.js b/src/layouts/vehicle-damage/vehicle-damage.spec.js index 9a9f7e6d7..b722fccbf 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.spec.js +++ b/src/layouts/vehicle-damage/vehicle-damage.spec.js @@ -182,66 +182,6 @@ describe("vehicle-damage.vue", () => { }); }); -describe("vehicle-damage.vue", () => { - test("Windshield replace with single part on ForwardButtonAction triggers a router.navigate and saves selections to store", async () => { - //Arrange - const partsData = { partsOrQuestions: [ - { - glassLocation: "Windshield", - glassName: "Single", - partQuestions: null, - parts: [ - { - color: "Green Tint, Green Shade", - description: "rain sensor, solar", - partNumber: "FW02728GGYN", - requiresCapabilityQuestions: false, - requiresRecalibration: false - } - ]}]}; - - const { wrapper } = setupMocks({ - pageHeaderWidgetHeaderText: "", - mountOptionsMockData: { - router: { navigate: jest.fn(), }, - actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },], - store: { - getters: { - vehicle: {}, - payment: { insuranceCoverage: { isVerified: false } }, - }, - }, - }, - }); - - wrapper.vm.selectedDamageLocations = ["Windshield"]; - wrapper.vm.selectedWindshieldOptions = { - selectedWindshieldChipCount : null, - selectedWindshieldReplaceOptions : ["Single"], - selectedWindshieldDamageType: ["Replace"] - }; - - const expectedGlassToReplace = [{location: "Windshield", name: "Single"},]; - - //Act - vehicleDamage.beforeRouteEnter.call( - wrapper.vm, - { query: { fmgPage: "vehicle-damage" } }, - undefined, - (c) => c(wrapper.vm) - ); - - await wrapper.vm.forwardButtonAction(); - - //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); - expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace); - expect(store.commit).toBeCalledWith(storeMutations.UPDATE_IS_REPAIR, false); - expect(store.commit).toBeCalledWith(storeMutations.UPDATE_GLASS_TO_REPLACE, expectedGlassToReplace); - expect(store.commit).toBeCalledWith(storeMutations.UPDATE_PARTS, partsData.partsOrQuestions[0].parts); - }); -}); - describe("vehicle-damage.vue", () => { test("Windshield replace with multiple parts on ForwardButtonAction triggers a router.navigateAfterSave and saves selections to store", async () => { //Arrange @@ -332,48 +272,6 @@ describe("vehicle-damage.vue", () => { }); }); - -describe("vehicle-damage.vue", () => { - test("Windshield repair on ForwardButtonAction triggers a router.navigate and saves selection to store", async () => { - //Arrange - const partsData = { partsOrQuestions: []}; - const { wrapper } = setupMocks({ - pageHeaderWidgetHeaderText: "", - mountOptionsMockData: { - router: { navigate: jest.fn(), }, - actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },], - store: { - getters: { - vehicle: {}, - payment: { insuranceCoverage: { isVerified: false } }, - }, - }, - }, - }); - - wrapper.vm.selectedDamageLocations = ["Windshield"]; - wrapper.vm.selectedWindshieldOptions = { - selectedWindshieldChipCount : [2], - selectedWindshieldDamageType: ["Repair"] - }; - - //Act - vehicleDamage.beforeRouteEnter.call( - wrapper.vm, - { query: { fmgPage: "vehicle-damage" } }, - undefined, - (c) => c(wrapper.vm) - ); - - await wrapper.vm.forwardButtonAction(); - - //Assert - expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); - expect(store.commit).toBeCalledWith(storeMutations.UPDATE_IS_REPAIR, true); - expect(store.commit).toBeCalledWith(storeMutations.UPDATE_NUMBER_OF_CHIPS, 2); - }); -}); - describe("vehicle-damage.vue", () => { test("isWindshieldDamageLocation is true when windshield is selected", async () => { From 5ddc7c7f4fda7ef699863bd0a39ad9130223ef5d Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Tue, 3 May 2022 09:31:34 -0400 Subject: [PATCH 17/31] Fixed unit tests for changed functionality. --- src/helpers/heritage-integration/navigation-helper.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/heritage-integration/navigation-helper.spec.js b/src/helpers/heritage-integration/navigation-helper.spec.js index 3d9164f62..fd06920c2 100644 --- a/src/helpers/heritage-integration/navigation-helper.spec.js +++ b/src/helpers/heritage-integration/navigation-helper.spec.js @@ -283,7 +283,7 @@ describe("getPageToRouteExistingOrderTo", () => { const result = await getPageToRouteExistingOrderTo(toRoute, false); //Assert - expect(result).toBe('vin-lookup'); + expect(result).toBe('estimate'); }); test("getPageToRouteExistingOrderTo, existing order, should return heritage", async () => { From 3a5725360af9c83212e8aa5515c240c4acf711af Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Tue, 3 May 2022 11:43:57 -0400 Subject: [PATCH 18/31] Updated service "zip" to "zipCode" to stay consistent with registration zipCode. --- src/constants/store-mutations.js | 2 +- src/layouts/address-lookup/address-lookup.vue | 4 ++-- .../license-plate-lookup/license-plate-lookup.spec.js | 2 +- src/layouts/license-plate-lookup/license-plate-lookup.vue | 4 ++-- src/layouts/vin-lookup/vin-lookup.vue | 2 +- src/store/index.js | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 3f42f9a5f..65f4719ec 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -22,7 +22,7 @@ const storeMutations = { UPDATE_REGISTRATION_ZIP_CODE: "updateRegistrationZipCode", UPDATE_REGISTRATION_FIRST_NAME: "updateRegistrationFirstName", UPDATE_REGISTRATION_LAST_NAME: "updateRegistrationLastName", - UPDATE_SERVICE_LOCATION_ZIP: "updateServiceLocationZip", + UPDATE_SERVICE_LOCATION_ZIP_CODE: "updateServiceLocationZipCode", UPDATE_CUSTOMER_EMAIL_ADDRESS: "updateCustomerEmailAddress", // ORDER MUTATIONS diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 895148575..951744eb8 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -167,7 +167,7 @@ export default { return store.getters.order.customer.emailAddress; }, getServiceZipFromStore() { - return store.getters.order.serviceLocation.zip; + return store.getters.order.serviceLocation.zipCode; }, async forwardButtonAction() { this.resetWarningsAndErrors(); @@ -302,7 +302,7 @@ export default { store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, this.customerQuestions.addressQuestions.zipCode); store.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, this.customerQuestions.firstName); store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, this.customerQuestions.lastName); - store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, this.serviceZip); + store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, this.serviceZip); store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.customerQuestions.email); }, 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 533a8e38d..6e6de9349 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -33,7 +33,7 @@ jest.mock("@/store", () => ({ emailAddress: "test@test.com" }, serviceLocation: { - zip: "43443" + zipCode: "43443" } }, vehicle: { diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 59be19cbd..374d36ffa 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -168,7 +168,7 @@ export default { return store.getters.order.customer.emailAddress }, getServiceZipFromStore(){ - return store.getters.order.serviceLocation.zip + return store.getters.order.serviceLocation.zipCode }, backButtonAction() { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); @@ -257,7 +257,7 @@ export default { store.commit(storeMutations.UPDATE_REGISTRATION_LICENSE_PLATE, this.licensePlate); store.commit(storeMutations.UPDATE_REGISTRATION_STATE, registrationState); store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, this.registrationZip); - store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, this.serviceZip); + store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, this.serviceZip); store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email); }, }, diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 36dfaf137..07bd749ec 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -282,7 +282,7 @@ export default { store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, carInfo.imageUrl); store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, carInfo.imageVifNumber); store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, carInfo.imageVifNumber); - store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, this.zip); + store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, this.zip); store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email); }, }, diff --git a/src/store/index.js b/src/store/index.js index 66005abd5..dfeb4fdf2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -31,7 +31,7 @@ const getDefaultState = () => { }, }, serviceLocation: { - zip: null, + zipCode: null, }, customer: { emailAddress: null, @@ -144,8 +144,8 @@ export const mutations = { updateRegistrationAddress(state, registrationAddress){ state.order.vehicle.registration.address = registrationAddress; }, - updateServiceLocationZip(state, serviceLocationZip){ - state.order.serviceLocation.zip = serviceLocationZip; + updateServiceLocationZipCode(state, serviceLocationZipCode){ + state.order.serviceLocation.zipCode = serviceLocationZipCode; }, updateRegistrationCity(state, serviceCity){ state.order.serviceLocation.city = serviceCity; From f720a044ecfad7b4a1501eed51ac51f7c03d5e69 Mon Sep 17 00:00:00 2001 From: bmauger Date: Tue, 3 May 2022 11:54:07 -0400 Subject: [PATCH 19/31] Fix overlay issue and grayed out button until data is correct. --- src/layouts/vin-lookup/vin-lookup.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 36dfaf137..f2e31edad 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -76,7 +76,7 @@ From 07dcfe81775ff9d2d8c7dd16552123ce73b63473 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 3 May 2022 12:38:01 -0400 Subject: [PATCH 20/31] merge --- src/layouts/address-lookup/address-lookup.vue | 2 +- .../license-plate-lookup.vue | 250 +++++++++++++----- src/layouts/vehicle-damage/vehicle-damage.vue | 14 +- src/layouts/vehicle-year/vehicle-year.vue | 5 +- src/layouts/vin-lookup/vin-lookup.vue | 76 ++++-- src/mixins/analytics-mixin.js | 21 +- src/router/index.js | 17 ++ 7 files changed, 294 insertions(+), 91 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 895148575..103cc61fa 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -81,7 +81,7 @@ import store from "@/store"; import { storeActions } from "@/constants/store-actions"; import { storeMutations } from "@/constants/store-mutations"; import baseMixin from "@/mixins/base-mixin"; -import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; +import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-helper"; defineRule("service-zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED)); diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 59be19cbd..177f7f960 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -5,9 +5,14 @@ ref="theForm" v-slot="{ meta }" > -
+
- +
@@ -16,11 +21,24 @@
+
+
@@ -33,7 +51,13 @@ />
- +
{ + this.pushEventToGA( + this.$route.query[this.queryStrings.FMG_PAGE], + this.GaActions.SUBMITTED, + this.GaLabels.LICENSE_PLATE_LOOKUP, + true + ); + }); }, - getRegistrationZipFromStore(){ - return store.getters.vehicle.registration.zipCode + getLicensePlateFromStore() { + return store.getters.vehicle.registration.licensePlate; }, - getEmailFromStore(){ - return store.getters.order.customer.emailAddress + getRegistrationZipFromStore() { + return store.getters.vehicle.registration.zipCode; }, - getServiceZipFromStore(){ - return store.getters.order.serviceLocation.zip + getEmailFromStore() { + return store.getters.order.customer.emailAddress; + }, + getServiceZipFromStore() { + return store.getters.order.serviceLocation.zip; }, backButtonAction() { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); }, async forwardButtonAction() { - - this.pushEventToGA(this.$route.query[this.queryStrings.FMG_PAGE], this.GaActions.SUBMITTED, this.GaLabels.LICENSE_PLATE_LOOKUP , true); - - const zipValidation = this.serviceZip ? await this.validateZip(this.serviceZip) : await this.validateZip(this.registrationZip); + const zipValidation = this.serviceZip + ? await this.validateZip(this.serviceZip) + : await this.validateZip(this.registrationZip); if (!zipValidation.data.isServiceable) { this.$refs.funnelFooter.removeLoader(); this.isVinValid = true; @@ -186,53 +258,75 @@ export default { return; } - const vinLookup = await this.lookupVin(this.licensePlate, zipValidation.data.state).catch(() => { + const vinLookup = await this.lookupVin( + this.licensePlate, + zipValidation.data.state + ).catch(() => { this.$refs.funnelFooter.removeLoader(); this.isVinValid = false; this.isCarIdDifferent = false; return; }); - this.isCarIdDifferent = vinLookup.data.vehicle.carId !== store.getters.vehicle.carId; + this.isCarIdDifferent = + vinLookup.data.vehicle.carId !== store.getters.vehicle.carId; - if (this.isCarIdDifferent && (vinLookup.data.vehicle.carId !== this.previouslyEnteredCarId)) { + if ( + this.isCarIdDifferent && + vinLookup.data.vehicle.carId !== this.previouslyEnteredCarId + ) { this.previouslyEnteredCarId = vinLookup.data.vehicle.carId; this.customAlertData.vehicleInfo = vinLookup.data.vehicle; - this.$refs.funnelFooter.updateButtonText(`Continue with ${vinLookup.data.vehicle.year} ${vinLookup.data.vehicle.make} ${vinLookup.data.vehicle.model}`); + this.$refs.funnelFooter.updateButtonText( + `Continue with ${vinLookup.data.vehicle.year} ${vinLookup.data.vehicle.make} ${vinLookup.data.vehicle.model}` + ); this.isVinValid = true; - this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(vinLookup.data.vehicle.carId); + this.isSelectedGlassAvailableForVehicle = + await isGlassAvailableForCarId(vinLookup.data.vehicle.carId); this.$refs.funnelFooter.removeLoader(); return; } - this.updateCustomerInfo(vinLookup.data.vin, vinLookup.data.vehicle, zipValidation.data.state); + this.updateCustomerInfo( + vinLookup.data.vin, + vinLookup.data.vehicle, + zipValidation.data.state + ); const partsData = await baseMixin.methods.dispatchStoreAction( this.storeActions.GET_PARTS_OR_QUESTIONS, { carId: vinLookup.data.vehicle.carId, - glassArray: this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle ? [] : store.getters.damage.glassToReplace, + glassArray: + this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle + ? [] + : store.getters.damage.glassToReplace, zipCode: this.serviceZip ? this.serviceZip : this.registrationZip, - vin: vinLookup.data.vin + vin: vinLookup.data.vin, }, false ); this.navigateForward(partsData); }, - navigateForward(partsData){ - if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){ - this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, partsData.data); - return; - } else { - navigateAfterSaveToHeritageFunnel(this.$route); - return; - } + navigateForward(partsData) { + if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { + this.$router.navigateAfterSave( + this.navigationScenarios.CLICKED_FORWARD, + this.$route, + {}, + { displayVehicleChangeAlert: true }, + partsData.data + ); + return; + } else { + navigateAfterSaveToHeritageFunnel(this.$route); + return; + } }, validateZip(zip) { - return baseMixin.methods.dispatchStoreAction( - storeActions.VALIDATE_ZIP, - { zip } - ); + return baseMixin.methods.dispatchStoreAction(storeActions.VALIDATE_ZIP, { + zip, + }); }, lookupVin(plate, state) { return baseMixin.methods.dispatchStoreAction( @@ -241,8 +335,8 @@ export default { ); }, updateCustomerInfo(vin, vehicleInfo, registrationState) { - if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){ - store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { + store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); } store.commit(storeMutations.UPDATE_VEHICLE_VIN, vin); store.commit(storeMutations.UPDATE_YEAR, vehicleInfo.year); @@ -250,28 +344,52 @@ export default { store.commit(storeMutations.UPDATE_MODEL, vehicleInfo.model); store.commit(storeMutations.UPDATE_STYLE, vehicleInfo.style); store.commit(storeMutations.UPDATE_CAR_ID, vehicleInfo.carId); - store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, vehicleInfo.category); - store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, vehicleInfo.imageUrl); - store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, vehicleInfo.imageVifNumber); - store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, vehicleInfo.imageColor); - store.commit(storeMutations.UPDATE_REGISTRATION_LICENSE_PLATE, this.licensePlate); + store.commit( + storeMutations.UPDATE_VEHICLE_CATEGORY, + vehicleInfo.category + ); + store.commit( + storeMutations.UPDATE_VEHICLE_IMAGE_URL, + vehicleInfo.imageUrl + ); + store.commit( + storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, + vehicleInfo.imageVifNumber + ); + store.commit( + storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, + vehicleInfo.imageColor + ); + store.commit( + storeMutations.UPDATE_REGISTRATION_LICENSE_PLATE, + this.licensePlate + ); store.commit(storeMutations.UPDATE_REGISTRATION_STATE, registrationState); - store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, this.registrationZip); + store.commit( + storeMutations.UPDATE_REGISTRATION_ZIP_CODE, + this.registrationZip + ); store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, this.serviceZip); store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email); }, }, watch: { - licensePlate() { - this.$refs.funnelFooter.updateButtonText(this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")); - }, - registrationZip(){ - this.$refs.funnelFooter.updateButtonText(this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")); - }, - serviceZip(){ - this.$refs.funnelFooter.updateButtonText(this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")); - } + licensePlate() { + this.$refs.funnelFooter.updateButtonText( + this.getCmsContent("FunnelFooterWidget", "ForwardButtonText") + ); }, + registrationZip() { + this.$refs.funnelFooter.updateButtonText( + this.getCmsContent("FunnelFooterWidget", "ForwardButtonText") + ); + }, + serviceZip() { + this.$refs.funnelFooter.updateButtonText( + this.getCmsContent("FunnelFooterWidget", "ForwardButtonText") + ); + }, + }, components: { Form, funnelHeader, diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 862abaced..b099ca091 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -134,6 +134,8 @@ export default { vm.$refs.backGlassOptions.initializeComponent( resultMap.damageOptions.backGlassOptions.availableReplacementOptions ); + + }); }, data(){ @@ -149,10 +151,7 @@ export default { } }, mounted(){ - if(this.$store.getters.vehicle.imageVifNumber){ - this.pushEventToGA(this.GaCategories.EVOX, `${this.GaActions.VIF}_${this.$store.getters.vehicle.imageVifNumber}`, - this.$store.getters.vehicle.carId, true); - } + this.attachCustomEvents(); }, methods: { arePagePrerequisitesValid() { @@ -166,6 +165,13 @@ export default { store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }, + attachCustomEvents(){ + if(this.$store.getters.vehicle.imageVifNumber){ + this.pushEventToGA(this.GaCategories.EVOX, `${this.GaActions.VIF}_${this.$store.getters.vehicle.imageVifNumber}`, + this.$store.getters.vehicle.carId, true); + } + }, + backButtonAction() { // route to move backwards this.$router.navigate( diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index fec51eafd..37becf5a7 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -24,7 +24,7 @@ import { settleAllPromises } from "@/helpers/layout-helper"; import { storeMutations } from "@/constants/store-mutations"; import { storeActions } from "@/constants/store-actions"; import { experimentUniverses } from "@/constants/experiments"; -import { getDeviceIdValue, getSessionIdValue, getSessionKeyValue } from "@/helpers/heritage-integration/cookie-helper"; +import { getDeviceIdValue, getSessionKeyValue } from "@/helpers/heritage-integration/cookie-helper"; import baseMixin from "@/mixins/base-mixin"; import store from "@/store"; @@ -94,7 +94,6 @@ export default { return true; }, resetDependentState() { - // Set store.commit(storeMutations.UPDATE_MAKE, null); store.commit(storeMutations.UPDATE_MODEL, null); @@ -106,7 +105,7 @@ export default { // Invokes store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - } + }, }, components: { yearQuestion, diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index f2e31edad..b836454bc 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -5,13 +5,26 @@ ref="theForm" v-slot="{ meta }" > -
+
- +
- +
@@ -21,12 +34,27 @@
- +
- +
{ + this.pushEventToGA( + this.$route.query[this.queryStrings.FMG_PAGE], + this.GaActions.SUBMITTED, + this.GaLabels.VINLOOKUP, + true + ); + }); + }, backButtonAction() { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); }, async forwardButtonAction() { - this.pushEventToGA(this.$route.query[this.queryStrings.FMG_PAGE], this.GaActions.SUBMITTED, this.GaLabels.VINLOOKUP , true); - const zipValidation = await this.validateZip(this.zip); if (!zipValidation.data.isServiceable) { this.customAlertData.zip = this.zip; @@ -257,10 +304,9 @@ export default { } }, validateZip(zip) { - return baseMixin.methods.dispatchStoreAction( - storeActions.VALIDATE_ZIP, - { zip } - ); + return baseMixin.methods.dispatchStoreAction(storeActions.VALIDATE_ZIP, { + zip, + }); }, lookupVehicle(vin) { return baseMixin.methods.dispatchStoreAction( diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index c2c86c2dd..0279a0887 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -81,7 +81,24 @@ export default { // Push to the data layer with the Google Custom Dimension Index. pushToDataLayerIfDefined(experimentWithDimension); }); - } + }, + + appendActionToMethod(object, method, actionToAppend) { + const baseMethod = object[method.name]; + object[method.name] = function () { + var result = baseMethod.apply(object, arguments); + actionToAppend.apply(this, arguments); + return result; + }; + }, + + prependActionToMethod(object, method, actionToPrepend) { + const baseMethod = object[method.name]; + object[method.name] = function () { + actionToPrepend.apply(this, arguments); + return baseMethod.apply(object, arguments); + }; + }, }, computed: { analyticsPageEvents() { @@ -96,7 +113,7 @@ export default { GaLabels() { return GaLabels; } - } + }, }; function pushToDataLayerIfDefined(data) { diff --git a/src/router/index.js b/src/router/index.js index 9ffd28522..5b24b0205 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -79,6 +79,9 @@ const routes = [ await GoToFunnelStartOn404(next); } + // Run analytics logic, if there is any for the page. + //attachCustomEvents(component); + return next({ name: to.query.fmgPage, query: to.query, params: to.params }); } @@ -100,6 +103,9 @@ const routes = [ await GoToFunnelStartOn404(next); } + // Run analytics logic, if there is any for the page. + //attachCustomEvents(nextComponent); + // Assign current query string parameters, as well as our fmgPage one. next({ name: routeData[0].name, @@ -126,6 +132,7 @@ const router = createRouter({ router.afterEach(async (to, from) => { // Push page view to GA analyticsMixin.methods.pushPageViewToGA(to.query[queryStrings.FMG_PAGE]); + const assignedExperiments = await baseMixin.methods.dispatchStoreAction(storeActions.GET_EXPERIMENTS_BY_USER_FOR_GA, { userId: getDeviceIdValue() }); analyticsMixin.methods.pushExperimentsToDataLayer(assignedExperiments); }); @@ -274,4 +281,14 @@ function resetDependentState(component) { return component.default.methods.resetDependentState(); } +// Run analytics logic to run custom events. +function attachCustomEvents(component) { + try { + return component.default.methods.attachCustomEvents(); + } catch (error) { + console.log(error); + return; // Eat the exception, analytics events shouldn't break anything. + } +} + export default router; \ No newline at end of file From 694a3aabc7afbc106107402943517e3e4ff8f192 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 3 May 2022 12:47:14 -0400 Subject: [PATCH 21/31] remove unneeded code --- .../license-plate-lookup.vue | 57 ++++++++++--------- src/router/index.js | 16 ------ 2 files changed, 29 insertions(+), 44 deletions(-) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 177f7f960..7ca539b78 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -16,7 +16,13 @@
- +
@@ -28,7 +34,14 @@ mask="#####" validationRules="zip-required" /> - +
@@ -39,7 +52,13 @@ inputId="email" validationRules="email-address-required|email-address-format" /> - +
\ No newline at end of file + diff --git a/src/router/index.js b/src/router/index.js index 5b24b0205..1af18ec1b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -79,9 +79,6 @@ const routes = [ await GoToFunnelStartOn404(next); } - // Run analytics logic, if there is any for the page. - //attachCustomEvents(component); - return next({ name: to.query.fmgPage, query: to.query, params: to.params }); } @@ -103,9 +100,6 @@ const routes = [ await GoToFunnelStartOn404(next); } - // Run analytics logic, if there is any for the page. - //attachCustomEvents(nextComponent); - // Assign current query string parameters, as well as our fmgPage one. next({ name: routeData[0].name, @@ -281,14 +275,4 @@ function resetDependentState(component) { return component.default.methods.resetDependentState(); } -// Run analytics logic to run custom events. -function attachCustomEvents(component) { - try { - return component.default.methods.attachCustomEvents(); - } catch (error) { - console.log(error); - return; // Eat the exception, analytics events shouldn't break anything. - } -} - export default router; \ No newline at end of file From a14e3ca6824bfac25aad228136cb21e652be15db Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 3 May 2022 12:58:26 -0400 Subject: [PATCH 22/31] unit tests --- src/helpers/unit-test-helper.js | 1 + src/mixins/analytics-mixin.js | 11 +---------- src/mixins/analytics-mixin.spec.js | 1 - 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/helpers/unit-test-helper.js b/src/helpers/unit-test-helper.js index 770dd893e..6577ed6ff 100644 --- a/src/helpers/unit-test-helper.js +++ b/src/helpers/unit-test-helper.js @@ -23,6 +23,7 @@ export function getMountOptions(mockData) { mocks.pushPageViewToGA = jest.fn(); mocks.logEvent = jest.fn(); mocks.pushExperimentsToDataLayer = jest.fn(); + mocks.prependActionToMethod = jest.fn(); mocks.dispatchStoreAction = jest.fn(); mocks.dispatchStoreAction.mockImplementation((actionName) => { diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 0279a0887..85402c8cb 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -82,16 +82,7 @@ export default { pushToDataLayerIfDefined(experimentWithDimension); }); }, - - appendActionToMethod(object, method, actionToAppend) { - const baseMethod = object[method.name]; - object[method.name] = function () { - var result = baseMethod.apply(object, arguments); - actionToAppend.apply(this, arguments); - return result; - }; - }, - + prependActionToMethod(object, method, actionToPrepend) { const baseMethod = object[method.name]; object[method.name] = function () { diff --git a/src/mixins/analytics-mixin.spec.js b/src/mixins/analytics-mixin.spec.js index b4ec2a5b5..ae1ba00a7 100644 --- a/src/mixins/analytics-mixin.spec.js +++ b/src/mixins/analytics-mixin.spec.js @@ -79,5 +79,4 @@ describe("analyticsMixin.js", () => { expect(window.dataLayer).toEqual([ { settings_5: {"Google Custom Dimension Index": "5"}, variationName_5: 'test', universeName_5: 'testUniverse' } ]); }); - }); \ No newline at end of file From a6481307f7105ae9e084bbb48cd9d1aadea87e33 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Tue, 3 May 2022 14:49:12 -0400 Subject: [PATCH 23/31] estimate page edits --- src/layouts/estimate/estimate.vue | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 2e395aa0b..f77f30f8e 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -13,8 +13,8 @@ cmsWidgetName="VinLookupMethod" class="button-question-overflow" :questionText="questionText" - :answers="answersToDisplay" - :groupName="groupName" + :answers="answersFromCms" + groupName="vinLookupMethodOption" buttonType="listButton" v-model="selectedValues" isRequired @@ -53,13 +53,10 @@ export default { name: "estimate", data() { return { - groupName: "vinLookupMethodOptions", selectedValues: [], }; }, - props: { - name: String, - }, + async beforeRouteEnter(to, from, next) { //Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); @@ -128,21 +125,6 @@ export default { HomeAddress: true, }; }, - answersToDisplay() { - const filteredAnswers = Array.isArray(this.answersFromCms) - ? this.answersFromCms.filter((ans) => { - const name = ans.Name.split("-"); - return name[0]; - }) - : []; - return filteredAnswers.map((ans) => { - const newName = ans.Name.includes("-") - ? ans.Name.split("-")[1] - : ans.Name; - ans.Name = newName; - return ans; - }); - }, }, components: { funnelHeader, From a42600f24cf7d2fc062facff0a7f69ac91b1fb24 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 3 May 2022 15:08:19 -0400 Subject: [PATCH 24/31] adjusted endpoint and logic --- src/constants/endpoints.js | 4 ++-- src/constants/store-actions.js | 2 +- src/global-methods.js | 5 ++++- src/mixins/analytics-mixin.js | 2 +- src/router/index.js | 7 +++++-- src/store/index.js | 6 +++--- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index ca1555e7b..13ad55b34 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -75,8 +75,8 @@ const endpoints = { url: "/analytics/api/v1/analytics/activity", method: "POST", }, - GetExperimentsByUserForGa: { - url: "/analytics/api/v1/analytics/get-experiments-for-GA", + GetExperimentsByUser: { + url: "/analytics/api/v1/analytics/get-experiments", method: "GET", } }; diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 74dac5043..fe100d5e3 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -20,7 +20,7 @@ const storeActions = { VALIDATE_ZIP: "validateZip", LOG_EXPERIMENT_EXPOSURE: "logExperimentExposure", LOG_ACTIVITY: "logActivity", - GET_EXPERIMENTS_BY_USER_FOR_GA: "getExperimentsByUserForGa", + GET_EXPERIMENTS_BY_USER: "GetExperimentsByUser", // DEPENDENCY MUTATIONS RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies", diff --git a/src/global-methods.js b/src/global-methods.js index 5e4d04ea3..71f153bdf 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -7,7 +7,10 @@ import { GaCategories, GaActions, GaLabels } from "@/constants/analytics"; export default { callHttpClient({ method, endpoint, payload, logApiCall = true }) { return new Promise((resolve, reject) => { - const cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; + let cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; + if(endpoint.includes("analytics")){ + cfDistroUrl = 'https://localhost:44324'; + } const payloadAndAnalyticsData = Object.assign({}, payload, { AppName: "FixMyGlass" }); axios({ method: method, url: cfDistroUrl + endpoint, data: payloadAndAnalyticsData, crossDomain: true, responseType: {} }) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 85402c8cb..d4cf7ccd1 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -62,7 +62,7 @@ export default { }, pushExperimentsToDataLayer(experiments) { - experiments?.data?.forEach(exp => { + experiments?.forEach(exp => { // Set Google Dimension Index based on experiment settings. let googleDimensionIndex = 99; diff --git a/src/router/index.js b/src/router/index.js index 1af18ec1b..f11bd4228 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -127,8 +127,11 @@ router.afterEach(async (to, from) => { // Push page view to GA analyticsMixin.methods.pushPageViewToGA(to.query[queryStrings.FMG_PAGE]); - const assignedExperiments = await baseMixin.methods.dispatchStoreAction(storeActions.GET_EXPERIMENTS_BY_USER_FOR_GA, { userId: getDeviceIdValue() }); - analyticsMixin.methods.pushExperimentsToDataLayer(assignedExperiments); + baseMixin.methods.dispatchStoreAction(storeActions.GET_EXPERIMENTS_BY_USER, { userId: getDeviceIdValue() }) + .then( (response) => { + analyticsMixin.methods.pushExperimentsToDataLayer(response.data); + }); + }); router.navigate = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) => { diff --git a/src/store/index.js b/src/store/index.js index 66005abd5..c12caff07 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -459,10 +459,10 @@ export const actions = { }); }, - getExperimentsByUserForGa(context, { userId }){ + GetExperimentsByUser(context, { userId }){ return globalMethods.callHttpClient({ - method: endpoints.GetExperimentsByUserForGa.method, - endpoint: `${endpoints.GetExperimentsByUserForGa.url}/${userId}`, + method: endpoints.GetExperimentsByUser.method, + endpoint: `${endpoints.GetExperimentsByUser.url}/${userId}`, payload: {} }); }, From 57bd4dbaf75f788e10b1844ba0c8a1d3044763d1 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 3 May 2022 15:09:50 -0400 Subject: [PATCH 25/31] removed temp code --- src/global-methods.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/global-methods.js b/src/global-methods.js index 71f153bdf..5e4d04ea3 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -7,10 +7,7 @@ import { GaCategories, GaActions, GaLabels } from "@/constants/analytics"; export default { callHttpClient({ method, endpoint, payload, logApiCall = true }) { return new Promise((resolve, reject) => { - let cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; - if(endpoint.includes("analytics")){ - cfDistroUrl = 'https://localhost:44324'; - } + const cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; const payloadAndAnalyticsData = Object.assign({}, payload, { AppName: "FixMyGlass" }); axios({ method: method, url: cfDistroUrl + endpoint, data: payloadAndAnalyticsData, crossDomain: true, responseType: {} }) From b5b40d2c5c05f8d3af747f9197a2ae1a70f89250 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Tue, 3 May 2022 15:15:34 -0400 Subject: [PATCH 26/31] estimate page --- src/layouts/estimate/estimate.vue | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index f77f30f8e..b46c38801 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -118,13 +118,6 @@ export default { answersFromCms() { return this.getCmsContent("VinLookupMethod", "Answers"); }, - vinLookupMethodOptionsMap() { - return { - ManualVin: true, - LicensePlate: true, - HomeAddress: true, - }; - }, }, components: { funnelHeader, From 809c6d7aa95020a4f39c8b433c11a3b548a9cc08 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 3 May 2022 15:33:56 -0400 Subject: [PATCH 27/31] mapping --- src/mixins/analytics-mixin.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index d4cf7ccd1..36ec73fe4 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -72,11 +72,13 @@ export default { } // Create object with dimension index and value. - const experimentWithDimension = {}; - - Object.keys(exp).forEach(key => { - experimentWithDimension[`${key}_${googleDimensionIndex}`] = exp[key]; - }); + const experimentWithDimension = { + [`experimentId_${googleDimensionIndex}`]: exp.universeId, + [`variationId_${googleDimensionIndex}`]: exp.variationId, + [`experimentName_${googleDimensionIndex}`]: exp.universeName, + [`variationName_${googleDimensionIndex}`]: exp.variationName, + [`customDimension_${googleDimensionIndex}`]: `${exp.universeId}_${exp.variationId}_${exp.universeName}_${exp.variationName}` + }; // Push to the data layer with the Google Custom Dimension Index. pushToDataLayerIfDefined(experimentWithDimension); From fc0ea703bac9f5cd65d874a025cef336e108854b Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 3 May 2022 15:46:32 -0400 Subject: [PATCH 28/31] fix unit tests --- src/mixins/analytics-mixin.spec.js | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/mixins/analytics-mixin.spec.js b/src/mixins/analytics-mixin.spec.js index ae1ba00a7..1e29e35de 100644 --- a/src/mixins/analytics-mixin.spec.js +++ b/src/mixins/analytics-mixin.spec.js @@ -40,21 +40,27 @@ describe("analyticsMixin.js", () => { // Arrange window.dataLayer = []; - const mockExperimentData = { - data: [ + const mockExperimentData = + [ { settings: {}, variationName: 'test', universeName: 'testUniverse' } ] - } + // Act analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData); // Assert - expect(window.dataLayer).toEqual([ { settings_99: {}, variationName_99: 'test', universeName_99: 'testUniverse' } ]); + expect(window.dataLayer).toEqual([{ + experimentId_99: undefined, + variationId_99: undefined, + experimentName_99: 'testUniverse', + variationName_99: 'test', + customDimension_99: 'undefined_undefined_testUniverse_test' + }]); }); @@ -62,21 +68,27 @@ describe("analyticsMixin.js", () => { // Arrange window.dataLayer = []; - const mockExperimentData = { - data: [ + const mockExperimentData = + [ { - settings: { "Google Custom Dimension Index": "5"}, + settings: { "Google Custom Dimension Index": "5" }, variationName: 'test', universeName: 'testUniverse' } ] - } + // Act analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData); // Assert - expect(window.dataLayer).toEqual([ { settings_5: {"Google Custom Dimension Index": "5"}, variationName_5: 'test', universeName_5: 'testUniverse' } ]); + expect(window.dataLayer).toEqual([{ + experimentId_5: undefined, + variationId_5: undefined, + experimentName_5: 'testUniverse', + variationName_5: 'test', + customDimension_5: 'undefined_undefined_testUniverse_test' + }]); }); }); \ No newline at end of file From e3bf843e0a45042e3b3ed1f840375deef138a484 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 3 May 2022 16:28:09 -0400 Subject: [PATCH 29/31] CSR-113 Edit comment --- src/constants/application-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/application-config.js b/src/constants/application-config.js index 5f5e77cdc..0d173db19 100644 --- a/src/constants/application-config.js +++ b/src/constants/application-config.js @@ -5,7 +5,7 @@ const applicationConfig = { ANALYTICS_SESSION_TIMEOUT_MINUTES: 30, SAVED_SESSION_TIMEOUT_DAYS: 45, COOKIE_PATH: "/", - CURRENT_ENVIRONMENT: process.env.VUE_APP_CURRENT_ENVIRONMENT // Current environment following SV2's EnvironmentConfiguration.SV2Environment + CURRENT_ENVIRONMENT: process.env.VUE_APP_CURRENT_ENVIRONMENT // "Localhost", "Dev", "QA", and "Prod" }; export { applicationConfig }; \ No newline at end of file From 341cc02d7d097b6282cbe7c97e549601238cf568 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Wed, 4 May 2022 09:07:59 -0400 Subject: [PATCH 30/31] CSR-18 activity log split into lagpageview and logcustomevent --- src/constants/endpoints.js | 8 +++++++ src/constants/store-actions.js | 3 ++- src/mixins/analytics-mixin.js | 30 +++++++++++++++++--------- src/mixins/analytics-mixin.spec.js | 24 +++++++++++++++++---- src/store/index.js | 34 ++++++++++++++++++++++-------- src/store/store.spec.js | 22 +++++++++++++++---- 6 files changed, 93 insertions(+), 28 deletions(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index ca1555e7b..50efbda04 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -75,6 +75,14 @@ const endpoints = { url: "/analytics/api/v1/analytics/activity", method: "POST", }, + LogPageView:{ + url: "/analytics/api/v1/analytics/log-page-view", + method: "POST", + }, + LogCustomEvent:{ + url: "/analytics/api/v1/analytics/log-custom-event", + method: "POST", + }, GetExperimentsByUserForGa: { url: "/analytics/api/v1/analytics/get-experiments-for-GA", method: "GET", diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 74dac5043..b6d3793f4 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -19,7 +19,8 @@ const storeActions = { SET_REFERRAL_INFORMATION: "setReferralInformation", VALIDATE_ZIP: "validateZip", LOG_EXPERIMENT_EXPOSURE: "logExperimentExposure", - LOG_ACTIVITY: "logActivity", + LOG_PAGE_VIEW: "logPageView", + LOG_CUSTOM_EVENT: "logCustomEvent", GET_EXPERIMENTS_BY_USER_FOR_GA: "getExperimentsByUserForGa", // DEPENDENCY MUTATIONS diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 85402c8cb..df2d073c4 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -11,24 +11,34 @@ const currentPageName = getPageNameByQueryString(); export default { methods: { - logEvent(pageEvent, category, action, label, value) { + logPageView(pageEvent) { var payload = { userId: getDeviceIdValue(), sessionKey: getSessionKeyValue(), pageName: currentPageName, sessionId: getSessionIdValue(), + action: '', + event: pageEvent, shouldUseSessionId: true, }; - if (pageEvent) { - payload.pageEvent = { action: '', event: pageEvent }; - } + baseMixin.methods.dispatchStoreAction(storeActions.LOG_PAGE_VIEW, payload, false); + }, - if (category) { - payload.customEvent = { category: category, action: action, label: label, value: value }; - } + logCustomEvent(category, action, label, value) { + var payload = { + userId: getDeviceIdValue(), + sessionKey: getSessionKeyValue(), + pageName: currentPageName, + sessionId: getSessionIdValue(), + category: category, + action: action, + label: label, + value: value, + shouldUseSessionId: true, + }; - baseMixin.methods.dispatchStoreAction(storeActions.LOG_ACTIVITY, payload, false); + baseMixin.methods.dispatchStoreAction(storeActions.LOG_CUSTOM_EVENT, payload, false); }, pushEventToGA(category, action, label, pushToLogApp = false) { @@ -44,7 +54,7 @@ export default { pushToDataLayerIfDefined(eventToBePushed); if (pushToLogApp) { - this.logEvent(undefined, category, action, label, undefined); + this.logCustomEvent(category, action, label, undefined); } }, @@ -58,7 +68,7 @@ export default { pushToDataLayerIfDefined(pageViewEvent); - this.logEvent(currentPageName, analyticsPageEvents.ENTRY); + this.logPageView(analyticsPageEvents.ENTRY); }, pushExperimentsToDataLayer(experiments) { diff --git a/src/mixins/analytics-mixin.spec.js b/src/mixins/analytics-mixin.spec.js index ae1ba00a7..4158bdeff 100644 --- a/src/mixins/analytics-mixin.spec.js +++ b/src/mixins/analytics-mixin.spec.js @@ -3,18 +3,34 @@ import { setupMocksForJsFiles } from "@/helpers/unit-test-helper.js"; import { storeActions } from "@/constants/store-actions"; describe("analyticsMixin.js", () => { - test("logEvent: calls dispatch with type and payload", () => { + test("logPageView: calls dispatch with type and payload", () => { const type = ""; const payload = {}; const mockData = { actionList: [{ - actionName: storeActions.LOG_ACTIVITY + actionName: storeActions.LOG_PAGE_VIEW }], } const mocks = setupMocksForJsFiles(mockData); - analyticsMixin.methods.logEvent(type, payload); + analyticsMixin.methods.logPageView(type, payload); + + expect(mocks.baseMixin.methods.dispatchStoreAction).toBeCalled(); + }); + + test("logCustomEvent: calls dispatch with type and payload", () => { + const type = ""; + const payload = {}; + + const mockData = { + actionList: [{ + actionName: storeActions.LOG_CUSTOM_EVENT + }], + } + const mocks = setupMocksForJsFiles(mockData); + + analyticsMixin.methods.logCustomEvent(type, payload); expect(mocks.baseMixin.methods.dispatchStoreAction).toBeCalled(); }); @@ -23,7 +39,7 @@ describe("analyticsMixin.js", () => { // Arrange const mockData = { actionList: [{ - actionName: storeActions.LOG_ACTIVITY + actionName: storeActions.LOG_CUSTOM_EVENT }], } const mocks = setupMocksForJsFiles(mockData); diff --git a/src/store/index.js b/src/store/index.js index dfeb4fdf2..9e7f2f459 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -433,27 +433,43 @@ export const actions = { }); }, - logActivity(context, { userId, sessionKey, pageName, sessionId, pageEvent, customEvent, shouldUseSessionId }) { + logPageView(context, { userId, sessionKey, pageName, sessionId, action, event, shouldUseSessionId }) { var payload = { userId: userId, sessionKey: sessionKey, sessionId: sessionId, pageName: pageName, applicationName: 'SafeliteDotCom', + action: action, + event: event, shouldUseSessionId: shouldUseSessionId }; - if (typeof pageEvent !== 'undefined') { - payload.pageEvent = { action: pageEvent.action, event: pageEvent.event}; - } + return globalMethods.callHttpClient({ + method: endpoints.LogPageView.method, + endpoint: endpoints.LogPageView.url, + payload: payload, + logApiCall: false + }); + }, - if (typeof customEvent !== 'undefined') { - payload.customEvents = [{category: customEvent.category, action: customEvent.action, label: customEvent.label, value: customEvent.value}]; - } + logCustomEvent(context, { userId, sessionKey, pageName, sessionId, category, action, label, value, shouldUseSessionId }) { + var payload = { + userId: userId, + sessionKey: sessionKey, + sessionId: sessionId, + pageName: pageName, + applicationName: 'SafeliteDotCom', + category: category, + action: action, + label: label, + value: value, + shouldUseSessionId: shouldUseSessionId + }; return globalMethods.callHttpClient({ - method: endpoints.LogActivity.method, - endpoint: endpoints.LogActivity.url, + method: endpoints.LogCustomEvent.method, + endpoint: endpoints.LogCustomEvent.url, payload: payload, logApiCall: false }); diff --git a/src/store/store.spec.js b/src/store/store.spec.js index e27569a6f..b1667eb4c 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -617,7 +617,7 @@ describe("Actions", () => { expect(commit).toBeCalledWith(storeMutations.UPDATE_REFERRAL_CORRELATION_ID, "xxx-xxx-xxx"); }); - it("logActivity action, should return nothing", async () => { + it("logPageView action, should return nothing", async () => { // Arrange const context = state; @@ -626,12 +626,26 @@ describe("Actions", () => { event: "ENTRY", } - var customEvent = [{ + // Act + globalMethods.callHttpClient.mockImplementation(() => { + return Promise.resolve({ }); + }); + + // Assert + const response = await actions.logPageView(context, { userId: "userId", sessionKey: "sessionKey", pageName: "pageName", sessionId: "sessionId", pageEvent: pageEvent, shouldUseSessionId: true }); + expect(response).toEqual({}); + }); + + it("logCustomEvent action, should return nothing", async () => { + + // Arrange + const context = state; + var customEvent = { category: "tstCat", action: "click", label: "damage", value: "psych" - }]; + }; // Act globalMethods.callHttpClient.mockImplementation(() => { @@ -639,7 +653,7 @@ describe("Actions", () => { }); // Assert - const response = await actions.logActivity(context, { userId: "userId", sessionKey: "sessionKey", pageName: "pageName", sessionId: "sessionId", pageEvent: pageEvent, customEvent: customEvent, shouldUseSessionId: true }); + const response = await actions.logCustomEvent(context, { userId: "userId", sessionKey: "sessionKey", pageName: "pageName", sessionId: "sessionId", customEvent: customEvent, shouldUseSessionId: true }); expect(response).toEqual({}); }); From a385e2a8bc353e7bed854c6c469939c06949d2c4 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Wed, 4 May 2022 09:15:22 -0400 Subject: [PATCH 31/31] CSR-18 remove endpoint --- src/constants/endpoints.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 3860ad97d..059693773 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -71,10 +71,6 @@ const endpoints = { url: "/analytics/api/v1/analytics/log-experiment-exposure", method: "POST", }, - LogActivity:{ - url: "/analytics/api/v1/analytics/activity", - method: "POST", - }, LogPageView:{ url: "/analytics/api/v1/analytics/log-page-view", method: "POST",