@hackler/react-sdk 11.41.0 → 11.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.d.ts +73 -0
- package/lib/client.d.ts.map +1 -1
- package/lib/index.es.js +78 -1
- package/lib/index.js +78 -1
- package/lib/index.umd.js +1 -1
- package/package.json +3 -7
package/lib/client.d.ts
CHANGED
|
@@ -26,14 +26,77 @@ export declare class HackleReactSDKClient extends Emitter<HackleReactSDKClientEv
|
|
|
26
26
|
setUserId(userId: string | undefined): void;
|
|
27
27
|
setDeviceId(deviceId: string): void;
|
|
28
28
|
setUserProperty(key: string, value: any): void;
|
|
29
|
+
/**
|
|
30
|
+
* Updates the user's properties.
|
|
31
|
+
*
|
|
32
|
+
* @param operations Property operations to update user properties.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
29
35
|
updateUserProperties(operations: PropertyOperations): void;
|
|
30
36
|
resetUser(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Determine the variation to expose to the user for experiment.
|
|
39
|
+
*
|
|
40
|
+
* This method return the {"A"} if:
|
|
41
|
+
* - The experiment key is invalid
|
|
42
|
+
* - The experiment has not started yet
|
|
43
|
+
* - The user is not allocated to the experiment
|
|
44
|
+
* - The determined variation has been dropped
|
|
45
|
+
*
|
|
46
|
+
* @param experimentKey the unique key of the experiment.
|
|
47
|
+
* @param user the user to participate in the experiment. MUST NOT be null.
|
|
48
|
+
* @param defaultVariation the default variation of the experiment.
|
|
49
|
+
*
|
|
50
|
+
* @return string the decided variation for the user, or the default variation.
|
|
51
|
+
*/
|
|
31
52
|
variation(experimentKey: number, user?: User | null, defaultVariation?: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Determine the variation to expose to the user for experiment, and returns an object that
|
|
55
|
+
* describes the way the variation was determined.
|
|
56
|
+
*
|
|
57
|
+
* @param experimentKey the unique key of the experiment.
|
|
58
|
+
* @param user the user to participate in the experiment. MUST NOT be null. (e.g. { id: "userId"} )
|
|
59
|
+
* @param defaultVariation the default variation of the experiment. MUST NOT be null.
|
|
60
|
+
*
|
|
61
|
+
* @return {Decision} object
|
|
62
|
+
*/
|
|
32
63
|
variationDetail(experimentKey: number, user?: User | null, defaultVariation?: string): Decision;
|
|
64
|
+
/**
|
|
65
|
+
* Determine whether the feature is turned on to the user.
|
|
66
|
+
*
|
|
67
|
+
* @param featureKey the unique key for the feature.
|
|
68
|
+
* @param user the user requesting the feature.
|
|
69
|
+
*
|
|
70
|
+
* @return boolean True if the feature is on. False if the feature is off.
|
|
71
|
+
*
|
|
72
|
+
* @since 2.0.0
|
|
73
|
+
*/
|
|
33
74
|
isFeatureOn(featureKey: number, user?: User | null): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Determine whether the feature is turned on to the user, and returns an object that
|
|
77
|
+
* describes the way the value was determined.
|
|
78
|
+
*
|
|
79
|
+
* @param featureKey the unique key for the feature.
|
|
80
|
+
* @param user the identifier of user.
|
|
81
|
+
*
|
|
82
|
+
* @return {FeatureFlagDecision}
|
|
83
|
+
*
|
|
84
|
+
* @since 2.0.0
|
|
85
|
+
*/
|
|
34
86
|
featureFlagDetail(featureKey: number, user?: User | null): FeatureFlagDecision;
|
|
87
|
+
/**
|
|
88
|
+
* Records the event performed by the user.
|
|
89
|
+
*
|
|
90
|
+
* @param event the unique key of the event. MUST NOT be null.
|
|
91
|
+
* @param user the identifier of user that performed the event. id MUST NOT be null. (e.g. { id: "userId"} )
|
|
92
|
+
*/
|
|
35
93
|
track(event: string | HackleEvent, user?: User | null): void;
|
|
36
94
|
trackPageView(option?: PageView): void;
|
|
95
|
+
/**
|
|
96
|
+
* Return a instance of Hackle Remote Config.
|
|
97
|
+
*
|
|
98
|
+
* @param user the identifier of user.
|
|
99
|
+
*/
|
|
37
100
|
remoteConfig(user?: User | null): HackleRemoteConfig;
|
|
38
101
|
onReady(cb: any, timeout?: number): void;
|
|
39
102
|
onInitialized(config?: {
|
|
@@ -46,6 +109,16 @@ export declare class HackleReactSDKClient extends Emitter<HackleReactSDKClientEv
|
|
|
46
109
|
hideUserExplorer(): void;
|
|
47
110
|
fetch(): Promise<void>;
|
|
48
111
|
setInAppMessageListener(listener: HackleInAppMessageListener | null): void;
|
|
112
|
+
/**
|
|
113
|
+
* Set user's phone number. Existing value will be replaced by new value if you call this method again.
|
|
114
|
+
*
|
|
115
|
+
* @param phoneNumber String satisfying valid E.164 format is accepted.
|
|
116
|
+
*/
|
|
117
|
+
setPhoneNumber(phoneNumber: string): void;
|
|
118
|
+
/**
|
|
119
|
+
* Reset user's phone number to be an empty value.
|
|
120
|
+
*/
|
|
121
|
+
unsetPhoneNumber(): void;
|
|
49
122
|
}
|
|
50
123
|
export declare function createInstance(sdkKey: string, config?: Config): HackleReactSDKClient;
|
|
51
124
|
export {};
|
package/lib/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,mBAAmB,EAEnB,WAAW,EACX,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,EACR,IAAI,EACJ,kBAAkB,EAClB,0BAA0B,EAC3B,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,UAAU,MAAM;IACd,IAAI,CAAC,EAAE,IAAI,CAAA;IAEX,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAE9B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,gCAAgC,CAAC,EAAE,MAAM,CAAA;IACzC,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,YAAY,EAAE,sBAAsB,GAAG,IAAI,CAAC;QAAC,KAAK,IAAI,IAAI,CAAA;KAAE,CAAA;IACrF,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB,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AAE,MAAM;IAIjC,aAAa,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAI1E,OAAO,CAAC,eAAe;IAOvB,gBAAgB;IAIhB,gBAAgB;IAIhB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,uBAAuB,CAAC,QAAQ,EAAE,0BAA0B,GAAG,IAAI,GAAG,IAAI;IAI1E;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM;IAIlC;;OAEG;IACH,gBAAgB;CAGjB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAEpF"}
|
package/lib/index.es.js
CHANGED
|
@@ -64,7 +64,7 @@ function __read(o, n) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
var SDK_NAME_HEADER = "react-sdk";
|
|
67
|
-
var SDK_VERSION_HEADER = "11.
|
|
67
|
+
var SDK_VERSION_HEADER = "11.43.0" ;
|
|
68
68
|
|
|
69
69
|
var Emitter = /** @class */ (function () {
|
|
70
70
|
function Emitter() {
|
|
@@ -173,6 +173,12 @@ var HackleReactSDKClient = /** @class */ (function (_super) {
|
|
|
173
173
|
this.client.setUserProperty(key, value);
|
|
174
174
|
this.emitUpdatedUser(this.getUser());
|
|
175
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* Updates the user's properties.
|
|
178
|
+
*
|
|
179
|
+
* @param operations Property operations to update user properties.
|
|
180
|
+
*
|
|
181
|
+
*/
|
|
176
182
|
HackleReactSDKClient.prototype.updateUserProperties = function (operations) {
|
|
177
183
|
this.client.updateUserProperties(operations);
|
|
178
184
|
this.emitUpdatedUser(this.getUser());
|
|
@@ -181,24 +187,81 @@ var HackleReactSDKClient = /** @class */ (function (_super) {
|
|
|
181
187
|
this.client.resetUser();
|
|
182
188
|
this.emitUpdatedUser(this.getUser());
|
|
183
189
|
};
|
|
190
|
+
/**
|
|
191
|
+
* Determine the variation to expose to the user for experiment.
|
|
192
|
+
*
|
|
193
|
+
* This method return the {"A"} if:
|
|
194
|
+
* - The experiment key is invalid
|
|
195
|
+
* - The experiment has not started yet
|
|
196
|
+
* - The user is not allocated to the experiment
|
|
197
|
+
* - The determined variation has been dropped
|
|
198
|
+
*
|
|
199
|
+
* @param experimentKey the unique key of the experiment.
|
|
200
|
+
* @param user the user to participate in the experiment. MUST NOT be null.
|
|
201
|
+
* @param defaultVariation the default variation of the experiment.
|
|
202
|
+
*
|
|
203
|
+
* @return string the decided variation for the user, or the default variation.
|
|
204
|
+
*/
|
|
184
205
|
HackleReactSDKClient.prototype.variation = function (experimentKey, user, defaultVariation) {
|
|
185
206
|
return this.client.variation(experimentKey, user || undefined, defaultVariation);
|
|
186
207
|
};
|
|
208
|
+
/**
|
|
209
|
+
* Determine the variation to expose to the user for experiment, and returns an object that
|
|
210
|
+
* describes the way the variation was determined.
|
|
211
|
+
*
|
|
212
|
+
* @param experimentKey the unique key of the experiment.
|
|
213
|
+
* @param user the user to participate in the experiment. MUST NOT be null. (e.g. { id: "userId"} )
|
|
214
|
+
* @param defaultVariation the default variation of the experiment. MUST NOT be null.
|
|
215
|
+
*
|
|
216
|
+
* @return {Decision} object
|
|
217
|
+
*/
|
|
187
218
|
HackleReactSDKClient.prototype.variationDetail = function (experimentKey, user, defaultVariation) {
|
|
188
219
|
return this.client.variationDetail(experimentKey, user || undefined, defaultVariation);
|
|
189
220
|
};
|
|
221
|
+
/**
|
|
222
|
+
* Determine whether the feature is turned on to the user.
|
|
223
|
+
*
|
|
224
|
+
* @param featureKey the unique key for the feature.
|
|
225
|
+
* @param user the user requesting the feature.
|
|
226
|
+
*
|
|
227
|
+
* @return boolean True if the feature is on. False if the feature is off.
|
|
228
|
+
*
|
|
229
|
+
* @since 2.0.0
|
|
230
|
+
*/
|
|
190
231
|
HackleReactSDKClient.prototype.isFeatureOn = function (featureKey, user) {
|
|
191
232
|
return this.client.isFeatureOn(featureKey, user || undefined);
|
|
192
233
|
};
|
|
234
|
+
/**
|
|
235
|
+
* Determine whether the feature is turned on to the user, and returns an object that
|
|
236
|
+
* describes the way the value was determined.
|
|
237
|
+
*
|
|
238
|
+
* @param featureKey the unique key for the feature.
|
|
239
|
+
* @param user the identifier of user.
|
|
240
|
+
*
|
|
241
|
+
* @return {FeatureFlagDecision}
|
|
242
|
+
*
|
|
243
|
+
* @since 2.0.0
|
|
244
|
+
*/
|
|
193
245
|
HackleReactSDKClient.prototype.featureFlagDetail = function (featureKey, user) {
|
|
194
246
|
return this.client.featureFlagDetail(featureKey, user || undefined);
|
|
195
247
|
};
|
|
248
|
+
/**
|
|
249
|
+
* Records the event performed by the user.
|
|
250
|
+
*
|
|
251
|
+
* @param event the unique key of the event. MUST NOT be null.
|
|
252
|
+
* @param user the identifier of user that performed the event. id MUST NOT be null. (e.g. { id: "userId"} )
|
|
253
|
+
*/
|
|
196
254
|
HackleReactSDKClient.prototype.track = function (event, user) {
|
|
197
255
|
this.client.track(event, user || undefined);
|
|
198
256
|
};
|
|
199
257
|
HackleReactSDKClient.prototype.trackPageView = function (option) {
|
|
200
258
|
this.client.trackPageView(__assign(__assign({}, option), { user: (option === null || option === void 0 ? void 0 : option.user) || undefined }));
|
|
201
259
|
};
|
|
260
|
+
/**
|
|
261
|
+
* Return a instance of Hackle Remote Config.
|
|
262
|
+
*
|
|
263
|
+
* @param user the identifier of user.
|
|
264
|
+
*/
|
|
202
265
|
HackleReactSDKClient.prototype.remoteConfig = function (user) {
|
|
203
266
|
return this.client.remoteConfig(user || undefined);
|
|
204
267
|
};
|
|
@@ -226,6 +289,20 @@ var HackleReactSDKClient = /** @class */ (function (_super) {
|
|
|
226
289
|
HackleReactSDKClient.prototype.setInAppMessageListener = function (listener) {
|
|
227
290
|
this.client.setInAppMessageListener(listener);
|
|
228
291
|
};
|
|
292
|
+
/**
|
|
293
|
+
* Set user's phone number. Existing value will be replaced by new value if you call this method again.
|
|
294
|
+
*
|
|
295
|
+
* @param phoneNumber String satisfying valid E.164 format is accepted.
|
|
296
|
+
*/
|
|
297
|
+
HackleReactSDKClient.prototype.setPhoneNumber = function (phoneNumber) {
|
|
298
|
+
this.client.setPhoneNumber(phoneNumber);
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Reset user's phone number to be an empty value.
|
|
302
|
+
*/
|
|
303
|
+
HackleReactSDKClient.prototype.unsetPhoneNumber = function () {
|
|
304
|
+
this.client.unsetPhoneNumber();
|
|
305
|
+
};
|
|
229
306
|
return HackleReactSDKClient;
|
|
230
307
|
}(Emitter));
|
|
231
308
|
function createInstance(sdkKey, config) {
|
package/lib/index.js
CHANGED
|
@@ -89,7 +89,7 @@ function __read(o, n) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
var SDK_NAME_HEADER = "react-sdk";
|
|
92
|
-
var SDK_VERSION_HEADER = "11.
|
|
92
|
+
var SDK_VERSION_HEADER = "11.43.0" ;
|
|
93
93
|
|
|
94
94
|
var Emitter = /** @class */ (function () {
|
|
95
95
|
function Emitter() {
|
|
@@ -198,6 +198,12 @@ var HackleReactSDKClient = /** @class */ (function (_super) {
|
|
|
198
198
|
this.client.setUserProperty(key, value);
|
|
199
199
|
this.emitUpdatedUser(this.getUser());
|
|
200
200
|
};
|
|
201
|
+
/**
|
|
202
|
+
* Updates the user's properties.
|
|
203
|
+
*
|
|
204
|
+
* @param operations Property operations to update user properties.
|
|
205
|
+
*
|
|
206
|
+
*/
|
|
201
207
|
HackleReactSDKClient.prototype.updateUserProperties = function (operations) {
|
|
202
208
|
this.client.updateUserProperties(operations);
|
|
203
209
|
this.emitUpdatedUser(this.getUser());
|
|
@@ -206,24 +212,81 @@ var HackleReactSDKClient = /** @class */ (function (_super) {
|
|
|
206
212
|
this.client.resetUser();
|
|
207
213
|
this.emitUpdatedUser(this.getUser());
|
|
208
214
|
};
|
|
215
|
+
/**
|
|
216
|
+
* Determine the variation to expose to the user for experiment.
|
|
217
|
+
*
|
|
218
|
+
* This method return the {"A"} if:
|
|
219
|
+
* - The experiment key is invalid
|
|
220
|
+
* - The experiment has not started yet
|
|
221
|
+
* - The user is not allocated to the experiment
|
|
222
|
+
* - The determined variation has been dropped
|
|
223
|
+
*
|
|
224
|
+
* @param experimentKey the unique key of the experiment.
|
|
225
|
+
* @param user the user to participate in the experiment. MUST NOT be null.
|
|
226
|
+
* @param defaultVariation the default variation of the experiment.
|
|
227
|
+
*
|
|
228
|
+
* @return string the decided variation for the user, or the default variation.
|
|
229
|
+
*/
|
|
209
230
|
HackleReactSDKClient.prototype.variation = function (experimentKey, user, defaultVariation) {
|
|
210
231
|
return this.client.variation(experimentKey, user || undefined, defaultVariation);
|
|
211
232
|
};
|
|
233
|
+
/**
|
|
234
|
+
* Determine the variation to expose to the user for experiment, and returns an object that
|
|
235
|
+
* describes the way the variation was determined.
|
|
236
|
+
*
|
|
237
|
+
* @param experimentKey the unique key of the experiment.
|
|
238
|
+
* @param user the user to participate in the experiment. MUST NOT be null. (e.g. { id: "userId"} )
|
|
239
|
+
* @param defaultVariation the default variation of the experiment. MUST NOT be null.
|
|
240
|
+
*
|
|
241
|
+
* @return {Decision} object
|
|
242
|
+
*/
|
|
212
243
|
HackleReactSDKClient.prototype.variationDetail = function (experimentKey, user, defaultVariation) {
|
|
213
244
|
return this.client.variationDetail(experimentKey, user || undefined, defaultVariation);
|
|
214
245
|
};
|
|
246
|
+
/**
|
|
247
|
+
* Determine whether the feature is turned on to the user.
|
|
248
|
+
*
|
|
249
|
+
* @param featureKey the unique key for the feature.
|
|
250
|
+
* @param user the user requesting the feature.
|
|
251
|
+
*
|
|
252
|
+
* @return boolean True if the feature is on. False if the feature is off.
|
|
253
|
+
*
|
|
254
|
+
* @since 2.0.0
|
|
255
|
+
*/
|
|
215
256
|
HackleReactSDKClient.prototype.isFeatureOn = function (featureKey, user) {
|
|
216
257
|
return this.client.isFeatureOn(featureKey, user || undefined);
|
|
217
258
|
};
|
|
259
|
+
/**
|
|
260
|
+
* Determine whether the feature is turned on to the user, and returns an object that
|
|
261
|
+
* describes the way the value was determined.
|
|
262
|
+
*
|
|
263
|
+
* @param featureKey the unique key for the feature.
|
|
264
|
+
* @param user the identifier of user.
|
|
265
|
+
*
|
|
266
|
+
* @return {FeatureFlagDecision}
|
|
267
|
+
*
|
|
268
|
+
* @since 2.0.0
|
|
269
|
+
*/
|
|
218
270
|
HackleReactSDKClient.prototype.featureFlagDetail = function (featureKey, user) {
|
|
219
271
|
return this.client.featureFlagDetail(featureKey, user || undefined);
|
|
220
272
|
};
|
|
273
|
+
/**
|
|
274
|
+
* Records the event performed by the user.
|
|
275
|
+
*
|
|
276
|
+
* @param event the unique key of the event. MUST NOT be null.
|
|
277
|
+
* @param user the identifier of user that performed the event. id MUST NOT be null. (e.g. { id: "userId"} )
|
|
278
|
+
*/
|
|
221
279
|
HackleReactSDKClient.prototype.track = function (event, user) {
|
|
222
280
|
this.client.track(event, user || undefined);
|
|
223
281
|
};
|
|
224
282
|
HackleReactSDKClient.prototype.trackPageView = function (option) {
|
|
225
283
|
this.client.trackPageView(__assign(__assign({}, option), { user: (option === null || option === void 0 ? void 0 : option.user) || undefined }));
|
|
226
284
|
};
|
|
285
|
+
/**
|
|
286
|
+
* Return a instance of Hackle Remote Config.
|
|
287
|
+
*
|
|
288
|
+
* @param user the identifier of user.
|
|
289
|
+
*/
|
|
227
290
|
HackleReactSDKClient.prototype.remoteConfig = function (user) {
|
|
228
291
|
return this.client.remoteConfig(user || undefined);
|
|
229
292
|
};
|
|
@@ -251,6 +314,20 @@ var HackleReactSDKClient = /** @class */ (function (_super) {
|
|
|
251
314
|
HackleReactSDKClient.prototype.setInAppMessageListener = function (listener) {
|
|
252
315
|
this.client.setInAppMessageListener(listener);
|
|
253
316
|
};
|
|
317
|
+
/**
|
|
318
|
+
* Set user's phone number. Existing value will be replaced by new value if you call this method again.
|
|
319
|
+
*
|
|
320
|
+
* @param phoneNumber String satisfying valid E.164 format is accepted.
|
|
321
|
+
*/
|
|
322
|
+
HackleReactSDKClient.prototype.setPhoneNumber = function (phoneNumber) {
|
|
323
|
+
this.client.setPhoneNumber(phoneNumber);
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Reset user's phone number to be an empty value.
|
|
327
|
+
*/
|
|
328
|
+
HackleReactSDKClient.prototype.unsetPhoneNumber = function () {
|
|
329
|
+
this.client.unsetPhoneNumber();
|
|
330
|
+
};
|
|
254
331
|
return HackleReactSDKClient;
|
|
255
332
|
}(Emitter));
|
|
256
333
|
function createInstance(sdkKey, config) {
|