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

78 lines
2.9 KiB
TypeScript
Raw Normal View History

// Module ID: 4676
// Function ID: 4677
// Name: ExperimentManager
// Dependencies: [4671, 4672, 573, 2]
2026-07-20 16:05:17 +00:00
// Exports: overrideBucket, registerGuildExperiment, registerUserExperiment, trackExposureToExperiment
// Module 4676 (ExperimentManager)
import DispatcherDefault from "Dispatcher" /* 573 */;
import ExperimentStore from "ExperimentStore" /* 4671 */;
2026-07-23 10:11:24 +00:00
const registerExperiment = fn(4671).registerExperiment;
const ExperimentConstants = fn(4672);
({ ExperimentTypes: closure_4, ExposureTypes } = ExperimentConstants);
const ExperimentSystem = { LEGACY: "legacy", APEX: "apex" };
const size = fn(2);
const result = size.fileFinishedImporting("modules/experiments/ExperimentManager.tsx");
2026-07-20 16:05:17 +00:00
export const trackExposureToExperiment = function trackExposureToExperiment(id, descriptor, location) {
const obj = { experimentId: id, descriptor, location: null, location_stack: null, fingerprint: null, excluded: null, exposureType: null };
2026-07-20 16:05:17 +00:00
let _location;
2026-07-29 08:29:29 +00:00
if (location != null) {
2026-07-20 16:05:17 +00:00
_location = location.location;
}
obj.location = _location;
2026-07-20 16:05:17 +00:00
let analyticsLocations;
2026-07-29 08:29:29 +00:00
if (location != null) {
2026-07-20 16:05:17 +00:00
analyticsLocations = location.analyticsLocations;
}
obj.location_stack = analyticsLocations;
2026-07-20 16:05:17 +00:00
let fingerprint;
2026-07-29 08:29:29 +00:00
if (location != null) {
2026-07-20 16:05:17 +00:00
fingerprint = location.fingerprint;
}
obj.fingerprint = fingerprint;
2026-07-20 16:05:17 +00:00
let excluded;
2026-07-29 08:29:29 +00:00
if (location != null) {
2026-07-20 16:05:17 +00:00
excluded = location.excluded;
}
obj.excluded = excluded;
2026-07-20 16:05:17 +00:00
let exposureType;
2026-07-29 08:29:29 +00:00
if (location != null) {
2026-07-20 16:05:17 +00:00
exposureType = location.exposureType;
}
obj.exposureType = exposureType;
ExperimentStore.trackExposure(obj);
2026-07-20 16:05:17 +00:00
};
export const registerUserExperiment = function registerUserExperiment(id) {
id = id.id;
registerExperiment({ experimentId: id, experimentType: constants.USER, title: id.title, description: id.description, buckets: id.buckets, commonTriggerPoint: id.commonTriggerPoint });
return { id };
};
export const registerGuildExperiment = function registerGuildExperiment(id) {
id = id.id;
registerExperiment({ experimentId: id, experimentType: constants.GUILD, title: id.title, description: id.description, buckets: id.buckets, commonTriggerPoint: id.commonTriggerPoint });
return { id };
};
export { ExperimentSystem };
export const overrideBucket = function overrideBucket(system, map, id) {
2026-07-20 16:05:17 +00:00
if (obj.LEGACY === system) {
const obj2 = { type: "EXPERIMENT_OVERRIDE_BUCKET", experimentId: map, experimentBucket: null };
2026-07-29 08:29:29 +00:00
let tmp10 = null;
2026-07-20 16:05:17 +00:00
if (null != id) {
2026-07-29 08:29:29 +00:00
tmp10 = id;
2026-07-20 16:05:17 +00:00
}
obj2.experimentBucket = tmp10;
DispatcherDefault.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 };
DispatcherDefault.dispatch(obj4);
2026-07-20 16:05:17 +00:00
} else {
obj = DispatcherDefault;
const obj6 = { type: "APEX_EXPERIMENT_OVERRIDE_CREATE", experimentName: map, variantId: id };
obj.dispatch(obj6);
2026-07-20 16:05:17 +00:00
}
}
};