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; 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 { @keyframes rotate {
0% { 0% {
transform: 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 { @keyframes rotate {
0% { transform: rotate(0)} 0% { transform: rotate(0)}
100% { transform: rotate(360deg)} 100% { transform: rotate(360deg)}

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="cart mb-4"> <div class="cart mb-5">
<div class="px-0"> <div class="px-0">
<div <div
class="row vin-toggle flex align-items-center" class="row vin-toggle flex align-items-center"
@ -33,7 +33,6 @@
</div> </div>
<!-- Nonpackaged Cart Items --> <!-- Nonpackaged Cart Items -->
<hr style="background: red" />
<div <div
class="premium-appt-cart-item" class="premium-appt-cart-item"
v-for="(cartItem, i) in nonpackageCartItems" 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> </style>

View file

@ -1,6 +1,7 @@
import store from "@/store"; import store from "@/store";
import { storeActions } from "@/constants/store-actions"; import { storeActions } from "@/constants/store-actions";
import { partTypeStrings } from "@/constants/part-type-strings"; import { partTypeStrings } from "@/constants/part-type-strings";
import { deepClone } from "@/helpers/object-helper";
import baseMixin from "@/mixins/base-mixin.js"; import baseMixin from "@/mixins/base-mixin.js";
export const promoPartNumberStrings = { export const promoPartNumberStrings = {
@ -126,6 +127,31 @@ export function getPromosThatMatchLineItemsOnOrder(promos, lineItemsOnOrder) {
return matchingPromos; 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) { export function shouldStripPromoQueryString(fmgPageQueryValue) {
return pagesToStripPromoQueryStringFrom.includes(fmgPageQueryValue); return pagesToStripPromoQueryStringFrom.includes(fmgPageQueryValue);
} }

View file

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

View file

@ -97,7 +97,11 @@ export default {
this.$refs[modalName].closeModal(); this.$refs[modalName].closeModal();
}, },
addRainDefenseToCart(modalName, part) { 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); this.closeModal(modalName);
const message = this.getRainDefenseAddedMessage(); const message = this.getRainDefenseAddedMessage();
this.$emit("added-to-cart", { this.$emit("added-to-cart", {
@ -133,19 +137,23 @@ export default {
this.selectedWipers = ["REAR"]; 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) => { itemsForCart.forEach((type) => {
if (type === wipersOfferedStrings.FRONT) { if (type === wipersOfferedStrings.FRONT) {
part.frontWiperLineItems.forEach((part) => { part.frontWiperLineItems.forEach((part) => {
this.currentCartItems.vaps.push(part); clonedVaps.push(part);
}); });
} }
if (type === wipersOfferedStrings.REAR) { if (type === wipersOfferedStrings.REAR) {
part.rearWiperLineItems.forEach((part) => { part.rearWiperLineItems.forEach((part) => {
this.currentCartItems.vaps.push(part); clonedVaps.push(part);
}); });
} }
}); });
this.currentCartItems.vaps = clonedVaps;
this.closeModal(modalName); this.closeModal(modalName);

View file

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

View file

@ -30,7 +30,7 @@
@cart-remove="cartRemove" @cart-remove="cartRemove"
recyclingModalCmsWidgetName="RecycleModal" /> recyclingModalCmsWidgetName="RecycleModal" />
<hr /> <hr class="my-5" />
<div> <div>
<alert <alert
@ -88,7 +88,8 @@ import { paymentMethods } from "@/constants/payment-method-constants";
import { experimentSettings } from "@/constants/experiments"; import { experimentSettings } from "@/constants/experiments";
import { import {
revalidatePromosAndValidateNewPromo, revalidatePromosAndValidateNewPromo,
getAddableVapsFromAvailableLineItems, getPromosWithAddableVaps,
getVapsThatNeedToBeAddedToSatisfyPromos,
} from "@/helpers/promotions-helper"; } from "@/helpers/promotions-helper";
import { queryStrings } from "@/constants/query-strings"; import { queryStrings } from "@/constants/query-strings";
import { getQuerystringParameter } from "@/helpers/querystring-helper"; import { getQuerystringParameter } from "@/helpers/querystring-helper";
@ -177,7 +178,9 @@ export default {
"payment-method" "payment-method"
); );
availableLineItems.push(...(validatePromoResponse?.orderPromos ?? [])); const newValidatedPromos = validatePromoResponse?.orderPromos ?? [];
availableLineItems.push(...newValidatedPromos);
// End of promo logic // End of promo logic
const taxedAvailableLineItems = await baseMixin.methods.dispatchStoreActionWithLogging( const taxedAvailableLineItems = await baseMixin.methods.dispatchStoreActionWithLogging(
@ -201,6 +204,15 @@ export default {
availableLineItems, availableLineItems,
lineItemsFromStore 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. // Call the "next" function to complete the transition to this page.
next((vm) => { next((vm) => {
@ -254,7 +266,7 @@ export default {
const scheduleReqs = !!( const scheduleReqs = !!(
schedule.date && schedule.date &&
schedule.startTime && schedule.startTime &&
(!isMobile || schedule.endTime) && schedule.endTime &&
schedule.jobMaxMinutes && schedule.jobMaxMinutes &&
schedule.jobMinMinutes schedule.jobMinMinutes
); );
@ -412,11 +424,35 @@ export default {
shouldDisplayPiaAlert() { shouldDisplayPiaAlert() {
return this.$route.params[this.routerParams.DISPLAY_PIA_ALERT]; 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: { watch: {
customCtaCopy(newValue) { customCtaCopy(newValue) {
this.updateFooterButtonText(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: { components: {
funnelHeader, funnelHeader,

View file

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

View file

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

View file

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