@ninetailed/experience.js 6.1.0 → 6.2.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.cjs CHANGED
@@ -3400,18 +3400,14 @@ class Ninetailed {
3400
3400
  });
3401
3401
  /**
3402
3402
  * @deprecated The legacy datamodel is not recommended anymore
3403
- * Will be removed in version 5 of the SDK
3403
+ * Will be removed in the next version of the SDK
3404
3404
  */
3405
3405
  this.trackHasSeenComponent = properties => __awaiter(this, void 0, void 0, function* () {
3406
3406
  return this.instance.dispatch(Object.assign(Object.assign({}, properties), {
3407
3407
  type: HAS_SEEN_COMPONENT
3408
3408
  }));
3409
3409
  });
3410
- /**
3411
- * @deprecated Use the Ninetailed provided observers instead
3412
- * Will be removed in version 5 of the SDK
3413
- */
3414
- this.trackHasSeenExperience = properties => {
3410
+ this.trackComponentView = properties => {
3415
3411
  return this.instance.dispatch(Object.assign(Object.assign({}, properties), {
3416
3412
  type: HAS_SEEN_ELEMENT
3417
3413
  }));
@@ -3433,11 +3429,9 @@ class Ninetailed {
3433
3429
  this.onElementSeen = element => {
3434
3430
  const payload = this.observedElements.get(element);
3435
3431
  if (typeof payload !== 'undefined') {
3436
- this.instance.dispatch(Object.assign(Object.assign({
3432
+ this.trackComponentView(Object.assign({
3437
3433
  element
3438
- }, payload), {
3439
- type: HAS_SEEN_ELEMENT
3440
- }));
3434
+ }, payload));
3441
3435
  }
3442
3436
  };
3443
3437
  this.identify = (uid, traits, options) => __awaiter(this, void 0, void 0, function* () {
@@ -3614,8 +3608,6 @@ class Ninetailed {
3614
3608
  window.ninetailed = Object.assign({}, window.ninetailed, {
3615
3609
  page: this.page.bind(this),
3616
3610
  track: this.track.bind(this),
3617
- trackHasSeenComponent: this.trackHasSeenComponent.bind(this),
3618
- trackHasSeenExperience: this.trackHasSeenExperience.bind(this),
3619
3611
  identify: this.identify.bind(this),
3620
3612
  reset: this.reset.bind(this),
3621
3613
  debug: this.debug.bind(this),
package/index.js CHANGED
@@ -3393,18 +3393,14 @@ class Ninetailed {
3393
3393
  });
3394
3394
  /**
3395
3395
  * @deprecated The legacy datamodel is not recommended anymore
3396
- * Will be removed in version 5 of the SDK
3396
+ * Will be removed in the next version of the SDK
3397
3397
  */
3398
3398
  this.trackHasSeenComponent = properties => __awaiter(this, void 0, void 0, function* () {
3399
3399
  return this.instance.dispatch(Object.assign(Object.assign({}, properties), {
3400
3400
  type: HAS_SEEN_COMPONENT
3401
3401
  }));
3402
3402
  });
3403
- /**
3404
- * @deprecated Use the Ninetailed provided observers instead
3405
- * Will be removed in version 5 of the SDK
3406
- */
3407
- this.trackHasSeenExperience = properties => {
3403
+ this.trackComponentView = properties => {
3408
3404
  return this.instance.dispatch(Object.assign(Object.assign({}, properties), {
3409
3405
  type: HAS_SEEN_ELEMENT
3410
3406
  }));
@@ -3426,11 +3422,9 @@ class Ninetailed {
3426
3422
  this.onElementSeen = element => {
3427
3423
  const payload = this.observedElements.get(element);
3428
3424
  if (typeof payload !== 'undefined') {
3429
- this.instance.dispatch(Object.assign(Object.assign({
3425
+ this.trackComponentView(Object.assign({
3430
3426
  element
3431
- }, payload), {
3432
- type: HAS_SEEN_ELEMENT
3433
- }));
3427
+ }, payload));
3434
3428
  }
3435
3429
  };
3436
3430
  this.identify = (uid, traits, options) => __awaiter(this, void 0, void 0, function* () {
@@ -3607,8 +3601,6 @@ class Ninetailed {
3607
3601
  window.ninetailed = Object.assign({}, window.ninetailed, {
3608
3602
  page: this.page.bind(this),
3609
3603
  track: this.track.bind(this),
3610
- trackHasSeenComponent: this.trackHasSeenComponent.bind(this),
3611
- trackHasSeenExperience: this.trackHasSeenExperience.bind(this),
3612
3604
  identify: this.identify.bind(this),
3613
3605
  reset: this.reset.bind(this),
3614
3606
  debug: this.debug.bind(this),
@@ -1,6 +1,6 @@
1
1
  /// <reference types="analytics" />
2
2
  import { Locale, Traits, Profile, OnLogHandler, OnErrorHandler, Logger, PageviewProperties, Properties, NinetailedApiClient, NinetailedApiClientOptions } from '@ninetailed/experience.js-shared';
3
- import { EventFunctionOptions, NinetailedInstance, NinetailedPlugin, OnIsInitializedCallback, OnProfileChangeCallback, ProfileState, TrackHasSeenComponent, TrackHasSeenExperience, ElementSeenPayload } from './types';
3
+ import { EventFunctionOptions, NinetailedInstance, NinetailedPlugin, OnIsInitializedCallback, OnProfileChangeCallback, ProfileState, TrackHasSeenComponent, ElementSeenPayload, TrackComponentView } from './types';
4
4
  import { ObserveOptions } from './ElementSeenObserver';
5
5
  declare global {
6
6
  interface Window {
@@ -41,14 +41,10 @@ export declare class Ninetailed implements NinetailedInstance {
41
41
  track: (event: string, properties?: Properties, options?: EventFunctionOptions) => Promise<import("./types").FlushResult>;
42
42
  /**
43
43
  * @deprecated The legacy datamodel is not recommended anymore
44
- * Will be removed in version 5 of the SDK
44
+ * Will be removed in the next version of the SDK
45
45
  */
46
46
  trackHasSeenComponent: TrackHasSeenComponent;
47
- /**
48
- * @deprecated Use the Ninetailed provided observers instead
49
- * Will be removed in version 5 of the SDK
50
- */
51
- trackHasSeenExperience: TrackHasSeenExperience;
47
+ trackComponentView: TrackComponentView;
52
48
  observeElement: (payload: ElementSeenPayload, options?: ObserveOptions) => void;
53
49
  unobserveElement: (element: Element) => void;
54
50
  private onElementSeen;
@@ -37,7 +37,7 @@ export type OnProfileChangeCallback = (profile: ProfileState) => void;
37
37
  export type Page = (data?: Partial<PageviewProperties>, options?: EventFunctionOptions) => Promise<FlushResult>;
38
38
  export type Track = (event: string, properties?: Properties, options?: EventFunctionOptions) => Promise<FlushResult>;
39
39
  export type TrackHasSeenComponent = (properties: TrackComponentProperties) => Promise<void>;
40
- export type TrackHasSeenExperience = (properties: ElementSeenPayload) => Promise<void>;
40
+ export type TrackComponentView = (properties: ElementSeenPayload) => Promise<void>;
41
41
  export type Identify = (uid: string, traits?: Traits, options?: EventFunctionOptions) => Promise<FlushResult>;
42
42
  export type Reset = () => void;
43
43
  export type Debug = (enable: boolean) => void;
@@ -47,8 +47,11 @@ type UnObserveElement = Ninetailed['unobserveElement'];
47
47
  export interface NinetailedInstance {
48
48
  page: Page;
49
49
  track: Track;
50
+ /**
51
+ * @deprecated
52
+ */
50
53
  trackHasSeenComponent: TrackHasSeenComponent;
51
- trackHasSeenExperience: TrackHasSeenExperience;
54
+ trackComponentView: TrackComponentView;
52
55
  identify: Identify;
53
56
  reset: Reset;
54
57
  debug: Debug;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js",
3
- "version": "6.1.0",
3
+ "version": "6.2.1",
4
4
  "module": "./index.js",
5
5
  "main": "./index.cjs",
6
6
  "type": "module",
7
7
  "types": "./index.d.ts",
8
8
  "dependencies": {
9
- "@ninetailed/experience.js-shared": "6.1.0",
9
+ "@ninetailed/experience.js-shared": "6.2.1",
10
10
  "analytics": "0.8.1",
11
11
  "zod": "3.21.4"
12
12
  },