// Generated by dts-bundle-generator v8.1.2 export declare enum MARKED_DECISION_POINT_STATUS { CONDITION_APPLIED = "condition applied", CONDITION_FAILED_TO_APPLY = "condition not applied", NO_CONDITION_ASSIGNED = "no condition assigned" } declare enum IMetricMetaData { CONTINUOUS = "continuous", CATEGORICAL = "categorical" } declare enum EXPERIMENT_TYPE { SIMPLE = "Simple", FACTORIAL = "Factorial" } declare enum PAYLOAD_TYPE { STRING = "string", JSON = "json", CSV = "csv" } declare enum SUPPORTED_CALIPER_PROFILES { GRADING = "GradingProfile" } declare enum SUPPORTED_CALIPER_EVENTS { GRADE = "GradeEvent" } export interface IExperimentAssignmentv5 { site: string; target: string; assignedCondition: AssignedCondition[]; assignedFactor?: Record[]; experimentType: EXPERIMENT_TYPE; } export interface AssignedCondition { conditionCode: string; payload: IPayload; experimentId?: string; id: string; } export interface ILogMetrics { attributes?: Record; groupedMetrics: ILogGroupMetrics[]; } export interface ILogGroupMetrics { groupClass: string; groupKey: string; groupUniquifier: string; attributes?: Record; } export interface ILogInput { timestamp: string; metrics: ILogMetrics; } export interface IUserAliasesv6 { aliases: string[]; } export interface IUserAliases extends IUserAliasesv6 { userId: string; } export interface IPayload { type: PAYLOAD_TYPE; value: string; } export interface ScoreObject { id: string; type: string; attempt: Attempt; extensions?: object; scoreGiven?: number; } export interface CaliperActor { id: string; type: string; } export interface Attempt { id?: string; type: string; assignee?: CaliperActor; assignable?: CaliperActor; duration?: string; extensions?: ILogInput; } export interface CaliperGradingProfile { id: string; type: SUPPORTED_CALIPER_EVENTS; profile: SUPPORTED_CALIPER_PROFILES; actor: CaliperActor; action: string; object: Attempt; generated: ScoreObject; extensions: Record; eventTime: string; } export interface CaliperEnvelope { sensor: string; sendTime: string; dataVersion: string; data: CaliperGradingProfile[]; } declare enum BinaryRewardAllowedValue { SUCCESS = "SUCCESS", FAILURE = "FAILURE" } export declare namespace UpGradeClientInterfaces { interface IConfig { hostURL: string; userId: string; context: string; apiVersion: string; clientSessionId?: string; token?: string; httpClient?: UpGradeClientInterfaces.IHttpClientWrapper; featureFlagUserGroupsForSession: IFeatureFlagOptions | null; } interface IConfigOptions { token?: string; clientSessionId?: string; httpClient?: UpGradeClientInterfaces.IHttpClientWrapper; featureFlagUserGroupsForSession?: IFeatureFlagOptions | null; } interface IFeatureFlagOptions { groupsForSession: Record; includeStoredUserGroups: boolean; } interface IResponse { status: boolean; data?: any; message?: any; } interface IMarkDecisionPointParams { site: string; target: string; condition: string; status: MARKED_DECISION_POINT_STATUS; uniquifier?: string; clientError?: string; } interface IExperimentUser { id: string; group?: IExperimentUserGroup; workingGroup?: IExperimentUserWorkingGroup; } type IExperimentUserGroup = Record>; type IExperimentUserWorkingGroup = Record; type IExperimentUserAliases = string[]; interface IMarkDecisionPoint { id: string; site: string; target: string; userId: string; experimentId: string; } interface ILog { id: string; data: any; metrics: IMetric[]; user: IExperimentUser; timeStamp: string; uniquifier: string; } interface ILogResponse { createdAt?: string; updatedAt?: string; versionNumber?: number; id: string; uniquifier: string; timeStamp: string; data: any; } interface IMetric { key: string; type: IMetricMetaData; allowedData: string[]; } interface IExperimentUserAliasesResponse { userId: string; aliases: IExperimentUserAliases; } interface ISendRewardResponse { message: string; request: { rewardValue: "SUCCESS" | "FAILURE"; experimentId?: string; context?: string; decisionPoint?: { site: string; target: string; }; }; reward: { variable: string; value: number; mooclet: number; version: number; learner: string; }; } interface IHttpClientWrapperRequestConfig { headers?: { [key: string]: string | string[]; }; withCredentials?: boolean; } interface IHttpClientWrapper { config?: IHttpClientWrapperRequestConfig; doGet: (url: string, options: IHttpClientWrapperRequestConfig) => Promise; doPost: (url: string, body: RequestBodyType, options: IHttpClientWrapperRequestConfig) => Promise; doPatch: (url: string, body: RequestBodyType, options: IHttpClientWrapperRequestConfig) => Promise; } } export declare namespace UpGradeClientEnums { enum REQUEST_METHOD { GET = "GET", POST = "POST", PATCH = "PATCH" } } export declare namespace UpGradeClientRequests { interface IInitRequestBody { id?: string; group?: UpGradeClientInterfaces.IExperimentUserGroup; workingGroup?: UpGradeClientInterfaces.IExperimentUserWorkingGroup; } interface ISetGroupMembershipRequestBody { group: UpGradeClientInterfaces.IExperimentUserGroup; } interface ISetWorkingGroupRequestBody { workingGroup: UpGradeClientInterfaces.IExperimentUserWorkingGroup; } interface ISetAltIdsRequestBody { aliases: UpGradeClientInterfaces.IExperimentUserAliases; } interface IGetAllExperimentConditionsRequestBody { context: string; } type IGetAllFeatureFlagsRequestBody = { context: string; } | { context: string; groupsForSession: Record; includeStoredUserGroups: boolean; }; interface IMarkDecisionPointRequestBody { status: MARKED_DECISION_POINT_STATUS; data: { site: string; target: string; assignedCondition: { conditionCode: string; experimentId?: string; }; }; uniquifier?: string; clientError?: string; } interface ISendRewardRequestBody { rewardValue: "SUCCESS" | "FAILURE"; experimentId?: string; context?: string; decisionPoint?: { site: string; target: string; }; } } declare class DataService { private group; private workingGroup; private experimentAssignmentData; private featureFlags; getGroup(): UpGradeClientInterfaces.IExperimentUserGroup; setGroup(group: UpGradeClientInterfaces.IExperimentUserGroup): void; getWorkingGroup(): UpGradeClientInterfaces.IExperimentUserWorkingGroup; setWorkingGroup(workingGroup: UpGradeClientInterfaces.IExperimentUserWorkingGroup): void; getExperimentAssignmentData(): IExperimentAssignmentv5[]; setExperimentAssignmentData(experimentAssignmentData: IExperimentAssignmentv5[]): void; getFeatureFlags(): string[]; setFeatureFlags(featureFlags: string[]): void; rotateAssignmentList(assignment: IExperimentAssignmentv5): IExperimentAssignmentv5; findExperimentAssignmentBySiteAndTarget(site: string, target: string): IExperimentAssignmentv5; hasFeatureFlag(key: string): boolean; } export interface IMarkDecisionPointParams { site: string; target: string; condition: string; status: MARKED_DECISION_POINT_STATUS; uniquifier?: string; clientError?: string; } declare class ApiService { private dataService; private context; private hostUrl; private userId; private token; private apiVersion; private clientSessionId; private httpClient; private api; private groupsForSession; private includeStoredUserGroups; constructor(config: UpGradeClientInterfaces.IConfig, dataService: DataService); setFeatureFlagUserGroupsForSession(groupsForSession: Record>, includeStoredUserGroups: boolean): void; private setHttpClient; private validateClient; private createOptions; private sendRequest; init(group?: Record>, workingGroup?: Record): Promise; setGroupMembership(group: UpGradeClientInterfaces.IExperimentUserGroup): Promise; setWorkingGroup(workingGroup: UpGradeClientInterfaces.IExperimentUserWorkingGroup): Promise; setAltUserIds(altUserIds: UpGradeClientInterfaces.IExperimentUserAliases): Promise; getAllExperimentConditions(): Promise; markDecisionPoint({ site, target, condition, status, uniquifier, clientError, }: IMarkDecisionPointParams): Promise; log(logData: ILogInput[]): Promise; logCaliper(logData: CaliperEnvelope): Promise; getAllFeatureFlags(): Promise; sendReward(params: { rewardValue: "SUCCESS" | "FAILURE"; experimentId?: string; context?: string; decisionPoint?: { site: string; target: string; }; }): Promise; } export declare class Assignment { private apiService; private _site; private _target; private _conditionCode; private _payloadType; private _payloadValue; private _experimentType; private _assignedFactor; constructor({ site, target, assignedCondition, assignedFactor, experimentType }: IExperimentAssignmentv5, apiService: ApiService); getCondition(): string; getPayload(): IPayload | null; getExperimentType(): EXPERIMENT_TYPE; get factors(): string[]; getFactorLevel(factor: string): string; getFactorPayload(factor: string): IPayload | null; /** * Will record ("mark") that a user has "seen" an experiment condition per at the Assignment's decision point location (site + target). * * Marking the decision point will record the user's condition assignment and the time of the decision point, regardless of whether the user is enrolled in an experiment. * * @param status `status` signifies a client application's note on what it did in the code with condition assignment that Upgrade provided. * Status can be one of the following: * * ```ts * export enum MARKED_DECISION_POINT_STATUS { * CONDITION_APPLIED = 'condition applied', * CONDITION_FAILED_TO_APPLY = 'condition not applied', * NO_CONDITION_ASSIGNED = 'no condition assigned', * } * ``` * @param uniquifier A `uniquifier` unique string can be sent along to help tie a user's logged metrics to a specific marked condition. * This identifier will also need to be sent when calling `upgradeClient.log()` * This is required for 'within-subjects' experiments. * * @param clientError The client can also send along an additional `clientError` string to log context as to why a condition was not applied. * * @example * ```ts * import { MARKED_DECISION_POINT_STATUS } from 'upgrade_types'; * * const site = 'dashboard'; * const target = 'experimental button'; * const status: MARKED_DECISION_POINT_STATUS = MARKED_DECISION_POINT_STATUS.CONDITION_FAILED_TO_APPLY * const clientError = 'variant not recognized'; //optional * * ```ts * const assignment: Assignment[] = await upgradeClient.getDecisionPointAssignment(site, target); * const markResponse = await assignment.markDecisionPoint(MARKED_DECISION_POINT_STATUS.CONDITION_APPLIED); * ``` * * Note*: mark can also be called via `Client.markDecisionPoint()` without an Assignment object`: * ```ts * import { MARKED_DECISION_POINT_STATUS } from 'upgrade_types'; * * const site = 'dashboard'; * const target = 'experimental button'; * const condition = 'variant_x'; // send null if no condition / no experiment is running / error * const status: MARKED_DECISION_POINT_STATUS = MARKED_DECISION_POINT_STATUS.CONDITION_FAILED_TO_APPLY * const clientError = 'variant not recognized'; //optional * * const markResponse = await upgradeClient.markDecisionPoint(site, target, condition, MARKED_DECISION_POINT_STATUS.CONDITION_APPLIED); * ``` */ markDecisionPoint(status: MARKED_DECISION_POINT_STATUS, uniquifier?: string, clientError?: string): Promise; } declare class UpgradeClient { private apiService; private dataService; static MARKED_DECISION_POINT_STATUS: typeof MARKED_DECISION_POINT_STATUS; static BINARY_REWARD_VALUE: typeof BinaryRewardAllowedValue; /** * When constructing UpgradeClient, the user id, api host url, and "context" identifier are required. * These will be attached to various API calls for this instance of the client. * * @example * * ```typescript * // required * const hostUrl: "htts://my-hosted-upgrade-api.com"; * const userId: "abc123"; * const context: "my-app-context-name"; * * // not required, each is also optional * const options: { * token: "someToken"; * clientSessionId: "someSessionId"; * featureFlagUserGroupsForSession: null * } * * const upgradeClient: UpgradeClient[] = new UpgradeClient(hostURL, userId, context); * const upgradeClient: UpgradeClient[] = new UpgradeClient(hostURL, userId, context, options); * ``` * * UPDATE: #featureFlagUserGroupsForSession * * ```typescript * // required * const hostUrl: "htts://my-hosted-upgrade-api.com"; * const userId: "abc123"; * const context: "my-app-context-name"; * * // to configure feature flag endpoint to rely on session-only groups or merge supplemental groups with stored user groups * // see below for usage scenarios * // note: this is optional, and if not provided, the client will use standard user lookup with stored groups only * const options: { * featureFlagUserGroupsForSession: { * groupsForSession: { "classId": ["testClass"] }; * includeStoredUserGroups: false; // true to merge with stored user groups, false to skip any stored user entirely * } * } * * const upgradeClient: UpgradeClient[] = new UpgradeClient(hostURL, userId, context); * const upgradeClient: UpgradeClient[] = new UpgradeClient(hostURL, userId, context, options); * ``` * * **Stored-user Mode** (Standard stored user lookup): * - Omit both `groupsForSession` and `includeStoredUserGroups` parameters * - Uses only stored user groups from the database * - User must already have been initialized, will 404 if user does not exist * * **Ephemeral Mode** (Session-only groups): * - Set `includeStoredUserGroups` to `false` and provide `groupsForSession` * - Uses only the groups provided in the session, ignoring any stored user groups. * - Does not require the user to be initialized (it will bypass stored user lookup) * - Useful when complete group information is always provided at runtime. * * **Merged Mode** (Stored + Session groups): * - Set `includeStoredUserGroups` to `true` and provide `groupsForSession` * - User must already have been initialized, will 404 if user does not exist. * - Session groups are merged with stored groups if they don't already exist for stored user. * - Session groups are never persisted. * - Useful for adding context-specific ephemeral groups to an existing user. */ constructor(userId: string, hostUrl: string, context: string, options?: UpGradeClientInterfaces.IConfigOptions); private validateFeatureFlagGroupOptions; /** * Sets the feature flag session user group options. * * Note: This is a convenience method, this can also be set directly in the constructor of UpgradeClient. * See example usage in the constructor documentation. * * @example * ```typescript * * **Scenario 1: Session-only groups (Ephemeral user request)** * const options: UpGradeClientInterfaces.IFeatureFlagOptions = { * groupsForSession: { classId: ['testClass'] }, * includeStoredUserGroups: false * }; * ``` * * **Scenario 2: Merged groups (Merged stored/ephemeral groups request mode)** * ```typescript * const options: UpGradeClientInterfaces.IFeatureFlagOptions = { * groupsForSession: { classId: ['testClass'] }, * includeStoredUserGroups: true * }; * ``` * * **Scenario 3: Default behavior (Standard mode)** * Note this is the default behavior and does not need to be set, unless clearing previously set groupsForSession options * ```typescript * const options: UpGradeClientInterfaces.IFeatureFlagOptions = null; * ``` */ setFeatureFlagUserGroupsForSession(featureFlagOptions: UpGradeClientInterfaces.IFeatureFlagOptions | null | undefined): void; /** * This will initialize user and metadata for the user. It will return the user object with id, group, and working group. * NOTE: A user must be initialized at least once before calling any other methods. * Else, you will see "Experiment user not defined" errors when other SDK methods are called. * * @example * ```typescript * const group: Record> = { * classId: ['class1', 'class2'], * districtId: ['district1', 'district2'], * } * * const workingGroup: Record = { * classId: 'class1', * districtId: 'district2', * } * * const initResponse: UpGradeClientInterfaces.IUser[] = await upgradeClient.init(); * const initResponse: UpGradeClientInterfaces.IUser[] = await upgradeClient.init(group); * const initResponse: UpGradeClientInterfaces.IUser[] = await upgradeClient.init(group, workingGroup); * * ``` */ init(group?: Record>, workingGroup?: Record): Promise; /** * Will set the group membership(s) for the user and return the user object with updated working group. * * @example * ```typescript * const group: Record> = { * classId: ['class1', 'class2'], * districtId: ['district1', 'district2'], * } * * const groupMembershipResponse: UpGradeClientInterfaces.IUser[] = await upgradeClient.setGroupMembership(group); * ``` */ setGroupMembership(group: Record>): Promise; /** * Will set the working group(s) for the user and return the user object with updated working group. * * @example * ```typescript * const workingGroup: Record = { * classId: 'class1', * districtId: 'district2', * } * * const workingGroupResponse: UpGradeClientInterfaces.IUser[] = await upgradeClient.setWorkingGroup(workingGroup); * ``` */ setWorkingGroup(workingGroup: Record): Promise; /** * This will return all the assignment for the given context. * The return object contains site, target, experimentType, assignedCondition array and assignedFactor array(optional) * Here assignedCondition and assignedFactors(For Factorial-experiment) are arrays * They will return a stack of condition user will be assigned in that order * For With-in subjects these stacks will be contain all conditions according to the chosen `Condition-Order` * For Between subjects experiment both stack will return array containing single condition. * @param options.ignoreCache If true, it will ignore the cached experiment assignments and fetch fresh data from the API. * This is useful when you want to ensure you have the latest assignments. * If false, it will return the cached assignments if available. * @example * ```typescript * const userId = "User1" * const context = "mathia" * * const getAllResponse: IExperimentAssignmentv5[] = await upgradeClient.getAllExperimentConditions(); * ``` */ getAllExperimentConditions(options?: { ignoreCache: boolean; }): Promise; /** * Given a site and optional target, return the Assignment this decision point * NOTE: If getAllExperimentConditions() has not been called, this will call it first. * NOTE ALSO: If getAllExperimentConditions() has been called, this will return the cached result and not make a network call. * * @example * ```typescript * const assignmentResponse: Assignment = await upgradeClient.getDecisionPointAssignment(site, target); * ``` */ getDecisionPointAssignment(site: string, target?: string): Promise; /** * Will record ("mark") that a user has "seen" a condition at the given decision point (site + target). * * NOTE: This method may be deprecated in favor of Assignment.markDecisionPoint() in a future release. * * Marking the decision point will record the user's condition assignment, regardless of whether the user is enrolled in an experiment. * * @param site * @param target * @param condition `condition` is the string identifier that the user was assigned to. If none is provided, the condition will be default (null) * * @param status `status` signifies a client application's note on what it did in the code with condition assignment that Upgrade provided. * Status can be one of the following: * * ```ts * export enum MARKED_DECISION_POINT_STATUS { * CONDITION_APPLIED = 'condition applied', * CONDITION_FAILED_TO_APPLY = 'condition not applied', * NO_CONDITION_ASSIGNED = 'no condition assigned', * } * ``` * * @param uniquifier A `uniquifier` unique string can be sent along to help tie a user's logged metrics to a specific marked condition. * This identifier will also need to be sent when calling `upgradeClient.log()` * This is required for 'within-subjects' experiments. * * @param clientError The client can also send along an additional `clientError` string to log context as to why a condition was not applied. * * @example * ```ts * import { MARKED_DECISION_POINT_STATUS } from 'upgrade_types'; * * const site = 'dashboard'; * const target = 'experimental button'; * const condition = 'variant_x'; // send null if no condition / no experiment is running / error * const status: MARKED_DECISION_POINT_STATUS = MARKED_DECISION_POINT_STATUS.CONDITION_FAILED_TO_APPLY * const clientError = 'variant not recognized'; //optional * * const markResponse = await upgradeClient.markDecisionPoint(site, target, condition, MARKED_DECISION_POINT_STATUS.CONDITION_APPLIED); * ``` * * Note*: mark can also be called via `Assignment.markDecisionPoint()` when returning an assignment from `getDecisionPointAssignment()`: * ```ts * const assignment: Assignment[] = await upgradeClient.getDecisionPointAssignment(site, target); * const markResponse = await assignment.markDecisionPoint(MARKED_DECISION_POINT_STATUS.CONDITION_APPLIED); * ``` */ markDecisionPoint(site: string, target: string, condition: string | null, status: MARKED_DECISION_POINT_STATUS, uniquifier?: string, clientError?: string): Promise; /** * @deprecated * Please use "markDecisionPoint" instead. This is just a name change, the functionality is the same, but could be removed in future. * * Will record ("mark") that a user has "seen" a condition at the given decision point (site + target). * * NOTE: This method may be deprecated in favor of Assignment.markDecisionPoint() in a future release. * * Marking the decision point will record the user's condition assignment, regardless of whether the user is enrolled in an experiment. * * @param site * @param target * @param condition `condition` is the string identifier that the user was assigned to. If none is provided, the condition will be default (null) * * @param status `status` signifies a client application's note on what it did in the code with condition assignment that Upgrade provided. * Status can be one of the following: * * ```ts * export enum MARKED_DECISION_POINT_STATUS { * CONDITION_APPLIED = 'condition applied', * CONDITION_FAILED_TO_APPLY = 'condition not applied', * NO_CONDITION_ASSIGNED = 'no condition assigned', * } * ``` * * @param uniquifier A `uniquifier` unique string can be sent along to help tie a user's logged metrics to a specific marked condition. * This identifier will also need to be sent when calling `upgradeClient.log()` * This is required for 'within-subjects' experiments. * * @param clientError The client can also send along an additional `clientError` string to log context as to why a condition was not applied. * * @example * ```ts * import { MARKED_DECISION_POINT_STATUS } from 'upgrade_types'; * * const site = 'dashboard'; * const target = 'experimental button'; * const condition = 'variant_x'; // send null if no condition / no experiment is running / error * const status: MARKED_DECISION_POINT_STATUS = MARKED_DECISION_POINT_STATUS.CONDITION_FAILED_TO_APPLY * const clientError = 'variant not recognized'; //optional * * const markResponse = await upgradeClient.markExperimentPoint(site, target, condition, MARKED_DECISION_POINT_STATUS.CONDITION_APPLIED); * ``` * * Note*: mark can also be called via `Assignment.markDecisionPoint()` when returning an assignment from `getDecisionPointAssignment()`: * ```ts * const assignment: Assignment[] = await upgradeClient.getDecisionPointAssignment(site, target); * const markResponse = await assignment.markDecisionPoint(MARKED_DECISION_POINT_STATUS.CONDITION_APPLIED); * ``` */ markExperimentPoint: (site: string, target: string, condition: string | null, status: MARKED_DECISION_POINT_STATUS, uniquifier?: string, clientError?: string) => Promise; /** * Fetches flags for the user given a context and stores them in the data service. * @param options.ignoreCache If true, it will ignore the cached feature flags and fetch fresh data from the API. * * @example * ```typescript * const featureFlags = await upgradeClient.getAllFeatureFlags(); * console.log(featureFlags); // ['feature1', 'feature2', 'feature3'] * ``` * * NOTE: See `#featureFlagUserGroupsForSession` option explanation in the constructor of UpgradeClient * to see configurations that may affect the responses to this method */ getAllFeatureFlags(options?: { ignoreCache: boolean; }): Promise; /** * Checks if a specific feature flag is enabled for the user. * Note: will await a promise if feature flags have not been fetched yet! * * @example * ```typescript * const isFeatureEnabled = await upgradeClient.hasFeatureFlag('feature1'); * console.log(isFeatureEnabled); // true or false * ``` * * NOTE: See `#featureFlagUserGroupsForSession` option explanation in the constructor of UpgradeClient * to see configurations that may affect the responses to this method */ hasFeatureFlag(key: string): Promise; /** * Will report user outcome metrics to Upgrade. * Please see https://upgrade-platform.gitbook.io/docs/developer-guide/reference/metrics for more information. * * @example * ```ts * const metrics: ILogInput[] = [ * { * userId, * timestamp: '2022-03-03T19:49:00.496', * metrics: { * attributes: { * totalTimeSeconds: 41834, * totalMasteryWorkspacesCompleted: 15, * totalConceptBuildersCompleted: 17, * totalMasteryWorkspacesGraduated: 15, * totalSessions: 50, * totalProblemsCompleted: 249, * }, * groupedMetrics: [ * { * groupClass: 'conceptBuilderWorkspace', * groupKey: 'graphs_of_functions', * groupUniquifier: '2022-02-03T19:48:53.861Z', * attributes: { * timeSeconds: 488, * hintCount: 2, * errorCount: 15, * completionCount: 1, * workspaceCompletionStatus: 'GRADUATED', * problemsCompleted: 4, * }, * }, * ], * }, * ]; * * const logResponse: ILog[] = await upgradeClient.metrics(metrics); * ``` */ log(value: ILogInput[]): Promise; /** * Will report Caliper user outcome metrics to Upgrade, same as log() but with Caliper envelope. * * @example * ```ts * const logRequest: CaliperEnvelope = { sensor: 'test', sendTime: 'test', dataVersion: 'test', data: [], }; * * * const logCaliperResponse: ILog[] = await upgradeClient.logCaliper(logRequest); * * ``` */ logCaliper(value: CaliperEnvelope): Promise; /** * Will set an array of alternate user ids for the user. * * @example * ```ts * const aliases: string[] = ['alias1', 'alias2']; * * const setAltUserIdsResponse: IExperimentUserAliases[] = await upgradeClient.setAltUserIds(aliases); * ``` */ setAltUserIds(altUserIds: string[]): Promise; /** * Sends a binary reward signal for an adaptive experiment (Mooclet). * * This method allows sending reward feedback (SUCCESS or FAILURE) for adaptive experiments. * The reward is used by the adaptive algorithm to update its learning model and improve future assignments. * * **Reward Values:** * You can pass reward values in two ways: * - As string literals: 'SUCCESS' or 'FAILURE' * - Using the enum: UpgradeClient.BINARY_REWARD_VALUE.SUCCESS or UpgradeClient.BINARY_REWARD_VALUE.FAILURE * * **Lookup Methods:** * * The method supports two ways to identify the experiment: * * 1. **Direct Lookup** - Provide the `experimentId` directly * 2. **Decision Point Lookup** - Provide `context` and `decisionPoint` (site and target) to look up the experiment * * At least one of these methods must be provided. * * @example * ```ts * // Example 1: Using string literals with experimentId * const response = await upgradeClient.sendReward({ * rewardValue: 'SUCCESS', * experimentId: 'exp_adaptive_123' * }); * ``` * * @example * ```ts * // Example 2: Using the enum with experimentId * const response = await upgradeClient.sendReward({ * rewardValue: UpgradeClient.BINARY_REWARD_VALUE.SUCCESS, * experimentId: 'exp_adaptive_123' * }); * ``` * * @example * ```ts * // Example 3: Using decision point lookup with string literals * const response = await upgradeClient.sendReward({ * rewardValue: 'FAILURE', * context: 'learning-module', * decisionPoint: { * site: 'math-course', * target: 'problem-set-1' * } * }); * ``` * * @example * ```ts * // Example 4: Using decision point lookup with enum * const response = await upgradeClient.sendReward({ * rewardValue: UpgradeClient.BINARY_REWARD_VALUE.FAILURE, * context: 'learning-module', * decisionPoint: { * site: 'math-course', * target: 'problem-set-1' * } * }); * ``` */ sendReward(params: { rewardValue: "SUCCESS" | "FAILURE"; experimentId?: string; context?: string; decisionPoint?: { site: string; target: string; }; }): Promise; } export { UpgradeClient as default, }; export {};