Merge branch 'develop' into CSR-2383-fix-collapsed-cart-on-confirm

This commit is contained in:
Bryan Mauger 2024-11-22 12:40:27 -05:00
commit 14b371a262
8 changed files with 76 additions and 23 deletions

View file

@ -307,7 +307,7 @@ describe("cart.vue", () => {
});
// Service package discount Fee Cart Item
test("if there is service package discount fee on the order, a service package discount cart item should be added to the cart", () => {
test("only if there is service package discount fee for the package, a service package discount cart item should be added to the cart", () => {
// Arrange
const lineItems = {
glassParts: [],
@ -336,17 +336,8 @@ describe("cart.vue", () => {
availableVaps: availableVaps,
},
});
// Assert
expect(wrapper.vm.servicePackageDiscountCartItem).not.toBeNull();
expect(wrapper.vm.servicePackageDiscountCartItem.subTotal).toEqual(-70);
expect(wrapper.vm.servicePackageDiscountCartItem.salesTax).toEqual(0);
const found =
wrapper.vm.cartItems.findIndex(
(cartItem) => cartItem == wrapper.vm.servicePackageDiscountCartItem
) >= 0;
expect(found).toBe(true);
expect(wrapper.vm.servicePackageDiscountCartItem).toBeNull();
});
// Other Supporting Items Cart Item

View file

@ -163,10 +163,15 @@ import promoModalQuestion from "@/fmg-components/promo-modal-question/promo-moda
// Mixins
import baseMixin from "@/mixins/base-mixin.js";
import experimentMixin from "@/mixins/experiment-mixin.js";
// Helpers
import { deepClone } from "@/helpers/object-helper";
import { getHighestFullySatisfiedTier, getPackageContents } from "@/helpers/service-package-helper";
import {
getHighestFullySatisfiedTier,
getPackageContents,
getDiscountPackageName,
} from "@/helpers/service-package-helper";
import { getPromoCodeWithoutBundleIdentifier } from "@/helpers/promotions-helper";
import { storeActions } from "@/constants/store-actions";
@ -175,6 +180,7 @@ import { partTypeStrings } from "@/constants/part-type-strings";
import { cartItemCategories } from "@/constants/cart-item-categories";
import { cartItemTypes } from "@/constants/cart-item-types";
import { coverageStatus, cartItemTypesCoveredByInsurance } from "@/constants/insurance";
import { experimentSettings } from "@/constants/experiments";
export default {
name: "cart",
@ -292,8 +298,16 @@ export default {
this.lineItems[category] = this.lineItems[category].filter(
(lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType
);
await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false);
if (category == cartItemCategories.VAPS) {
await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false);
}
if (category == cartItemCategories.SUPPORTING_ITEMS) {
await this.dispatchStoreAction(
storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING,
this.lineItems.supportingItems,
false
);
}
},
async saveVaps(lineItems) {
@ -426,7 +440,14 @@ export default {
}
if (this.servicePackageDiscountCartItem) {
cartItems.push(this.servicePackageDiscountCartItem);
if (this.discountPackageNames != this.packageLevel) {
this.removeItem(
this.servicePackageDiscountCartItem.cartItemType,
cartItemCategories.SUPPORTING_ITEMS
);
} else {
cartItems.push(this.servicePackageDiscountCartItem);
}
}
if (this.premiumAppointmentDiscountCartItem) {
@ -442,6 +463,12 @@ export default {
return cartItems;
},
},
discountPackageNames() {
const discountServicePackage = experimentMixin.methods.getSettingValue(
experimentSettings.PROMO_ON_PACKAGE
);
return getDiscountPackageName(discountServicePackage);
},
servicePackageTitleWidget() {
const servicePackageNames = this.getCmsContent(
this.servicePackageOptionsCmsName,

View file

@ -109,7 +109,7 @@ export async function getImplicitNavigation(toRoute) {
Used to navigate to the heritage funnel with the correct query string and url.
*/
export async function navigateToHeritageFunnel({ shouldSaveSession, pageNameToLog }) {
export async function navigateToHeritageFunnel({ shouldSaveSession, pageNameToLog, navType }) {
const log = getQuerystringParameter(queryStrings.LOG);
if (log === "true") {
console.log("------------- Navigate to heritage start -----------------");
@ -136,6 +136,10 @@ export async function navigateToHeritageFunnel({ shouldSaveSession, pageNameToLo
heritageParms["promo"] = promo;
}
if (navType) {
heritageParms["navType"] = navType;
}
if (
(process.env.VUE_APP_HERITAGE_FUNNEL.includes("fixmyglasstest") &&
process.env.VUE_APP_CURRENT_ENVIRONMENT === "Localhost") ||

View file

@ -428,7 +428,8 @@ export default {
);
},
shouldHideRecalibration() {
return store.getters.shouldHideRecalibration;
if (this.isInsuranceSelected) return false;
return (experimentMixin.methods.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE)?.toLowerCase() === "true" && this.isRecalibrationOnOrder);
},
showAfterpayBanner() {
return (

View file

@ -276,11 +276,16 @@ export default {
max-height: 500px;
}
.row {
align-items: center;
}
p {
font-weight: 600;
display: flex;
justify-content: space-between;
align-items: center;
white-space: nowrap;
span {
&.pricing-info {
color: $green;
@ -315,11 +320,12 @@ export default {
font-weight: 600;
font-size: 0.875rem;
display: flex;
justify-content: space-between;
justify-content: flex-end;
align-items: center;
div.strikethrough-discount-price {
text-decoration: line-through;
margin-right: 0.5rem;
font-weight: 600;
font-weight: 400;
font-size: 0.75rem;
line-height: 20px;
color: $gray-550;
@ -393,7 +399,7 @@ export default {
display: flex;
flex-direction: row;
margin: auto;
margin-left: -2rem;
margin-left: -1.25rem;
padding: 0.5rem 1rem;
border-radius: 0.25rem;
margin-top: 0.5rem;

View file

@ -520,7 +520,11 @@ export default {
(payment?.insuranceCoverage?.isVerified ||
store.getters.order.referralNumber.length === 6)
) {
navigateToHeritageFunnel({ shouldSaveSession: false });
navigateToHeritageFunnel({
shouldSaveSession: false,
pageNameToLog: "service-location",
navType: "back",
});
} else {
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_BACK,

View file

@ -939,7 +939,7 @@ export const getters = {
.reduce((r, c) => Object.assign(r, c), {}) ?? {},
isVerifiedAndDeductibleZeroConfirmed: (state) => {
// used as a CMS variable on /payment-method, needed for FunnelSubHeaderWidget on cart pages
// used in CMS on /payment-method in Header Sub Text, for FunnelSubHeaderWidget on cart pages
if (
state.order.policy.currentDeductible === 0 &&
getters.coverageIsVerified(state) &&
@ -949,6 +949,14 @@ export const getters = {
}
return false;
},
isItacOrNoComp: (state) => {
// used in CMS on /payment-method in Header Sub Text, for FunnelSubHeaderWidget on cart pages
if (state.order.policy.isNoComp || state.order.policy.isItac) {
return true;
} else {
return false;
}
},
requiresVerifiedRedirecting: (state) => {
return state.order?.referralNumber?.length === 6;
},

View file

@ -10,7 +10,7 @@ body {
overflow-x: unset;
}
&.page-container-grouped-styles {
height: 100vh;
height: 100dvh;
display: flex;
flex-direction: column;
}
@ -68,6 +68,18 @@ body {
height: 1px;
overflow: hidden;
}
// Fix "iOS viewport scroll bug" issue on iPhone
// where bottom of page is covered by address bar
@media only screen
and (min-device-width: 375px)
and (max-device-width: 812px)
and (-webkit-min-device-pixel-ratio: 3)
and (orientation: portrait) {
.page-container-grouped-styles {
padding-bottom: 3rem;
}
}
}
.modal-open {
.container-fluid {