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

@ -845,7 +845,7 @@ export default {
this.lineItems = deepClone(newValue); this.lineItems = deepClone(newValue);
}, },
deep: true, deep: true,
} },
}, },
components: { components: {
textBlock, textBlock,

View file

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