CSR-1971 | sync local and store promos

This commit is contained in:
Scott Kiener 2024-03-04 07:58:22 -05:00
parent b42e436288
commit a45702a560
2 changed files with 6 additions and 8 deletions

View file

@ -236,7 +236,7 @@ export default {
this.lineItems[category] = this.lineItems[category].filter(
(lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType
);
this.$emit("update:modelValue", this.lineItems);
},
getPromoCodeList() {
@ -845,7 +845,7 @@ export default {
this.lineItems = deepClone(newValue);
},
deep: true,
}
},
},
components: {
textBlock,

View file

@ -29,7 +29,7 @@
:availableLineItems="availableLineItems"
:isInsuranceSelected="isInsuranceSelected"
@vapsItemsSelected="vapsItemsSelectedAction"
:activePromos="allActivePromos"
:activePromos="lineItems.promos"
v-on="{ 'buttonEvent.openModal': openModalAction }"
validationRules="option-required"
isRequired />
@ -151,7 +151,6 @@ export default {
const resultMap = await settleAllPromises(promiseResultMap);
const lineItems = deepClone(store.getters.order.lineItems);
lineItems.promos = lineItems.promos ?? [];
lineItems.vaps = lineItems.vaps ?? [];
const nullSafeGlassParts = lineItems.glassParts ?? [];
const availableLineItems = [
@ -190,6 +189,8 @@ export default {
pricingResults,
"quote"
);
// Sync local promos with any new promos added by validate/revalidate
lineItems.promos = store.getters.lineItems.promos ?? [];
// End of promo logic
// Call the "next" function to complete the transition to this page.
@ -229,9 +230,6 @@ export default {
};
},
computed: {
allActivePromos() {
return this.lineItems.promos ?? [];
},
lineItemsCloneForWatcher() {
return Object.assign({}, this.lineItems);
},
@ -319,7 +317,7 @@ export default {
this.dispatchStoreAction(
storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS,
{
activePromos: this.lineItems.promos
activePromos: this.lineItems.promos,
},
false
);