Merge remote-tracking branch 'origin/develop' into feature/CSR-1391.1

This commit is contained in:
Matt Caimi 2023-11-08 14:53:18 -05:00
commit 8dfd6c4023
11 changed files with 134 additions and 13 deletions

View file

@ -87,6 +87,20 @@
display: none;
}
.buy-backdrop {
background-color: rgba(0, 0, 0, 0.3) !important;
}
.buy-backdrop #afterpay__iframe-checkout-container {
width: 100%;
}
.buy-backdrop #afterpay__iframe-checkout-container .style_closeWrapper__lIHJe {
display: none;
}
.buy-container-closer {
display: none;
}
@keyframes rotate {
0% {
transform: rotate(0);

View file

@ -90,6 +90,24 @@
}
}
// AfterPay Styles
.buy-backdrop {
background-color: rgba(0,0,0,.3)!important;
#afterpay__iframe-checkout-container {
width: 100%;
.style_closeWrapper__lIHJe {
display: none;
}
}
}
.buy-container-closer {
display: none;
}
// Modal Spinner
@keyframes rotate {
0% { transform: rotate(0)}
100% { transform: rotate(360deg)}

View file

@ -1,5 +1,5 @@
<template>
<div class="cart mb-4">
<div class="cart mb-5">
<div class="px-0">
<div
class="row vin-toggle flex align-items-center"
@ -33,7 +33,6 @@
</div>
<!-- Nonpackaged Cart Items -->
<hr style="background: red" />
<div
class="premium-appt-cart-item"
v-for="(cartItem, i) in nonpackageCartItems"
@ -802,4 +801,12 @@ export default {
}
}
}
.payment-method-question {
.question-text {
margin: 1rem 0 0.5rem 0;
}
span {
line-height: 24px;
}
}
</style>

View file

