Merge pull request #1260 from Safelite/feature/Digital/CSR-1529
CSR-1529
This commit is contained in:
commit
131acc26e6
4 changed files with 42 additions and 11 deletions
|
|
@ -12,6 +12,7 @@ const GaEvents = {
|
||||||
const GaCategories = {
|
const GaCategories = {
|
||||||
API_RESPONSE: "Api_Response",
|
API_RESPONSE: "Api_Response",
|
||||||
EVOX: "Evox",
|
EVOX: "Evox",
|
||||||
|
FUNNEL_ENTRY: "funnel_entry",
|
||||||
};
|
};
|
||||||
|
|
||||||
const GaActions = {
|
const GaActions = {
|
||||||
|
|
@ -20,6 +21,7 @@ const GaActions = {
|
||||||
VIF: "vif",
|
VIF: "vif",
|
||||||
SUBMITTED: "Submitted",
|
SUBMITTED: "Submitted",
|
||||||
DISPLAYED: "Displayed",
|
DISPLAYED: "Displayed",
|
||||||
|
ZIP_CODE_PROVIDED: "zip_code_provided",
|
||||||
};
|
};
|
||||||
|
|
||||||
const GaLabels = {
|
const GaLabels = {
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ jest.mock("@/store", () => ({
|
||||||
damage: {
|
damage: {
|
||||||
glassToReplace: [],
|
glassToReplace: [],
|
||||||
},
|
},
|
||||||
|
order: { serviceLocation: { zipCode: "11111" } },
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -133,6 +134,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
getters: {
|
getters: {
|
||||||
vehicle: {},
|
vehicle: {},
|
||||||
payment: { insuranceCoverage: { isVerified: false } },
|
payment: { insuranceCoverage: { isVerified: false } },
|
||||||
|
order: { serviceLocation: { zipCode: "11111" } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -175,7 +177,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
||||||
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(
|
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(
|
||||||
storeActions.GET_DAMAGE_OPTIONS,
|
storeActions.GET_DAMAGE_OPTIONS,
|
||||||
{ carId: "C00000000" }
|
{ carId: "C00000000", zipCode: "11111" }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -241,6 +243,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
getters: {
|
getters: {
|
||||||
vehicle: {},
|
vehicle: {},
|
||||||
payment: { insuranceCoverage: { isVerified: false } },
|
payment: { insuranceCoverage: { isVerified: false } },
|
||||||
|
order: { serviceLocation: { zipCode: "11111" } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -270,11 +273,10 @@ describe("vehicle-damage.vue", () => {
|
||||||
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
||||||
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(
|
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(
|
||||||
storeActions.GET_DAMAGE_OPTIONS,
|
storeActions.GET_DAMAGE_OPTIONS,
|
||||||
{ carId: "C00000000" }
|
{ carId: "C00000000", zipCode: "11111" }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("alert", () => {
|
describe("alert", () => {
|
||||||
test("when displayVehicleChangeAlert router params is true, the alert: 'vehicleChangeAlert' should be rendered", () => {
|
test("when displayVehicleChangeAlert router params is true, the alert: 'vehicleChangeAlert' should be rendered", () => {
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
|
|
@ -321,7 +323,6 @@ describe("vehicle-damage.vue", () => {
|
||||||
expect(wrapper.findComponent({ ref: "vehicleChangeAlert" }).exists()).toBe(false);
|
expect(wrapper.findComponent({ ref: "vehicleChangeAlert" }).exists()).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("glass selections and corresponding variables", () => {
|
describe("glass selections and corresponding variables", () => {
|
||||||
test("isWindshieldDamageLocation is true when windshield is selected", async () => {
|
test("isWindshieldDamageLocation is true when windshield is selected", async () => {
|
||||||
//Arrange
|
//Arrange
|
||||||
|
|
@ -453,7 +454,6 @@ describe("vehicle-damage.vue", () => {
|
||||||
expect(wrapper.vm.isPassengerSideReplace).toEqual(true);
|
expect(wrapper.vm.isPassengerSideReplace).toEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("state validations", () => {
|
describe("state validations", () => {
|
||||||
test("CarId set, arePagePrerequisitesValid should be true ", async () => {
|
test("CarId set, arePagePrerequisitesValid should be true ", async () => {
|
||||||
//Arrange
|
//Arrange
|
||||||
|
|
@ -474,7 +474,6 @@ describe("vehicle-damage.vue", () => {
|
||||||
expect(arePagePrerequisitesValid).toBe(true);
|
expect(arePagePrerequisitesValid).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("input validations", () => {
|
describe("input validations", () => {
|
||||||
// THE FOLLOWING TEST IS NOT NECESSARILY REQUIRED FOR COVERAGE
|
// THE FOLLOWING TEST IS NOT NECESSARILY REQUIRED FOR COVERAGE
|
||||||
// BUT KEEP FOR AN EXAMPLE OF A VALIDATION TEST
|
// BUT KEEP FOR AN EXAMPLE OF A VALIDATION TEST
|
||||||
|
|
@ -501,7 +500,6 @@ describe("vehicle-damage.vue", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("get glass options from store", () => {
|
describe("get glass options from store", () => {
|
||||||
const damageLocations = [
|
const damageLocations = [
|
||||||
["Windshield", [damageLocationsSelected.WINDSHIELD]],
|
["Windshield", [damageLocationsSelected.WINDSHIELD]],
|
||||||
|
|
@ -528,6 +526,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
eventBusItem: jest.fn(),
|
eventBusItem: jest.fn(),
|
||||||
damage: { glassToReplace: [{ glassLocation: damageLocation }] },
|
damage: { glassToReplace: [{ glassLocation: damageLocation }] },
|
||||||
isRepair: true,
|
isRepair: true,
|
||||||
|
order: { serviceLocation: { zipCode: "11111" } },
|
||||||
};
|
};
|
||||||
|
|
||||||
var glassSelections = wrapper.vm.getDamageLocationsFromStore();
|
var glassSelections = wrapper.vm.getDamageLocationsFromStore();
|
||||||
|
|
@ -605,6 +604,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
isRepair: isRepair,
|
isRepair: isRepair,
|
||||||
numberOfChips: 2,
|
numberOfChips: 2,
|
||||||
},
|
},
|
||||||
|
order: { serviceLocation: { zipCode: "11111" } },
|
||||||
};
|
};
|
||||||
|
|
||||||
var windshieldSelections = wrapper.vm.getWindshieldOptionsFromStore();
|
var windshieldSelections = wrapper.vm.getWindshieldOptionsFromStore();
|
||||||
|
|
@ -641,6 +641,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
||||||
},
|
},
|
||||||
isRepair: true,
|
isRepair: true,
|
||||||
|
order: { serviceLocation: { zipCode: "11111" } },
|
||||||
};
|
};
|
||||||
|
|
||||||
var glassSelections = wrapper.vm.getDriverSideReplaceOptionsFromStore();
|
var glassSelections = wrapper.vm.getDriverSideReplaceOptionsFromStore();
|
||||||
|
|
@ -677,6 +678,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
||||||
},
|
},
|
||||||
isRepair: true,
|
isRepair: true,
|
||||||
|
order: { serviceLocation: { zipCode: "11111" } },
|
||||||
};
|
};
|
||||||
|
|
||||||
var glassSelections = wrapper.vm.getPassengerSideReplaceOptionsFromStore();
|
var glassSelections = wrapper.vm.getPassengerSideReplaceOptionsFromStore();
|
||||||
|
|
@ -711,6 +713,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
||||||
},
|
},
|
||||||
isRepair: true,
|
isRepair: true,
|
||||||
|
order: { serviceLocation: { zipCode: "11111" } },
|
||||||
};
|
};
|
||||||
|
|
||||||
var glassSelections = wrapper.vm.getRearReplaceOptionsFromStore();
|
var glassSelections = wrapper.vm.getRearReplaceOptionsFromStore();
|
||||||
|
|
@ -720,7 +723,6 @@ describe("vehicle-damage.vue", () => {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("hide back button", () => {
|
describe("hide back button", () => {
|
||||||
test("if claim registration is delayed => should hide back button", () => {
|
test("if claim registration is delayed => should hide back button", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -744,6 +746,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
getters: {
|
getters: {
|
||||||
vehicle: {},
|
vehicle: {},
|
||||||
payment: { insuranceCoverage: { isVerified: true } },
|
payment: { insuranceCoverage: { isVerified: true } },
|
||||||
|
order: { serviceLocation: { zipCode: "11111" } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -784,6 +787,7 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo
|
||||||
isVerified: false,
|
isVerified: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
order: { serviceLocation: { zipCode: "11111" } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||||
|
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import baseMixin from "@/mixins/base-mixin";
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
|
import { queryStrings } from "@/constants/query-strings";
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("replace-options-required", required(errorMessages.REPLACE_OPTIONS_REQUIRED));
|
defineRule("replace-options-required", required(errorMessages.REPLACE_OPTIONS_REQUIRED));
|
||||||
|
|
||||||
|
|
@ -90,9 +90,20 @@ export default {
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
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(
|
const damageOptionsPromise = baseMixin.methods.dispatchStoreAction(
|
||||||
storeActions.GET_DAMAGE_OPTIONS,
|
storeActions.GET_DAMAGE_OPTIONS,
|
||||||
{ carId: store.getters.vehicle.carId }
|
{ carId: store.getters.vehicle.carId, zipCode: zip }
|
||||||
);
|
);
|
||||||
|
|
||||||
// Settle promises and get results
|
// Settle promises and get results
|
||||||
|
|
@ -135,6 +146,7 @@ export default {
|
||||||
},
|
},
|
||||||
selectedWindshieldOptions: this.getWindshieldOptionsFromStore(),
|
selectedWindshieldOptions: this.getWindshieldOptionsFromStore(),
|
||||||
selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(),
|
selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(),
|
||||||
|
serviceZipCode: this.getZipFromStore() ?? this.$route.query.zipcode,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -157,6 +169,18 @@ export default {
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (this.serviceZipCode) {
|
||||||
|
this.pushEventToGA(
|
||||||
|
this.GaCategories.FUNNEL_ENTRY,
|
||||||
|
this.GaActions.ZIP_CODE_PROVIDED,
|
||||||
|
this.serviceZipCode,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getZipFromStore() {
|
||||||
|
return this.$store.getters.order.serviceLocation.zipCode;
|
||||||
},
|
},
|
||||||
|
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
|
|
|
||||||
|
|
@ -740,11 +740,12 @@ export const actions = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getDamageOptions(context, { carId }) {
|
getDamageOptions(context, { carId, zipCode }) {
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
methods: endpoints.GetDamageOptions.method,
|
methods: endpoints.GetDamageOptions.method,
|
||||||
endpoint: `${endpoints.GetDamageOptions.url}/${carId}`,
|
endpoint: `${endpoints.GetDamageOptions.url}/${carId}`,
|
||||||
payload: {},
|
payload: {},
|
||||||
|
additionalSuccessEventDataHandler: (response) => "QueryStringZip: " + zipCode,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue