Merge pull request #1284 from Safelite/feature/Digital/csr-1529.2
zip code GA event optimized
This commit is contained in:
commit
eef8fa82c7
4 changed files with 18 additions and 27 deletions
10
src/helpers/querystring-helper.js
Normal file
10
src/helpers/querystring-helper.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export function getQuerystringParameter(key) {
|
||||
const queryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
const lowerCaseParams = new URLSearchParams();
|
||||
for (const [name, value] of urlParams) {
|
||||
lowerCaseParams.append(name.toLowerCase(), value);
|
||||
}
|
||||
|
||||
return lowerCaseParams.get(key) ? lowerCaseParams.get(key) : null;
|
||||
}
|
||||
|
|
@ -52,7 +52,6 @@ jest.mock("@/store", () => ({
|
|||
damage: {
|
||||
glassToReplace: [],
|
||||
},
|
||||
order: { serviceLocation: { zipCode: "11111" } },
|
||||
},
|
||||
}));
|
||||
|
||||
|
|
@ -134,7 +133,6 @@ describe("vehicle-damage.vue", () => {
|
|||
getters: {
|
||||
vehicle: {},
|
||||
payment: { insuranceCoverage: { isVerified: false } },
|
||||
order: { serviceLocation: { zipCode: "11111" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -177,7 +175,7 @@ describe("vehicle-damage.vue", () => {
|
|||
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
||||
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(
|
||||
storeActions.GET_DAMAGE_OPTIONS,
|
||||
{ carId: "C00000000", zipCode: "11111" }
|
||||
{ carId: "C00000000" }
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -243,7 +241,6 @@ describe("vehicle-damage.vue", () => {
|
|||
getters: {
|
||||
vehicle: {},
|
||||
payment: { insuranceCoverage: { isVerified: false } },
|
||||
order: { serviceLocation: { zipCode: "11111" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -273,7 +270,7 @@ describe("vehicle-damage.vue", () => {
|
|||
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
||||
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(
|
||||
storeActions.GET_DAMAGE_OPTIONS,
|
||||
{ carId: "C00000000", zipCode: "11111" }
|
||||
{ carId: "C00000000" }
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -526,7 +523,6 @@ describe("vehicle-damage.vue", () => {
|
|||
eventBusItem: jest.fn(),
|
||||
damage: { glassToReplace: [{ glassLocation: damageLocation }] },
|
||||
isRepair: true,
|
||||
order: { serviceLocation: { zipCode: "11111" } },
|
||||
};
|
||||
|
||||
var glassSelections = wrapper.vm.getDamageLocationsFromStore();
|
||||
|
|
@ -604,7 +600,6 @@ describe("vehicle-damage.vue", () => {
|
|||
isRepair: isRepair,
|
||||
numberOfChips: 2,
|
||||
},
|
||||
order: { serviceLocation: { zipCode: "11111" } },
|
||||
};
|
||||
|
||||
var windshieldSelections = wrapper.vm.getWindshieldOptionsFromStore();
|
||||
|
|
@ -641,7 +636,6 @@ describe("vehicle-damage.vue", () => {
|
|||
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
||||
},
|
||||
isRepair: true,
|
||||
order: { serviceLocation: { zipCode: "11111" } },
|
||||
};
|
||||
|
||||
var glassSelections = wrapper.vm.getDriverSideReplaceOptionsFromStore();
|
||||
|
|
@ -678,7 +672,6 @@ describe("vehicle-damage.vue", () => {
|
|||
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
||||
},
|
||||
isRepair: true,
|
||||
order: { serviceLocation: { zipCode: "11111" } },
|
||||
};
|
||||
|
||||
var glassSelections = wrapper.vm.getPassengerSideReplaceOptionsFromStore();
|
||||
|
|
@ -713,7 +706,6 @@ describe("vehicle-damage.vue", () => {
|
|||
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
||||
},
|
||||
isRepair: true,
|
||||
order: { serviceLocation: { zipCode: "11111" } },
|
||||
};
|
||||
|
||||
var glassSelections = wrapper.vm.getRearReplaceOptionsFromStore();
|
||||
|
|
@ -746,7 +738,6 @@ describe("vehicle-damage.vue", () => {
|
|||
getters: {
|
||||
vehicle: {},
|
||||
payment: { insuranceCoverage: { isVerified: true } },
|
||||
order: { serviceLocation: { zipCode: "11111" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -787,7 +778,6 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo
|
|||
isVerified: false,
|
||||
},
|
||||
},
|
||||
order: { serviceLocation: { zipCode: "11111" } },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
|||
|
||||
import store from "@/store";
|
||||
import baseMixin from "@/mixins/base-mixin";
|
||||
import { queryStrings } from "@/constants/query-strings";
|
||||
// DEFINE VALIDATION RULES
|
||||
defineRule("replace-options-required", required(errorMessages.REPLACE_OPTIONS_REQUIRED));
|
||||
|
||||
|
|
@ -90,20 +89,10 @@ export default {
|
|||
async beforeRouteEnter(to, from, next) {
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||
const queryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
const lowerCaseParams = new URLSearchParams();
|
||||
for (const [name, value] of urlParams) {
|
||||
lowerCaseParams.append(name.toLowerCase(), value);
|
||||
}
|
||||
|
||||
const zip = lowerCaseParams.get(queryStrings.ZIP_CODE)
|
||||
? lowerCaseParams.get(queryStrings.ZIP_CODE)
|
||||
: store.getters.order.serviceLocation.zipCode;
|
||||
|
||||
const damageOptionsPromise = baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.GET_DAMAGE_OPTIONS,
|
||||
{ carId: store.getters.vehicle.carId, zipCode: zip }
|
||||
{ carId: store.getters.vehicle.carId }
|
||||
);
|
||||
|
||||
// Settle promises and get results
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
|||
import { deleteFunnelCookie } from "@/helpers/heritage-integration/cookie-helper.js";
|
||||
import { deepEqual } from "@/helpers/object-helper";
|
||||
import { AppointmentTypeStrings, PREMIUM_FEE_PART_TYPE } from "@/constants/schedule-constants";
|
||||
|
||||
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
||||
import { queryStrings } from "@/constants/query-strings";
|
||||
// Export State
|
||||
const getDefaultState = () => {
|
||||
return {
|
||||
|
|
@ -740,12 +741,13 @@ export const actions = {
|
|||
});
|
||||
},
|
||||
|
||||
getDamageOptions(context, { carId, zipCode }) {
|
||||
getDamageOptions(context, { carId }) {
|
||||
return globalMethods.callHttpClient({
|
||||
methods: endpoints.GetDamageOptions.method,
|
||||
endpoint: `${endpoints.GetDamageOptions.url}/${carId}`,
|
||||
payload: {},
|
||||
additionalSuccessEventDataHandler: (response) => "QueryStringZip: " + zipCode,
|
||||
additionalSuccessEventDataHandler: (response) =>
|
||||
"QueryStringZip: " + getQuerystringParameter(queryStrings.ZIP_CODE),
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue