@ninetailed/experience.js 7.7.3 → 7.7.4-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.cjs.js
CHANGED
|
@@ -527,7 +527,7 @@ const makeExperienceSelectMiddleware = ({
|
|
|
527
527
|
const middlewareFunctions = pluginsWithMiddleware.map(plugin => plugin.getExperienceSelectionMiddleware({
|
|
528
528
|
experiences,
|
|
529
529
|
baseline
|
|
530
|
-
}));
|
|
530
|
+
})).filter(result => typeof result !== 'undefined');
|
|
531
531
|
return experience_jsShared.pipe(...middlewareFunctions);
|
|
532
532
|
};
|
|
533
533
|
const middleware = prepareMiddleware();
|
|
@@ -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.
|
|
1127
|
-
track: this.
|
|
1128
|
-
identify: 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
|
@@ -491,7 +491,7 @@ const makeExperienceSelectMiddleware = ({
|
|
|
491
491
|
const middlewareFunctions = pluginsWithMiddleware.map(plugin => plugin.getExperienceSelectionMiddleware({
|
|
492
492
|
experiences,
|
|
493
493
|
baseline
|
|
494
|
-
}));
|
|
494
|
+
})).filter(result => typeof result !== 'undefined');
|
|
495
495
|
return pipe(...middlewareFunctions);
|
|
496
496
|
};
|
|
497
497
|
const middleware = prepareMiddleware();
|
|
@@ -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.
|
|
1110
|
-
track: this.
|
|
1111
|
-
identify: 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
|
+
"version": "7.7.4-beta.0",
|
|
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.
|
|
13
|
-
"@ninetailed/experience.js-shared": "7.7.
|
|
12
|
+
"@ninetailed/experience.js-plugin-analytics": "7.7.4-beta.0",
|
|
13
|
+
"@ninetailed/experience.js-shared": "7.7.4-beta.0",
|
|
14
14
|
"analytics": "0.8.1",
|
|
15
15
|
"uuid": "9.0.0"
|
|
16
16
|
},
|
package/src/lib/Ninetailed.d.ts
CHANGED
|
@@ -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
|
}
|
|
@@ -9,7 +9,7 @@ type BuildExperienceSelectionMiddlewareArg<TVariant extends Reference> = {
|
|
|
9
9
|
experiences: ExperienceConfiguration<TVariant>[];
|
|
10
10
|
baseline: Reference;
|
|
11
11
|
};
|
|
12
|
-
export type BuildExperienceSelectionMiddleware<TBaseline extends Reference, TVariant extends Reference> = (arg: BuildExperienceSelectionMiddlewareArg<TVariant>) => ExperienceSelectionMiddleware<TBaseline, TVariant
|
|
12
|
+
export type BuildExperienceSelectionMiddleware<TBaseline extends Reference, TVariant extends Reference> = (arg: BuildExperienceSelectionMiddlewareArg<TVariant>) => ExperienceSelectionMiddleware<TBaseline, TVariant> | undefined;
|
|
13
13
|
export interface HasExperienceSelectionMiddleware<TBaseline extends Reference, TVariant extends Reference> {
|
|
14
14
|
getExperienceSelectionMiddleware: BuildExperienceSelectionMiddleware<TBaseline, TVariant>;
|
|
15
15
|
}
|