@ninetailed/experience.js 2.2.10-beta.0 → 2.2.11-beta.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/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);
@@ -3282,10 +3280,8 @@ class Ninetailed {
3282
3280
  preview
3283
3281
  })]
3284
3282
  });
3285
- const detachOnReadyListener = this.instance.on('ready', () => {
3286
- this.isInitialized = true;
3283
+ this.onIsInitialized(() => {
3287
3284
  logger.info('Ninetailed Experience.js SDK is completely initialized.');
3288
- detachOnReadyListener();
3289
3285
  }); // put in private method
3290
3286
 
3291
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
 
@@ -3278,10 +3308,8 @@
3278
3308
  preview: preview
3279
3309
  })], false)
3280
3310
  });
3281
- var detachOnReadyListener = this.instance.on('ready', function () {
3282
- _this.isInitialized = true;
3311
+ this.onIsInitialized(function () {
3283
3312
  logger.info('Ninetailed Experience.js SDK is completely initialized.');
3284
- detachOnReadyListener();
3285
3313
  }); // put in private method
3286
3314
 
3287
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,19 +1,19 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js",
3
- "version": "2.2.10-beta.0",
3
+ "version": "2.2.11-beta.0",
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.10-beta.0",
9
+ "@ninetailed/experience.js-shared": "2.2.11-beta.0",
10
10
  "uuid": "^8.3.2",
11
11
  "ts-toolbelt": "^9.6.0",
12
12
  "locale-enum": "^1.1.1",
13
13
  "i18n-iso-countries": "^7.3.0",
14
14
  "lodash": "^4.17.21",
15
15
  "murmurhash-js": "^1.0.0",
16
- "diary": "^0.3.1"
16
+ "diary": "^0.4.3"
17
17
  },
18
18
  "peerDependencies": {}
19
19
  }