@ -1,6 +1,7 @@
import store from "@/store";
import { storeActions } from "@/constants/store-actions";
import { partTypeStrings } from "@/constants/part-type-strings";
import { deepClone } from "@/helpers/object-helper";
import baseMixin from "@/mixins/base-mixin.js";
export const promoPartNumberStrings = {
@ -126,6 +127,31 @@ export function getPromosThatMatchLineItemsOnOrder(promos, lineItemsOnOrder) {
return matchingPromos;
}
// Returns the vaps that the provided <promos> requires to be on the order to satisfy
// Items that are already in <lineItemsOnOrder> will not be returned
export function getVapsThatNeedToBeAddedToSatisfyPromos(
promos,
availableLineItems,
lineItemsOnOrder
) {
const clonedVaps = deepClone(lineItemsOnOrder.vaps ?? []);
const promosWithAddableVaps = getPromosWithAddableVaps(promos);
if (promosWithAddableVaps.length) {
const matchingLineItems = getLineItemsThatMatchPromos(
promosWithAddableVaps,
availableLineItems
);
// Check if matching items are already in the order
const idsOfVapsAlreadyInOrder = clonedVaps.map((lineItem) => lineItem.id);
const vapsToAddToCart = matchingLineItems.filter(
(lineItem) => !idsOfVapsAlreadyInOrder.includes(lineItem.id)
);
return vapsToAddToCart;
} else {
return [];
}
}
export function shouldStripPromoQueryString(fmgPageQueryValue) {
return pagesToStripPromoQueryStringFrom.includes(fmgPageQueryValue);
}

View file

@ -14,6 +14,7 @@
<div>
<vehicleBanner
cmsWidgetName="VehicleBannerWidget"
:displayVehicleImage="vehicleBannerImageUrl"
:displayGenericVehicleImage="false" />
</div>
<div class="scheduleText">
@ -205,6 +206,9 @@ export default {
return `at ${get12HourTimeFormat(this.ScheduleStartTime)}`;
}
},
vehicleBannerImageUrl() {
return store.getters.submittedOrder?.vehicle.imageUrl;
},
},
methods: {
arePagePrerequisitesValid() {
@ -238,7 +242,11 @@ export default {
const schedule = store.getters.order.schedule;
const scheduleReqs = !!(schedule.date && schedule.startTime && schedule.endTime);
return serviceLocationReqs && scheduleReqs;
// Customer
const customer = store.getters.order.customer;
const customerReqs = !!customer.emailAddress;
return serviceLocationReqs && scheduleReqs && customerReqs;
},
forwardButtonAction() {
window.location.assign("//www.safelite.com/");

View file

@ -97,7 +97,11 @@ export default {
this.$refs[modalName].closeModal();
},
addRainDefenseToCart(modalName, part) {
this.currentCartItems.vaps.push(part);
// Clone vaps array, then replace this.currentCartItems.vaps with it at the end
// in order to successfully trigger parent's watcher
const clonedVaps = this.currentCartItems.vaps.slice(0);
clonedVaps.push(part);
this.currentCartItems.vaps = clonedVaps;
this.closeModal(modalName);
const message = this.getRainDefenseAddedMessage();
this.$emit("added-to-cart", {
@ -133,19 +137,23 @@ export default {
this.selectedWipers = ["REAR"];
}
}
// Clone vaps array, then replace this.currentCartItems.vaps with it at the end
// in order to successfully trigger parent's watcher
const clonedVaps = this.currentCartItems.vaps.slice(0);
itemsForCart.forEach((type) => {
if (type === wipersOfferedStrings.FRONT) {
part.frontWiperLineItems.forEach((part) => {
this.currentCartItems.vaps.push(part);
clonedVaps.push(part);
});
}
if (type === wipersOfferedStrings.REAR) {
part.rearWiperLineItems.forEach((part) => {
this.currentCartItems.vaps.push(part);
clonedVaps.push(part);
});
}
});
this.currentCartItems.vaps = clonedVaps;
this.closeModal(modalName);

View file

@ -77,6 +77,7 @@ export default {
.payment-method-question {
.question-text span {
text-align: left;
line-height: 24px;
}
}
</style>

View file

@ -30,7 +30,7 @@
@cart-remove="cartRemove"
recyclingModalCmsWidgetName="RecycleModal" />
<hr />
<hr class="my-5" />
<div>
<alert
@ -88,7 +88,8 @@ import { paymentMethods } from "@/constants/payment-method-constants";
import { experimentSettings } from "@/constants/experiments";
import {
revalidatePromosAndValidateNewPromo,
getAddableVapsFromAvailableLineItems,
getPromosWithAddableVaps,
getVapsThatNeedToBeAddedToSatisfyPromos,
} from "@/helpers/promotions-helper";
import { queryStrings } from "@/constants/query-strings";
import { getQuerystringParameter } from "@/helpers/querystring-helper";
@ -177,7 +178,9 @@ export default {
"payment-method"
);
availableLineItems.push(...(validatePromoResponse?.orderPromos ?? []));
const newValidatedPromos = validatePromoResponse?.orderPromos ?? [];
availableLineItems.push(...newValidatedPromos);
// End of promo logic
const taxedAvailableLineItems = await baseMixin.methods.dispatchStoreActionWithLogging(
@ -201,6 +204,15 @@ export default {
availableLineItems,
lineItemsFromStore
);
// Add items that were not in the store yet but added via query string promo validation
lineItems.promos = lineItems.promos ?? [];
lineItems.promos.push(...newValidatedPromos);
const vapsToAddToCart = getVapsThatNeedToBeAddedToSatisfyPromos(
newValidatedPromos,
availableLineItems,
lineItems
);
lineItems.vaps.push(...vapsToAddToCart);
// Call the "next" function to complete the transition to this page.
next((vm) => {
@ -254,7 +266,7 @@ export default {
const scheduleReqs = !!(
schedule.date &&
schedule.startTime &&
(!isMobile || schedule.endTime) &&
schedule.endTime &&
schedule.jobMaxMinutes &&
schedule.jobMinMinutes
);
@ -412,11 +424,35 @@ export default {
shouldDisplayPiaAlert() {
return this.$route.params[this.routerParams.DISPLAY_PIA_ALERT];
},
// Necessary to make the watcher of lineItems work
// JavaScript does not keep a record of the old value, only a reference to it's location in the memory.
// This creates a separate location for oldValue/newValue so they can be compared
// See Vue github issue #2164
lineItemsCloneForWatcher() {
return Object.assign({}, this.lineItems);
},
},
watch: {
customCtaCopy(newValue) {
this.updateFooterButtonText(newValue);
},
lineItemsCloneForWatcher: {
handler(newValue, oldValue) {
if (
!oldValue ||
oldValue.length == 0 ||
!oldValue.vaps ||
!newValue ||
newValue.length == 0
) {
return;
}
if (oldValue.vaps.length != newValue.vaps.length) {
this.revalidatePromos();
}
},
deep: true,
},
},
components: {
funnelHeader,

View file

@ -425,7 +425,7 @@ export default {
const scheduleReqs = !!(
schedule.date &&
schedule.startTime &&
(!isMobile || schedule.endTime) &&
schedule.endTime &&
schedule.jobMaxMinutes &&
schedule.jobMinMinutes
);
@ -588,7 +588,7 @@ export default {
<style lang="scss">
.hop-iframe {
position: relative;
min-height: 1120px;
min-height: 650px;
width: 100%;
border: 0 none;
}

View file

@ -55,4 +55,7 @@ export default {
:deep(.review-block-content > ul) {
margin-bottom: 0rem;
}
.review-block-content {
width: 90%;
}
</style>

View file

@ -207,7 +207,7 @@ export default {
const scheduleReqs = !!(
schedule.date &&
schedule.startTime &&
(!isMobile || schedule.endTime) &&
schedule.endTime &&
schedule.jobMaxMinutes &&
schedule.jobMinMinutes
);