CASH-69: Add MSR experiment. Filter recal part by partType instead of part number

This commit is contained in:
Chris Redelinghuys 2025-01-29 11:14:31 -05:00
parent 5746fc52d5
commit 042e896235
5 changed files with 33 additions and 8 deletions

View file

@ -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 = {

View file

@ -0,0 +1,7 @@
const partNumberStrings = {
// Recalibration
MOBILE_STATIC_RECAL_FEE: "RECAL MOBILE",
MOBILE_DUAL_RECAL_FEE: "RECAL MOBILEDUAL",
};
export { partNumberStrings };

View file

@ -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,
},
};
});

View file

@ -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 ||

View file

@ -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 {