From 042e8962352a96f3623a831b55caf34b7d645c48 Mon Sep 17 00:00:00 2001 From: Chris Redelinghuys Date: Wed, 29 Jan 2025 11:14:31 -0500 Subject: [PATCH] CASH-69: Add MSR experiment. Filter recal part by partType instead of part number --- src/constants/experiments.js | 2 ++ src/constants/part-number-strings.js | 7 +++++++ .../service-location/service-location.spec.js | 4 ++++ src/layouts/service-location/service-location.vue | 14 ++++++++++++-- src/store/index.js | 14 ++++++++------ 5 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 src/constants/part-number-strings.js diff --git a/src/constants/experiments.js b/src/constants/experiments.js index 83555fc04..92d27a4a1 100644 --- a/src/constants/experiments.js +++ b/src/constants/experiments.js @@ -1,6 +1,7 @@ const experimentUniverses = { CONCEPT_FUNNEL: "ConceptFunnel", RECAL_PRICE_REMOVAL: "NextGen_RecalPriceRemoval", + MSR: "MSR", }; const experimentSettings = { @@ -16,6 +17,7 @@ const experimentSettings = { RECAL_PRICE_REMOVE: "RecalPriceRemove", INSURANCE_TAB_TO_DISPLAY_THRESHOLD_INTERNAL: "NextGen_InternalInsuranceTabDisplayThreshold", INSURANCE_TAB_TO_DISPLAY_THRESHOLD_EXTERNAL: "NextGen_ExternalInsuranceTabDisplayThreshold", + DISPLAY_MSR: "DisplayMSR", }; const experimentTriggers = { diff --git a/src/constants/part-number-strings.js b/src/constants/part-number-strings.js new file mode 100644 index 000000000..c32864a87 --- /dev/null +++ b/src/constants/part-number-strings.js @@ -0,0 +1,7 @@ +const partNumberStrings = { + // Recalibration + MOBILE_STATIC_RECAL_FEE: "RECAL MOBILE", + MOBILE_DUAL_RECAL_FEE: "RECAL MOBILEDUAL", +}; + +export { partNumberStrings }; diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index 6333082ec..54f28a89c 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -7,6 +7,7 @@ import { getMountOptions } from "@/helpers/unit-test-helper"; import store from "@/store"; import baseMixin from "@/mixins/base-mixin"; +import { experimentSettings } from "@/constants/experiments"; // Define Mocks jest.mock("@/helpers/cms-content-helper", () => ({ @@ -199,6 +200,9 @@ beforeEach(() => { zipCode: "43054", }, }, + experimentSettings: { + settingName: experimentSettings.DISPLAY_MSR, + }, }; }); diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 71bfa4b01..9addea705 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -139,6 +139,8 @@ import contentGroupModal from "@/fmg-components/content-group-modal/content-grou // Supporting files import baseMixin from "@/mixins/base-mixin.js"; +import experimentMixin from "@/mixins/experiment-mixin.js"; +import { experimentSettings } from "@/constants/experiments"; import { AppointmentTypeStrings } from "@/constants/schedule-constants"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; @@ -151,6 +153,7 @@ import { import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import { applicationConfig } from "@/constants/application-config"; import { Provider } from "@/layouts/service-location/classes/provider"; +import { partNumberStrings } from "@/constants/part-number-strings"; import store from "@/store"; @@ -159,7 +162,6 @@ import { defineRule } from "vee-validate"; import { errorMessages } from "@/constants/error-messages"; const MOBILE_FEE_PART_TYPE = "MOBILE FEE"; -const MOBILE_STATIC_RECAL_FEE_PART_NUMBER = "RECAL MOBILE"; // DEFINE VALIDATION RULES defineRule("mobile-location-required", (value) => { @@ -319,11 +321,19 @@ export default { }, isMobileStaticRecalibrationApplicable() { return ( + this.displayMSR && this.isVehicleMobileStaticRecalibrationApplicable && - this.mobileFeePart?.partNumber == MOBILE_STATIC_RECAL_FEE_PART_NUMBER && + this.mobileFeePart?.partNumber == partNumberStrings.MOBILE_STATIC_RECAL_FEE && (this.isInsurance ? this.mobileFeePart?.isInsurable : true) ); }, + displayMSR() { + return ( + experimentMixin.methods + .getSettingValue(experimentSettings.DISPLAY_MSR) + ?.toLowerCase() === "true" + ); + }, mobileFeeApplies() { if ( this.mobileFeePart?.laborAmount > 0 || diff --git a/src/store/index.js b/src/store/index.js index fa83032d5..48c6078c7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1671,10 +1671,10 @@ export const actions = { var endPoint = `${endpoints.GetMobileFeePart.url}/?serviceType=${serviceType}&facilityType=${facilityType}&parentAccountNumber=${parentAccountNumber}&billToAccountNumber=${billToAccountNumber}&providerNumber=${providerNumber}&isItacOptimized=${isItacOptimized}&zipCode=${zipCode}`; if (isMobileStaticRecalibrationApplicable) { - const staticRecalPartNumber = getStaticRecalPartNumber(order.lineItems?.glassParts[0]); + const recalPartNumber = getRecalPartNumber(order.lineItems?.glassParts[0]); const carId = order.vehicle?.carId; - if (staticRecalPartNumber && carId) { - endPoint = `${endPoint}&partNumbers=${staticRecalPartNumber}&carId=${carId}`; + if (recalPartNumber && carId) { + endPoint = `${endPoint}&partNumbers=${recalPartNumber}&carId=${carId}`; } } @@ -3718,9 +3718,11 @@ function saveExternalParameterState(externalParameterState) { window.sessionStorage.setItem("externalParameterState", JSON.stringify(externalParameterState)); } -//This function checks if static recalibration is available for the vehicle and returns the part number for it. -function getStaticRecalPartNumber(glassPartsArray) { - const recalPart = glassPartsArray.childParts.find((item) => item.partNumber === "RECAL STATIC"); +//This function finds the recalibration part and returns the part number for it. +function getRecalPartNumber(glassPartsArray) { + const recalPart = glassPartsArray.childParts.find( + (item) => item.partType === partTypeStrings.ADAS_RECALIBRATION + ); if (recalPart) { return recalPart.partNumber; } else {