@ninetailed/experience.js 2.2.9-beta.0 → 2.2.10-beta.1

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/index.esm.js CHANGED
@@ -3198,17 +3198,15 @@ class Ninetailed {
3198
3198
  return this.instance.identify(uid, traits, this.buildOptions(options));
3199
3199
  });
3200
3200
 
3201
- this.reset = () => {
3202
- this.onIsInitialized(() => {
3203
- this.instance.plugins[PLUGIN_NAME].reset();
3204
- });
3205
- };
3201
+ this.reset = () => __awaiter(this, void 0, void 0, function* () {
3202
+ yield this.waitUntilInitialized();
3203
+ this.instance.plugins[PLUGIN_NAME].reset();
3204
+ });
3206
3205
 
3207
- this.debug = enabled => {
3208
- this.onIsInitialized(() => {
3209
- this.instance.plugins[PLUGIN_NAME].debug(enabled);
3210
- });
3211
- };
3206
+ this.debug = enabled => __awaiter(this, void 0, void 0, function* () {
3207
+ yield this.waitUntilInitialized();
3208
+ this.instance.plugins[PLUGIN_NAME].debug(enabled);
3209
+ });
3212
3210
 
3213
3211
  this.onProfileChange = cb => {
3214
3212
  cb(this.profileState);
@@ -3229,6 +3227,7 @@ class Ninetailed {
3229
3227
  onIsInitialized();
3230
3228
  } else {
3231
3229
  const detachOnReadyListener = this.instance.on('ready', () => {
3230
+ this.isInitialized = true;
3232
3231
  onIsInitialized();
3233
3232
  detachOnReadyListener();
3234
3233
  });
@@ -3281,10 +3280,8 @@ class Ninetailed {
3281
3280
  preview
3282
3281
  })]
3283
3282
  });
3284
- const detachOnReadyListener = this.instance.on('ready', () => {
3285
- this.isInitialized = true;
3283
+ this.onIsInitialized(() => {
3286
3284
  logger.info('Ninetailed Experience.js SDK is completely initialized.');
3287
- detachOnReadyListener();
3288
3285
  }); // put in private method
3289
3286
 
3290
3287
  this.onProfileChange(profileState => {
package/index.umd.js CHANGED
@@ -3196,14 +3196,44 @@
3196
3196
  };
3197
3197
 
3198
3198
  this.reset = function () {
3199
- _this.onIsInitialized(function () {
3200
- _this.instance.plugins[PLUGIN_NAME].reset();
3199
+ return __awaiter(_this, void 0, void 0, function () {
3200
+ return __generator(this, function (_a) {
3201
+ switch (_a.label) {
3202
+ case 0:
3203
+ return [4
3204
+ /*yield*/
3205
+ , this.waitUntilInitialized()];
3206
+
3207
+ case 1:
3208
+ _a.sent();
3209
+
3210
+ this.instance.plugins[PLUGIN_NAME].reset();
3211
+ return [2
3212
+ /*return*/
3213
+ ];
3214
+ }
3215
+ });
3201
3216
  });
3202
3217
  };
3203
3218
 
3204
3219
  this.debug = function (enabled) {
3205
- _this.onIsInitialized(function () {
3206
- _this.instance.plugins[PLUGIN_NAME].debug(enabled);
3220
+ return __awaiter(_this, void 0, void 0, function () {
3221
+ return __generator(this, function (_a) {
3222
+ switch (_a.label) {
3223
+ case 0:
3224
+ return [4
3225
+ /*yield*/
3226
+ , this.waitUntilInitialized()];
3227
+
3228
+ case 1:
3229
+ _a.sent();
3230
+
3231
+ this.instance.plugins[PLUGIN_NAME].debug(enabled);
3232
+ return [2
3233
+ /*return*/
3234
+ ];
3235
+ }
3236
+ });
3207
3237
  });
3208
3238
  };
3209
3239
 
@@ -3225,6 +3255,7 @@
3225
3255
  onIsInitialized();
3226
3256
  } else {
3227
3257
  var detachOnReadyListener_1 = _this.instance.on('ready', function () {
3258
+ _this.isInitialized = true;
3228
3259
  onIsInitialized();
3229
3260
  detachOnReadyListener_1();
3230
3261
  });
@@ -3277,10 +3308,8 @@
3277
3308
  preview: preview
3278
3309
  })], false)
3279
3310
  });
3280
- var detachOnReadyListener = this.instance.on('ready', function () {
3281
- _this.isInitialized = true;
3311
+ this.onIsInitialized(function () {
3282
3312
  logger.info('Ninetailed Experience.js SDK is completely initialized.');
3283
- detachOnReadyListener();
3284
3313
  }); // put in private method
3285
3314
 
3286
3315
  this.onProfileChange(function (profileState) {
@@ -82,8 +82,8 @@ export declare class Ninetailed implements NinetailedInstance {
82
82
  trackHasSeenComponent: TrackHasSeenComponent;
83
83
  trackExperience: TrackExperience;
84
84
  identify: (uid: string, traits?: Traits, options?: EventFunctionOptions) => Promise<any>;
85
- reset: () => void;
86
- debug: (enabled: boolean) => void;
85
+ reset: () => Promise<void>;
86
+ debug: (enabled: boolean) => Promise<void>;
87
87
  onProfileChange: (cb: OnProfileChangeCallback) => DetachListeners;
88
88
  onIsInitialized: (onIsInitialized: OnIsInitializedCallback) => void;
89
89
  private waitUntilInitialized;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js",
3
- "version": "2.2.9-beta.0",
3
+ "version": "2.2.10-beta.1",
4
4
  "main": "./index.umd.js",
5
5
  "module": "./index.esm.js",
6
6
  "typings": "./index.d.ts",
7
7
  "dependencies": {
8
8
  "analytics": "^0.8.0",
9
- "@ninetailed/experience.js-shared": "2.2.9-beta.0",
9
+ "@ninetailed/experience.js-shared": "2.2.10-beta.1",
10
10
  "uuid": "^8.3.2",
11
11
  "ts-toolbelt": "^9.6.0",
12
12
  "locale-enum": "^1.1.1",