diff --git a/src/constants/insurance.js b/src/constants/insurance.js index f7550513b..b1e874858 100644 --- a/src/constants/insurance.js +++ b/src/constants/insurance.js @@ -78,3 +78,7 @@ export function coverageTypeEnum(strCoverageType) { return null; } } + +export const insuranceCompanyNameStrings = { + ERIE: "erie insurance", +}; diff --git a/src/constants/quote-page-discounts.js b/src/constants/quote-page-discounts.js index 2dd32d915..ed4439ea4 100644 --- a/src/constants/quote-page-discounts.js +++ b/src/constants/quote-page-discounts.js @@ -3,6 +3,7 @@ import { partTypeStrings } from "./part-type-strings"; export const quotePageDiscountTable = [ // Repair + //--Cash { name: "Repair Glass Only", experimentCode: "Show_GlassOnly_Repair_Discount", @@ -10,6 +11,7 @@ export const quotePageDiscountTable = [ partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, description: "GLASS RPR GEOTARGET DISC", packageLevel: packageNames.TIER_ONE, + isInsurance: false, }, { name: "Repair Standard", @@ -18,6 +20,7 @@ export const quotePageDiscountTable = [ partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, description: "STD RPR GEOTARGET DISC", packageLevel: packageNames.TIER_TWO, + isInsurance: false, }, { name: "Repair Premium", @@ -26,8 +29,38 @@ export const quotePageDiscountTable = [ partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, description: "PREM RPR GEOTARGET DISC", packageLevel: packageNames.TIER_THREE, + isInsurance: false, + }, + //--Insurance + { + name: "Insurance Repair Glass Only", + experimentCode: "Show_Ins_GlassOnly_Repair_Discount", + partNumber: "GL RPR INS PKG", + partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, + description: "GLASS RPR GEOTARGET DISC", + packageLevel: packageNames.TIER_ONE, + isInsurance: true, + }, + { + name: "Insurance Repair Standard", + experimentCode: "Show_Ins_Standard_Repair_Discount", + partNumber: "STD RPR INS PKG", + partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, + description: "STD RPR GEOTARGET DISC", + packageLevel: packageNames.TIER_TWO, + isInsurance: true, + }, + { + name: "Insurance Repair Premium", + experimentCode: "Show_Ins_Premium_Repair_Discount", + partNumber: "PRM RPR INS PKG", + partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, + description: "PREM RPR GEOTARGET DISC", + packageLevel: packageNames.TIER_THREE, + isInsurance: true, }, // Replace - No recal + //--Cash { name: "Replace Glass Only", experimentCode: "Show_GlassOnly_Replace_Discount", @@ -35,6 +68,7 @@ export const quotePageDiscountTable = [ partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, description: "GLASS RPL GEOTARGET DISC", packageLevel: packageNames.TIER_ONE, + isInsurance: false, }, { name: "Replace Standard", @@ -43,6 +77,7 @@ export const quotePageDiscountTable = [ partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, description: "STD RPL GEOTARGET DISC", packageLevel: packageNames.TIER_TWO, + isInsurance: false, }, { name: "Replace Premium", @@ -51,8 +86,38 @@ export const quotePageDiscountTable = [ partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, description: "PREM RPL GEOTARGET DISC", packageLevel: packageNames.TIER_THREE, + isInsurance: false, + }, + //--Insurance + { + name: "Insurance Replace Glass Only", + experimentCode: "Show_Ins_GlassOnly_Replace_Discount", + partNumber: "GL RPL INS PKG", + partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, + description: "GLASS RPL GEOTARGET DISC", + packageLevel: packageNames.TIER_ONE, + isInsurance: true, + }, + { + name: "Insurance Replace Standard", + experimentCode: "Show_Ins_Standard_Replace_Discount", + partNumber: "STD RPL INS PKG", + partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, + description: "STD RPL GEOTARGET DISC", + packageLevel: packageNames.TIER_TWO, + isInsurance: true, + }, + { + name: "Insurance Replace Premium", + experimentCode: "Show_Ins_Premium_Replace_Discount", + partNumber: "PRM RPL INS PKG", + partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, + description: "PREM RPL GEOTARGET DISC", + packageLevel: packageNames.TIER_THREE, + isInsurance: true, }, // Replace - with recal + //--Cash { name: "Recal Glass Only", experimentCode: "Show_GlassOnly_Recal_Discount", @@ -60,6 +125,7 @@ export const quotePageDiscountTable = [ partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, description: "GLASS RCL GEOTARGET DISC", packageLevel: packageNames.TIER_ONE, + isInsurance: false, }, { name: "Recal Standard", @@ -68,6 +134,7 @@ export const quotePageDiscountTable = [ partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, description: "STD RCL GEOTARGET DISC", packageLevel: packageNames.TIER_TWO, + isInsurance: false, }, { name: "Recal Premium", @@ -76,5 +143,34 @@ export const quotePageDiscountTable = [ partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, description: "PREM RCL GEOTARGET DISC", packageLevel: packageNames.TIER_THREE, + isInsurance: false, + }, + //--Insurance + { + name: "Insurance Recal Glass Only", + experimentCode: "Show_Ins_GlassOnly_Recal_Discount", + partNumber: "GL RCL INS PKG", + partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, + description: "GLASS RCL GEOTARGET DISC", + packageLevel: packageNames.TIER_ONE, + isInsurance: true, + }, + { + name: "Insurance Recal Standard", + experimentCode: "Show_Ins_Standard_Recal_Discount", + partNumber: "STD RCL INS PKG", + partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, + description: "STD RCL GEOTARGET DISC", + packageLevel: packageNames.TIER_TWO, + isInsurance: true, + }, + { + name: "Insurance Recal Premium", + experimentCode: "Show_Ins_Premium_Recal_Discount", + partNumber: "PRM RCL INS PKG", + partType: partTypeStrings.QUOTE_PAGE_DISCOUNT, + description: "PREM RCL GEOTARGET DISC", + packageLevel: packageNames.TIER_THREE, + isInsurance: true, }, ]; diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index 1455847bd..38e33d149 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -197,7 +197,7 @@ export default { }, async removeQPDLineItemIfExists() { const lineItems = deepClone(store.getters.order.lineItems); - lineItems.supportingItems = baseMixin.methods.filterOutQuotePageDiscountPart( + lineItems.supportingItems = baseMixin.methods.filterOutCashQuotePageDiscountPart( lineItems.supportingItems ); await baseMixin.methods.dispatchStoreAction( diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 0bd095b77..851f912ed 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -99,6 +99,12 @@ v-if="showSaveProgressModal" pageName="quote" /> + + { - return item.partType != partTypeStrings.QUOTE_PAGE_DISCOUNT; - }); - this.dispatchStoreAction( - this.storeActions.SAVE_SUPPORTING_ITEMS, - supportingItems, - false - ); - } else { - this.dispatchStoreAction( - this.storeActions.SAVE_SUPPORTING_ITEMS, - this.lineItems.supportingItems, - false - ); - } + this.dispatchStoreAction( + this.storeActions.SAVE_SUPPORTING_ITEMS, + this.lineItems.supportingItems, + false + ); this.dispatchStoreAction(this.storeActions.SAVE_VAPS, this.lineItems.vaps, false); this.dispatchStoreAction( storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS, diff --git a/src/layouts/quote/service-package-question/service-package-question.spec.js b/src/layouts/quote/service-package-question/service-package-question.spec.js index a44dc463c..cfa48c616 100644 --- a/src/layouts/quote/service-package-question/service-package-question.spec.js +++ b/src/layouts/quote/service-package-question/service-package-question.spec.js @@ -116,6 +116,7 @@ describe("service-package-question.vue", () => { availableQuotePageDiscounts: [ { packageLevel: packageNames.TIER_THREE, + isInsurance: false, item: { description: null, kitPrice: 0, 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 436e98b24..6a2d791b3 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -145,19 +145,18 @@ export default { buttonLabelSubCopy: this.getSubheaderTextFromCms(answer.SubWidgetName), buttonBodyCopy: this.getBodyTextFromCms(answer.SubWidgetName), //The package supports service-package-discount if it has the text value in CMS - buttonAuxillaryCopy: this.isInsuranceSelected - ? this.getDiscountedPackagePriceString(answer.Name, false) - : this.getDiscountedPackagePriceString( - answer.Name, - this.hasDiscountForPackage(answer.Name) - ), + buttonAuxillaryCopy: this.getDiscountedPackagePriceString( + answer.Name, + this.hasDiscountForPackage(answer.Name) + ), buttonFooterCopy: this.getFooterTextFromCms(answer.SubWidgetName), additionalButtonData: { strikeThroughPrice: this.getPackagePriceString(answer.Name), hasDiscount: this.hasDiscountForPackage(answer.Name), - Text: this.isInsuranceSelected - ? false - : "Special: Save $" + this.getDiscountPrice(answer.Name), + Text: + "Special: Save $" + + this.getDiscountPrice(answer.Name) + + (this.isInsuranceSelected ? "*" : ""), isInsuranceSelected: this.isInsuranceSelected, }, })); @@ -297,9 +296,11 @@ export default { if (discountedPrice) { lineItemsToPrice.push(...removeVapsPromosFromPromoArray(this.activePromos)); } + let quotePageDiscountAmount = 0; if (quotePageDiscount) { const part = this.getDiscountPartForSelectedPackage(packageName); if (part) { + quotePageDiscountAmount = baseMixin.methods.getTotalLineItemPrice(part); lineItemsToPrice.push(part); } } @@ -310,6 +311,7 @@ export default { ); priceFloat += this.getVapsPrice(packageName, discountedPrice); + this.isInsuranceSelected && (priceFloat += quotePageDiscountAmount); return priceFloat; }, @@ -388,7 +390,9 @@ export default { getDiscountPartForSelectedPackage(packageName) { if (this.availableQuotePageDiscounts?.length > 0) { const match = this.availableQuotePageDiscounts.find( - (discountInfo) => discountInfo.packageLevel === packageName + (discountInfo) => + discountInfo.isInsurance === this.isInsuranceSelected && + discountInfo.packageLevel === packageName ); return match?.item; } diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index 30bc21433..03f859f90 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -237,6 +237,8 @@ import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigat import { applicationConfig } from "@/constants/application-config"; import { Provider } from "@/layouts/service-location/classes/provider"; import { partNumberStrings } from "@/constants/part-number-strings"; +import { partTypeStrings } from "@/constants/part-type-strings"; +import { insuranceCompanyNameStrings } from "@/constants/insurance"; import store from "@/store"; @@ -1608,6 +1610,19 @@ export default { } } + if (this.isInsurance && supportingItems) { + const insuranceCompanyName = this.$store.getters.policy.insuranceCompanyName; + const removeQPDpartIndex = supportingItems.findIndex( + (item) => item.partType == partTypeStrings.QUOTE_PAGE_DISCOUNT + ); + if ( + removeQPDpartIndex >= 0 && + insuranceCompanyName.toLowerCase() === insuranceCompanyNameStrings.ERIE + ) { + supportingItems.splice(removeQPDpartIndex, 1); + } + } + this.dispatchStoreAction( this.storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING, supportingItems, diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index 813a3189a..9696ea1bb 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -135,6 +135,15 @@ export default { }); return filteredLineItems; }, + filterOutCashQuotePageDiscountPart(lineItems) { + const filteredLineItems = lineItems?.filter((item) => { + return !( + item?.partType?.includes(partTypeStrings.QUOTE_PAGE_DISCOUNT) && + item?.partNumber?.includes("CSH") + ); + }); + return filteredLineItems; + }, filterOutRecalibration(lineItems) { return getItemsWithoutRecalParts(lineItems); },