From 60e41adf3d2e48229fefee3d83dece838cb3f29c Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 5 Dec 2022 10:08:54 -0500 Subject: [PATCH] CSR-963 Skip Vin Experiment Setting --- src/constants/experiments.js | 1 + .../heritage-integration/navigation-helper.js | 10 ++++++- src/layouts/estimate/estimate.spec.js | 27 ++++++++++++++----- src/layouts/estimate/estimate.vue | 18 +++++++++++-- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/src/constants/experiments.js b/src/constants/experiments.js index f2e5d4928..f6d25f1a7 100644 --- a/src/constants/experiments.js +++ b/src/constants/experiments.js @@ -4,6 +4,7 @@ const experimentUniverses = { const experimentSettings = { GOOGLE_CUSTOM_DIMENSION_INDEX: "Google Custom Dimension Index", + SUPPRESS_VIN_CAPTURE: "SuppressVinCapture", }; const experimentTriggers = { diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 2c28d1d49..dd84c8b35 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -5,6 +5,8 @@ import { saveSession } from "@/helpers/heritage-integration/order-helper.js"; import { fmgPageValues } from "@/router/router-constants/fmgPage-values"; import { storeActions } from "@/constants/store-actions.js"; import { settleAllPromises } from "@/helpers/layout-helper"; +import experimentMixin from "@/mixins/experiment-mixin"; +import { experimentSettings } from "@/constants/experiments"; import store from "@/store"; import router from "@/router"; @@ -98,12 +100,18 @@ async function getLatestPageForRedirection() { } else if (partQuestionsComponent.methods.arePagePrerequisitesValid()) { return fmgPageValues.PART_QUESTIONS; } else if ( + // capture vin vinLookupComponent.methods.arePagePrerequisitesValid() && !store.getters.damage.isRepair && - !isVinOptionalVehicle + !isVinOptionalVehicle && + experimentMixin.methods.hasSettingEqualTo( + experimentSettings.SUPPRESS_VIN_CAPTURE, + false + ) ) { return fmgPageValues.VIN_LOOKUP; } else { + // do not capture vin return fmgPageValues.ESTIMATE; } } diff --git a/src/layouts/estimate/estimate.spec.js b/src/layouts/estimate/estimate.spec.js index 4e533bb70..22f60531a 100644 --- a/src/layouts/estimate/estimate.spec.js +++ b/src/layouts/estimate/estimate.spec.js @@ -221,16 +221,29 @@ describe("estimate.vue", () => { describe("skipVinLookup", () => { const skipOptions = [ - [true, true, true], - [true, false, true], - [false, true, true], - [false, false, false], + [true, true, true, true], + [true, false, false, true], + [false, true, true, true], + [false, false, false, false], ]; test.each(skipOptions)( - "isRepair %s and isVinOptional %s should return %s", - async (isRepair, isVinOptionalVehicle, expectedVinSkip) => { - const { wrapper } = setupMocks({ isVinOptionalVehicle: isVinOptionalVehicle }); + "isRepair %s, isVinOptional %s and suppressVinCapture %s should return %s", + async (isRepair, isVinOptionalVehicle, suppressVinCapture, expectedVinSkip) => { + const { wrapper } = setupMocks({}); + await wrapper.setData({ + isVinOptionalVehicle: isVinOptionalVehicle, + }); + store.commit(storeMutations.UPDATE_IS_REPAIR, isRepair); + const mockExperimentsList = [ + { + universeName: "ConceptFunne;", + settings: { + SuppressVinCapture: suppressVinCapture, + }, + }, + ]; + store.commit(storeMutations.UPDATE_EXPERIMENTS, mockExperimentsList); expect(wrapper.vm.skipVinLookup).toEqual(expectedVinSkip); } diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 3d0d16b4a..764334544 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -102,6 +102,8 @@ import store from "@/store"; import { storeActions } from "@/constants/store-actions"; import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; +import experimentMixin from "@/mixins/experiment-mixin"; +import { experimentSettings } from "@/constants/experiments"; // Define Validation Rules defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED)); @@ -248,10 +250,22 @@ export default { return store.getters.damage.isRepair; }, skipVinLookup() { - return this.isRepair || this.isVinOptionalVehicle; + return ( + this.isRepair || + this.isVinOptionalVehicle || + experimentMixin.methods.hasSettingEqualTo( + experimentSettings.SUPPRESS_VIN_CAPTURE, + true + ) + ); }, alertInfo() { - return this.isVinOptionalVehicle && !this.isRepair + return (this.isVinOptionalVehicle || + experimentMixin.methods.hasSettingEqualTo( + experimentSettings.SUPPRESS_VIN_CAPTURE, + true + )) && + !this.isRepair ? "AlertQuoteVinOptional" : "AlertQuoteReady"; },