decord/alpha/source/modules/experiments/ExperimentManager.tsx

89 lines
3.1 KiB
TypeScript
Raw Permalink Normal View History

2026-10-10 08:08:14 +00:00
// Module ID: 5021
// Function ID: 5022
// Name: ExperimentManager
2026-10-10 08:08:14 +00:00
// Dependencies: [5016, 5017, 584, 2]
2026-07-20 16:05:17 +00:00
// Exports: overrideBucket, registerGuildExperiment, registerUserExperiment, trackExposureToExperiment
2026-10-10 08:08:14 +00:00
// Module 5021 (ExperimentManager)
2026-10-03 08:58:59 +00:00
import DispatcherDefault from "Dispatcher" /* 584 */;
2026-10-10 08:08:14 +00:00
import ExperimentStore2 from "ExperimentStore" /* 5016 */;
import ExperimentConstants from "ExperimentConstants" /* 5017 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
const ExperimentStore = ExperimentStore2;
let ExposureTypes;
let closure_4;
const registerExperiment = ExperimentStore2.registerExperiment;
({ ExperimentTypes: closure_4, ExposureTypes } = ExperimentConstants);
const ExperimentSystem = { LEGACY: "legacy", APEX: "apex" };
const result = size.fileFinishedImporting("modules/experiments/ExperimentManager.tsx");
2026-07-20 16:05:17 +00:00
export const trackExposureToExperiment = function trackExposureToExperiment(id, descriptor, location) {
let _location;
2026-10-03 08:58:59 +00:00
let analyticsLocations;
let excluded;
let exposureType;
let fingerprint;
const obj = { experimentId: id, descriptor, location: _location, location_stack: analyticsLocations, fingerprint, excluded, exposureType };
_location = undefined;
const trackExposure = ExperimentStore.trackExposure;
2026-07-29 08:29:29 +00:00
if (location != null) {
2026-07-20 16:05:17 +00:00
_location = location.location;
}
2026-10-03 08:58:59 +00:00
analyticsLocations = undefined;
2026-07-29 08:29:29 +00:00
if (location != null) {
2026-07-20 16:05:17 +00:00
analyticsLocations = location.analyticsLocations;
}
2026-10-03 08:58:59 +00:00
fingerprint = undefined;
2026-07-29 08:29:29 +00:00
if (location != null) {
2026-07-20 16:05:17 +00:00
fingerprint = location.fingerprint;
}
2026-10-03 08:58:59 +00:00
excluded = undefined;
2026-07-29 08:29:29 +00:00
if (location != null) {
2026-07-20 16:05:17 +00:00
excluded = location.excluded;
}
2026-10-03 08:58:59 +00:00
exposureType = undefined;
2026-07-29 08:29:29 +00:00
if (location != null) {
2026-07-20 16:05:17 +00:00
exposureType = location.exposureType;
}
2026-10-03 08:58:59 +00:00
trackExposure(obj);
2026-07-20 16:05:17 +00:00
};
export const registerUserExperiment = function registerUserExperiment(id) {
id = id.id;
2026-10-03 08:58:59 +00:00
const obj = { experimentId: id, experimentType: constants.USER, title: id.title, description: id.description, buckets: id.buckets, commonTriggerPoint: id.commonTriggerPoint };
registerExperiment(obj);
2026-07-20 16:05:17 +00:00
return { id };
};
export const registerGuildExperiment = function registerGuildExperiment(id) {
id = id.id;
2026-10-03 08:58:59 +00:00
const obj = { experimentId: id, experimentType: constants.GUILD, title: id.title, description: id.description, buckets: id.buckets, commonTriggerPoint: id.commonTriggerPoint };
registerExperiment(obj);
2026-07-20 16:05:17 +00:00
return { id };
};
export { ExperimentSystem };
export const overrideBucket = function overrideBucket(system, map, id) {
2026-10-03 08:58:59 +00:00
let obj;
let tmp11;
2026-07-20 16:05:17 +00:00
if (obj.LEGACY === system) {
2026-10-03 08:58:59 +00:00
const obj2 = { type: "EXPERIMENT_OVERRIDE_BUCKET", experimentId: map, experimentBucket: tmp11 };
tmp11 = null;
const dispatch = DispatcherDefault.dispatch;
DispatcherDefault;
2026-07-20 16:05:17 +00:00
if (null != id) {
2026-10-03 08:58:59 +00:00
tmp11 = id;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
dispatch(obj2);
2026-07-29 08:29:29 +00:00
} else if (tmp.APEX === system) {
2026-07-20 16:05:17 +00:00
if (null == id) {
const obj4 = { type: "APEX_EXPERIMENT_OVERRIDE_DELETE", experimentName: map };
2026-10-03 08:58:59 +00:00
const obj3 = DispatcherDefault;
obj3.dispatch(obj4);
2026-07-20 16:05:17 +00:00
} else {
obj = DispatcherDefault;
2026-10-03 08:58:59 +00:00
const obj5 = { type: "APEX_EXPERIMENT_OVERRIDE_CREATE", experimentName: map, variantId: id };
obj.dispatch(obj5);
2026-07-20 16:05:17 +00:00
}
}
};