From 87e0426258a510d68517c9cc67145ea865e522d6 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Fri, 6 Sep 2024 14:48:22 -0400 Subject: [PATCH] CSR-2179: add experiment logging for nextGen_RecalPriceRemoval on quote page --- src/constants/experiments.js | 1 + src/layouts/quote/quote.vue | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/constants/experiments.js b/src/constants/experiments.js index eb7fed508..bc2eea9af 100644 --- a/src/constants/experiments.js +++ b/src/constants/experiments.js @@ -1,5 +1,6 @@ const experimentUniverses = { CONCEPT_FUNNEL: "ConceptFunnel", + RECAL_PRICE_REMOVAL: "NextGen_RecalPriceRemoval", }; const experimentSettings = { diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 0d0e30128..2ddcc755f 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -99,6 +99,8 @@ import contentGroupModal from "@/fmg-components/content-group-modal/content-grou import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue"; import afterpayModalBanner from "@/layouts/quote/afterpay-modal-banner/afterpay-modal-banner"; import recalDisclaimer from "@/layouts/quote/recal-disclaimer/recal-disclaimer.vue"; + +// Supporting files import baseMixin from "@/mixins/base-mixin.js"; import experimentMixin from "@/mixins/experiment-mixin.js"; import vehicleQuestionsMixin from "../../mixins/vehicle-questions-mixin"; @@ -107,6 +109,8 @@ import { storeActions } from "@/constants/store-actions"; import { deepClone } from "@/helpers/object-helper"; import store from "@/store"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; +import { experimentUniverses } from "@/constants/experiments"; +import { getSessionKeyValue, getUserIdValue } from "@/helpers/heritage-integration/cookie-helper"; import { required } from "@/helpers/validation-rules"; import { errorMessages } from "@/constants/error-messages"; import { Form, defineRule } from "vee-validate"; @@ -133,6 +137,9 @@ 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, { @@ -200,6 +207,33 @@ 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, + }, + "vehicle", + false + ); + } + // When calling pricing from the quote page, always use the cash parent account baseMixin.methods.dispatchStoreAction( storeActions.SAVE_PARENT_ACCOUNT_NUMBER,