Merge pull request #2280 from Safelite/feature/CASH-183

CASH-183 | Update the store when exposure is logged
This commit is contained in:
scottkiener 2025-02-05 11:11:00 -05:00 committed by GitHub
commit af66b4dacc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 3 deletions

View file

@ -55,7 +55,7 @@ const storeActions = {
GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems",
// Analytics
LOG_EXPERIMENT_EXPOSURE: "logExperimentExposure",
LOG_EXPERIMENT_EXPOSURE_AND_UPDATE_STORE: "logExperimentExposureAndUpdateStore",
LOG_PAGE_VIEW: "logPageView",
LOG_CUSTOM_EVENT: "logCustomEvent",
INITIALIZE_SESSION: "initializeSession",

View file

@ -187,7 +187,7 @@ export default {
if (experimentForLogging !== undefined) {
// Log experiment exposure
baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.LOG_EXPERIMENT_EXPOSURE,
storeActions.LOG_EXPERIMENT_EXPOSURE_AND_UPDATE_STORE,
{
userId: getUserIdValue(),
deviceId: getDeviceIdValue(),

View file

@ -1287,10 +1287,23 @@ export const actions = {
},
// Analytics Actions
logExperimentExposure(
logExperimentExposureAndUpdateStore(
context,
{ payload: { userId, deviceId, sessionKey, pageName, experiment }, pageNameToLog }
) {
const experiments = deepClone(context.getters.applicationUser.experiments);
const experimentToMarkAsExposed = experiments.find(ex => {
ex.universeId == experiment.universeId &&
ex.testId == experiment.testIde &&
ex.variationId == experiment.variationId &&
ex.assignmentId == experiment.assignmentId
});
if (experimentToMarkAsExposed) {
experimentToMarkAsExposed.isExposed = true;
}
context.commit(storeMutations.UPDATE_EXPERIMENTS, experiments);
return globalMethods.callHttpClient({
method: endpoints.LogExperimentExposureIfAssigned.method,
endpoint: endpoints.LogExperimentExposureIfAssigned.url,