From ea4820ec5e7af0c6d4a6c4e4dd4c6d2b7dfc52d4 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Tue, 31 Jan 2023 17:05:05 -0500 Subject: [PATCH 1/5] CSR-1058 | URI encode the serverData --- 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 d2634dd10..93a3e5a25 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1432,7 +1432,7 @@ export const actions = { `${availableLineItemsFormattedForRequest}`; const lineItemServerData = context.getters.order.lineItems.serverData; if (lineItemServerData) { - queryString += `&ServerData=${lineItemServerData}`; + queryString += `&ServerData=${encodeURIComponent(lineItemServerData)}`; } const response = await globalMethods.callHttpClient({ method: endpoints.PriceOrderItems.method, From 3399ef24a046cea060c3e18050d9905119bf9f85 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 23 Feb 2023 08:09:53 -0500 Subject: [PATCH 2/5] CSR-1212 reworked to be more specific so it doesn't pass prereq for an empty array --- src/layouts/vehicle-parts/vehicle-parts.vue | 6 ++++-- vue.config.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index 1c35f96fa..3c2978744 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -149,10 +149,12 @@ export default { methods: { arePagePrerequisitesValid() { // Check if isRepair is populated and if the pageData we need is here (Parts data) + const vehiclePartsFromPageData = store.getters.pageData( + fmgPageValues.VEHICLE_PARTS + ); return ( store.getters.damage.isRepair != null && - store.getters.pageData(fmgPageValues.VEHICLE_PARTS) && - Object.keys(store.getters.pageData(fmgPageValues.VEHICLE_PARTS)).length !== 0 + vehiclePartsFromPageData?.partsOrQuestions?.some((part) => part?.glassName) ); }, async forwardButtonAction() { diff --git a/vue.config.js b/vue.config.js index 64c83dd9e..e87582db2 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,7 +1,7 @@ process.env.VUE_APP_CONSUMER_CF_DISTRO = "https://digitalapi.dev.safelite.io"; process.env.VUE_APP_HERITAGE_FUNNEL = - "http://localhost:38000/default.aspx"; + "http://localhost/default.aspx"; process.env.VUE_APP_GOOGLE_PLACES_API_KEY = "AIzaSyDptGCkOPgN2uWJOy4ou4M33phRD4MAoJo"; process.env.VUE_APP_CURRENT_ENVIRONMENT = "Localhost"; From 4fff8b9f6b82b2cf505b9e6f8a5b30cfb36a588e Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 23 Feb 2023 08:18:12 -0500 Subject: [PATCH 3/5] CSR-1212 add back port --- vue.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vue.config.js b/vue.config.js index e87582db2..64c83dd9e 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,7 +1,7 @@ process.env.VUE_APP_CONSUMER_CF_DISTRO = "https://digitalapi.dev.safelite.io"; process.env.VUE_APP_HERITAGE_FUNNEL = - "http://localhost/default.aspx"; + "http://localhost:38000/default.aspx"; process.env.VUE_APP_GOOGLE_PLACES_API_KEY = "AIzaSyDptGCkOPgN2uWJOy4ou4M33phRD4MAoJo"; process.env.VUE_APP_CURRENT_ENVIRONMENT = "Localhost"; From 36bebf1e0d7dc5a949095f29fec173ef410bbcf5 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 23 Feb 2023 08:25:34 -0500 Subject: [PATCH 4/5] CSR-1212 prettier --- src/layouts/vehicle-parts/vehicle-parts.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index 3c2978744..e06604a4a 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -149,9 +149,7 @@ export default { methods: { arePagePrerequisitesValid() { // Check if isRepair is populated and if the pageData we need is here (Parts data) - const vehiclePartsFromPageData = store.getters.pageData( - fmgPageValues.VEHICLE_PARTS - ); + const vehiclePartsFromPageData = store.getters.pageData(fmgPageValues.VEHICLE_PARTS); return ( store.getters.damage.isRepair != null && vehiclePartsFromPageData?.partsOrQuestions?.some((part) => part?.glassName) From 57f3b80e6ff23240edba4801b8ec8f47e84804e0 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 24 Feb 2023 09:46:39 -0500 Subject: [PATCH 5/5] CSR-945 Allow zipCode querystring in concept funnel --- src/constants/query-strings.js | 1 + src/layouts/estimate/estimate.spec.js | 3 +++ src/layouts/estimate/estimate.vue | 2 +- .../license-plate-lookup.spec.js | 3 +++ .../license-plate-lookup.vue | 2 +- src/layouts/vin-lookup/vin-lookup.spec.js | 1 + src/layouts/vin-lookup/vin-lookup.vue | 2 +- src/router/index.js | 19 ++++++++++++++++--- 8 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/constants/query-strings.js b/src/constants/query-strings.js index f75e526d6..d2dbcf976 100644 --- a/src/constants/query-strings.js +++ b/src/constants/query-strings.js @@ -1,6 +1,7 @@ const queryStrings = { FMG_PAGE: "fmgPage", START_TYPE: "start_type", + ZIP_CODE: "zipCode", }; export { queryStrings }; diff --git a/src/layouts/estimate/estimate.spec.js b/src/layouts/estimate/estimate.spec.js index c4b92830a..4a0a3f434 100644 --- a/src/layouts/estimate/estimate.spec.js +++ b/src/layouts/estimate/estimate.spec.js @@ -258,6 +258,9 @@ function setupMocks({ navigateWithSaving: jest.fn(), navigateWithoutSaving: jest.fn(), }, + route: { + query: {}, + }, }, }) { //Mock CMS Content diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index dd16a479f..4eafab25e 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -132,7 +132,7 @@ export default { data() { return { selectedVinLookupMethod: null, - serviceZipCode: this.getZipFromStore(), + serviceZipCode: this.getZipFromStore() ?? this.$route.query.zipCode, emailAddress: this.getEmailFromStore(), displayInvalidZipAlert: false, displayNonServiceableZipAlert: false, 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 d83f49643..b23f5c101 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -660,6 +660,9 @@ function setupMocks({ navigateWithoutSaving: jest.fn(), navigateWithSaving: jest.fn(), }, + route: { + query: {}, + }, store: { getters: { vehicle: { diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 159d89260..ec54fd4f7 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -152,7 +152,7 @@ export default { data() { return { licensePlate: this.getLicensePlateFromStore(), - registrationZipCode: this.getRegistrationZipFromStore(), + registrationZipCode: this.getRegistrationZipFromStore() ?? this.$route.query.zipCode, email: this.getEmailFromStore(), serviceZipCode: this.getServiceZipFromStore(), displayNonServiceableZipAlert: false, diff --git a/src/layouts/vin-lookup/vin-lookup.spec.js b/src/layouts/vin-lookup/vin-lookup.spec.js index aca1b99c2..fc15d3667 100644 --- a/src/layouts/vin-lookup/vin-lookup.spec.js +++ b/src/layouts/vin-lookup/vin-lookup.spec.js @@ -254,6 +254,7 @@ function setupMocks({ customMountOptions }) { mountOptions.global.mocks["$store"] = store; mountOptions.global.mixins = [mockMixin]; mountOptions["attachTo"] = document.body; // append wrapper to document.body to test DOM methods + mountOptions.route = { query: {} }; const wrapper = shallowMount(vinLookup, mountOptions); mockOutStubFunctions(wrapper); diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 990fd0658..17e981bc8 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -176,7 +176,7 @@ export default { data() { return { vin: this.getVinFromStore(), - serviceZipCode: this.getZipFromStore(), + serviceZipCode: this.getZipFromStore() ?? this.$route.query.zipCode, emailAddress: this.getEmailFromStore(), isCarIdDifferent: false, customAlertData: {}, diff --git a/src/router/index.js b/src/router/index.js index 30fc8583b..409ce0419 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -260,11 +260,24 @@ async function navigate( optionalParams.isSavingNavigation = isSavingNavigation; + // add querystring params to the route. if they are already in the store then no need to add them + var queryStringsObject = { + fmgPage: destinationFmgPageValue, + }; + + if ( + Object.hasOwn(currentRoute.query, queryStrings.ZIP_CODE) && + (store.getters.order.serviceLocation.zipCode === undefined || + store.getters.order.serviceLocation.zipCode == null) && + (store.getters.order.vehicle.registration.zipCode === undefined || + store.getters.order.vehicle.registration.zipCode == null) + ) { + queryStringsObject[queryStrings.ZIP_CODE] = currentRoute.query.zipCode; + } + router.push({ name: "root", - query: Object.assign(optionalQuery, { - fmgPage: destinationFmgPageValue, - }), + query: Object.assign(optionalQuery, queryStringsObject), params: optionalParams, }); } else if (matchingScenarioMap.destinationUrl !== undefined) {