From e54ead578e532059944a1632ff85bc58cb4f4c22 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 5 Sep 2024 17:02:15 -0400 Subject: [PATCH 01/40] Add call to recal endpoint --- src/constants/endpoints.js | 4 +++ src/constants/store-actions.js | 1 + src/mixins/vehicle-questions-mixin.js | 12 +++++++- src/store/index.js | 40 +++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 43abf149c..2b5c654e5 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -84,6 +84,10 @@ const endpoints = { url: "/parts/api/v1/parts/supporting-items", method: "POST", }, + GetRecalPart: { + url: "/parts/api/v1/parts/recal-parts", + method: "GET", + }, GetAlertReasons: { url: "/location/api/v1/location/alert-reasons", method: "GET", diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 069079d35..f5c7ea047 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -53,6 +53,7 @@ const storeActions = { VALIDATE_ORDER_PROMO_AND_SAVE_SERVER_DATA: "validateOrderPromoAndSaveServerData", REVALIDATE_ORDER_PROMOS_AND_SAVE_SERVER_DATA: "revalidateOrderPromosAndSaveServerData", GET_INSURANCE_COMPANY_LIST: "getInsuranceCompanyList", + GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems", // DEPENDENCY MUTATIONS RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies", diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 2749d1933..517fc7c90 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -450,7 +450,17 @@ export default { const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions); // save to store lineItems.glassParts - self.dispatchStoreAction(storeActions.SAVE_GLASS_PARTS, collectedGlassParts, false); + await self.dispatchStoreAction( + storeActions.SAVE_GLASS_PARTS, + collectedGlassParts, + false + ); + + await self.dispatchStoreActionWithLogging( + storeActions.GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS, + null, + currentPage + ); const payment = store.getters.payment; diff --git a/src/store/index.js b/src/store/index.js index aa5747a0f..a74a52623 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2855,6 +2855,46 @@ export const actions = { externalParameterMMS.externalParameterStyle ); }, + + async getRecalPartsAndSaveToLineItems(context, { pageNameToLog }) { + // identify each part that needs recal + const glassParts = context.state.order?.lineItems?.glassParts ?? []; + + for (let i = 0; i < glassParts.length; i++) { + // does this part need recal? + const needsRecal = + !!glassParts[i].requiresRecalibration && !!glassParts[i].recalibrationType; + + if (needsRecal) { + const recalType = glassParts[i].recalibrationType; + const parentAccountNumber = + context.state.order.payment.parentAccountNumber ?? + applicationConfig.CASH_PARENT_ACCOUNT_NUMBER; + + // Get part from API + const urlExtension = `${context.state.order.vehicle.carId}/${glassParts[i].partNumber}/${recalType}/${parentAccountNumber}/${context.state.order.serviceLocation.zipCode}/${applicationConfig.ANALYTICS_APPLICATION_NAME}/${context.state.order.referralSequenceNumber}`; + + const recalPartResponse = await globalMethods.callHttpClient({ + method: endpoints.GetRecalPart.method, + endpoint: `${endpoints.GetRecalPart.url}/${urlExtension}`, + payload: {}, + pageNameToLog: pageNameToLog, + }); + + // If any parts retrieved, add as children to the glass part. + if ( + recalPartResponse.status === 200 && + recalPartResponse.data.recalibrationParts?.length > 0 + ) { + if (!glassParts[i].childParts) { + glassParts[i].childParts = []; + } + + glassParts[i].childParts.push(...recalPartResponse.data.recalibrationParts); + } + } + } + }, }; export default createStore({ From 6f3e35388b7c7b2dfc434d59a80895d71201f5d5 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 12 Sep 2024 09:52:39 -0400 Subject: [PATCH 02/40] Create helper files --- src/constants/part-type-strings.js | 1 + src/helpers/recal-helper.js | 39 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/helpers/recal-helper.js diff --git a/src/constants/part-type-strings.js b/src/constants/part-type-strings.js index 3ad66c40a..4681e2776 100644 --- a/src/constants/part-type-strings.js +++ b/src/constants/part-type-strings.js @@ -2,6 +2,7 @@ const partTypeStrings = { FRONT_WIPER: "FRONT WIPER", REAR_WIPER: "REAR WIPER", RAIN_DEFENSE: "RAIN DEFENSE", + ADAS_RECALIBRATION: "ADAS RECALIBRATION", RECALIBRATION: "RECALIBRATION", REPLACE_FEE: "REPLACE FEE", RECYCLE_FEE: "RECYCLE FEE", diff --git a/src/helpers/recal-helper.js b/src/helpers/recal-helper.js new file mode 100644 index 000000000..d6b1d044f --- /dev/null +++ b/src/helpers/recal-helper.js @@ -0,0 +1,39 @@ +import { deepClone } from "@/helpers/object-helper"; +import { partTypeStrings } from "@/constants/part-type-strings"; + +const recalPartTypes = [partTypeStrings.RECALIBRATION, partTypeStrings.ADAS_RECALIBRATION]; + +export function isRecalPartOrHasChildRecalPart(lineItem) { + if (lineItem.childParts && lineItem.childParts.length > 0) { + return isRecalPart(lineItem) || containsRecalParts(lineItem.childParts); + } else { + return isRecalPart(lineItem); + } +} + +export function isRecalPart(lineItem) { + return recalPartTypes.some((type) => lineItem.partType === type); +} + +export function containsRecalParts(lineItems) { + if (!lineItems) { + return false; + } + return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li)); +} + +export function getItemsWithoutRecalParts(lineItems) { + const copy = deepClone(lineItems); + + const firstLevelFiltered = copy.filter((li) => !isRecalPart(li)); + + const childrenFiltered = firstLevelFiltered.map((li) => { + if (li.childParts && li.childParts.length > 0) { + li.childParts = getItemsWithoutRecalParts(li.childParts); + } + + return li; + }); + + return childrenFiltered; +} From 51fb83932d38a84b0a29faa63f4f23c1d696e34f Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 12 Sep 2024 12:28:32 -0400 Subject: [PATCH 03/40] Update `containsRecalPart` to accept both lineitems formats --- src/helpers/recal-helper.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/helpers/recal-helper.js b/src/helpers/recal-helper.js index d6b1d044f..fa33e7849 100644 --- a/src/helpers/recal-helper.js +++ b/src/helpers/recal-helper.js @@ -19,7 +19,20 @@ export function containsRecalParts(lineItems) { if (!lineItems) { return false; } - return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li)); + + if (Array.isArray(lineItems)) { + return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li)); + } else { + // complex object form -- flatten and re-call. + const flattened = [ + ...(lineItems.glassParts ?? []), + ...(lineItems.supportingItems ?? []), + ...(lineItems.vaps ?? []), + ...(lineItems.promos ?? []), + ]; + + return flattened.some((li) => isRecalPartOrHasChildRecalPart(li)); + } } export function getItemsWithoutRecalParts(lineItems) { From e29248a7ed0b65c207a25c4ede65fd96b542b0e3 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 12 Sep 2024 12:29:22 -0400 Subject: [PATCH 04/40] Update quote to use new parts --- src/layouts/quote/quote.vue | 19 +++++++++---------- .../service-package-question.vue | 13 +++++-------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 3d539e630..c0e6165ea 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -30,6 +30,7 @@ insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget" groupName="ServicePackageQuestion" :availableLineItems="availableLineItems" + :shouldHideRecalibration="shouldHideRecalibration" :isInsuranceSelected="isInsuranceSelected" @vapsItemsSelected="vapsItemsSelectedAction" @servicePackageDiscountSelected="servicePackageDiscountSelectedAction" @@ -131,6 +132,7 @@ import { containsLineItemWithPartType } from "@/helpers/service-package-helper"; import { nextTick } from "vue"; import { packageNames } from "@/constants/package-names"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; +import { containsRecalParts } from "@/helpers/recal-helper"; defineRule("option-required", required(errorMessages.OPTION_REQUIRED)); export default { @@ -209,10 +211,7 @@ export default { ]; // If the recal experiment is found then log the experiment exposure. - const isRecalibrationOnOrder = containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - availableLineItems - ); + const isRecalibrationOnOrder = containsRecalParts(availableLineItems); const canSafeliteRecalibrate = nullSafeGlassParts.some((glassPart) => { return glassPart.partType === "WINDSHIELD" && glassPart.canSafeliteRecalibrate; }); @@ -354,10 +353,7 @@ export default { return Object.assign({}, this.lineItems); }, isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this?.availableLineItems - ); + return containsRecalParts(this.lineItems); }, shouldHideRecalibration() { const recalSettingValue = experimentMixin.methods.getSettingValue( @@ -366,10 +362,13 @@ export default { return recalSettingValue; }, showAfterpayBanner() { - return !this.isInsuranceSelected && (!this.isRecalibrationOnOrder || !this.shouldHideRecalibration) + return ( + !this.isInsuranceSelected && + (!this.isRecalibrationOnOrder || !this.shouldHideRecalibration) + ); }, showRecalDisclaimer() { - return this.isRecalibrationOnOrder && this.shouldHideRecalibration + return this.isRecalibrationOnOrder && this.shouldHideRecalibration; }, }, methods: { 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 93d8ff79b..f17fe908a 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -36,6 +36,7 @@ import { getPromosWithAddableVaps, getLineItemsThatMatchPromos, } from "@/helpers/promotions-helper"; +import { containsRecalParts, getItemsWithoutRecalParts } from "@/helpers/recal-helper"; export default { name: "servicePackageQuestion", @@ -49,6 +50,7 @@ export default { availableLineItems: null, activePromos: null, servicePackage: null, + shouldHideRecalibration: Boolean, }, data() { return { @@ -142,10 +144,7 @@ export default { return modifiedAnswers; }, isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this.nullSafeAvailableLineItems - ); + return containsRecalParts(this.nullSafeAvailableLineItems); }, isServicePackageDiscountOnOrder() { return containsLineItemWithPartType( @@ -242,10 +241,8 @@ export default { }, getPackagePrice(packageName, { discountedPrice = false, servicePackageDiscount = false }) { var lineItemsToPrice = [...this.nullSafeAvailableLineItems]; - if (this.isRecalibrationOnOrder) { - lineItemsToPrice = lineItemsToPrice.filter((item) => { - return item.partType != partTypeStrings.RECALIBRATION; - }); + if (this.shouldHideRecalibration && this.isRecalibrationOnOrder) { + lineItemsToPrice = getItemsWithoutRecalParts(lineItemsToPrice); } //remove service package discount part From e30f2631e5952411f9c842728c48872acbf7674f Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 17 Sep 2024 13:23:19 -0400 Subject: [PATCH 05/40] Merge issue --- src/layouts/quote/quote.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 599ba0f6a..c6176ff9d 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -30,7 +30,6 @@ insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget" groupName="ServicePackageQuestion" :availableLineItems="availableLineItems" - :shouldHideRecalibration="shouldHideRecalibration" :isInsuranceSelected="isInsuranceSelected" :isRecalibrationOnOrder="isRecalibrationOnOrder" :shouldHideRecalibration="shouldHideRecalibration" From 1dde9eb6f7e50fe2f92579c29227c9a1f0bc4b35 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 17 Sep 2024 13:45:32 -0400 Subject: [PATCH 06/40] Update store getters for recal --- src/store/index.js | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index c95366add..b0037bc61 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -39,6 +39,7 @@ import { coverageType, coverageTypeValue, } from "@/constants/insurance"; +import { containsRecalParts } from "@/helpers/recal-helper"; // Export State const getDefaultState = () => { @@ -2421,8 +2422,9 @@ export const actions = { })); const order = context.getters.order; - - var providerNumber = order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; + + var providerNumber = + order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; if (providerNumber.startsWith("00")) { providerNumber = providerNumber.substring(1); } @@ -2912,34 +2914,7 @@ export default createStore({ // Private Functions function getHasRecalibrationPart(state) { - var hasRequiresRecalibration = - getNonFalseValuesOfPropertyInArrayOfObjects( - state.order.lineItems.glassParts, - "requiresRecalibration" - )?.length > 0; - var hasRecalibrationType = - getNonFalseValuesOfPropertyInArrayOfObjects( - state.order.lineItems.glassParts, - "recalibrationType" - )?.length > 0; - - if (hasRequiresRecalibration) { - if (hasRecalibrationType) { - // Has both 'requiresRecalibration' and 'recalibrationType' and 'recalibrationType' - return ( - getNonFalseValuesOfPropertyInArrayOfObjects( - state.order.lineItems.glassParts, - "recalibrationType" - )[0].toLowerCase() != "unknown" - ); - } else { - // Has 'requiresRecalibration' but no 'recalibrationType' at all - return true; - } - } else { - // Does not have 'requiresRecalibration' - return false; - } + return containsRecalParts(state.order.lineItems); } function sortArrayOfObjectsByPropertyValue(arrayOfObjects, propertyName) { From 51655e7247d73f704aae148f5eb4223099453296 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 17 Sep 2024 14:23:55 -0400 Subject: [PATCH 07/40] Update payment-method & cart for new recal --- src/fmg-components/cart/cart.vue | 4 ++-- src/layouts/payment-method/payment-method.vue | 10 ++++++---- src/mixins/base-mixin.js | 6 ++---- src/store/index.js | 5 +++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 90c1adf98..0dffbd6de 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -305,8 +305,8 @@ export default { if (!this.lineItems || this.lineItems.length < 1) return; const lineItemsCopy = deepClone(this.lineItems); - lineItemsCopy.supportingItems = lineItemsCopy.supportingItems - ? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.supportingItems) + lineItemsCopy.glassParts = lineItemsCopy.glassParts + ? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.glassParts) : []; return lineItemsCopy; }, diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index ff7e6a8d8..2c458e124 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -153,6 +153,7 @@ import { partTypeStrings } from "@/constants/part-type-strings"; import { mapTaxedLineItemsToStoreFormat } from "../../store"; import { coverageStatus } from "@/constants/insurance"; import { containsLineItemWithPartType } from "@/helpers/service-package-helper"; +import { containsRecalParts } from "@/helpers/recal-helper"; defineRule("payment-method-required", required(errorMessages.OPTION_REQUIRED)); defineRule("recal-ack-required", required(errorMessages.RECAL_ACK_REQUIRED)); @@ -588,10 +589,11 @@ export default { }, computed: { isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this.$store.getters.order.lineItems?.supportingItems - ); + const order = baseMixin.methods.hasSubmittedOrder() + ? baseMixin.methods.getSubmittedOrder() + : this.$store.getters.order; + + return containsRecalParts(order.lineItems); }, shouldHideRecalibration() { return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE); diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index c1e60d16a..669e3306f 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -8,6 +8,7 @@ import { queryStrings } from "@/constants/query-strings"; import { dynamicStrings } from "@/constants/dynamic-strings"; import { partTypeStrings } from "../constants/part-type-strings"; import { showFmgLoadingModal } from "@/helpers/loading-modal-helper"; +import { getItemsWithoutRecalParts } from "@/helpers/recal-helper"; export default { data() { @@ -103,10 +104,7 @@ export default { return filteredLineItems; }, filterOutRecalibration(lineItems) { - const filteredLineItems = lineItems.filter((item) => { - return !item.partType.includes(partTypeStrings.RECALIBRATION); - }); - return filteredLineItems; + return getItemsWithoutRecalParts(lineItems); }, getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) { let totalPrice = 0; diff --git a/src/store/index.js b/src/store/index.js index 8a87018d6..f6751bcef 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2422,8 +2422,9 @@ export const actions = { })); const order = context.getters.order; - - var providerNumber = order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; + + var providerNumber = + order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; if (providerNumber.startsWith("00") && providerNumber.length > 5) { providerNumber = providerNumber.substring(1); } From 9bf5255f2b7dc7abc82f47e3486654e8dc8b98ea Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Fri, 20 Sep 2024 15:23:28 -0400 Subject: [PATCH 08/40] CSR-2166: refactoring to include logic to retrieve an insurance threshold from external parameters --- src/constants/experiments.js | 2 + src/layouts/quote/quote.vue | 90 ++++++++++++++++++++++++------------ 2 files changed, 63 insertions(+), 29 deletions(-) diff --git a/src/constants/experiments.js b/src/constants/experiments.js index 52017ce47..eeabeb7d6 100644 --- a/src/constants/experiments.js +++ b/src/constants/experiments.js @@ -13,6 +13,8 @@ const experimentSettings = { IS_EMAIL_OPTIONAL: "isEmailOptional", SERVICE_PACKAGE_DISCOUNT: "OfferServicePackageDiscount", RECAL_PRICE_REMOVE: "RecalPriceRemove", + INSURANCE_TAB_TO_DISPLAY_THRESHOLD_INTERNAL: "NextGen_InternalInsuranceTabDisplayThreshold", + INSURANCE_TAB_TO_DISPLAY_THRESHOLD_EXTERNAL: "NextGen_ExternalInsuranceTabDisplayThreshold", }; const experimentTriggers = { diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index f98d4dab0..a5222b49b 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -135,6 +135,8 @@ import { packageNames } from "@/constants/package-names"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; defineRule("option-required", required(errorMessages.OPTION_REQUIRED)); +const INSURANCE_TAB_TO_DISPLAY_THRESHOLD_DEFAULT = 300; + export default { name: "quote", async beforeRouteEnter(to, from, next) { @@ -262,7 +264,6 @@ export default { vm.addableVaps = addableVaps; vm.lineItems = lineItems; vm.availableLineItems = pricingResults; - vm.isInsuranceSelected = vm.getDefaultIsInsuranceSelectedValue(vm.availableLineItems); vm.holdParentAccountNumber = holdParentAccountNumber; vm.holdBillToAccountNumber = holdBillToAccountNumber; @@ -291,8 +292,51 @@ export default { navigateToHeritageFunnel({ shouldSaveSession: true, pageNameToLog: "quote" }); } - if (store.getters.externalParameterState?.isExternalParameter) { - if (store.getters.externalParameterQuote.isInsurance == true) { + const getIsInsuranceSelectedValue = (availableLineItems, insuranceThreshold) => { + const serviceLocationState = store.getters.order.serviceLocation.state; + // Override if coming back from QuoteDetails. Remove override after Quote release + const isInsuranceOverrideValue = to.query?.isInsurance; + + const defaultIsInsuranceSelectedValue = store.getters.order.payment.isInsurance; + //Default to Insurance Tab if user Service zip is from certain States + if ( + serviceLocationState != null && + payWithInsuranceStates.find((item) => item === serviceLocationState) + ) + return true; + else if (isInsuranceOverrideValue != null) { + return isInsuranceOverrideValue == "true"; + } else if (defaultIsInsuranceSelectedValue != null) { + return defaultIsInsuranceSelectedValue; + } else { + // TEMPORARY CODE WHILE DEVELOPING + if (availableLineItems) { + let tierOnePackagePriceTemp = baseMixin.methods.getTierOnePackagePrice( + baseMixin.methods.filterOutFees(availableLineItems) + ); + let whatToReturn = baseMixin.methods.getTierOnePackagePrice( + baseMixin.methods.filterOutFees(availableLineItems) + ) > insuranceThreshold; + return whatToReturn; // TODO AJC: TIGHTEN THIS BACK UP AFTER TESTING + } else { + return null; + } + } + }; + let thresholdToUse = INSURANCE_TAB_TO_DISPLAY_THRESHOLD_DEFAULT; + let internalThreshold = experimentMixin.methods.getSettingValue( + experimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_INTERNAL + ); + + if (!store.getters.externalParameterState?.isExternalParameter) { // there are no external parameters + + if (internalThreshold) thresholdToUse = internalThreshold; + vm.isInsuranceSelected = getIsInsuranceSelectedValue(vm.availableLineItems, thresholdToUse); + baseMixin.methods.ResetExternalParamsAndHideModal(); + + } else { // there ARE external parameters + + if (store.getters.externalParameterQuote.isInsurance == true) { // did user intentionally select insurance? vm.isInsuranceSelected = true; vm.servicePackage = store.getters.externalParameterQuote.servicePackage; await nextTick(); @@ -303,10 +347,22 @@ export default { baseMixin.methods.ResetExternalParamsAndHideModal(); } } else { + // did user come from external source (LeadGen)? + let externalSource = store.getters.externalParameterSource ? store.getters.externalParameterSource : null; + + // Business logic to determine what "external" source is + if (externalSource?.includes("LeadGen")) { + const externalThreshold = experimentMixin.methods.getSettingValue( + experimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_EXTERNAL + ); + if (externalThreshold) thresholdToUse = externalThreshold; + } else { + if (internalThreshold) thresholdToUse = internalThreshold; + } + vm.isInsuranceSelected = getIsInsuranceSelectedValue(vm.availableLineItems, thresholdToUse); baseMixin.methods.ResetExternalParamsAndHideModal(); } - } else { - baseMixin.methods.ResetExternalParamsAndHideModal(); + } }); }, @@ -392,30 +448,6 @@ export default { payment.insuranceCoverage?.isVerified === false) ); }, - getDefaultIsInsuranceSelectedValue(availableLineItems) { - const serviceLocationState = store.getters.order.serviceLocation.state; - // Override if coming back from QuoteDetails. Remove override after Quote release - const isInsuranceOverrideValue = this.$route.query?.isInsurance; - - const defaultIsInsuranceSelectedValue = this.$store.getters.order.payment.isInsurance; - //Default to Insurance Tab if user Service zip is from certain States - if ( - serviceLocationState != null && - payWithInsuranceStates.find((item) => item === serviceLocationState) - ) - return true; - else if (isInsuranceOverrideValue != null) { - return isInsuranceOverrideValue == "true"; - } else if (defaultIsInsuranceSelectedValue != null) { - return defaultIsInsuranceSelectedValue; - } else { - return availableLineItems - ? baseMixin.methods.getTierOnePackagePrice( - baseMixin.methods.filterOutFees(availableLineItems) - ) > 300 - : null; - } - }, vapsItemsSelectedAction(vapsItemsSelected) { this.lineItems.vaps = vapsItemsSelected; }, From add23e716509068b71a97b9fd465dcc7ac5f55ef Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Fri, 20 Sep 2024 16:50:24 -0400 Subject: [PATCH 09/40] CSR-2166: fix unit test --- src/layouts/quote/quote.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index d8e08a77d..ef5c945a3 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -391,12 +391,11 @@ describe("quote.vue", () => { }, }; const { wrapper } = setupMocks({}); - wrapper.vm.$route = { query: { isInsurance: "false" } }; //Act await quote.beforeRouteEnter.call( wrapper.vm, - { query: { fmgPage: "quote" } }, + { query: { fmgPage: "quote", isInsurance: false } }, undefined, (c) => c(wrapper.vm) ); From a6fadcb6772c14945257077e14fc3aea4e24c747 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 23 Sep 2024 10:10:54 -0400 Subject: [PATCH 10/40] CSR-1600 CSR-1600 clear work order number if ctu changes on referral with delete substatus used in pia. --- src/layouts/payment-method/payment-method.vue | 30 +++++++++---------- src/layouts/service-zip/service-zip.vue | 4 +-- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index ff7e6a8d8..0083efead 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -551,23 +551,21 @@ export default { }, async setupPia() { this.$refs.loadingModal.showModal(); - - // if we don't have a work order in delete substatus, set the flag and submit. // we need a work order number for pia so we can pass it to safeliteHop. - if (!store.getters.order.workOrderNumber) { - try { - await submitWorkOrder({ - pageNameToLog: "payment-method", - submitAfterSave: false, - createDeleteStatusWorkOrderForPia: true, - }); - } catch (error) { - console.log("error: response from pia submit work order:" + error.message); - this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); - this.$route.query[queryStrings.DISPLAY_PIA_ALERT] = true; - return; - } + // this will create one in delete substatus. + try { + await submitWorkOrder({ + pageNameToLog: "payment-method", + submitAfterSave: false, + createDeleteStatusWorkOrderForPia: true, + }); + } catch (error) { + console.log("error: response from pia submit work order:" + error.message); + this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); + this.$route.query[queryStrings.DISPLAY_PIA_ALERT] = true; + return; } + this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_PAY_NOW, @@ -594,7 +592,7 @@ export default { ); }, shouldHideRecalibration() { - return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE); + return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE).toLower() === "true"; }, showApplePay() { return baseMixin.methods.showApplePay(); diff --git a/src/layouts/service-zip/service-zip.vue b/src/layouts/service-zip/service-zip.vue index 34efac1a1..a60eb4aff 100644 --- a/src/layouts/service-zip/service-zip.vue +++ b/src/layouts/service-zip/service-zip.vue @@ -213,7 +213,7 @@ export default { const supportingItemsPromise = await this.dispatchStoreActionWithLogging( storeActions.GET_SUPPORTING_ITEMS, null, - "estimate" + "service-zip" ); const promiseResultMap = [ @@ -232,7 +232,7 @@ export default { ); // call saveSession here - navigateWithSaving saves too late in the flow - await saveSession({ pageNameToLog: "estimate" }); + await saveSession({ pageNameToLog: "service-zip" }); return this.$router.navigateWithSaving( this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS, this.$route From 0b7354d54ef2b57922faf1bcaabd076da64d8ca4 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 23 Sep 2024 10:43:34 -0400 Subject: [PATCH 11/40] CSR-1600 test CSR-1600 test --- src/layouts/payment-method/payment-method.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 0083efead..89a31d454 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -565,7 +565,7 @@ export default { this.$route.query[queryStrings.DISPLAY_PIA_ALERT] = true; return; } - + this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_PAY_NOW, @@ -592,7 +592,9 @@ export default { ); }, shouldHideRecalibration() { - return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE).toLower() === "true"; + return ( + this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE).toLowerCase() === "true" + ); }, showApplePay() { return baseMixin.methods.showApplePay(); From 2560787b4f4ea0fb3ada64409614b7f786d54b04 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 23 Sep 2024 13:50:47 -0400 Subject: [PATCH 12/40] CSR-2166: remove recal from calculation if experiment says it should be hidden --- src/layouts/quote/quote.vue | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index a5222b49b..76e206586 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -296,8 +296,11 @@ export default { const serviceLocationState = store.getters.order.serviceLocation.state; // Override if coming back from QuoteDetails. Remove override after Quote release const isInsuranceOverrideValue = to.query?.isInsurance; - const defaultIsInsuranceSelectedValue = store.getters.order.payment.isInsurance; + const hideRecalCost = experimentMixin.methods.getSettingValue( + experimentSettings.RECAL_PRICE_REMOVE + ); + //Default to Insurance Tab if user Service zip is from certain States if ( serviceLocationState != null && @@ -309,15 +312,18 @@ export default { } else if (defaultIsInsuranceSelectedValue != null) { return defaultIsInsuranceSelectedValue; } else { - // TEMPORARY CODE WHILE DEVELOPING if (availableLineItems) { - let tierOnePackagePriceTemp = baseMixin.methods.getTierOnePackagePrice( - baseMixin.methods.filterOutFees(availableLineItems) - ); - let whatToReturn = baseMixin.methods.getTierOnePackagePrice( - baseMixin.methods.filterOutFees(availableLineItems) - ) > insuranceThreshold; - return whatToReturn; // TODO AJC: TIGHTEN THIS BACK UP AFTER TESTING + + const lineItemsForCalculatingPrice = + (hideRecalCost === "true") ? + baseMixin.methods.filterOutFees( + baseMixin.methods.filterOutRecalibration(availableLineItems) // Strip out recal before filtering out fees + ) : + baseMixin.methods.filterOutFees(availableLineItems); + + let tierOnePackagePriceTemp = baseMixin.methods.getTierOnePackagePrice(lineItemsForCalculatingPrice); // TEMP, FOR TESTING /// TODO AJC: TIGHTEN THIS BACK UP AFTER TESTING + + return baseMixin.methods.getTierOnePackagePrice(lineItemsForCalculatingPrice) > insuranceThreshold; // compare base price vs arbitrary threshold (representing insurance price) } else { return null; } From 40ba5bb3b8b2856bfd51eb271b327f12fb2246fd Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 23 Sep 2024 14:04:47 -0400 Subject: [PATCH 13/40] CSR-1600 CSR-1600 rename pia field --- src/helpers/heritage-integration/order-helper.js | 14 +++++++------- src/layouts/payment-method/payment-method.vue | 5 +++-- src/router/index.js | 5 +---- src/store/index.js | 14 ++++++++++---- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/helpers/heritage-integration/order-helper.js b/src/helpers/heritage-integration/order-helper.js index 07c469ae8..555c41325 100644 --- a/src/helpers/heritage-integration/order-helper.js +++ b/src/helpers/heritage-integration/order-helper.js @@ -57,7 +57,7 @@ export async function saveSession({ pageNameToLog, shouldAwaitSaveSessionQueue = false, submitAfterSave = false, - createDeleteStatusWorkOrderForPia = false, + createUnscheduledStatusWorkOrderForPIA = false, }) { var saveSessionPromise; if (store.getters.applicationUser.saveSessionPromise) { @@ -67,7 +67,7 @@ export async function saveSession({ return saveSessionHelper( pageNameToLog, submitAfterSave, - createDeleteStatusWorkOrderForPia + createUnscheduledStatusWorkOrderForPIA ); }); } else { @@ -75,7 +75,7 @@ export async function saveSession({ saveSessionPromise = saveSessionHelper( pageNameToLog, submitAfterSave, - createDeleteStatusWorkOrderForPia + createUnscheduledStatusWorkOrderForPIA ); } store.commit(storeMutations.UPDATE_SAVE_SESSION_PROMISE, saveSessionPromise); @@ -88,13 +88,13 @@ export async function saveSession({ export async function submitWorkOrder({ pageNameToLog, submitAfterSave = false, - createDeleteStatusWorkOrderForPia = false, + createUnscheduledStatusWorkOrderForPIA = false, }) { await saveSession({ pageNameToLog: pageNameToLog, shouldAwaitSaveSessionQueue: true, submitAfterSave: submitAfterSave, - createDeleteStatusWorkOrderForPia: createDeleteStatusWorkOrderForPia, + createUnscheduledStatusWorkOrderForPIA: createUnscheduledStatusWorkOrderForPIA, }); } @@ -139,13 +139,13 @@ async function loadSession( async function saveSessionHelper( pageNameToLog, submitAfterSave = false, - createDeleteStatusWorkOrderForPia = false + createUnscheduledStatusWorkOrderForPIA = false ) { const savedSessionInfo = await baseMixin.methods.dispatchStoreActionWithLogging( storeActions.SAVE_SESSION, { submitAfterSave: submitAfterSave, - createDeleteStatusWorkOrderForPia: createDeleteStatusWorkOrderForPia, + createUnscheduledStatusWorkOrderForPIA: createUnscheduledStatusWorkOrderForPIA, }, pageNameToLog ); diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 89a31d454..9b7222bfc 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -557,7 +557,7 @@ export default { await submitWorkOrder({ pageNameToLog: "payment-method", submitAfterSave: false, - createDeleteStatusWorkOrderForPia: true, + createUnscheduledStatusWorkOrderForPIA: true, }); } catch (error) { console.log("error: response from pia submit work order:" + error.message); @@ -593,7 +593,8 @@ export default { }, shouldHideRecalibration() { return ( - this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE).toLowerCase() === "true" + this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE).toLowerCase() === "true" && + this.isRecalibrationOnOrder ); }, showApplePay() { diff --git a/src/router/index.js b/src/router/index.js index 266ccb855..4c57921b7 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -683,10 +683,7 @@ function updateExternalParameterState() { ); } if (externalParameterSource) { - store.commit( - storeMutations.UPDATE_EXTERNAL_PARAMETER_SOURCE, - externalParameterSource - ); + store.commit(storeMutations.UPDATE_EXTERNAL_PARAMETER_SOURCE, externalParameterSource); } } diff --git a/src/store/index.js b/src/store/index.js index a724d26c1..c0cb2e0e7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -109,6 +109,7 @@ const getDefaultState = () => { insuranceCoverage: { isVerified: null, coverageStatus: null, + coverageSubStatus: null, coverageType: null, coverageVerificationType: null, }, @@ -690,6 +691,8 @@ export const mutations = { state.order.payment.insuranceCoverage.coverageStatus = coverageStatusValue( sessionInformation?.order.insuranceCoverage.coverageStatus ); + state.order.payment.insuranceCoverage.coverageSubStatus = + sessionInformation?.order.insuranceCoverage.coverageSubStatus; state.order.payment.insuranceCoverage.coverageType = coverageTypeValue( sessionInformation?.order.insuranceCoverage.coverageType ); @@ -1534,9 +1537,12 @@ export const actions = { ? context.getters.payment.billToAccountNumber : applicationConfig.CASH_DEFAULT_BILL_TO_ACCOUNT_NUMBER; + const covStatus = context.getters.payment?.insuranceCoverage?.coverageStatus; + const covSubStatus = context.getters.payment?.insuranceCoverage?.coverageSubStatus; + return globalMethods.callHttpClient({ method: endpoints.GetMobileFeePart.method, - endpoint: `${endpoints.GetMobileFeePart.url}/${damageType}/${parentAccountNumber}/${billToAccountNumber}`, + endpoint: `${endpoints.GetMobileFeePart.url}/${damageType}/${parentAccountNumber}/${billToAccountNumber}/${covStatus}/${covSubStatus}`, logApiCall: true, pageNameToLog: pageNameToLog, }); @@ -1818,8 +1824,8 @@ export const actions = { const lineItems = context.state.order.lineItems; const submitAfterSave = payload?.submitAfterSave === "true"; - const createDeleteStatusWorkOrderForPia = - payload?.createDeleteStatusWorkOrderForPia === "true"; + const createUnscheduledStatusWorkOrderForPIA = + payload?.createUnscheduledStatusWorkOrderForPIA === "true"; // create a new array to avoid mutating state const newGlassToReplace = convertGlassPieceNamingForApi(damage.glassToReplace); @@ -1954,7 +1960,7 @@ export const actions = { referralNumber: order.referralNumber?.toString(), referralSequenceNumber: order.referralSequenceNumber, eon: order.eon, - createDeleteStatusWorkOrderForPia: createDeleteStatusWorkOrderForPia, + createUnscheduledStatusWorkOrderForPIA: createUnscheduledStatusWorkOrderForPIA, lockToken: order.lockToken, isRecalAckOptIn: order.isRecalAckOptIn, }, From e26fda362b7a81b5c425c29d00a33649b9adb87e Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 23 Sep 2024 14:36:16 -0400 Subject: [PATCH 14/40] CSR-1600 CSR-1600 spec file test --- src/helpers/heritage-integration/order-helper.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/heritage-integration/order-helper.spec.js b/src/helpers/heritage-integration/order-helper.spec.js index daf9af6bb..ac8d08e9f 100644 --- a/src/helpers/heritage-integration/order-helper.spec.js +++ b/src/helpers/heritage-integration/order-helper.spec.js @@ -179,7 +179,7 @@ describe("saveSession", () => { // Assert expect(mocks.baseMixin.methods.dispatchStoreActionWithLogging).toHaveBeenCalledWith( storeActions.SAVE_SESSION, - { createDeleteStatusWorkOrderForPia: false, submitAfterSave: false }, + { createUnscheduledStatusWorkOrderForPIA: false, submitAfterSave: false }, "test" ); expect(mocks.baseMixin.methods.dispatchStoreAction).toHaveBeenCalledWith( @@ -287,7 +287,7 @@ describe("submitWorkOrder", () => { // Assert expect(mocks.baseMixin.methods.dispatchStoreActionWithLogging).toHaveBeenCalledWith( storeActions.SAVE_SESSION, - { createDeleteStatusWorkOrderForPia: false, submitAfterSave: true }, + { createUnscheduledStatusWorkOrderForPIA: false, submitAfterSave: true }, "test" ); expect(mocks.baseMixin.methods.dispatchStoreAction).toHaveBeenCalledWith( From 5e7bc8dc1338c6db1a8d01731dbc7ccd627d8a6d Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 23 Sep 2024 15:27:55 -0400 Subject: [PATCH 15/40] CSR-2166: some temporary debugging indications for dev --- src/layouts/quote/quote.vue | 13 +++++++++++++ .../service-package-question.vue | 11 ++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 76e206586..5d3db0c3a 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -15,6 +15,12 @@ +
+

thresholdToUse: {{ thresholdToUse }}

+

externalSource: {{ externalSource }}

+

recalSettingValue: {{ recalSettingValue }}

+
+ +
+ + +

isInsuranceSelected: {{ isInsuranceSelected }}

+

isRecalibrationOnOrder: {{ isRecalibrationOnOrder }}

+

shouldHideRecalibration: {{ shouldHideRecalibration }}

+ + +
{ From 784705041ae8799db2d4692b9fdee8060e6a3efe Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 23 Sep 2024 16:06:25 -0400 Subject: [PATCH 16/40] CSR-2166: EVEN MORE temporary debugging indications for dev --- src/layouts/quote/quote.vue | 3 ++- .../service-package-question/service-package-question.vue | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 5d3db0c3a..c9e1b3064 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -18,6 +18,7 @@

thresholdToUse: {{ thresholdToUse }}

externalSource: {{ externalSource }}

+

typeof recalSettingValue: {{ typeof recalSettingValue }}

recalSettingValue: {{ recalSettingValue }}


@@ -409,7 +410,7 @@ export default { shouldHideRecalibration() { const recalSettingValue = experimentMixin.methods.getSettingValue( experimentSettings.RECAL_PRICE_REMOVE - ); + ).toLowerCase() === "true"; return recalSettingValue; }, showAfterpayBanner() { 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 2d8012aeb..b092ea65b 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -3,7 +3,9 @@

isInsuranceSelected: {{ isInsuranceSelected }}

+

typeof isRecalibrationOnOrder: {{ typeof isRecalibrationOnOrder }}

isRecalibrationOnOrder: {{ isRecalibrationOnOrder }}

+

typeof shouldHideRecalibration: {{ typeof shouldHideRecalibration }}

shouldHideRecalibration: {{ shouldHideRecalibration }}

From 00f34b7c3c3cc43f94df6b8837a43870b06a201c Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 23 Sep 2024 16:16:18 -0400 Subject: [PATCH 17/40] CSR-2166: fix for null exception error --- src/layouts/quote/quote.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index c9e1b3064..083862763 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -410,7 +410,7 @@ export default { shouldHideRecalibration() { const recalSettingValue = experimentMixin.methods.getSettingValue( experimentSettings.RECAL_PRICE_REMOVE - ).toLowerCase() === "true"; + )?.toLowerCase() === "true"; return recalSettingValue; }, showAfterpayBanner() { From 53d4a09a527e900d07c2137300cfe10dded90498 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 23 Sep 2024 18:09:30 -0400 Subject: [PATCH 18/40] CSR-2166: change all instances of hide recal setting from experiments to compare strings not boolean / reformatting --- src/layouts/confirmation/confirmation.vue | 5 +- src/layouts/payment-method/payment-method.vue | 5 +- src/layouts/quote/quote.vue | 60 ++++++++++++------- src/router/index.js | 5 +- 4 files changed, 46 insertions(+), 29 deletions(-) diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index acb97cba2..53851b251 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -170,7 +170,10 @@ export default { }, computed: { shouldHideRecalibration() { - return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE); + const recalSettingValue = + this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE)?.toLowerCase() === + "true"; + return recalSettingValue; }, ShowCart() { if (this.isPia && this.submittedOrder?.settledTenderAmount == 0) { diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index ff7e6a8d8..de1c2670a 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -594,7 +594,10 @@ export default { ); }, shouldHideRecalibration() { - return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE); + const recalSettingValue = + this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE)?.toLowerCase() === + "true"; + return recalSettingValue; }, showApplePay() { return baseMixin.methods.showApplePay(); diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 083862763..fd261483c 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -304,9 +304,10 @@ export default { // Override if coming back from QuoteDetails. Remove override after Quote release const isInsuranceOverrideValue = to.query?.isInsurance; const defaultIsInsuranceSelectedValue = store.getters.order.payment.isInsurance; - const hideRecalCost = experimentMixin.methods.getSettingValue( - experimentSettings.RECAL_PRICE_REMOVE - ); + const hideRecalCost = + experimentMixin.methods + .getSettingValue(experimentSettings.RECAL_PRICE_REMOVE) + ?.toLowerCase() === "true"; //Default to Insurance Tab if user Service zip is from certain States if ( @@ -320,17 +321,20 @@ export default { return defaultIsInsuranceSelectedValue; } else { if (availableLineItems) { + const lineItemsForCalculatingPrice = hideRecalCost + ? baseMixin.methods.filterOutFees( + baseMixin.methods.filterOutRecalibration(availableLineItems) // Strip out recal before filtering out fees + ) + : baseMixin.methods.filterOutFees(availableLineItems); - const lineItemsForCalculatingPrice = - (hideRecalCost === "true") ? - baseMixin.methods.filterOutFees( - baseMixin.methods.filterOutRecalibration(availableLineItems) // Strip out recal before filtering out fees - ) : - baseMixin.methods.filterOutFees(availableLineItems); + let tierOnePackagePriceTemp = baseMixin.methods.getTierOnePackagePrice( + lineItemsForCalculatingPrice + ); // TEMP, FOR TESTING /// TODO AJC: TIGHTEN THIS BACK UP AFTER TESTING - let tierOnePackagePriceTemp = baseMixin.methods.getTierOnePackagePrice(lineItemsForCalculatingPrice); // TEMP, FOR TESTING /// TODO AJC: TIGHTEN THIS BACK UP AFTER TESTING - - return baseMixin.methods.getTierOnePackagePrice(lineItemsForCalculatingPrice) > insuranceThreshold; // compare base price vs arbitrary threshold (representing insurance price) + return ( + baseMixin.methods.getTierOnePackagePrice(lineItemsForCalculatingPrice) > + insuranceThreshold + ); // compare base price vs arbitrary threshold (representing insurance price) } else { return null; } @@ -341,15 +345,20 @@ export default { experimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_INTERNAL ); - if (!store.getters.externalParameterState?.isExternalParameter) { // there are no external parameters + if (!store.getters.externalParameterState?.isExternalParameter) { + // there are no external parameters if (internalThreshold) thresholdToUse = internalThreshold; - vm.isInsuranceSelected = getIsInsuranceSelectedValue(vm.availableLineItems, thresholdToUse); + vm.isInsuranceSelected = getIsInsuranceSelectedValue( + vm.availableLineItems, + thresholdToUse + ); baseMixin.methods.ResetExternalParamsAndHideModal(); + } else { + // there ARE external parameters - } else { // there ARE external parameters - - if (store.getters.externalParameterQuote.isInsurance == true) { // did user intentionally select insurance? + if (store.getters.externalParameterQuote.isInsurance == true) { + // did user intentionally select insurance? vm.isInsuranceSelected = true; vm.servicePackage = store.getters.externalParameterQuote.servicePackage; await nextTick(); @@ -361,7 +370,9 @@ export default { } } else { // did user come from external source (LeadGen)? - let externalSource = store.getters.externalParameterSource ? store.getters.externalParameterSource : null; + let externalSource = store.getters.externalParameterSource + ? store.getters.externalParameterSource + : null; vm.externalSource = externalSource; // TEMP 9/23 @@ -374,10 +385,12 @@ export default { } else { if (internalThreshold) thresholdToUse = internalThreshold; } - vm.isInsuranceSelected = getIsInsuranceSelectedValue(vm.availableLineItems, thresholdToUse); + vm.isInsuranceSelected = getIsInsuranceSelectedValue( + vm.availableLineItems, + thresholdToUse + ); baseMixin.methods.ResetExternalParamsAndHideModal(); } - } vm.thresholdToUse = thresholdToUse; @@ -408,9 +421,10 @@ export default { ); }, shouldHideRecalibration() { - const recalSettingValue = experimentMixin.methods.getSettingValue( - experimentSettings.RECAL_PRICE_REMOVE - )?.toLowerCase() === "true"; + const recalSettingValue = + experimentMixin.methods + .getSettingValue(experimentSettings.RECAL_PRICE_REMOVE) + ?.toLowerCase() === "true"; return recalSettingValue; }, showAfterpayBanner() { diff --git a/src/router/index.js b/src/router/index.js index 266ccb855..4c57921b7 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -683,10 +683,7 @@ function updateExternalParameterState() { ); } if (externalParameterSource) { - store.commit( - storeMutations.UPDATE_EXTERNAL_PARAMETER_SOURCE, - externalParameterSource - ); + store.commit(storeMutations.UPDATE_EXTERNAL_PARAMETER_SOURCE, externalParameterSource); } } From 3cd54358c661f01bc714478915a6a3bce300a57a Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 23 Sep 2024 18:18:45 -0400 Subject: [PATCH 19/40] CSR-2166: remove temp changes that were needed to test on dev --- src/layouts/quote/quote.vue | 18 ------------------ .../service-package-question.vue | 11 ----------- 2 files changed, 29 deletions(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index fd261483c..2eefbb996 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -15,13 +15,6 @@ -
-

thresholdToUse: {{ thresholdToUse }}

-

externalSource: {{ externalSource }}

-

typeof recalSettingValue: {{ typeof recalSettingValue }}

-

recalSettingValue: {{ recalSettingValue }}

-
- insuranceThreshold @@ -374,8 +363,6 @@ export default { ? store.getters.externalParameterSource : null; - vm.externalSource = externalSource; // TEMP 9/23 - // Business logic to determine what "external" source is if (externalSource?.includes("LeadGen")) { const externalThreshold = experimentMixin.methods.getSettingValue( @@ -392,8 +379,6 @@ export default { baseMixin.methods.ResetExternalParamsAndHideModal(); } } - - vm.thresholdToUse = thresholdToUse; }); }, data() { @@ -405,9 +390,6 @@ export default { servicePackage: null, holdParentAccountNumber: null, holdBillToAccountNumber: null, - - thresholdToUse: null, // TEMP 9/23 - externalSource: null, // TEMP 9/23 }; }, computed: { 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 b092ea65b..6af6a31f5 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -1,15 +1,4 @@