Merge pull request #1627 from Safelite/rlsmerge/2023.12.14-to-develop

Rlsmerge/2023.12.14 to develop
This commit is contained in:
CarlNation 2023-12-08 11:05:43 -05:00 committed by GitHub
commit 1d7dc6c2c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 74 additions and 3 deletions

View file

@ -55,6 +55,7 @@ const storeMutations = {
WORK_ORDER_NUMBER: "updateWorkOrderNumber", WORK_ORDER_NUMBER: "updateWorkOrderNumber",
Customer_Portal_Login_Token: "updateCustomerPortalLoginToken", Customer_Portal_Login_Token: "updateCustomerPortalLoginToken",
LOCK_TOKEN: "updateLockToken", LOCK_TOKEN: "updateLockToken",
UPDATE_SETTLED_TENDER_AMOUNT: "updateSettledTenderAmount",
// EVENT BUS MUTATIONS // EVENT BUS MUTATIONS
ADD_EVENT_TO_BUS: "addEventToBus", ADD_EVENT_TO_BUS: "addEventToBus",

View file

@ -164,6 +164,7 @@ async function saveSessionHelper(
workOrderNumber: savedSessionInfo.data.workOrderNumber, workOrderNumber: savedSessionInfo.data.workOrderNumber,
customerPortalLoginToken: savedSessionInfo.data.customerPortalLoginToken, customerPortalLoginToken: savedSessionInfo.data.customerPortalLoginToken,
lockToken: savedSessionInfo.data.lockToken, lockToken: savedSessionInfo.data.lockToken,
settledTenderAmount: savedSessionInfo.data.settledTenderAmount,
}, },
false false
); );

View file

