Merge branch 'feature/CSR-1994' of https://github.com/Safelite/DigitalConsumer.FixMyGlass into feature/CSR-1994

This commit is contained in:
Sneha 2024-05-20 19:11:15 +05:30
commit b2e42e1c6c
2 changed files with 10 additions and 21 deletions

View file

@ -31,7 +31,6 @@
@vapsItemsSelected="vapsItemsSelectedAction" @vapsItemsSelected="vapsItemsSelectedAction"
@servicePackageDiscountSelected="servicePackageDiscountSelectedAction" @servicePackageDiscountSelected="servicePackageDiscountSelectedAction"
:activePromos="lineItems.promos" :activePromos="lineItems.promos"
:lineItems="lineItems"
v-on="{ 'buttonEvent.openModal': openModalAction }" v-on="{ 'buttonEvent.openModal': openModalAction }"
validationRules="option-required" validationRules="option-required"
isRequired /> isRequired />
@ -109,7 +108,6 @@ import { queryStrings } from "@/constants/query-strings";
import { getQuerystringParameter } from "@/helpers/querystring-helper"; import { getQuerystringParameter } from "@/helpers/querystring-helper";
import promoModalQuestion from "@/fmg-components/promo-modal-question/promo-modal-question"; import promoModalQuestion from "@/fmg-components/promo-modal-question/promo-modal-question";
import { experimentSettings } from "@/constants/experiments"; import { experimentSettings } from "@/constants/experiments";
import { partTypeStrings } from "@/constants/part-type-strings";
defineRule("option-required", required(errorMessages.OPTION_REQUIRED)); defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
export default { export default {
@ -163,26 +161,23 @@ export default {
experimentSettings.SERVICE_PACKAGE_DISCOUNT experimentSettings.SERVICE_PACKAGE_DISCOUNT
); );
const isServicePackageDiscount = servicePackageDiscountSettingValue === "True"; const isServicePackageDiscount = servicePackageDiscountSettingValue === "True";
//Service package cash discount api call when experiment is active
var servicePackageDiscountPart = [];
if (isServicePackageDiscount) { if (isServicePackageDiscount) {
const servicePackageDiscountPart = const servicePackageDiscountPartResponse =
await baseMixin.methods.dispatchStoreActionWithLogging( await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.CASH_SERVICE_PACKAGE_DISCOUNT, storeActions.CASH_SERVICE_PACKAGE_DISCOUNT,
null, null,
"quote" "quote"
); );
//add service package discount part to supporting items to get price together servicePackageDiscountPart = servicePackageDiscountPartResponse.data;
lineItems.supportingItems = [
...resultMap.supportingItems,
servicePackageDiscountPart.data,
];
} else {
lineItems.supportingItems = resultMap.supportingItems;
} }
const availableLineItems = [ const availableLineItems = [
resultMap.rainDefense, resultMap.rainDefense,
...lineItems.supportingItems, ...resultMap.supportingItems,
...resultMap.wipers, ...resultMap.wipers,
...nullSafeGlassParts, ...nullSafeGlassParts,
...servicePackageDiscountPart,
]; ];
const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging( const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging(
@ -193,18 +188,13 @@ export default {
"quote", "quote",
false 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( baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_SUPPORTING_ITEMS, storeActions.SAVE_SUPPORTING_ITEMS,
lineItems.supportingItems, resultMap.supportingItems,
false false
); );
lineItems.supportingItems = resultMap.supportingItems;
const addableVaps = [...resultMap.wipers, resultMap.rainDefense]; const addableVaps = [...resultMap.wipers, resultMap.rainDefense];
// Promo logic // Promo logic

View file

@ -46,7 +46,6 @@ export default {
isRequired: Boolean, isRequired: Boolean,
isInsuranceSelected: Boolean, isInsuranceSelected: Boolean,
availableLineItems: null, availableLineItems: null,
lineItems: null,
activePromos: null, activePromos: null,
}, },
data() { data() {
@ -96,7 +95,7 @@ export default {
return this.availableLineItems ?? []; return this.availableLineItems ?? [];
}, },
supportingLineItems() { supportingLineItems() {
return this.lineItems?.supportingItems; return this.$store.getters.lineItems?.supportingItems;
}, },
servicePackageAnswers() { servicePackageAnswers() {
const cmsWidgetName = this.isInsuranceSelected const cmsWidgetName = this.isInsuranceSelected