CSR-2179: add experiment logging for nextGen_RecalPriceRemoval on quote page

This commit is contained in:
Adam Caouette 2024-09-06 14:48:22 -04:00
parent af55ada8e9
commit 87e0426258
2 changed files with 35 additions and 0 deletions

View file

@ -1,5 +1,6 @@
const experimentUniverses = { const experimentUniverses = {
CONCEPT_FUNNEL: "ConceptFunnel", CONCEPT_FUNNEL: "ConceptFunnel",
RECAL_PRICE_REMOVAL: "NextGen_RecalPriceRemoval",
}; };
const experimentSettings = { const experimentSettings = {

View file

@ -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 loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
import afterpayModalBanner from "@/layouts/quote/afterpay-modal-banner/afterpay-modal-banner"; import afterpayModalBanner from "@/layouts/quote/afterpay-modal-banner/afterpay-modal-banner";
import recalDisclaimer from "@/layouts/quote/recal-disclaimer/recal-disclaimer.vue"; import recalDisclaimer from "@/layouts/quote/recal-disclaimer/recal-disclaimer.vue";
// Supporting files
import baseMixin from "@/mixins/base-mixin.js"; import baseMixin from "@/mixins/base-mixin.js";
import experimentMixin from "@/mixins/experiment-mixin.js"; import experimentMixin from "@/mixins/experiment-mixin.js";
import vehicleQuestionsMixin from "../../mixins/vehicle-questions-mixin"; import vehicleQuestionsMixin from "../../mixins/vehicle-questions-mixin";
@ -107,6 +109,8 @@ import { storeActions } from "@/constants/store-actions";
import { deepClone } from "@/helpers/object-helper"; import { deepClone } from "@/helpers/object-helper";
import store from "@/store"; import store from "@/store";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; 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 { required } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages"; import { errorMessages } from "@/constants/error-messages";
import { Form, defineRule } from "vee-validate"; import { Form, defineRule } from "vee-validate";
@ -133,6 +137,9 @@ export default {
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {
// Call APIs // Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); 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( const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.GET_WIPERS, storeActions.GET_WIPERS,
{ {
@ -200,6 +207,33 @@ export default {
...servicePackageDiscountPart, ...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 // When calling pricing from the quote page, always use the cash parent account
baseMixin.methods.dispatchStoreAction( baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_PARENT_ACCOUNT_NUMBER, storeActions.SAVE_PARENT_ACCOUNT_NUMBER,