diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index b6e27d3a2..bf36b7d06 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -31,7 +31,6 @@ @vapsItemsSelected="vapsItemsSelectedAction" @servicePackageDiscountSelected="servicePackageDiscountSelectedAction" :activePromos="lineItems.promos" - :lineItems="lineItems" v-on="{ 'buttonEvent.openModal': openModalAction }" validationRules="option-required" isRequired /> @@ -109,7 +108,6 @@ import { queryStrings } from "@/constants/query-strings"; import { getQuerystringParameter } from "@/helpers/querystring-helper"; import promoModalQuestion from "@/fmg-components/promo-modal-question/promo-modal-question"; import { experimentSettings } from "@/constants/experiments"; -import { partTypeStrings } from "@/constants/part-type-strings"; defineRule("option-required", required(errorMessages.OPTION_REQUIRED)); export default { @@ -163,26 +161,23 @@ export default { experimentSettings.SERVICE_PACKAGE_DISCOUNT ); const isServicePackageDiscount = servicePackageDiscountSettingValue === "True"; + //Service package cash discount api call when experiment is active + var servicePackageDiscountPart = []; if (isServicePackageDiscount) { - const servicePackageDiscountPart = + const servicePackageDiscountPartResponse = await baseMixin.methods.dispatchStoreActionWithLogging( storeActions.CASH_SERVICE_PACKAGE_DISCOUNT, null, "quote" ); - //add service package discount part to supporting items to get price together - lineItems.supportingItems = [ - ...resultMap.supportingItems, - servicePackageDiscountPart.data, - ]; - } else { - lineItems.supportingItems = resultMap.supportingItems; + servicePackageDiscountPart = servicePackageDiscountPartResponse.data; } const availableLineItems = [ resultMap.rainDefense, - ...lineItems.supportingItems, + ...resultMap.supportingItems, ...resultMap.wipers, ...nullSafeGlassParts, + ...servicePackageDiscountPart, ]; const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging( @@ -193,18 +188,13 @@ export default { "quote", false ); - if (isServicePackageDiscount) { - //remove service package discount part after pricing - lineItems.supportingItems = lineItems.supportingItems.filter( - (item) => item.partType !== partTypeStrings.SERVICE_PACKAGE_DISCOUNT - ); - } + baseMixin.methods.dispatchStoreAction( storeActions.SAVE_SUPPORTING_ITEMS, - lineItems.supportingItems, + resultMap.supportingItems, false ); - + lineItems.supportingItems = resultMap.supportingItems; const addableVaps = [...resultMap.wipers, resultMap.rainDefense]; // Promo logic diff --git a/src/layouts/quote/service-package-question/service-package-question.vue b/src/layouts/quote/service-package-question/service-package-question.vue index 9fe4908bc..24e855511 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -46,7 +46,6 @@ export default { isRequired: Boolean, isInsuranceSelected: Boolean, availableLineItems: null, - lineItems: null, activePromos: null, }, data() { @@ -96,7 +95,7 @@ export default { return this.availableLineItems ?? []; }, supportingLineItems() { - return this.lineItems?.supportingItems; + return this.$store.getters.lineItems?.supportingItems; }, servicePackageAnswers() { const cmsWidgetName = this.isInsuranceSelected