This commit is contained in:
Leah Schumann 2023-06-07 13:51:19 -04:00
parent b54b6ed5f3
commit 6a7d3b8626
6 changed files with 36 additions and 15 deletions

View file

@ -70,6 +70,7 @@ const storeActions = {
SAVE_VIN: "saveVin", SAVE_VIN: "saveVin",
SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup", SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup",
SAVE_GLASS_PARTS: "saveGlassParts", SAVE_GLASS_PARTS: "saveGlassParts",
SAVE_GLASS_PART_PRICES: "saveGlassPartPrices",
SAVE_PART_QUESTION_ANSWERS: "savePartQuestionAnswers", SAVE_PART_QUESTION_ANSWERS: "savePartQuestionAnswers",
RESET_MOLDING_AND_CAPABILITY_QUESTIONS_IF_NEEDED: RESET_MOLDING_AND_CAPABILITY_QUESTIONS_IF_NEEDED:
"resetMoldingAndCapabilityQuestionAnswersIfNeeded", "resetMoldingAndCapabilityQuestionAnswersIfNeeded",

View file

@ -60,6 +60,7 @@ const storeMutations = {
RESET_SAVE_SESSION_PROMISE: "resetSaveSessionPromise", RESET_SAVE_SESSION_PROMISE: "resetSaveSessionPromise",
RESET_SERVICE_LOCATION_APPOINTMENT_TYPE: "resetServiceLocationAppointmentType", RESET_SERVICE_LOCATION_APPOINTMENT_TYPE: "resetServiceLocationAppointmentType",
RESET_SERVICE_LOCATION_PROVIDER: "resetServiceLocationProvider", RESET_SERVICE_LOCATION_PROVIDER: "resetServiceLocationProvider",
RESET_SERVICE_LOCATION_MOBILE_ADDRESS: "resetServiceLocationMobileAddress",
// OTHER MUTATIONS // OTHER MUTATIONS
UPDATE_PAGE_DATA: "updatePageData", UPDATE_PAGE_DATA: "updatePageData",

View file

@ -182,6 +182,7 @@ export default {
this.isInsuranceSelected, this.isInsuranceSelected,
false false
); );
if (!this.isInsuranceSelected) { if (!this.isInsuranceSelected) {
this.dispatchStoreAction( this.dispatchStoreAction(
this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER, this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER,
@ -196,18 +197,21 @@ export default {
) { ) {
this.supportingItems = this.filterOutFees(this.supportingItems); this.supportingItems = this.filterOutFees(this.supportingItems);
} }
if (this.pricedGlassParts.length > 0) { if (this.pricedGlassParts.length > 0) {
this.dispatchStoreAction( this.dispatchStoreAction(
this.storeActions.SAVE_GLASS_PARTS, this.storeActions.SAVE_GLASS_PART_PRICES,
this.pricedGlassParts, this.pricedGlassParts,
false false
); );
} }
this.dispatchStoreAction( this.dispatchStoreAction(
this.storeActions.SAVE_SUPPORTING_ITEMS, this.storeActions.SAVE_SUPPORTING_ITEMS,
this.supportingItems, this.supportingItems,
false false
); );
this.dispatchStoreAction(this.storeActions.SAVE_VAPS, this.selectedVaps, false); this.dispatchStoreAction(this.storeActions.SAVE_VAPS, this.selectedVaps, false);
const payment = this.$store.getters.payment; const payment = this.$store.getters.payment;

View file

@ -442,7 +442,10 @@ export default {
const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions); const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions);
// save to store lineItems.glassParts // save to store lineItems.glassParts
self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts); await baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_GLASS_PARTS,
collectedGlassParts
)
const payment = store.getters.payment; const payment = store.getters.payment;

View file

@ -2240,15 +2240,17 @@ describe("vehicle-questions-mixin", () => {
// Assert // Assert
expect(wrapper.vm.$store.commit).toHaveBeenCalledTimes(1); expect(wrapper.vm.$store.commit).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$store.commit).toHaveBeenCalledWith( expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith(
storeMutations.UPDATE_GLASS_PARTS, storeActions.SAVE_GLASS_PARTS,
collectedGlassParts collectedGlassParts
); );
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1); expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
{ query: { fmgPage: "vin-lookup" } } { query: { fmgPage: "vin-lookup" } }
); );
expect(wrapper.vm.$router.navigateWithoutSaving).not.toHaveBeenCalled(); expect(wrapper.vm.$router.navigateWithoutSaving).not.toHaveBeenCalled();
}); });
}); });

View file

@ -253,16 +253,7 @@ export const mutations = {
state.order.serviceLocation.isVehicleProtected = serviceLocationInfo.isVehicleProtected; state.order.serviceLocation.isVehicleProtected = serviceLocationInfo.isVehicleProtected;
if (serviceLocationInfo.provider) { if (serviceLocationInfo.provider) {
state.order.serviceLocation.provider.providerNumber = state.order.serviceLocation.provider = serviceLocationInfo.provider;
serviceLocationInfo.provider?.providerNumber;
state.order.serviceLocation.provider.address.streetAddress =
serviceLocationInfo.provider?.address?.streetAddress;
state.order.serviceLocation.provider.address.city =
serviceLocationInfo.provider?.address?.city;
state.order.serviceLocation.provider.address.state =
serviceLocationInfo.provider?.address?.state;
state.order.serviceLocation.provider.address.zip =
serviceLocationInfo.provider?.address?.zip;
} }
}, },
updateSchedule(state, scheduleInfo) { updateSchedule(state, scheduleInfo) {
@ -354,6 +345,14 @@ export const mutations = {
resetServiceLocationProvider(state) { resetServiceLocationProvider(state) {
state.order.serviceLocation.provider = null; state.order.serviceLocation.provider = null;
}, },
resetServiceLocationMobileAddress(state) {
state.order.serviceLocation.address = null;
state.order.serviceLocation.address2 = null;
state.order.serviceLocation.city = null;
state.order.serviceLocation.state = null;
state.order.serviceLocation.zipCode = null;
state.order.serviceLocation.isVehicleProtected = null;
},
// Misc Mutations // Misc Mutations
updateStateWithOrderInformation(state, sessionInformation) { updateStateWithOrderInformation(state, sessionInformation) {
state.order.referralNumber = sessionInformation.order.referralNumber; state.order.referralNumber = sessionInformation.order.referralNumber;
@ -1825,6 +1824,13 @@ export const actions = {
}, },
saveServiceLocation(context, serviceLocationInfo) { saveServiceLocation(context, serviceLocationInfo) {
if (
context.state.order.serviceLocation &&
serviceLocationInfo.zipCode !== context.state.order.serviceLocation.zipCode
) {
context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS);
}
context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocationInfo); context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocationInfo);
}, },
@ -1846,7 +1852,7 @@ export const actions = {
}, },
saveGlassParts(context, parts) { saveGlassParts(context, parts) {
if (!deepEqual(parts, context.getters.order.lineItems.glassParts)) { if (!deepEqual(parts, context.state.order.lineItems.glassParts)) {
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
} }
@ -1854,6 +1860,10 @@ export const actions = {
context.commit(storeMutations.UPDATE_GLASS_PARTS, parts); context.commit(storeMutations.UPDATE_GLASS_PARTS, parts);
}, },
saveGlassPartPrices(context, parts) {
context.commit(storeMutations.UPDATE_GLASS_PARTS, parts);
},
clearVin(context) { clearVin(context) {
context.commit(storeMutations.UPDATE_VEHICLE_VIN, null); context.commit(storeMutations.UPDATE_VEHICLE_VIN, null);
}, },