diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 8a7714410..f273b724c 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -236,8 +236,6 @@ export default { this.lineItems[category] = this.lineItems[category].filter( (lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType ); - - this.$emit("update:modelValue", this.lineItems); }, getPromoCodeList() { if (this.$refs["promoModalQuestion"]) { @@ -245,6 +243,10 @@ export default { } return []; }, + handleAddedPromo(lineItems) { + // NOTE: these lineItems are passed from promo-modal-question + //this.$emit("update:modelValue", lineItems); + }, }, computed: { screenReaderTotalAmountDueText() { @@ -846,6 +848,12 @@ export default { }, deep: true, }, + lineItems: { + handler(newValue) { + console.log('cart emitted a modelValue update'); + this.$emit("update:modelValue", newValue); + } + } }, components: { textBlock, diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index c1dd44145..82c3ad6d3 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -86,6 +86,7 @@ import baseMixin from "@/mixins/base-mixin.js"; import vehicleQuestionsMixin from "../../mixins/vehicle-questions-mixin"; import { settleAllPromises } from "@/helpers/layout-helper"; import { storeActions } from "@/constants/store-actions"; +import { deepClone } from "@/helpers/object-helper"; import store from "@/store"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { required } from "@/helpers/validation-rules"; @@ -149,7 +150,7 @@ export default { ]; const resultMap = await settleAllPromises(promiseResultMap); - const lineItems = store.getters.order.lineItems; + const lineItems = deepClone(store.getters.order.lineItems); const nullSafeGlassParts = lineItems.glassParts ?? []; const availableLineItems = [ resultMap.rainDefense, @@ -180,7 +181,8 @@ export default { const oldInactivePromos = store.getters.order.payment.inactivePromos?.slice(0); const promoCodeFromQueryString = getQuerystringParameter(queryStrings.PROMO); - + console.log("lineItems before sending off for promo"); + console.log(JSON.parse(JSON.stringify(lineItems))); const { validatePromoResponse, revalidatePromoResponse } = await revalidatePromosAndValidateQueryStringPromo( promoCodeFromQueryString, @@ -190,6 +192,7 @@ export default { lineItems.glassParts = nullSafeGlassParts; lineItems.promos = lineItems.promos ?? []; lineItems.vaps = lineItems.vaps ?? []; + console.log("lineItems.vaps", JSON.parse(JSON.stringify(lineItems.vaps))); // End of promo logic // Call the "next" function to complete the transition to this page. diff --git a/src/store/index.js b/src/store/index.js index 06a5631d3..ec3426bd5 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2176,6 +2176,7 @@ export const actions = { context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems); }, saveVaps(context, vaps) { + console.log("saving vaps"); addGuidToLineItemsIfNotAlreadyThere(vaps); context.commit(storeMutations.UPDATE_VAPS, vaps); }, @@ -2426,6 +2427,7 @@ export const actions = { lineItemsToUse = lineItemsToUse ? deepClone(lineItemsToUse) : deepClone(order.lineItems); addGuidToLineItemsIfNotAlreadyThere(lineItemsToUse.vaps); lineItemsToUse.promos = activePromosToUse; + console.log("lineItemsToUse:", lineItemsToUse); inactivePromosToUse = inactivePromosToUse ?? order.payment.inactivePromos; inactivePromosToUse = removeCurrentlyActivePromoCodesFromInactivePromos(