@ninetailed/experience.js-react 7.0.1-beta.0 → 7.1.0-beta.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 +31 -32
- package/index.js +31 -32
- package/lib/NinetailedProvider.d.ts +1 -1
- package/lib/useProfile.d.ts +1 -6
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -26,7 +26,6 @@ const NinetailedProvider = props => {
|
|
|
26
26
|
environment,
|
|
27
27
|
preview,
|
|
28
28
|
url,
|
|
29
|
-
profile,
|
|
30
29
|
locale,
|
|
31
30
|
requestTimeout,
|
|
32
31
|
plugins = [],
|
|
@@ -34,7 +33,7 @@ const NinetailedProvider = props => {
|
|
|
34
33
|
onError,
|
|
35
34
|
buildClientContext,
|
|
36
35
|
componentViewTrackingThreshold,
|
|
37
|
-
|
|
36
|
+
storageImpl
|
|
38
37
|
} = props;
|
|
39
38
|
return new experience_js.Ninetailed({
|
|
40
39
|
clientId,
|
|
@@ -43,14 +42,13 @@ const NinetailedProvider = props => {
|
|
|
43
42
|
}, {
|
|
44
43
|
url,
|
|
45
44
|
plugins,
|
|
46
|
-
profile,
|
|
47
45
|
locale,
|
|
48
46
|
requestTimeout,
|
|
49
47
|
onLog,
|
|
50
48
|
onError,
|
|
51
49
|
buildClientContext,
|
|
52
50
|
componentViewTrackingThreshold,
|
|
53
|
-
|
|
51
|
+
storageImpl
|
|
54
52
|
});
|
|
55
53
|
}, []);
|
|
56
54
|
const {
|
|
@@ -71,6 +69,33 @@ const useNinetailed = () => {
|
|
|
71
69
|
return ninetailed;
|
|
72
70
|
};
|
|
73
71
|
|
|
72
|
+
/******************************************************************************
|
|
73
|
+
Copyright (c) Microsoft Corporation.
|
|
74
|
+
|
|
75
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
76
|
+
purpose with or without fee is hereby granted.
|
|
77
|
+
|
|
78
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
79
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
80
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
81
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
82
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
83
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
84
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
85
|
+
***************************************************************************** */
|
|
86
|
+
|
|
87
|
+
function __rest(s, e) {
|
|
88
|
+
var t = {};
|
|
89
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
90
|
+
t[p] = s[p];
|
|
91
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
92
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
93
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
94
|
+
t[p[i]] = s[p[i]];
|
|
95
|
+
}
|
|
96
|
+
return t;
|
|
97
|
+
}
|
|
98
|
+
|
|
74
99
|
const useProfile = () => {
|
|
75
100
|
const ninetailed = useNinetailed();
|
|
76
101
|
const [profileState, setProfileState] = React.useState(ninetailed.profileState);
|
|
@@ -102,7 +127,8 @@ const useProfile = () => {
|
|
|
102
127
|
setProfileState(profileState);
|
|
103
128
|
});
|
|
104
129
|
}, []);*/
|
|
105
|
-
|
|
130
|
+
const profileStateWithoutExperiences = __rest(profileState, ["experiences"]);
|
|
131
|
+
return Object.assign(Object.assign({}, profileStateWithoutExperiences), {
|
|
106
132
|
loading: profileState.status === 'loading'
|
|
107
133
|
});
|
|
108
134
|
};
|
|
@@ -114,33 +140,6 @@ const usePersonalize = (baseline, variants, options = {
|
|
|
114
140
|
return experience_js.selectVariant(baseline, variants, profile, options);
|
|
115
141
|
};
|
|
116
142
|
|
|
117
|
-
/******************************************************************************
|
|
118
|
-
Copyright (c) Microsoft Corporation.
|
|
119
|
-
|
|
120
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
121
|
-
purpose with or without fee is hereby granted.
|
|
122
|
-
|
|
123
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
124
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
125
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
126
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
127
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
128
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
129
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
130
|
-
***************************************************************************** */
|
|
131
|
-
|
|
132
|
-
function __rest(s, e) {
|
|
133
|
-
var t = {};
|
|
134
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
135
|
-
t[p] = s[p];
|
|
136
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
137
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
138
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
139
|
-
t[p[i]] = s[p[i]];
|
|
140
|
-
}
|
|
141
|
-
return t;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
143
|
const TrackHasSeenComponent = ({
|
|
145
144
|
children,
|
|
146
145
|
variant,
|
package/index.js
CHANGED
|
@@ -18,7 +18,6 @@ const NinetailedProvider = props => {
|
|
|
18
18
|
environment,
|
|
19
19
|
preview,
|
|
20
20
|
url,
|
|
21
|
-
profile,
|
|
22
21
|
locale,
|
|
23
22
|
requestTimeout,
|
|
24
23
|
plugins = [],
|
|
@@ -26,7 +25,7 @@ const NinetailedProvider = props => {
|
|
|
26
25
|
onError,
|
|
27
26
|
buildClientContext,
|
|
28
27
|
componentViewTrackingThreshold,
|
|
29
|
-
|
|
28
|
+
storageImpl
|
|
30
29
|
} = props;
|
|
31
30
|
return new Ninetailed({
|
|
32
31
|
clientId,
|
|
@@ -35,14 +34,13 @@ const NinetailedProvider = props => {
|
|
|
35
34
|
}, {
|
|
36
35
|
url,
|
|
37
36
|
plugins,
|
|
38
|
-
profile,
|
|
39
37
|
locale,
|
|
40
38
|
requestTimeout,
|
|
41
39
|
onLog,
|
|
42
40
|
onError,
|
|
43
41
|
buildClientContext,
|
|
44
42
|
componentViewTrackingThreshold,
|
|
45
|
-
|
|
43
|
+
storageImpl
|
|
46
44
|
});
|
|
47
45
|
}, []);
|
|
48
46
|
const {
|
|
@@ -63,6 +61,33 @@ const useNinetailed = () => {
|
|
|
63
61
|
return ninetailed;
|
|
64
62
|
};
|
|
65
63
|
|
|
64
|
+
/******************************************************************************
|
|
65
|
+
Copyright (c) Microsoft Corporation.
|
|
66
|
+
|
|
67
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
68
|
+
purpose with or without fee is hereby granted.
|
|
69
|
+
|
|
70
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
71
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
72
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
73
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
74
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
75
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
76
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
77
|
+
***************************************************************************** */
|
|
78
|
+
|
|
79
|
+
function __rest(s, e) {
|
|
80
|
+
var t = {};
|
|
81
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
82
|
+
t[p] = s[p];
|
|
83
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
84
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
85
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
86
|
+
t[p[i]] = s[p[i]];
|
|
87
|
+
}
|
|
88
|
+
return t;
|
|
89
|
+
}
|
|
90
|
+
|
|
66
91
|
const useProfile = () => {
|
|
67
92
|
const ninetailed = useNinetailed();
|
|
68
93
|
const [profileState, setProfileState] = useState(ninetailed.profileState);
|
|
@@ -94,7 +119,8 @@ const useProfile = () => {
|
|
|
94
119
|
setProfileState(profileState);
|
|
95
120
|
});
|
|
96
121
|
}, []);*/
|
|
97
|
-
|
|
122
|
+
const profileStateWithoutExperiences = __rest(profileState, ["experiences"]);
|
|
123
|
+
return Object.assign(Object.assign({}, profileStateWithoutExperiences), {
|
|
98
124
|
loading: profileState.status === 'loading'
|
|
99
125
|
});
|
|
100
126
|
};
|
|
@@ -106,33 +132,6 @@ const usePersonalize = (baseline, variants, options = {
|
|
|
106
132
|
return selectVariant(baseline, variants, profile, options);
|
|
107
133
|
};
|
|
108
134
|
|
|
109
|
-
/******************************************************************************
|
|
110
|
-
Copyright (c) Microsoft Corporation.
|
|
111
|
-
|
|
112
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
113
|
-
purpose with or without fee is hereby granted.
|
|
114
|
-
|
|
115
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
116
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
117
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
118
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
119
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
120
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
121
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
122
|
-
***************************************************************************** */
|
|
123
|
-
|
|
124
|
-
function __rest(s, e) {
|
|
125
|
-
var t = {};
|
|
126
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
127
|
-
t[p] = s[p];
|
|
128
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
129
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
130
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
131
|
-
t[p[i]] = s[p[i]];
|
|
132
|
-
}
|
|
133
|
-
return t;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
135
|
const TrackHasSeenComponent = ({
|
|
137
136
|
children,
|
|
138
137
|
variant,
|
|
@@ -14,7 +14,7 @@ export type NinetailedProviderInstantiationProps = {
|
|
|
14
14
|
onError?: OnErrorHandler;
|
|
15
15
|
componentViewTrackingThreshold?: number;
|
|
16
16
|
buildClientContext?: () => NinetailedRequestContext;
|
|
17
|
-
|
|
17
|
+
storageImpl?: Storage;
|
|
18
18
|
};
|
|
19
19
|
export type NinetailedProviderProps = NinetailedProviderInstantiationProps | {
|
|
20
20
|
ninetailed: Ninetailed;
|
package/lib/useProfile.d.ts
CHANGED
|
@@ -3,12 +3,7 @@ export declare const useProfile: () => {
|
|
|
3
3
|
from: "api" | "hydrated";
|
|
4
4
|
status: "loading";
|
|
5
5
|
profile: null;
|
|
6
|
-
error: null;
|
|
7
|
-
* This effect compares the old and new profile state before updating it.
|
|
8
|
-
* We use a ref to avoid an infinite loop which can happen when an empty profile state was updated with no changes.
|
|
9
|
-
* This behaviour occurred as the validation handling on the error property was not set properly in the "CreateProfile" and "UpdateProfile" endpoint types.
|
|
10
|
-
* Furthermore, it was also observed, that it "only" occurred when the preview plugin was used in parallel.
|
|
11
|
-
*/
|
|
6
|
+
error: null;
|
|
12
7
|
} | {
|
|
13
8
|
loading: boolean;
|
|
14
9
|
from: "api" | "hydrated";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js-react",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0-beta.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": ">=16.8.0"
|
|
6
6
|
},
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"types": "./index.d.ts",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@ninetailed/experience.js": "7.0
|
|
12
|
+
"@ninetailed/experience.js": "7.1.0-beta.1",
|
|
13
13
|
"react-is": "18.2.0",
|
|
14
|
-
"@ninetailed/experience.js-shared": "7.0
|
|
14
|
+
"@ninetailed/experience.js-shared": "7.1.0-beta.1",
|
|
15
15
|
"radash": "10.9.0",
|
|
16
16
|
"react-intersection-observer": "8.34.0"
|
|
17
17
|
}
|