@ -112,6 +112,7 @@ export async function revalidatePromosAndValidateQueryStringPromo(
pageNameToLog, pageNameToLog,
false false
); );
const revalidationErrorPromoCodes = revalidatePromoResponse.errors.map((x) => x.promoCode); const revalidationErrorPromoCodes = revalidatePromoResponse.errors.map((x) => x.promoCode);
baseMixin.methods.dispatchStoreAction( baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS, storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS,
@ -122,6 +123,7 @@ export async function revalidatePromosAndValidateQueryStringPromo(
false false
); );
} }
if (hasNewPromo) { if (hasNewPromo) {
validatePromoResponse = await baseMixin.methods.dispatchStoreActionWithLogging( validatePromoResponse = await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.VALIDATE_ORDER_PROMO_AND_SAVE_SERVER_DATA, storeActions.VALIDATE_ORDER_PROMO_AND_SAVE_SERVER_DATA,
@ -132,6 +134,7 @@ export async function revalidatePromosAndValidateQueryStringPromo(
pageNameToLog, pageNameToLog,
false false
); );
if (validatePromoResponse.errorCode == null) { if (validatePromoResponse.errorCode == null) {
// Save promo to store // Save promo to store
const activePromos = store.getters.order.lineItems.promos ?? []; const activePromos = store.getters.order.lineItems.promos ?? [];

View file

@ -39,6 +39,7 @@
</div> </div>
<hr /> <hr />
<cart <cart
v-if="ShowCart"
:damage="damageInfo" :damage="damageInfo"
:availableVaps="vaps" :availableVaps="vaps"
:allowItemRemoval="false" :allowItemRemoval="false"
@ -138,6 +139,13 @@ export default {
}; };
}, },
computed: { computed: {
ShowCart() {
if (this.isPia && store.getters.submittedOrder.settledTenderAmount == 0) {
return false;
}
return true;
},
ScheduleConfirmationText() { ScheduleConfirmationText() {
return this.getCmsContent("ScheduleConfirmationWidget", "BodyText"); return this.getCmsContent("ScheduleConfirmationWidget", "BodyText");
}, },

View file

@ -10,6 +10,7 @@
<div class="col-md-6 col-xl-4"> <div class="col-md-6 col-xl-4">
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" class="mt-4 mb-5" /> <funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" class="mt-4 mb-5" />
<textboxQuestion <textboxQuestion
isRequired
class="mb-4" class="mb-4"
cmsWidgetName="FirstNameWidget" cmsWidgetName="FirstNameWidget"
v-model="firstName" v-model="firstName"
@ -18,6 +19,7 @@
validationRules="first-name-required" /> validationRules="first-name-required" />
<textboxQuestion <textboxQuestion
isRequired
class="mb-4" class="mb-4"
cmsWidgetName="LastNameWidget" cmsWidgetName="LastNameWidget"
v-model="lastName" v-model="lastName"
@ -26,6 +28,7 @@
validationRules="last-name-required" /> validationRules="last-name-required" />
<textboxQuestion <textboxQuestion
isRequired
class="mb-4" class="mb-4"
cmsWidgetName="emailQuestionWidget" cmsWidgetName="emailQuestionWidget"
v-model="emailAddress" v-model="emailAddress"
@ -33,10 +36,10 @@
validationRules="email-address-required|email-address-format" /> validationRules="email-address-required|email-address-format" />
<phoneNumberQuestion <phoneNumberQuestion
isRequired
class="mb-4" class="mb-4"
cmsWidgetName="PhoneNumberQuestionWidget" cmsWidgetName="PhoneNumberQuestionWidget"
v-model="phoneNumber" v-model="phoneNumber"
isRequired
validationRules="phone-number-required" /> validationRules="phone-number-required" />
<checkboxQuestion <checkboxQuestion

View file

@ -112,6 +112,7 @@ import { defineRule } from "vee-validate";
import { required } from "@/helpers/validation-rules"; import { required } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages"; import { errorMessages } from "@/constants/error-messages";
import { AppointmentTypeStrings } from "@/constants/schedule-constants"; import { AppointmentTypeStrings } from "@/constants/schedule-constants";
import { partTypeStrings } from "@/constants/part-type-strings";
import { mapTaxedLineItemsToStoreFormat } from "../../store"; import { mapTaxedLineItemsToStoreFormat } from "../../store";
defineRule("option-required", required(errorMessages.OPTION_REQUIRED)); defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
@ -156,12 +157,14 @@ export default {
const lineItemsFromStore = deepClone(store.getters.order.lineItems); const lineItemsFromStore = deepClone(store.getters.order.lineItems);
const glassParts = lineItemsFromStore.glassParts ?? []; const glassParts = lineItemsFromStore.glassParts ?? [];
const supportingItems = lineItemsFromStore.supportingItems ?? []; const supportingItems = lineItemsFromStore.supportingItems ?? [];
const vaps = lineItemsFromStore.vaps ?? [];
const lineItemsToTax = [ const lineItemsToTax = [
resultMap.rainDefense, resultMap.rainDefense,
...supportingItems, ...supportingItems,
...resultMap.wipers, ...resultMap.wipers,
...glassParts, ...glassParts,
...vaps,
]; ];
const availableVaps = [resultMap.rainDefense, ...resultMap.wipers]; const availableVaps = [resultMap.rainDefense, ...resultMap.wipers];
@ -378,6 +381,32 @@ export default {
); );
} }
// Because we don't yet have a robust solution for part interchange ...
// if there are front wiper line items in the revalidate response, we need to delete any existing front wiper line items from the store
// and replace them with those that come back from revalidation.
const revalidateResponseHasFrontWiperLineItems =
revalidatePromoResponse.promoLineItems.find(
(lineItem) => lineItem.partType == partTypeStrings.FRONT_WIPER
).length > 0;
if (revalidateResponseHasFrontWiperLineItems) {
const frontWiperLineItemsInStore = this.lineItems.vaps.find(
(lineItem) => lineItem.partType == partTypeStrings.FRONT_WIPER
);
if (frontWiperLineItemsInStore.length > 0) {
this.lineItems.vaps = this.lineItems.vaps.find(
(lineItem) => lineItem.partType != partTypeStrings.FRONT_WIPER
);
}
}
const vapsToAddToCart = getVapsThatNeedToBeAddedToSatisfyPromos(
revalidatePromoResponse.promoLineItems,
this.availableVaps,
this.lineItems
);
this.lineItems.vaps.push(...vapsToAddToCart);
this.lineItems.promos = revalidatePromoResponse.promoLineItems; this.lineItems.promos = revalidatePromoResponse.promoLineItems;
this.inactivePromos = revalidatePromoResponse.errors.map((x) => this.inactivePromos = revalidatePromoResponse.errors.map((x) =>
getPromoCodeWithoutBundleIdentifier(x.promoCode) getPromoCodeWithoutBundleIdentifier(x.promoCode)

View file

@ -60,7 +60,7 @@
<navbar <navbar
cmsWidgetName="FunnelFooterWidget" cmsWidgetName="FunnelFooterWidget"
@ForwardClicked="forwardButtonAction" @ForwardClicked="forwardButtonAction"
:isForwardActionDisabled="!meta.valid" :isForwardActionDisabled="!meta.valid || !allDataRetrieved"
ref="navbar" /> ref="navbar" />
</div> </div>
</div> </div>
@ -232,12 +232,14 @@ export default {
this.selectedMake = null; this.selectedMake = null;
this.selectedModel = null; this.selectedModel = null;
this.selectedStyle = null; this.selectedStyle = null;
this.carId = null;
} }
} else { } else {
this.makeOptions = []; this.makeOptions = [];
this.selectedMake = null; this.selectedMake = null;
this.selectedModel = null; this.selectedModel = null;
this.selectedStyle = null; this.selectedStyle = null;
this.carId = null;
} }
}, },
async selectedMake(make) { async selectedMake(make) {
@ -248,11 +250,13 @@ export default {
else { else {
this.selectedModel = null; this.selectedModel = null;
this.selectedStyle = null; this.selectedStyle = null;
this.carId = null;
} }
} else { } else {
this.modelOptions = []; this.modelOptions = [];
this.selectedModel = null; this.selectedModel = null;
this.selectedStyle = null; this.selectedStyle = null;
this.carId = null;
} }
}, },
async selectedModel(model) { async selectedModel(model) {
@ -269,10 +273,14 @@ export default {
if (sameStyle) { if (sameStyle) {
this.getVehicleDetails(); this.getVehicleDetails();
} }
} else this.selectedStyle = null; } else {
this.selectedStyle = null;
this.carId = null;
}
} else { } else {
this.styleOptions = []; this.styleOptions = [];
this.selectedStyle = null; this.selectedStyle = null;
this.carId = null;
} }
}, },
async selectedStyle(style) { async selectedStyle(style) {
@ -280,6 +288,7 @@ export default {
this.getVehicleDetails(); this.getVehicleDetails();
} else { } else {
this.imageUrl = null; this.imageUrl = null;
this.carId = null;
} }
}, },
}, },
@ -294,6 +303,15 @@ export default {
else if (this.imageUrl == null && this.carId !== null) return false; else if (this.imageUrl == null && this.carId !== null) return false;
else return true; else return true;
}, },
allDataRetrieved() {
return (
!!this.selectedYear &&
!!this.selectedMake &&
!!this.selectedModel &&
!!this.selectedStyle &&
!!this.carId
);
},
}, },
methods: { methods: {
getVehicle(year, make, model, style) { getVehicle(year, make, model, style) {

View file

@ -172,6 +172,8 @@ router.beforeEach(async (to, from, next) => {
if (isInIframe && notToPIAReturn) { if (isInIframe && notToPIAReturn) {
const newUrl = `${window.top.location.origin}${to.href}`; const newUrl = `${window.top.location.origin}${to.href}`;
window.top.location.href = newUrl; window.top.location.href = newUrl;
} else if (toQueryPage === fromQueryPage) {
router.go(0);
} else { } else {
next(); next();
} }

View file

@ -132,6 +132,7 @@ const getDefaultState = () => {
workOrderNumber: null, workOrderNumber: null,
customerPortalLoginToken: null, customerPortalLoginToken: null,
lockToken: null, lockToken: null,
settledTenderAmount: 0,
}, },
applicationUser: { applicationUser: {
eventBus: [], eventBus: [],
@ -257,6 +258,9 @@ export const mutations = {
updateLockToken(state, lockToken) { updateLockToken(state, lockToken) {
state.order.lockToken = lockToken; state.order.lockToken = lockToken;
}, },
updateSettledTenderAmount(state, settledTenderAmount) {
state.order.settledTenderAmount = settledTenderAmount;
},
updateCCToken(state, ccToken) { updateCCToken(state, ccToken) {
state.order.payment.ccToken.subscriptionId = ccToken.subscriptionId; state.order.payment.ccToken.subscriptionId = ccToken.subscriptionId;
state.order.payment.ccToken.expMonth = ccToken.expMonth; state.order.payment.ccToken.expMonth = ccToken.expMonth;
@ -1041,6 +1045,7 @@ export const actions = {
workOrderNumber, workOrderNumber,
customerPortalLoginToken, customerPortalLoginToken,
lockToken, lockToken,
settledTenderAmount,
} }
) { ) {
context.commit(storeMutations.UPDATE_REFERRAL_NUMBER, referralNumber); context.commit(storeMutations.UPDATE_REFERRAL_NUMBER, referralNumber);
@ -1054,6 +1059,7 @@ export const actions = {
context.commit(storeMutations.WORK_ORDER_NUMBER, workOrderNumber); context.commit(storeMutations.WORK_ORDER_NUMBER, workOrderNumber);
context.commit(storeMutations.LOCK_TOKEN, lockToken); context.commit(storeMutations.LOCK_TOKEN, lockToken);
context.commit(storeMutations.Customer_Portal_Login_Token, customerPortalLoginToken); context.commit(storeMutations.Customer_Portal_Login_Token, customerPortalLoginToken);
context.commit(storeMutations.UPDATE_SETTLED_TENDER_AMOUNT, settledTenderAmount);
}, },
logPageView( logPageView(