From a4a25ad547e73b66b3098aea6295f21797ba24f8 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 12 Sep 2024 15:44:15 -0400 Subject: [PATCH 1/4] CSR-2179: remove unnecessary experiment logging from quote --- src/layouts/quote/quote.vue | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 3d539e630..d6288735e 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -138,9 +138,6 @@ export default { async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); - const experimentForLogging = store.getters.applicationUser.experiments.find( - (e) => e.universeName === experimentUniverses.RECAL_PRICE_REMOVAL - ); const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging( storeActions.GET_WIPERS, { @@ -208,33 +205,6 @@ export default { ...servicePackageDiscountPart, ]; - // If the recal experiment is found then log the experiment exposure. - const isRecalibrationOnOrder = containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - availableLineItems - ); - const canSafeliteRecalibrate = nullSafeGlassParts.some((glassPart) => { - return glassPart.partType === "WINDSHIELD" && glassPart.canSafeliteRecalibrate; - }); - if ( - experimentForLogging !== undefined && - isRecalibrationOnOrder && - canSafeliteRecalibrate - ) { - // Log experiment exposure - baseMixin.methods.dispatchStoreActionWithLogging( - storeActions.LOG_EXPERIMENT_EXPOSURE, - { - userId: getUserIdValue(), - sessionKey: getSessionKeyValue(), - pageName: to.query.fmgPage, - experiment: experimentForLogging, - }, - "quote", - false - ); - } - // When calling pricing from the quote page, always use the cash parent account baseMixin.methods.dispatchStoreAction( storeActions.SAVE_PARENT_ACCOUNT_NUMBER, From 7cfcf07dd675f7c955a095ef46016b2157e17bf0 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 12 Sep 2024 15:46:49 -0400 Subject: [PATCH 2/4] CSR-2179: pass experiment boolean via prop from /quote & refactor --- src/layouts/quote/quote.vue | 9 +++++++-- .../service-package-question.vue | 11 ++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index d6288735e..660681da1 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -31,6 +31,8 @@ groupName="ServicePackageQuestion" :availableLineItems="availableLineItems" :isInsuranceSelected="isInsuranceSelected" + :isRecalibrationOnOrder="isRecalibrationOnOrder" + :shouldHideRecalibration="shouldHideRecalibration" @vapsItemsSelected="vapsItemsSelectedAction" @servicePackageDiscountSelected="servicePackageDiscountSelectedAction" :servicePackage="servicePackage" @@ -336,10 +338,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..4ef027ad5 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -49,6 +49,8 @@ export default { availableLineItems: null, activePromos: null, servicePackage: null, + isRecalibrationOnOrder: Boolean, + shouldHideRecalibration: Boolean, }, data() { return { @@ -141,12 +143,6 @@ export default { })); return modifiedAnswers; }, - isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this.nullSafeAvailableLineItems - ); - }, isServicePackageDiscountOnOrder() { return containsLineItemWithPartType( partTypeStrings.SERVICE_PACKAGE_DISCOUNT, @@ -242,7 +238,8 @@ export default { }, getPackagePrice(packageName, { discountedPrice = false, servicePackageDiscount = false }) { var lineItemsToPrice = [...this.nullSafeAvailableLineItems]; - if (this.isRecalibrationOnOrder) { + + if (this.isRecalibrationOnOrder && this.shouldHideRecalibration) { lineItemsToPrice = lineItemsToPrice.filter((item) => { return item.partType != partTypeStrings.RECALIBRATION; }); From 81586b0e4f0b339a36b64bdbf29560cd55f445d7 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 12 Sep 2024 15:48:39 -0400 Subject: [PATCH 3/4] CSR-2179: prettier and reformat fixes --- src/fmg-components/cart/cart.vue | 14 ++++++++------ src/layouts/confirmation/confirmation.vue | 4 +--- src/layouts/payment-method/payment-method.vue | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index d0f4d6ed4..e841d8849 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -305,9 +305,9 @@ 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.supportingItems = lineItemsCopy.supportingItems + ? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.supportingItems) + : []; return lineItemsCopy; }, showCoverageAsPending() { @@ -438,13 +438,15 @@ export default { packagePrice() { let packagePrice = 0; - if (!this.isInsurance && this.shouldHideRecalibration) { // Update packagePrice if Cash only && is part of RemoveRecal experiment + if (!this.isInsurance && this.shouldHideRecalibration) { + // Update packagePrice if Cash only && is part of RemoveRecal experiment packagePrice = baseMixin.methods.getTierOnePackagePrice( baseMixin.methods.filterOutFees( baseMixin.methods.filterOutRecalibration(this.availableLineItems) // Strip out recal before filtering out fees ) ); - } else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) { // Update packagePrice if is verified insurance OR if Cash && not part of RemoveRecal experiment + } else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) { + // Update packagePrice if is verified insurance OR if Cash && not part of RemoveRecal experiment packagePrice = baseMixin.methods.getTierOnePackagePrice( baseMixin.methods.filterOutFees(this.availableLineItems) ); @@ -1001,7 +1003,7 @@ export default { if (!this.lineItems || this.lineItems.length < 1) return; return this.isInsurance || !this.shouldHideRecalibration ? baseMixin.methods.getSubTotal(this.lineItems) // calculate with recal (if on order) - : baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal); // calculated without recal + : baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal); // calculate without recal }, salesTax() { if (!this.lineItems || this.lineItems.length < 1) return; diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index df3a3dfe7..acb97cba2 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -170,9 +170,7 @@ export default { }, computed: { shouldHideRecalibration() { - return this.getSettingValue( - experimentSettings.RECAL_PRICE_REMOVE - ); + return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE); }, 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 ccf4e1524..85fb84a63 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -55,7 +55,9 @@ class="service-questions" />
-
+
Date: Mon, 16 Sep 2024 06:06:38 -0400 Subject: [PATCH 4/4] CSR-2179: update unit tests --- src/layouts/quote/quote.spec.js | 3 +++ .../service-package-question/service-package-question.spec.js | 1 + 2 files changed, 4 insertions(+) diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index 4f2ac213e..ca2bfd78e 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -750,7 +750,10 @@ function setupMocks({ customMountOptions }) { baseMixin.methods.ResetExternalParamsAndHideModal = jest.fn(); baseMixin.methods.isFormValid = jest.fn().mockReturnValue(true); mountOptions.global.mocks["$store"] = store; + store.getters.experimentSettings = "test value"; + mountOptions["attachTo"] = document.body; + const wrapper = shallowMount(quote, mountOptions); wrapper.vm.setCmsContent = jest.fn(); return { wrapper }; 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 07d37ed19..a23d1ead6 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 @@ -475,6 +475,7 @@ describe("service-package-question.vue, matching business rules for package disp mockProps.availableLineItems.push(recalLineItem); mockProps.availableLineItems.push(driverFrontWiperLineItem); mockProps.availableLineItems.push(passengerFrontWiperLineItem); + mockProps.isRecalibrationOnOrder = true; Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]); const wrapper = setupMocks({ mountOptionsMockData: {