From 53d4a09a527e900d07c2137300cfe10dded90498 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 23 Sep 2024 18:09:30 -0400 Subject: [PATCH] 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); } }