diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e6fa6d0ff..036eb3d23 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,8 @@ 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__) cfDistributionId: $(cfDistributionId) \ No newline at end of file diff --git a/src/constants/application-config.js b/src/constants/application-config.js index b1ab342a7..0d173db19 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 // "Localhost", "Dev", "QA", and "Prod" }; 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/src/constants/endpoints.js b/src/constants/endpoints.js index ca1555e7b..059693773 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -71,12 +71,16 @@ const endpoints = { url: "/analytics/api/v1/analytics/log-experiment-exposure", method: "POST", }, - LogActivity:{ - url: "/analytics/api/v1/analytics/activity", + LogPageView:{ + url: "/analytics/api/v1/analytics/log-page-view", method: "POST", }, - GetExperimentsByUserForGa: { - url: "/analytics/api/v1/analytics/get-experiments-for-GA", + LogCustomEvent:{ + url: "/analytics/api/v1/analytics/log-custom-event", + method: "POST", + }, + GetExperimentsByUser: { + url: "/analytics/api/v1/analytics/get-experiments", method: "GET", } }; 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/store-actions.js b/src/constants/store-actions.js index 74dac5043..2a0a7f29d 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -19,8 +19,9 @@ const storeActions = { SET_REFERRAL_INFORMATION: "setReferralInformation", VALIDATE_ZIP: "validateZip", LOG_EXPERIMENT_EXPOSURE: "logExperimentExposure", - LOG_ACTIVITY: "logActivity", - GET_EXPERIMENTS_BY_USER_FOR_GA: "getExperimentsByUserForGa", + LOG_PAGE_VIEW: "logPageView", + LOG_CUSTOM_EVENT: "logCustomEvent", + GET_EXPERIMENTS_BY_USER: "GetExperimentsByUser", // DEPENDENCY MUTATIONS RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies", 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/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/global-methods.js b/src/global-methods.js index b96701d86..6c7c630f1 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -7,7 +7,7 @@ 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("order")) { cfDistroUrl = "https://localhost:44346"; diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index b98157d84..7e3de2345 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -94,9 +94,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/helpers/heritage-integration/navigation-helper.spec.js b/src/helpers/heritage-integration/navigation-helper.spec.js index de5df0239..fd06920c2 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 () => { @@ -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 () => { 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/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 895148575..032b42268 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)); @@ -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/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 0e41b24ed..b46c38801 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -1,13 +1,131 @@ + + \ No newline at end of file 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..1db7a57fd 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -1,63 +1,35 @@ \ No newline at end of file + 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 () => { diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index a78e8a277..70ba3512f 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -132,6 +132,8 @@ export default { vm.$refs.backGlassOptions.initializeComponent( resultMap.damageOptions.backGlassOptions.availableReplacementOptions ); + + }); }, data(){ @@ -147,10 +149,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() { @@ -164,6 +163,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( @@ -285,47 +291,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 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(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); + return; + } + 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/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index cb6ff6fcb..c0eaa97be 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"; @@ -96,7 +96,6 @@ export default { return true; }, resetDependentState() { - // Set store.commit(storeMutations.UPDATE_MAKE, null); store.commit(storeMutations.UPDATE_MODEL, null); @@ -108,7 +107,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 5948e574b..4c43eb513 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -1,123 +1,115 @@