@ninetailed/experience.js 7.5.0-beta.2 → 7.5.0-beta.4

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.cjs CHANGED
@@ -194,7 +194,7 @@ const ninetailedCorePlugin = ({
194
194
  config: {},
195
195
  initialize: ({
196
196
  instance
197
- }) => {
197
+ }) => __awaiter(void 0, void 0, void 0, function* () {
198
198
  _instance = instance;
199
199
  if (instance.storage.getItem(DEBUG_FLAG)) {
200
200
  experience_jsShared.logger.addSink(new experience_jsShared.ConsoleLogSink());
@@ -208,7 +208,7 @@ const ninetailedCorePlugin = ({
208
208
  instance.storage.removeItem(LEGACY_ANONYMOUS_ID);
209
209
  }
210
210
  if (typeof onInitProfileId === 'function') {
211
- const profileId = onInitProfileId(instance.storage.getItem(ANONYMOUS_ID));
211
+ const profileId = yield onInitProfileId(instance.storage.getItem(ANONYMOUS_ID));
212
212
  if (typeof profileId === 'string') {
213
213
  instance.storage.setItem(ANONYMOUS_ID, profileId);
214
214
  }
@@ -219,7 +219,7 @@ const ninetailedCorePlugin = ({
219
219
  enabledFeatures = payload.features || [];
220
220
  });
221
221
  experience_jsShared.logger.debug('Ninetailed Core plugin initialized.');
222
- },
222
+ }),
223
223
  flush: asyncThrottle(flush),
224
224
  pageStart: params => {
225
225
  return abortNonClientEvents(params);
@@ -293,7 +293,7 @@ const ninetailedCorePlugin = ({
293
293
  instance.storage.removeItem(EXPERIENCES_FALLBACK_CACHE);
294
294
  experience_jsShared.logger.debug('Removed old profile data from localstorage.');
295
295
  if (typeof onInitProfileId === 'function') {
296
- const profileId = onInitProfileId(undefined);
296
+ const profileId = yield onInitProfileId(undefined);
297
297
  if (typeof profileId === 'string') {
298
298
  instance.storage.setItem(ANONYMOUS_ID, profileId);
299
299
  }
package/index.js CHANGED
@@ -187,7 +187,7 @@ const ninetailedCorePlugin = ({
187
187
  config: {},
188
188
  initialize: ({
189
189
  instance
190
- }) => {
190
+ }) => __awaiter(void 0, void 0, void 0, function* () {
191
191
  _instance = instance;
192
192
  if (instance.storage.getItem(DEBUG_FLAG)) {
193
193
  logger.addSink(new ConsoleLogSink());
@@ -201,7 +201,7 @@ const ninetailedCorePlugin = ({
201
201
  instance.storage.removeItem(LEGACY_ANONYMOUS_ID);
202
202
  }
203
203
  if (typeof onInitProfileId === 'function') {
204
- const profileId = onInitProfileId(instance.storage.getItem(ANONYMOUS_ID));
204
+ const profileId = yield onInitProfileId(instance.storage.getItem(ANONYMOUS_ID));
205
205
  if (typeof profileId === 'string') {
206
206
  instance.storage.setItem(ANONYMOUS_ID, profileId);
207
207
  }
@@ -212,7 +212,7 @@ const ninetailedCorePlugin = ({
212
212
  enabledFeatures = payload.features || [];
213
213
  });
214
214
  logger.debug('Ninetailed Core plugin initialized.');
215
- },
215
+ }),
216
216
  flush: asyncThrottle(flush),
217
217
  pageStart: params => {
218
218
  return abortNonClientEvents(params);
@@ -286,7 +286,7 @@ const ninetailedCorePlugin = ({
286
286
  instance.storage.removeItem(EXPERIENCES_FALLBACK_CACHE);
287
287
  logger.debug('Removed old profile data from localstorage.');
288
288
  if (typeof onInitProfileId === 'function') {
289
- const profileId = onInitProfileId(undefined);
289
+ const profileId = yield onInitProfileId(undefined);
290
290
  if (typeof profileId === 'string') {
291
291
  instance.storage.setItem(ANONYMOUS_ID, profileId);
292
292
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js",
3
- "version": "7.5.0-beta.2",
3
+ "version": "7.5.0-beta.4",
4
4
  "license": "BSL-1.1",
5
5
  "module": "./index.js",
6
6
  "main": "./index.cjs",
7
7
  "type": "module",
8
8
  "types": "./src/index.d.ts",
9
9
  "dependencies": {
10
- "@ninetailed/experience.js-shared": "7.5.0-beta.2",
10
+ "@ninetailed/experience.js-shared": "7.5.0-beta.4",
11
11
  "analytics": "0.8.1",
12
12
  "zod": "3.21.4"
13
13
  },
@@ -1,5 +1,6 @@
1
1
  /// <reference types="analytics" />
2
2
  import { Locale, Traits, OnLogHandler, OnErrorHandler, Logger, PageviewProperties, Properties, NinetailedApiClient, NinetailedApiClientOptions, NinetailedRequestContext } from '@ninetailed/experience.js-shared';
3
+ import { OnInitProfileId } from './ninetailedCorePlugin';
3
4
  import { EventFunctionOptions, NinetailedInstance, NinetailedPlugin, OnIsInitializedCallback, OnProfileChangeCallback, ProfileState, TrackHasSeenComponent, ElementSeenPayload, TrackComponentView } from './types';
4
5
  import { ObserveOptions } from './ElementSeenObserver';
5
6
  declare global {
@@ -28,7 +29,7 @@ type Options = {
28
29
  onLog?: OnLogHandler;
29
30
  onError?: OnErrorHandler;
30
31
  componentViewTrackingThreshold?: number;
31
- onInitProfileId?: (profileId?: string) => string | undefined;
32
+ onInitProfileId?: OnInitProfileId;
32
33
  buildClientContext?: () => NinetailedRequestContext;
33
34
  storageImpl?: Storage;
34
35
  };
@@ -1,10 +1,11 @@
1
1
  import { Locale, NinetailedApiClient, NinetailedRequestContext } from '@ninetailed/experience.js-shared';
2
2
  import { NinetailedInstance, FlushResult, NinetailedPlugin } from '../types';
3
+ export type OnInitProfileId = (profileId?: string) => Promise<string | undefined> | string | undefined;
3
4
  type AnalyticsPluginNinetailedConfig = {
4
5
  apiClient: NinetailedApiClient;
5
6
  locale?: Locale;
6
7
  requestTimeout?: number;
7
- onInitProfileId?: (profileId?: string) => string | undefined;
8
+ onInitProfileId?: OnInitProfileId;
8
9
  buildClientContext?: () => NinetailedRequestContext;
9
10
  ninetailed: NinetailedInstance;
10
11
  };