Merge pull request #1267 from Safelite/rlsmerge/2023.08.10-to-develop

Release Merge 2023.08.10 -> Develop
This commit is contained in:
scottkiener 2023-07-24 15:59:59 -04:00 committed by GitHub
commit e297f817e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 13 deletions

View file

@ -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 = {

View file

@ -44,7 +44,8 @@
type="radio" type="radio"
name="day-of-month" name="day-of-month"
v-model="selectedDate" v-model="selectedDate"
@click="fireDateClickedEvent" @click="fireDateSelectedEvent"
@keypress.enter="fireDateSelectedEvent"
:value="date.inputValue" :value="date.inputValue"
:id="`${month.monthLabel}-${date.dateNum.toString()}`" /> :id="`${month.monthLabel}-${date.dateNum.toString()}`" />
<label :for="`${month.monthLabel}-${date.dateNum.toString()}`"> <label :for="`${month.monthLabel}-${date.dateNum.toString()}`">
@ -190,7 +191,11 @@ export default {
initializeComponent(initialData) { initializeComponent(initialData) {
this.setCalendarData(initialData); this.setCalendarData(initialData);
}, },
fireDateClickedEvent() { fireDateSelectedEvent(event) {
// Ignore if arrow key selected radioButton
if (event.screenX === 0 && event.screenY === 0) {
return;
}
this.$emit("date-clicked"); this.$emit("date-clicked");
}, },
getWeekStartDate(dateString) { getWeekStartDate(dateString) {

View file

@ -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" } },
}, },
}, },
}; };

View file

@ -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() {

View file

@ -759,11 +759,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,
}); });
}, },