Description
This task is a proposal to create a new mw.xLab module in the MetricsPlatform extension to start working there on the new JS xLab API following the current approach we prepared for the feature code to deal with the experiment enrollment configuration.
We propose the following:
- Create a module called mw.xLab where the needed API will be included for feature code to get experiment details for the current user
- There will be a getExperiment( EXPERIMENT_NAME ) function to get the enrollment details (the assigned group) for the experiment whose name if passed as parameter as an Experiment object
- The proposed API for the Experiment class is the following:
namespace mw.xLab { interface Experiment { /** * Gets whether the EESA enrolled the current user in this experiment. * * @private */ isEnrolled(): boolean; /** * Gets the group the current user was assigned by the EESA when they were * enrolled in this experiment. */ getAssignedGroup(): string|null; /** * Sends an interaction event associated with this experiment if the EESA * enrolled the current user in this experiment. */ send( action: string, interactionData: ?Object ): void; } }
Acceptance Criteria
- A new module, mw.xLab has been created
- The new module contains the required API:
- const experiment = getExperiment( EXPERIMENT_NAME)
- experiment.isEnrolled() (private)
- experiment.getAssignedGroup()
- experiment.send( action, interactionData )
- When assigned was arrived at by way of a CDN experiment, set the subject_id field to the string value of awaiting