@ninetailed/experience.js 7.7.3 → 7.7.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.js CHANGED
@@ -1014,6 +1014,18 @@ class Ninetailed {
1014
1014
  this.onIsInitialized(resolve);
1015
1015
  });
1016
1016
  };
1017
+ // The following methods are used to register methods of the Ninetailed instance on the window object.
1018
+ // GTM templates do not support executing async functions in `callInWindow`.
1019
+ // Therefore, we provide a versions of those methods without the async keyword.
1020
+ this.trackAsWindowHandler = (event, properties, options) => {
1021
+ return this.track(event, properties, options);
1022
+ };
1023
+ this.identifyAsWindowHandler = (uid, traits, options) => {
1024
+ return this.identify(uid, traits, options);
1025
+ };
1026
+ this.pageAsWindowHandler = (data, options) => {
1027
+ return this.page(data, options);
1028
+ };
1017
1029
  this.onVisibilityChange = () => {
1018
1030
  if (typeof document === 'undefined') {
1019
1031
  return;
@@ -1123,9 +1135,9 @@ class Ninetailed {
1123
1135
  registerWindowHandlers() {
1124
1136
  if (typeof window !== 'undefined') {
1125
1137
  window.ninetailed = Object.assign({}, window.ninetailed, {
1126
- page: this.page.bind(this),
1127
- track: this.track.bind(this),
1128
- identify: this.identify.bind(this),
1138
+ page: this.pageAsWindowHandler.bind(this),
1139
+ track: this.trackAsWindowHandler.bind(this),
1140
+ identify: this.identifyAsWindowHandler.bind(this),
1129
1141
  reset: this.reset.bind(this),
1130
1142
  debug: this.debug.bind(this),
1131
1143
  profile: this.profileState.profile
package/index.esm.js CHANGED
@@ -996,6 +996,18 @@ class Ninetailed {
996
996
  this.onIsInitialized(resolve);
997
997
  });
998
998
  };
999
+ // The following methods are used to register methods of the Ninetailed instance on the window object.
1000
+ // GTM templates do not support executing async functions in `callInWindow`.
1001
+ // Therefore, we provide a versions of those methods without the async keyword.
1002
+ this.trackAsWindowHandler = (event, properties, options) => {
1003
+ return this.track(event, properties, options);
1004
+ };
1005
+ this.identifyAsWindowHandler = (uid, traits, options) => {
1006
+ return this.identify(uid, traits, options);
1007
+ };
1008
+ this.pageAsWindowHandler = (data, options) => {
1009
+ return this.page(data, options);
1010
+ };
999
1011
  this.onVisibilityChange = () => {
1000
1012
  if (typeof document === 'undefined') {
1001
1013
  return;
@@ -1106,9 +1118,9 @@ class Ninetailed {
1106
1118
  registerWindowHandlers() {
1107
1119
  if (typeof window !== 'undefined') {
1108
1120
  window.ninetailed = Object.assign({}, window.ninetailed, {
1109
- page: this.page.bind(this),
1110
- track: this.track.bind(this),
1111
- identify: this.identify.bind(this),
1121
+ page: this.pageAsWindowHandler.bind(this),
1122
+ track: this.trackAsWindowHandler.bind(this),
1123
+ identify: this.identifyAsWindowHandler.bind(this),
1112
1124
  reset: this.reset.bind(this),
1113
1125
  debug: this.debug.bind(this),
1114
1126
  profile: this.profileState.profile
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js",
3
- "version": "7.7.3",
3
+ "version": "7.7.4",
4
4
  "description": "Ninetailed SDK for javascript",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -9,8 +9,8 @@
9
9
  "directory": "packages/sdks/javascript"
10
10
  },
11
11
  "dependencies": {
12
- "@ninetailed/experience.js-plugin-analytics": "7.7.3",
13
- "@ninetailed/experience.js-shared": "7.7.3",
12
+ "@ninetailed/experience.js-plugin-analytics": "7.7.4",
13
+ "@ninetailed/experience.js-shared": "7.7.4",
14
14
  "analytics": "0.8.1",
15
15
  "uuid": "9.0.0"
16
16
  },
@@ -81,6 +81,9 @@ export declare class Ninetailed implements NinetailedInstance {
81
81
  private waitUntilInitialized;
82
82
  get profileState(): ProfileState;
83
83
  private buildOptions;
84
+ private trackAsWindowHandler;
85
+ private identifyAsWindowHandler;
86
+ private pageAsWindowHandler;
84
87
  private registerWindowHandlers;
85
88
  private onVisibilityChange;
86
89
  }