@eppo/js-client-sdk-common
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -20,2 +20,14 @@ import { IAssignmentHooks } from '../assignment-hooks'; | ||
getAssignment(subjectKey: string, experimentKey: string, subjectAttributes?: Record<string, any>): string; | ||
/** | ||
* Asynchronously maps a subject to a variation for a given experiment, with pre and post assignment hooks | ||
* | ||
* @param subjectKey an identifier of the experiment subject, for example a user ID. | ||
* @param experimentKey experiment identifier | ||
* @param assignmentHooks interface for pre and post assignment hooks | ||
* @param subjectAttributes optional attributes associated with the subject, for example name and email. | ||
* The subject attributes are used for evaluating any targeting rules tied to the experiment. | ||
* @returns a variation value if the subject is part of the experiment sample, otherwise null | ||
* @public | ||
*/ | ||
getAssignmentWithHooks(subjectKey: string, experimentKey: string, assignmentHooks: IAssignmentHooks, subjectAttributes?: Record<string, any>): Promise<string>; | ||
} | ||
@@ -28,3 +40,3 @@ export default class EppoClient implements IEppoClient { | ||
getAssignment(subjectKey: string, experimentKey: string, subjectAttributes?: {}): string; | ||
getAssignmentWithHooks(subjectKey: string, experimentKey: string, subjectAttributes: {}, assignmentHooks: IAssignmentHooks): Promise<string>; | ||
getAssignmentWithHooks(subjectKey: string, experimentKey: string, assignmentHooks: IAssignmentHooks, subjectAttributes?: {}): Promise<string>; | ||
setLogger(logger: IAssignmentLogger): void; | ||
@@ -31,0 +43,0 @@ private flushQueuedEvents; |
@@ -41,3 +41,3 @@ "use strict"; | ||
} | ||
async getAssignmentWithHooks(subjectKey, experimentKey, subjectAttributes = {}, assignmentHooks) { | ||
async getAssignmentWithHooks(subjectKey, experimentKey, assignmentHooks, subjectAttributes = {}) { | ||
let assignment = await (assignmentHooks === null || assignmentHooks === void 0 ? void 0 : assignmentHooks.onPreAssignment(subjectKey)); | ||
@@ -44,0 +44,0 @@ if (assignment == null) { |
@@ -28,3 +28,3 @@ import { AxiosInstance } from 'axios'; | ||
getAssignment(subjectKey: string, experimentKey: string, subjectAttributes?: {}): string; | ||
getAssignmentWithHooks(subjectKey: string, experimentKey: string, subjectAttributes: {}, assignmentHooks: IAssignmentHooks): Promise<string>; | ||
getAssignmentWithHooks(subjectKey: string, experimentKey: string, assignmentHooks: IAssignmentHooks, subjectAttributes?: {}): Promise<string>; | ||
setLogger(logger: IAssignmentLogger): void; | ||
@@ -143,2 +143,14 @@ private flushQueuedEvents; | ||
getAssignment(subjectKey: string, experimentKey: string, subjectAttributes?: Record<string, any>): string; | ||
/** | ||
* Asynchronously maps a subject to a variation for a given experiment, with pre and post assignment hooks | ||
* | ||
* @param subjectKey an identifier of the experiment subject, for example a user ID. | ||
* @param experimentKey experiment identifier | ||
* @param assignmentHooks interface for pre and post assignment hooks | ||
* @param subjectAttributes optional attributes associated with the subject, for example name and email. | ||
* The subject attributes are used for evaluating any targeting rules tied to the experiment. | ||
* @returns a variation value if the subject is part of the experiment sample, otherwise null | ||
* @public | ||
*/ | ||
getAssignmentWithHooks(subjectKey: string, experimentKey: string, assignmentHooks: IAssignmentHooks, subjectAttributes?: Record<string, any>): Promise<string>; | ||
} | ||
@@ -145,0 +157,0 @@ |
{ | ||
"name": "@eppo/js-client-sdk-common", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Eppo SDK for client-side JavaScript applications (base for both web and react native)", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
115365
734