@ninetailed/experience.js-react 7.20.5 → 7.20.6
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 +37 -47
- package/index.esm.js +37 -47
- package/package.json +4 -4
- package/src/index.d.ts +1 -1
- package/src/lib/EntryAnalytics/EntryAnalytics.d.ts +4 -4
- package/src/lib/EntryAnalytics/index.d.ts +2 -2
- package/src/lib/Experience/ComponentMarker/ComponentMarker.d.ts +2 -2
- package/src/lib/Experience/ComponentMarker/index.d.ts +1 -1
- package/src/lib/Experience/DefaultExperienceLoadingComponent.d.ts +7 -7
- package/src/lib/Experience/ESRLoadingComponent.d.ts +16 -16
- package/src/lib/Experience/Experience.d.ts +5 -5
- package/src/lib/Experience/constants.d.ts +1 -1
- package/src/lib/Experience/index.d.ts +4 -4
- package/src/lib/Experience/types/Baseline.d.ts +3 -3
- package/src/lib/Experience/types/BaselineWithVariants.d.ts +6 -6
- package/src/lib/Experience/types/Experience.d.ts +22 -22
- package/src/lib/Experience/types/Variant.d.ts +3 -3
- package/src/lib/Experience/types/index.d.ts +4 -4
- package/src/lib/Experience/useExperience.d.ts +49 -49
- package/src/lib/MergeTag/MergeTag.d.ts +7 -7
- package/src/lib/MergeTag/helpers.d.ts +3 -3
- package/src/lib/MergeTag/index.d.ts +1 -1
- package/src/lib/NinetailedContext.d.ts +2 -3
- package/src/lib/NinetailedProvider.d.ts +24 -24
- package/src/lib/Personalize.d.ts +23 -23
- package/src/lib/TrackHasSeenComponent.d.ts +11 -11
- package/src/lib/Variant.d.ts +6 -6
- package/src/lib/index.d.ts +17 -17
- package/src/lib/useFlag.d.ts +31 -31
- package/src/lib/useFlagWithManualTracking.d.ts +19 -19
- package/src/lib/useNinetailed.d.ts +3 -3
- package/src/lib/usePersonalize.d.ts +32 -32
- package/src/lib/useProfile.d.ts +17 -17
package/index.cjs.js
CHANGED
|
@@ -51,11 +51,10 @@ const NinetailedProvider = props => {
|
|
|
51
51
|
const {
|
|
52
52
|
children
|
|
53
53
|
} = props;
|
|
54
|
-
return jsxRuntime.jsx(NinetailedContext.Provider,
|
|
55
|
-
value: ninetailed
|
|
56
|
-
}, {
|
|
54
|
+
return jsxRuntime.jsx(NinetailedContext.Provider, {
|
|
55
|
+
value: ninetailed,
|
|
57
56
|
children: children
|
|
58
|
-
})
|
|
57
|
+
});
|
|
59
58
|
};
|
|
60
59
|
|
|
61
60
|
const useNinetailed = () => {
|
|
@@ -80,7 +79,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
80
79
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
81
80
|
PERFORMANCE OF THIS SOFTWARE.
|
|
82
81
|
***************************************************************************** */
|
|
83
|
-
/* global Reflect, Promise
|
|
82
|
+
/* global Reflect, Promise */
|
|
84
83
|
|
|
85
84
|
|
|
86
85
|
function __rest(s, e) {
|
|
@@ -93,12 +92,7 @@ function __rest(s, e) {
|
|
|
93
92
|
t[p[i]] = s[p[i]];
|
|
94
93
|
}
|
|
95
94
|
return t;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
99
|
-
var e = new Error(message);
|
|
100
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
101
|
-
};
|
|
95
|
+
}
|
|
102
96
|
|
|
103
97
|
function formatProfileForHook(profile) {
|
|
104
98
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -110,16 +104,16 @@ function formatProfileForHook(profile) {
|
|
|
110
104
|
loading: profile.status === 'loading'
|
|
111
105
|
});
|
|
112
106
|
}
|
|
113
|
-
/**
|
|
114
|
-
* Custom hook that provides access to the Ninetailed profile state
|
|
115
|
-
* with the 'experiences' property removed to prevent unnecessary re-renders.
|
|
116
|
-
*
|
|
117
|
-
* This hook handles profile state changes efficiently by:
|
|
118
|
-
* 1. Only updating state when actual changes occur
|
|
119
|
-
* 2. Removing the large 'experiences' object from the state
|
|
120
|
-
* 3. Properly cleaning up subscriptions when components unmount
|
|
121
|
-
*
|
|
122
|
-
* @returns The profile state without the 'experiences' property
|
|
107
|
+
/**
|
|
108
|
+
* Custom hook that provides access to the Ninetailed profile state
|
|
109
|
+
* with the 'experiences' property removed to prevent unnecessary re-renders.
|
|
110
|
+
*
|
|
111
|
+
* This hook handles profile state changes efficiently by:
|
|
112
|
+
* 1. Only updating state when actual changes occur
|
|
113
|
+
* 2. Removing the large 'experiences' object from the state
|
|
114
|
+
* 3. Properly cleaning up subscriptions when components unmount
|
|
115
|
+
*
|
|
116
|
+
* @returns The profile state without the 'experiences' property
|
|
123
117
|
*/
|
|
124
118
|
const useProfile = () => {
|
|
125
119
|
const ninetailed = useNinetailed();
|
|
@@ -156,8 +150,8 @@ const usePersonalize = (baseline, variants, options = {
|
|
|
156
150
|
return experience_js.selectVariant(baseline, variants, profile, options);
|
|
157
151
|
};
|
|
158
152
|
|
|
159
|
-
/**
|
|
160
|
-
* Hook to access a Ninetailed variable flag with manual tracking control.
|
|
153
|
+
/**
|
|
154
|
+
* Hook to access a Ninetailed variable flag with manual tracking control.
|
|
161
155
|
*/
|
|
162
156
|
function useFlagWithManualTracking(flagKey, defaultValue) {
|
|
163
157
|
const ninetailed = useNinetailed();
|
|
@@ -247,11 +241,11 @@ function useFlagWithManualTracking(flagKey, defaultValue) {
|
|
|
247
241
|
return [result, track];
|
|
248
242
|
}
|
|
249
243
|
|
|
250
|
-
/**
|
|
251
|
-
* Hook to access a Ninetailed variable flag with built-in auto-tracking.
|
|
252
|
-
*
|
|
253
|
-
* @remarks
|
|
254
|
-
* For manual control over tracking behavior, consider using {@link useFlagWithManualTracking}.
|
|
244
|
+
/**
|
|
245
|
+
* Hook to access a Ninetailed variable flag with built-in auto-tracking.
|
|
246
|
+
*
|
|
247
|
+
* @remarks
|
|
248
|
+
* For manual control over tracking behavior, consider using {@link useFlagWithManualTracking}.
|
|
255
249
|
*/
|
|
256
250
|
function useFlag(flagKey, defaultValue, options = {}) {
|
|
257
251
|
const [result, track] = useFlagWithManualTracking(flagKey, defaultValue);
|
|
@@ -334,24 +328,22 @@ const Personalize = _a => {
|
|
|
334
328
|
if (LoadingComponent) {
|
|
335
329
|
return jsxRuntime.jsx(LoadingComponent, {});
|
|
336
330
|
}
|
|
337
|
-
return jsxRuntime.jsx("div",
|
|
331
|
+
return jsxRuntime.jsx("div", {
|
|
338
332
|
style: {
|
|
339
333
|
opacity: 0
|
|
340
|
-
}
|
|
341
|
-
}, {
|
|
334
|
+
},
|
|
342
335
|
children: jsxRuntime.jsx(Component, Object.assign({}, variant, {
|
|
343
336
|
ninetailed: {
|
|
344
337
|
isPersonalized,
|
|
345
338
|
audience
|
|
346
339
|
}
|
|
347
340
|
}))
|
|
348
|
-
}
|
|
341
|
+
}, "hide");
|
|
349
342
|
}
|
|
350
|
-
return jsxRuntime.jsx(TrackHasSeenComponent,
|
|
343
|
+
return jsxRuntime.jsx(TrackHasSeenComponent, {
|
|
351
344
|
variant: variant,
|
|
352
345
|
audience: audience,
|
|
353
|
-
isPersonalized: isPersonalized
|
|
354
|
-
}, {
|
|
346
|
+
isPersonalized: isPersonalized,
|
|
355
347
|
children: /*#__PURE__*/React.createElement(Component, Object.assign({}, variant, {
|
|
356
348
|
key: `${audience.id}-${variant.id}`,
|
|
357
349
|
ninetailed: {
|
|
@@ -359,7 +351,7 @@ const Personalize = _a => {
|
|
|
359
351
|
audience
|
|
360
352
|
}
|
|
361
353
|
}))
|
|
362
|
-
})
|
|
354
|
+
});
|
|
363
355
|
};
|
|
364
356
|
|
|
365
357
|
const generateSelectors = id => {
|
|
@@ -432,9 +424,9 @@ const ComponentMarker = /*#__PURE__*/React.forwardRef((_, ref) => {
|
|
|
432
424
|
const markerRef = React.useRef(null);
|
|
433
425
|
React.useEffect(() => {
|
|
434
426
|
var _a;
|
|
435
|
-
/*
|
|
436
|
-
Due to React's limitation on setting !important styles during rendering, we set the display property on the DOM element directly.
|
|
437
|
-
See: https://github.com/facebook/react/issues/1881
|
|
427
|
+
/*
|
|
428
|
+
Due to React's limitation on setting !important styles during rendering, we set the display property on the DOM element directly.
|
|
429
|
+
See: https://github.com/facebook/react/issues/1881
|
|
438
430
|
*/
|
|
439
431
|
(_a = markerRef.current) === null || _a === void 0 ? void 0 : _a.style.setProperty('display', 'none', 'important');
|
|
440
432
|
}, []);
|
|
@@ -511,15 +503,14 @@ const DefaultExperienceLoadingComponent = _a => {
|
|
|
511
503
|
};
|
|
512
504
|
}, [isHidden, logger, unhideAfterMs]);
|
|
513
505
|
if (isHidden) {
|
|
514
|
-
return jsxRuntime.jsx("div",
|
|
506
|
+
return jsxRuntime.jsx("div", {
|
|
515
507
|
style: {
|
|
516
508
|
visibility: 'hidden',
|
|
517
509
|
pointerEvents: 'none'
|
|
518
510
|
},
|
|
519
511
|
"aria-hidden": "true",
|
|
520
512
|
// Prevent focus and interaction within the hidden loading subtree.
|
|
521
|
-
inert: true
|
|
522
|
-
}, {
|
|
513
|
+
inert: true,
|
|
523
514
|
children: jsxRuntime.jsx(Component, Object.assign({}, passthroughProps, baseline, {
|
|
524
515
|
ninetailed: {
|
|
525
516
|
isPersonalized: false,
|
|
@@ -528,7 +519,7 @@ const DefaultExperienceLoadingComponent = _a => {
|
|
|
528
519
|
}
|
|
529
520
|
}
|
|
530
521
|
}))
|
|
531
|
-
}
|
|
522
|
+
}, "experience-loader-hidden-baseline");
|
|
532
523
|
}
|
|
533
524
|
return jsxRuntime.jsx(Component, Object.assign({}, passthroughProps, baseline, {
|
|
534
525
|
ninetailed: {
|
|
@@ -653,13 +644,12 @@ const ESRProvider = ({
|
|
|
653
644
|
experienceVariantsMap,
|
|
654
645
|
children
|
|
655
646
|
}) => {
|
|
656
|
-
return jsxRuntime.jsx(ESRContext.Provider,
|
|
647
|
+
return jsxRuntime.jsx(ESRContext.Provider, {
|
|
657
648
|
value: {
|
|
658
649
|
experienceVariantsMap
|
|
659
|
-
}
|
|
660
|
-
}, {
|
|
650
|
+
},
|
|
661
651
|
children: children
|
|
662
|
-
})
|
|
652
|
+
});
|
|
663
653
|
};
|
|
664
654
|
const useESR = () => {
|
|
665
655
|
const context = React.useContext(ESRContext);
|
package/index.esm.js
CHANGED
|
@@ -49,11 +49,10 @@ const NinetailedProvider = props => {
|
|
|
49
49
|
const {
|
|
50
50
|
children
|
|
51
51
|
} = props;
|
|
52
|
-
return jsx(NinetailedContext.Provider,
|
|
53
|
-
value: ninetailed
|
|
54
|
-
}, {
|
|
52
|
+
return jsx(NinetailedContext.Provider, {
|
|
53
|
+
value: ninetailed,
|
|
55
54
|
children: children
|
|
56
|
-
})
|
|
55
|
+
});
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
const useNinetailed = () => {
|
|
@@ -78,7 +77,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
78
77
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
79
78
|
PERFORMANCE OF THIS SOFTWARE.
|
|
80
79
|
***************************************************************************** */
|
|
81
|
-
/* global Reflect, Promise
|
|
80
|
+
/* global Reflect, Promise */
|
|
82
81
|
|
|
83
82
|
|
|
84
83
|
function __rest(s, e) {
|
|
@@ -91,12 +90,7 @@ function __rest(s, e) {
|
|
|
91
90
|
t[p[i]] = s[p[i]];
|
|
92
91
|
}
|
|
93
92
|
return t;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
97
|
-
var e = new Error(message);
|
|
98
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
99
|
-
};
|
|
93
|
+
}
|
|
100
94
|
|
|
101
95
|
function formatProfileForHook(profile) {
|
|
102
96
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -108,16 +102,16 @@ function formatProfileForHook(profile) {
|
|
|
108
102
|
loading: profile.status === 'loading'
|
|
109
103
|
});
|
|
110
104
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Custom hook that provides access to the Ninetailed profile state
|
|
113
|
-
* with the 'experiences' property removed to prevent unnecessary re-renders.
|
|
114
|
-
*
|
|
115
|
-
* This hook handles profile state changes efficiently by:
|
|
116
|
-
* 1. Only updating state when actual changes occur
|
|
117
|
-
* 2. Removing the large 'experiences' object from the state
|
|
118
|
-
* 3. Properly cleaning up subscriptions when components unmount
|
|
119
|
-
*
|
|
120
|
-
* @returns The profile state without the 'experiences' property
|
|
105
|
+
/**
|
|
106
|
+
* Custom hook that provides access to the Ninetailed profile state
|
|
107
|
+
* with the 'experiences' property removed to prevent unnecessary re-renders.
|
|
108
|
+
*
|
|
109
|
+
* This hook handles profile state changes efficiently by:
|
|
110
|
+
* 1. Only updating state when actual changes occur
|
|
111
|
+
* 2. Removing the large 'experiences' object from the state
|
|
112
|
+
* 3. Properly cleaning up subscriptions when components unmount
|
|
113
|
+
*
|
|
114
|
+
* @returns The profile state without the 'experiences' property
|
|
121
115
|
*/
|
|
122
116
|
const useProfile = () => {
|
|
123
117
|
const ninetailed = useNinetailed();
|
|
@@ -154,8 +148,8 @@ const usePersonalize = (baseline, variants, options = {
|
|
|
154
148
|
return selectVariant(baseline, variants, profile, options);
|
|
155
149
|
};
|
|
156
150
|
|
|
157
|
-
/**
|
|
158
|
-
* Hook to access a Ninetailed variable flag with manual tracking control.
|
|
151
|
+
/**
|
|
152
|
+
* Hook to access a Ninetailed variable flag with manual tracking control.
|
|
159
153
|
*/
|
|
160
154
|
function useFlagWithManualTracking(flagKey, defaultValue) {
|
|
161
155
|
const ninetailed = useNinetailed();
|
|
@@ -245,11 +239,11 @@ function useFlagWithManualTracking(flagKey, defaultValue) {
|
|
|
245
239
|
return [result, track];
|
|
246
240
|
}
|
|
247
241
|
|
|
248
|
-
/**
|
|
249
|
-
* Hook to access a Ninetailed variable flag with built-in auto-tracking.
|
|
250
|
-
*
|
|
251
|
-
* @remarks
|
|
252
|
-
* For manual control over tracking behavior, consider using {@link useFlagWithManualTracking}.
|
|
242
|
+
/**
|
|
243
|
+
* Hook to access a Ninetailed variable flag with built-in auto-tracking.
|
|
244
|
+
*
|
|
245
|
+
* @remarks
|
|
246
|
+
* For manual control over tracking behavior, consider using {@link useFlagWithManualTracking}.
|
|
253
247
|
*/
|
|
254
248
|
function useFlag(flagKey, defaultValue, options = {}) {
|
|
255
249
|
const [result, track] = useFlagWithManualTracking(flagKey, defaultValue);
|
|
@@ -332,24 +326,22 @@ const Personalize = _a => {
|
|
|
332
326
|
if (LoadingComponent) {
|
|
333
327
|
return jsx(LoadingComponent, {});
|
|
334
328
|
}
|
|
335
|
-
return jsx("div",
|
|
329
|
+
return jsx("div", {
|
|
336
330
|
style: {
|
|
337
331
|
opacity: 0
|
|
338
|
-
}
|
|
339
|
-
}, {
|
|
332
|
+
},
|
|
340
333
|
children: jsx(Component, Object.assign({}, variant, {
|
|
341
334
|
ninetailed: {
|
|
342
335
|
isPersonalized,
|
|
343
336
|
audience
|
|
344
337
|
}
|
|
345
338
|
}))
|
|
346
|
-
}
|
|
339
|
+
}, "hide");
|
|
347
340
|
}
|
|
348
|
-
return jsx(TrackHasSeenComponent,
|
|
341
|
+
return jsx(TrackHasSeenComponent, {
|
|
349
342
|
variant: variant,
|
|
350
343
|
audience: audience,
|
|
351
|
-
isPersonalized: isPersonalized
|
|
352
|
-
}, {
|
|
344
|
+
isPersonalized: isPersonalized,
|
|
353
345
|
children: /*#__PURE__*/createElement(Component, Object.assign({}, variant, {
|
|
354
346
|
key: `${audience.id}-${variant.id}`,
|
|
355
347
|
ninetailed: {
|
|
@@ -357,7 +349,7 @@ const Personalize = _a => {
|
|
|
357
349
|
audience
|
|
358
350
|
}
|
|
359
351
|
}))
|
|
360
|
-
})
|
|
352
|
+
});
|
|
361
353
|
};
|
|
362
354
|
|
|
363
355
|
const generateSelectors = id => {
|
|
@@ -430,9 +422,9 @@ const ComponentMarker = /*#__PURE__*/forwardRef((_, ref) => {
|
|
|
430
422
|
const markerRef = useRef(null);
|
|
431
423
|
useEffect(() => {
|
|
432
424
|
var _a;
|
|
433
|
-
/*
|
|
434
|
-
Due to React's limitation on setting !important styles during rendering, we set the display property on the DOM element directly.
|
|
435
|
-
See: https://github.com/facebook/react/issues/1881
|
|
425
|
+
/*
|
|
426
|
+
Due to React's limitation on setting !important styles during rendering, we set the display property on the DOM element directly.
|
|
427
|
+
See: https://github.com/facebook/react/issues/1881
|
|
436
428
|
*/
|
|
437
429
|
(_a = markerRef.current) === null || _a === void 0 ? void 0 : _a.style.setProperty('display', 'none', 'important');
|
|
438
430
|
}, []);
|
|
@@ -509,15 +501,14 @@ const DefaultExperienceLoadingComponent = _a => {
|
|
|
509
501
|
};
|
|
510
502
|
}, [isHidden, logger, unhideAfterMs]);
|
|
511
503
|
if (isHidden) {
|
|
512
|
-
return jsx("div",
|
|
504
|
+
return jsx("div", {
|
|
513
505
|
style: {
|
|
514
506
|
visibility: 'hidden',
|
|
515
507
|
pointerEvents: 'none'
|
|
516
508
|
},
|
|
517
509
|
"aria-hidden": "true",
|
|
518
510
|
// Prevent focus and interaction within the hidden loading subtree.
|
|
519
|
-
inert: true
|
|
520
|
-
}, {
|
|
511
|
+
inert: true,
|
|
521
512
|
children: jsx(Component, Object.assign({}, passthroughProps, baseline, {
|
|
522
513
|
ninetailed: {
|
|
523
514
|
isPersonalized: false,
|
|
@@ -526,7 +517,7 @@ const DefaultExperienceLoadingComponent = _a => {
|
|
|
526
517
|
}
|
|
527
518
|
}
|
|
528
519
|
}))
|
|
529
|
-
}
|
|
520
|
+
}, "experience-loader-hidden-baseline");
|
|
530
521
|
}
|
|
531
522
|
return jsx(Component, Object.assign({}, passthroughProps, baseline, {
|
|
532
523
|
ninetailed: {
|
|
@@ -651,13 +642,12 @@ const ESRProvider = ({
|
|
|
651
642
|
experienceVariantsMap,
|
|
652
643
|
children
|
|
653
644
|
}) => {
|
|
654
|
-
return jsx(ESRContext.Provider,
|
|
645
|
+
return jsx(ESRContext.Provider, {
|
|
655
646
|
value: {
|
|
656
647
|
experienceVariantsMap
|
|
657
|
-
}
|
|
658
|
-
}, {
|
|
648
|
+
},
|
|
659
649
|
children: children
|
|
660
|
-
})
|
|
650
|
+
});
|
|
661
651
|
};
|
|
662
652
|
const useESR = () => {
|
|
663
653
|
const context = React.useContext(ESRContext);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js-react",
|
|
3
|
-
"version": "7.20.
|
|
3
|
+
"version": "7.20.6",
|
|
4
4
|
"description": "Ninetailed SDK for React",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@ninetailed/experience.js": "7.20.
|
|
32
|
-
"@ninetailed/experience.js-shared": "7.20.
|
|
33
|
-
"@ninetailed/experience.js-plugin-analytics": "7.20.
|
|
31
|
+
"@ninetailed/experience.js": "7.20.6",
|
|
32
|
+
"@ninetailed/experience.js-shared": "7.20.6",
|
|
33
|
+
"@ninetailed/experience.js-plugin-analytics": "7.20.6",
|
|
34
34
|
"radash": "10.9.0",
|
|
35
35
|
"react-is": "19.2.4"
|
|
36
36
|
},
|
package/src/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './lib';
|
|
1
|
+
export * from './lib';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Baseline } from '@ninetailed/experience.js';
|
|
2
|
-
import { ExperienceProps } from '../Experience';
|
|
3
|
-
export type EntryAnalyticsProps<P> = Omit<ExperienceProps<P>, 'experiences'> & Baseline<P>;
|
|
4
|
-
export declare const EntryAnalytics: <P>({ component: Component, passthroughProps, ...entry }: EntryAnalyticsProps<P>) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { Baseline } from '@ninetailed/experience.js';
|
|
2
|
+
import { ExperienceProps } from '../Experience';
|
|
3
|
+
export type EntryAnalyticsProps<P> = Omit<ExperienceProps<P>, 'experiences'> & Baseline<P>;
|
|
4
|
+
export declare const EntryAnalytics: <P>({ component: Component, passthroughProps, ...entry }: EntryAnalyticsProps<P>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { EntryAnalyticsProps } from './EntryAnalytics';
|
|
2
|
-
export { EntryAnalytics } from './EntryAnalytics';
|
|
1
|
+
export type { EntryAnalyticsProps } from './EntryAnalytics';
|
|
2
|
+
export { EntryAnalytics } from './EntryAnalytics';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const ComponentMarker: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const ComponentMarker: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './ComponentMarker';
|
|
1
|
+
export * from './ComponentMarker';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Reference } from '@ninetailed/experience.js';
|
|
2
|
-
import type { ExperienceBaseProps } from './types/Experience';
|
|
3
|
-
type DefaultExperienceLoadingComponentProps = ExperienceBaseProps<Record<string, unknown>, Record<string, unknown>, Record<string, unknown> & Reference> & {
|
|
4
|
-
unhideAfterMs?: number;
|
|
5
|
-
};
|
|
6
|
-
export declare const DefaultExperienceLoadingComponent: ({ component: Component, unhideAfterMs, passthroughProps, ...baseline }: DefaultExperienceLoadingComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
1
|
+
import type { Reference } from '@ninetailed/experience.js';
|
|
2
|
+
import type { ExperienceBaseProps } from './types/Experience';
|
|
3
|
+
type DefaultExperienceLoadingComponentProps = ExperienceBaseProps<Record<string, unknown>, Record<string, unknown>, Record<string, unknown> & Reference> & {
|
|
4
|
+
unhideAfterMs?: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const DefaultExperienceLoadingComponent: ({ component: Component, unhideAfterMs, passthroughProps, ...baseline }: DefaultExperienceLoadingComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { ExperienceBaseProps } from './Experience';
|
|
3
|
-
import { Reference } from '@ninetailed/experience.js';
|
|
4
|
-
type ESRContextValue = {
|
|
5
|
-
experienceVariantsMap: Record<string, number>;
|
|
6
|
-
};
|
|
7
|
-
export declare const ESRContext: React.Context<ESRContextValue | undefined>;
|
|
8
|
-
type ESRProviderProps = {
|
|
9
|
-
experienceVariantsMap: Record<string, number>;
|
|
10
|
-
};
|
|
11
|
-
export declare const ESRProvider: React.FC<PropsWithChildren<ESRProviderProps>>;
|
|
12
|
-
export declare const useESR: () => {
|
|
13
|
-
experienceVariantsMap: Record<string, number>;
|
|
14
|
-
};
|
|
15
|
-
export declare const ESRLoadingComponent: <P, PassThroughProps extends Partial<P> = Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference = Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference>({ experiences, component: Component, passthroughProps, ...baseline }: ExperienceBaseProps<P, PassThroughProps, Variant>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { ExperienceBaseProps } from './Experience';
|
|
3
|
+
import { Reference } from '@ninetailed/experience.js';
|
|
4
|
+
type ESRContextValue = {
|
|
5
|
+
experienceVariantsMap: Record<string, number>;
|
|
6
|
+
};
|
|
7
|
+
export declare const ESRContext: React.Context<ESRContextValue | undefined>;
|
|
8
|
+
type ESRProviderProps = {
|
|
9
|
+
experienceVariantsMap: Record<string, number>;
|
|
10
|
+
};
|
|
11
|
+
export declare const ESRProvider: React.FC<PropsWithChildren<ESRProviderProps>>;
|
|
12
|
+
export declare const useESR: () => {
|
|
13
|
+
experienceVariantsMap: Record<string, number>;
|
|
14
|
+
};
|
|
15
|
+
export declare const ESRLoadingComponent: <P, PassThroughProps extends Partial<P> = Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference = Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference>({ experiences, component: Component, passthroughProps, ...baseline }: ExperienceBaseProps<P, PassThroughProps, Variant>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Reference } from '@ninetailed/experience.js';
|
|
2
|
-
import type { ExperienceProps } from './types/Experience';
|
|
3
|
-
export declare const Experience: <P, PassThroughProps extends Partial<P> = Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference = Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference>({ experiences, component: Component, loadingComponent: LoadingComponent, trackClicks, passthroughProps, ...baseline }: ExperienceProps<P, PassThroughProps, Variant>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export type { ExperienceProps, ExperienceBaseProps, ExperienceComponent, ExperienceLoadingComponent, } from './types/Experience';
|
|
5
|
-
export { DefaultExperienceLoadingComponent } from './DefaultExperienceLoadingComponent';
|
|
1
|
+
import type { Reference } from '@ninetailed/experience.js';
|
|
2
|
+
import type { ExperienceProps } from './types/Experience';
|
|
3
|
+
export declare const Experience: <P, PassThroughProps extends Partial<P> = Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference = Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference>({ experiences, component: Component, loadingComponent: LoadingComponent, trackClicks, passthroughProps, ...baseline }: ExperienceProps<P, PassThroughProps, Variant>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export type { ExperienceProps, ExperienceBaseProps, ExperienceComponent, ExperienceLoadingComponent, } from './types/Experience';
|
|
5
|
+
export { DefaultExperienceLoadingComponent } from './DefaultExperienceLoadingComponent';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const EXPERIENCE_TRAIT_PREFIX = "nt_experiment_";
|
|
1
|
+
export declare const EXPERIENCE_TRAIT_PREFIX = "nt_experiment_";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Experience, DefaultExperienceLoadingComponent } from './Experience';
|
|
2
|
-
export type { ExperienceProps, ExperienceBaseProps, ExperienceComponent, ExperienceLoadingComponent, } from './types/Experience';
|
|
3
|
-
export { ESRProvider, ESRLoadingComponent } from './ESRLoadingComponent';
|
|
4
|
-
export { useExperience } from './useExperience';
|
|
1
|
+
export { Experience, DefaultExperienceLoadingComponent } from './Experience';
|
|
2
|
+
export type { ExperienceProps, ExperienceBaseProps, ExperienceComponent, ExperienceLoadingComponent, } from './types/Experience';
|
|
3
|
+
export { ESRProvider, ESRLoadingComponent } from './ESRLoadingComponent';
|
|
4
|
+
export { useExperience } from './useExperience';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type Baseline<P extends object = object> = P & {
|
|
2
|
-
id: string;
|
|
3
|
-
};
|
|
1
|
+
export type Baseline<P extends object = object> = P & {
|
|
2
|
+
id: string;
|
|
3
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Baseline } from './Baseline';
|
|
2
|
-
import { Variant } from './Variant';
|
|
3
|
-
export type BaselineWithVariants = {
|
|
4
|
-
baseline: Baseline;
|
|
5
|
-
variants: Variant<Record<string, unknown>>[];
|
|
6
|
-
};
|
|
1
|
+
import { Baseline } from './Baseline';
|
|
2
|
+
import { Variant } from './Variant';
|
|
3
|
+
export type BaselineWithVariants = {
|
|
4
|
+
baseline: Baseline;
|
|
5
|
+
variants: Variant<Record<string, unknown>>[];
|
|
6
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
2
|
-
import type { Baseline, ExperienceConfiguration, Reference } from '@ninetailed/experience.js';
|
|
3
|
-
export type ExperienceComponent<P> = ComponentType<Omit<P, 'id'> & {
|
|
4
|
-
ninetailed?: {
|
|
5
|
-
isPersonalized: boolean;
|
|
6
|
-
audience: {
|
|
7
|
-
id: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
}>;
|
|
11
|
-
export type ExperienceBaseProps<P, PassThroughProps extends Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference> = Baseline<Pick<P, Exclude<keyof P, keyof PassThroughProps>>> & {
|
|
12
|
-
experiences: ExperienceConfiguration<Variant>[];
|
|
13
|
-
component: ComponentType<P>;
|
|
14
|
-
passthroughProps?: PassThroughProps;
|
|
15
|
-
};
|
|
16
|
-
export type ExperienceLoadingComponent<P, PassThroughProps extends Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference> = ComponentType<ExperienceBaseProps<P, PassThroughProps, Variant>>;
|
|
17
|
-
export type ExperienceProps<P, PassThroughProps extends Partial<P> = Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference = Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference> = ExperienceBaseProps<P, PassThroughProps, Variant> & {
|
|
18
|
-
experiences: ExperienceConfiguration<Variant>[];
|
|
19
|
-
component: ComponentType<P>;
|
|
20
|
-
loadingComponent?: ExperienceLoadingComponent<P, PassThroughProps, Variant>;
|
|
21
|
-
trackClicks?: boolean;
|
|
22
|
-
};
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { Baseline, ExperienceConfiguration, Reference } from '@ninetailed/experience.js';
|
|
3
|
+
export type ExperienceComponent<P> = ComponentType<Omit<P, 'id'> & {
|
|
4
|
+
ninetailed?: {
|
|
5
|
+
isPersonalized: boolean;
|
|
6
|
+
audience: {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
}>;
|
|
11
|
+
export type ExperienceBaseProps<P, PassThroughProps extends Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference> = Baseline<Pick<P, Exclude<keyof P, keyof PassThroughProps>>> & {
|
|
12
|
+
experiences: ExperienceConfiguration<Variant>[];
|
|
13
|
+
component: ComponentType<P>;
|
|
14
|
+
passthroughProps?: PassThroughProps;
|
|
15
|
+
};
|
|
16
|
+
export type ExperienceLoadingComponent<P, PassThroughProps extends Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference> = ComponentType<ExperienceBaseProps<P, PassThroughProps, Variant>>;
|
|
17
|
+
export type ExperienceProps<P, PassThroughProps extends Partial<P> = Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference = Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference> = ExperienceBaseProps<P, PassThroughProps, Variant> & {
|
|
18
|
+
experiences: ExperienceConfiguration<Variant>[];
|
|
19
|
+
component: ComponentType<P>;
|
|
20
|
+
loadingComponent?: ExperienceLoadingComponent<P, PassThroughProps, Variant>;
|
|
21
|
+
trackClicks?: boolean;
|
|
22
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type Variant<P> = P & {
|
|
2
|
-
id: string;
|
|
3
|
-
};
|
|
1
|
+
export type Variant<P> = P & {
|
|
2
|
+
id: string;
|
|
3
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Baseline } from './Baseline';
|
|
2
|
-
export type { Variant } from './Variant';
|
|
3
|
-
export type { BaselineWithVariants } from './BaselineWithVariants';
|
|
4
|
-
export type { ExperienceProps, ExperienceBaseProps, ExperienceComponent, ExperienceLoadingComponent, } from './Experience';
|
|
1
|
+
export type { Baseline } from './Baseline';
|
|
2
|
+
export type { Variant } from './Variant';
|
|
3
|
+
export type { BaselineWithVariants } from './BaselineWithVariants';
|
|
4
|
+
export type { ExperienceProps, ExperienceBaseProps, ExperienceComponent, ExperienceLoadingComponent, } from './Experience';
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { ExperienceConfiguration, Profile, Reference, VariantRef } from '@ninetailed/experience.js';
|
|
2
|
-
type Load<TBaseline extends Reference> = {
|
|
3
|
-
status: 'loading';
|
|
4
|
-
loading: boolean;
|
|
5
|
-
hasVariants: boolean;
|
|
6
|
-
baseline: TBaseline;
|
|
7
|
-
experience: null;
|
|
8
|
-
variant: TBaseline;
|
|
9
|
-
variantIndex: 0;
|
|
10
|
-
audience: null;
|
|
11
|
-
isPersonalized: boolean;
|
|
12
|
-
profile: null;
|
|
13
|
-
error: null;
|
|
14
|
-
};
|
|
15
|
-
type Success<TBaseline extends Reference, TVariant extends Reference> = {
|
|
16
|
-
status: 'success';
|
|
17
|
-
loading: boolean;
|
|
18
|
-
hasVariants: boolean;
|
|
19
|
-
baseline: TBaseline;
|
|
20
|
-
experience: ExperienceConfiguration<TVariant> | null;
|
|
21
|
-
variant: TBaseline | TVariant;
|
|
22
|
-
variantIndex: number;
|
|
23
|
-
audience: {
|
|
24
|
-
id: string;
|
|
25
|
-
} | null;
|
|
26
|
-
isPersonalized: boolean;
|
|
27
|
-
profile: Profile;
|
|
28
|
-
error: null;
|
|
29
|
-
};
|
|
30
|
-
type Fail<TBaseline extends Reference> = {
|
|
31
|
-
status: 'error';
|
|
32
|
-
loading: boolean;
|
|
33
|
-
hasVariants: boolean;
|
|
34
|
-
baseline: TBaseline;
|
|
35
|
-
experience: null;
|
|
36
|
-
variant: TBaseline;
|
|
37
|
-
variantIndex: 0;
|
|
38
|
-
audience: null;
|
|
39
|
-
isPersonalized: boolean;
|
|
40
|
-
profile: null;
|
|
41
|
-
error: Error;
|
|
42
|
-
};
|
|
43
|
-
type UseExperienceArgs<TBaseline extends Reference, TVariant extends Reference> = {
|
|
44
|
-
baseline: TBaseline;
|
|
45
|
-
experiences: ExperienceConfiguration<TVariant>[];
|
|
46
|
-
};
|
|
47
|
-
type UseExperienceReturn<TBaseline extends Reference, TVariant extends Reference> = Load<TBaseline> | Success<TBaseline, TVariant | VariantRef> | Fail<TBaseline>;
|
|
48
|
-
export declare const useExperience: <TBaseline extends Reference, TVariant extends Reference>({ baseline, experiences, }: UseExperienceArgs<TBaseline, TVariant>) => UseExperienceReturn<TBaseline, TVariant>;
|
|
49
|
-
export {};
|
|
1
|
+
import { ExperienceConfiguration, Profile, Reference, VariantRef } from '@ninetailed/experience.js';
|
|
2
|
+
type Load<TBaseline extends Reference> = {
|
|
3
|
+
status: 'loading';
|
|
4
|
+
loading: boolean;
|
|
5
|
+
hasVariants: boolean;
|
|
6
|
+
baseline: TBaseline;
|
|
7
|
+
experience: null;
|
|
8
|
+
variant: TBaseline;
|
|
9
|
+
variantIndex: 0;
|
|
10
|
+
audience: null;
|
|
11
|
+
isPersonalized: boolean;
|
|
12
|
+
profile: null;
|
|
13
|
+
error: null;
|
|
14
|
+
};
|
|
15
|
+
type Success<TBaseline extends Reference, TVariant extends Reference> = {
|
|
16
|
+
status: 'success';
|
|
17
|
+
loading: boolean;
|
|
18
|
+
hasVariants: boolean;
|
|
19
|
+
baseline: TBaseline;
|
|
20
|
+
experience: ExperienceConfiguration<TVariant> | null;
|
|
21
|
+
variant: TBaseline | TVariant;
|
|
22
|
+
variantIndex: number;
|
|
23
|
+
audience: {
|
|
24
|
+
id: string;
|
|
25
|
+
} | null;
|
|
26
|
+
isPersonalized: boolean;
|
|
27
|
+
profile: Profile;
|
|
28
|
+
error: null;
|
|
29
|
+
};
|
|
30
|
+
type Fail<TBaseline extends Reference> = {
|
|
31
|
+
status: 'error';
|
|
32
|
+
loading: boolean;
|
|
33
|
+
hasVariants: boolean;
|
|
34
|
+
baseline: TBaseline;
|
|
35
|
+
experience: null;
|
|
36
|
+
variant: TBaseline;
|
|
37
|
+
variantIndex: 0;
|
|
38
|
+
audience: null;
|
|
39
|
+
isPersonalized: boolean;
|
|
40
|
+
profile: null;
|
|
41
|
+
error: Error;
|
|
42
|
+
};
|
|
43
|
+
type UseExperienceArgs<TBaseline extends Reference, TVariant extends Reference> = {
|
|
44
|
+
baseline: TBaseline;
|
|
45
|
+
experiences: ExperienceConfiguration<TVariant>[];
|
|
46
|
+
};
|
|
47
|
+
type UseExperienceReturn<TBaseline extends Reference, TVariant extends Reference> = Load<TBaseline> | Success<TBaseline, TVariant | VariantRef> | Fail<TBaseline>;
|
|
48
|
+
export declare const useExperience: <TBaseline extends Reference, TVariant extends Reference>({ baseline, experiences, }: UseExperienceArgs<TBaseline, TVariant>) => UseExperienceReturn<TBaseline, TVariant>;
|
|
49
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
type MergeTagProps = {
|
|
3
|
-
id: string;
|
|
4
|
-
fallback?: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const MergeTag: ({ id, fallback, }: PropsWithChildren<MergeTagProps>) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
-
export {};
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
type MergeTagProps = {
|
|
3
|
+
id: string;
|
|
4
|
+
fallback?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const MergeTag: ({ id, fallback, }: PropsWithChildren<MergeTagProps>) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Profile } from '@ninetailed/experience.js-shared';
|
|
2
|
-
export declare const generateSelectors: (id: string) => string[];
|
|
3
|
-
export declare const selectValueFromProfile: (profile: Profile, id: string) => unknown;
|
|
1
|
+
import { Profile } from '@ninetailed/experience.js-shared';
|
|
2
|
+
export declare const generateSelectors: (id: string) => string[];
|
|
3
|
+
export declare const selectValueFromProfile: (profile: Profile, id: string) => unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './MergeTag';
|
|
1
|
+
export * from './MergeTag';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const NinetailedContext: import("react").Context<NinetailedInstance<import("@ninetailed/experience.js").Reference, import("@ninetailed/experience.js").Reference> | undefined>;
|
|
1
|
+
import { NinetailedInstance } from '@ninetailed/experience.js';
|
|
2
|
+
export declare const NinetailedContext: import("react").Context<NinetailedInstance<import("@ninetailed/experience.js").Reference, import("@ninetailed/experience.js").Reference> | undefined>;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Ninetailed, OnInitProfileId, Storage } from '@ninetailed/experience.js';
|
|
3
|
-
import { Locale, OnErrorHandler, OnLogHandler, NinetailedRequestContext } from '@ninetailed/experience.js-shared';
|
|
4
|
-
import { NinetailedPlugin } from '@ninetailed/experience.js-plugin-analytics';
|
|
5
|
-
export type NinetailedProviderInstantiationProps = {
|
|
6
|
-
clientId: string;
|
|
7
|
-
environment?: string;
|
|
8
|
-
preview?: boolean;
|
|
9
|
-
url?: string;
|
|
10
|
-
plugins?: (NinetailedPlugin | NinetailedPlugin[])[];
|
|
11
|
-
locale?: Locale;
|
|
12
|
-
requestTimeout?: number;
|
|
13
|
-
onLog?: OnLogHandler;
|
|
14
|
-
onError?: OnErrorHandler;
|
|
15
|
-
componentViewTrackingThreshold?: number;
|
|
16
|
-
buildClientContext?: () => NinetailedRequestContext;
|
|
17
|
-
onInitProfileId?: OnInitProfileId;
|
|
18
|
-
storageImpl?: Storage;
|
|
19
|
-
useSDKEvaluation?: boolean;
|
|
20
|
-
};
|
|
21
|
-
export type NinetailedProviderProps = NinetailedProviderInstantiationProps | {
|
|
22
|
-
ninetailed: Ninetailed;
|
|
23
|
-
};
|
|
24
|
-
export declare const NinetailedProvider: (props: React.PropsWithChildren<NinetailedProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Ninetailed, OnInitProfileId, Storage } from '@ninetailed/experience.js';
|
|
3
|
+
import { Locale, OnErrorHandler, OnLogHandler, NinetailedRequestContext } from '@ninetailed/experience.js-shared';
|
|
4
|
+
import { NinetailedPlugin } from '@ninetailed/experience.js-plugin-analytics';
|
|
5
|
+
export type NinetailedProviderInstantiationProps = {
|
|
6
|
+
clientId: string;
|
|
7
|
+
environment?: string;
|
|
8
|
+
preview?: boolean;
|
|
9
|
+
url?: string;
|
|
10
|
+
plugins?: (NinetailedPlugin | NinetailedPlugin[])[];
|
|
11
|
+
locale?: Locale;
|
|
12
|
+
requestTimeout?: number;
|
|
13
|
+
onLog?: OnLogHandler;
|
|
14
|
+
onError?: OnErrorHandler;
|
|
15
|
+
componentViewTrackingThreshold?: number;
|
|
16
|
+
buildClientContext?: () => NinetailedRequestContext;
|
|
17
|
+
onInitProfileId?: OnInitProfileId;
|
|
18
|
+
storageImpl?: Storage;
|
|
19
|
+
useSDKEvaluation?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type NinetailedProviderProps = NinetailedProviderInstantiationProps | {
|
|
22
|
+
ninetailed: Ninetailed;
|
|
23
|
+
};
|
|
24
|
+
export declare const NinetailedProvider: (props: React.PropsWithChildren<NinetailedProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
package/src/lib/Personalize.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Variant } from './Variant';
|
|
3
|
-
export type PersonalizedComponent<P> = React.ComponentType<Omit<P, 'id'> & {
|
|
4
|
-
ninetailed?: {
|
|
5
|
-
isPersonalized: boolean;
|
|
6
|
-
audience: {
|
|
7
|
-
id: string;
|
|
8
|
-
} | {
|
|
9
|
-
id: 'baseline';
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
}>;
|
|
13
|
-
type Baseline<P> = P & {
|
|
14
|
-
id: string;
|
|
15
|
-
};
|
|
16
|
-
type PersonalizeProps<P> = Baseline<P> & {
|
|
17
|
-
variants?: Variant<P>[];
|
|
18
|
-
component: PersonalizedComponent<P> | React.ComponentType<P>;
|
|
19
|
-
loadingComponent?: React.ComponentType;
|
|
20
|
-
holdout?: number;
|
|
21
|
-
};
|
|
22
|
-
export declare const Personalize: <P extends object>({ component: Component, loadingComponent: LoadingComponent, variants, holdout, ...baseline }: PersonalizeProps<P>) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Variant } from './Variant';
|
|
3
|
+
export type PersonalizedComponent<P> = React.ComponentType<Omit<P, 'id'> & {
|
|
4
|
+
ninetailed?: {
|
|
5
|
+
isPersonalized: boolean;
|
|
6
|
+
audience: {
|
|
7
|
+
id: string;
|
|
8
|
+
} | {
|
|
9
|
+
id: 'baseline';
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
13
|
+
type Baseline<P> = P & {
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
type PersonalizeProps<P> = Baseline<P> & {
|
|
17
|
+
variants?: Variant<P>[];
|
|
18
|
+
component: PersonalizedComponent<P> | React.ComponentType<P>;
|
|
19
|
+
loadingComponent?: React.ComponentType;
|
|
20
|
+
holdout?: number;
|
|
21
|
+
};
|
|
22
|
+
export declare const Personalize: <P extends object>({ component: Component, loadingComponent: LoadingComponent, variants, holdout, ...baseline }: PersonalizeProps<P>) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Variant } from './Variant';
|
|
3
|
-
type TrackHasSeenComponentProps = {
|
|
4
|
-
variant: Variant<any>;
|
|
5
|
-
audience: {
|
|
6
|
-
id: string;
|
|
7
|
-
};
|
|
8
|
-
isPersonalized: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare const TrackHasSeenComponent: React.FC<React.PropsWithChildren<TrackHasSeenComponentProps>>;
|
|
11
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Variant } from './Variant';
|
|
3
|
+
type TrackHasSeenComponentProps = {
|
|
4
|
+
variant: Variant<any>;
|
|
5
|
+
audience: {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
isPersonalized: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const TrackHasSeenComponent: React.FC<React.PropsWithChildren<TrackHasSeenComponentProps>>;
|
|
11
|
+
export {};
|
package/src/lib/Variant.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type Variant<P = unknown> = P & {
|
|
2
|
-
id: string;
|
|
3
|
-
audience: {
|
|
4
|
-
id: string;
|
|
5
|
-
};
|
|
6
|
-
};
|
|
1
|
+
export type Variant<P = unknown> = P & {
|
|
2
|
+
id: string;
|
|
3
|
+
audience: {
|
|
4
|
+
id: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
package/src/lib/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export type { Profile, Variant } from '@ninetailed/experience.js-shared';
|
|
2
|
-
export type { ExperienceConfiguration, ExperienceType, EXPERIENCE_TRAIT_PREFIX, } from '@ninetailed/experience.js';
|
|
3
|
-
export { NinetailedProvider } from './NinetailedProvider';
|
|
4
|
-
export type { NinetailedProviderProps, NinetailedProviderInstantiationProps, } from './NinetailedProvider';
|
|
5
|
-
export { useNinetailed } from './useNinetailed';
|
|
6
|
-
export { useProfile } from './useProfile';
|
|
7
|
-
export { usePersonalize } from './usePersonalize';
|
|
8
|
-
export { useFlag } from './useFlag';
|
|
9
|
-
export { useFlagWithManualTracking } from './useFlagWithManualTracking';
|
|
10
|
-
export { Personalize } from './Personalize';
|
|
11
|
-
export type { PersonalizedComponent } from './Personalize';
|
|
12
|
-
export { MergeTag } from './MergeTag';
|
|
13
|
-
export { TrackHasSeenComponent } from './TrackHasSeenComponent';
|
|
14
|
-
export { Experience, ESRProvider, ESRLoadingComponent, DefaultExperienceLoadingComponent, useExperience, } from './Experience';
|
|
15
|
-
export type { ExperienceProps, ExperienceBaseProps, ExperienceComponent, ExperienceLoadingComponent, } from './Experience';
|
|
16
|
-
export { EntryAnalytics } from './EntryAnalytics';
|
|
17
|
-
export type { EntryAnalyticsProps } from './EntryAnalytics';
|
|
1
|
+
export type { Profile, Variant } from '@ninetailed/experience.js-shared';
|
|
2
|
+
export type { ExperienceConfiguration, ExperienceType, EXPERIENCE_TRAIT_PREFIX, } from '@ninetailed/experience.js';
|
|
3
|
+
export { NinetailedProvider } from './NinetailedProvider';
|
|
4
|
+
export type { NinetailedProviderProps, NinetailedProviderInstantiationProps, } from './NinetailedProvider';
|
|
5
|
+
export { useNinetailed } from './useNinetailed';
|
|
6
|
+
export { useProfile } from './useProfile';
|
|
7
|
+
export { usePersonalize } from './usePersonalize';
|
|
8
|
+
export { useFlag } from './useFlag';
|
|
9
|
+
export { useFlagWithManualTracking } from './useFlagWithManualTracking';
|
|
10
|
+
export { Personalize } from './Personalize';
|
|
11
|
+
export type { PersonalizedComponent } from './Personalize';
|
|
12
|
+
export { MergeTag } from './MergeTag';
|
|
13
|
+
export { TrackHasSeenComponent } from './TrackHasSeenComponent';
|
|
14
|
+
export { Experience, ESRProvider, ESRLoadingComponent, DefaultExperienceLoadingComponent, useExperience, } from './Experience';
|
|
15
|
+
export type { ExperienceProps, ExperienceBaseProps, ExperienceComponent, ExperienceLoadingComponent, } from './Experience';
|
|
16
|
+
export { EntryAnalytics } from './EntryAnalytics';
|
|
17
|
+
export type { EntryAnalyticsProps } from './EntryAnalytics';
|
package/src/lib/useFlag.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { AllowedVariableType } from '@ninetailed/experience.js-shared';
|
|
2
|
-
export type FlagResult<T> = {
|
|
3
|
-
status: 'loading';
|
|
4
|
-
value: T;
|
|
5
|
-
error: null;
|
|
6
|
-
} | {
|
|
7
|
-
status: 'success';
|
|
8
|
-
value: T;
|
|
9
|
-
error: null;
|
|
10
|
-
} | {
|
|
11
|
-
status: 'error';
|
|
12
|
-
value: T;
|
|
13
|
-
error: Error;
|
|
14
|
-
};
|
|
15
|
-
type UseFlagOptions = {
|
|
16
|
-
/**
|
|
17
|
-
* Type for auto tracking
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* if this is a function then it should be stable, otherwise tracking will happen more frequently than expected
|
|
21
|
-
*/
|
|
22
|
-
shouldAutoTrack?: boolean | (() => boolean);
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Hook to access a Ninetailed variable flag with built-in auto-tracking.
|
|
26
|
-
*
|
|
27
|
-
* @remarks
|
|
28
|
-
* For manual control over tracking behavior, consider using {@link useFlagWithManualTracking}.
|
|
29
|
-
*/
|
|
30
|
-
export declare function useFlag<T extends AllowedVariableType>(flagKey: string, defaultValue: T, options?: UseFlagOptions): FlagResult<T>;
|
|
31
|
-
export {};
|
|
1
|
+
import { AllowedVariableType } from '@ninetailed/experience.js-shared';
|
|
2
|
+
export type FlagResult<T> = {
|
|
3
|
+
status: 'loading';
|
|
4
|
+
value: T;
|
|
5
|
+
error: null;
|
|
6
|
+
} | {
|
|
7
|
+
status: 'success';
|
|
8
|
+
value: T;
|
|
9
|
+
error: null;
|
|
10
|
+
} | {
|
|
11
|
+
status: 'error';
|
|
12
|
+
value: T;
|
|
13
|
+
error: Error;
|
|
14
|
+
};
|
|
15
|
+
type UseFlagOptions = {
|
|
16
|
+
/**
|
|
17
|
+
* Type for auto tracking
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* if this is a function then it should be stable, otherwise tracking will happen more frequently than expected
|
|
21
|
+
*/
|
|
22
|
+
shouldAutoTrack?: boolean | (() => boolean);
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Hook to access a Ninetailed variable flag with built-in auto-tracking.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* For manual control over tracking behavior, consider using {@link useFlagWithManualTracking}.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useFlag<T extends AllowedVariableType>(flagKey: string, defaultValue: T, options?: UseFlagOptions): FlagResult<T>;
|
|
31
|
+
export {};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { AllowedVariableType } from '@ninetailed/experience.js-shared';
|
|
2
|
-
export type FlagResult<T> = {
|
|
3
|
-
status: 'loading';
|
|
4
|
-
value: T;
|
|
5
|
-
error: null;
|
|
6
|
-
} | {
|
|
7
|
-
status: 'success';
|
|
8
|
-
value: T;
|
|
9
|
-
error: null;
|
|
10
|
-
} | {
|
|
11
|
-
status: 'error';
|
|
12
|
-
value: T;
|
|
13
|
-
error: Error;
|
|
14
|
-
};
|
|
15
|
-
export type FlagResultWithTracking<T> = [FlagResult<T>, () => void];
|
|
16
|
-
/**
|
|
17
|
-
* Hook to access a Ninetailed variable flag with manual tracking control.
|
|
18
|
-
*/
|
|
19
|
-
export declare function useFlagWithManualTracking<T extends AllowedVariableType>(flagKey: string, defaultValue: T): FlagResultWithTracking<T>;
|
|
1
|
+
import { AllowedVariableType } from '@ninetailed/experience.js-shared';
|
|
2
|
+
export type FlagResult<T> = {
|
|
3
|
+
status: 'loading';
|
|
4
|
+
value: T;
|
|
5
|
+
error: null;
|
|
6
|
+
} | {
|
|
7
|
+
status: 'success';
|
|
8
|
+
value: T;
|
|
9
|
+
error: null;
|
|
10
|
+
} | {
|
|
11
|
+
status: 'error';
|
|
12
|
+
value: T;
|
|
13
|
+
error: Error;
|
|
14
|
+
};
|
|
15
|
+
export type FlagResultWithTracking<T> = [FlagResult<T>, () => void];
|
|
16
|
+
/**
|
|
17
|
+
* Hook to access a Ninetailed variable flag with manual tracking control.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useFlagWithManualTracking<T extends AllowedVariableType>(flagKey: string, defaultValue: T): FlagResultWithTracking<T>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { NinetailedInstance } from '@ninetailed/experience.js';
|
|
2
|
-
import { Reference } from '@ninetailed/experience.js-shared';
|
|
3
|
-
export declare const useNinetailed: <TBaseline extends Reference = Reference, TVariant extends Reference = Reference>() => NinetailedInstance<TBaseline, TVariant>;
|
|
1
|
+
import { NinetailedInstance } from '@ninetailed/experience.js';
|
|
2
|
+
import { Reference } from '@ninetailed/experience.js-shared';
|
|
3
|
+
export declare const useNinetailed: <TBaseline extends Reference = Reference, TVariant extends Reference = Reference>() => NinetailedInstance<TBaseline, TVariant>;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { Variant } from '@ninetailed/experience.js-shared';
|
|
2
|
-
type Options = {
|
|
3
|
-
holdout?: number;
|
|
4
|
-
};
|
|
5
|
-
export declare const usePersonalize: <T extends {
|
|
6
|
-
id: string;
|
|
7
|
-
}>(baseline: T, variants: Variant<T>[], options?: Options) => {
|
|
8
|
-
loading: true;
|
|
9
|
-
variant: Variant<T>;
|
|
10
|
-
audience: {
|
|
11
|
-
id: "baseline";
|
|
12
|
-
};
|
|
13
|
-
isPersonalized: false;
|
|
14
|
-
error: null;
|
|
15
|
-
} | {
|
|
16
|
-
loading: false;
|
|
17
|
-
variant: Variant<T>;
|
|
18
|
-
audience: {
|
|
19
|
-
id: string;
|
|
20
|
-
};
|
|
21
|
-
isPersonalized: boolean;
|
|
22
|
-
error: null;
|
|
23
|
-
} | {
|
|
24
|
-
loading: false;
|
|
25
|
-
variant: Variant<T>;
|
|
26
|
-
audience: {
|
|
27
|
-
id: "baseline";
|
|
28
|
-
};
|
|
29
|
-
isPersonalized: false;
|
|
30
|
-
error: Error;
|
|
31
|
-
};
|
|
32
|
-
export {};
|
|
1
|
+
import { Variant } from '@ninetailed/experience.js-shared';
|
|
2
|
+
type Options = {
|
|
3
|
+
holdout?: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const usePersonalize: <T extends {
|
|
6
|
+
id: string;
|
|
7
|
+
}>(baseline: T, variants: Variant<T>[], options?: Options) => {
|
|
8
|
+
loading: true;
|
|
9
|
+
variant: Variant<T>;
|
|
10
|
+
audience: {
|
|
11
|
+
id: "baseline";
|
|
12
|
+
};
|
|
13
|
+
isPersonalized: false;
|
|
14
|
+
error: null;
|
|
15
|
+
} | {
|
|
16
|
+
loading: false;
|
|
17
|
+
variant: Variant<T>;
|
|
18
|
+
audience: {
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
isPersonalized: boolean;
|
|
22
|
+
error: null;
|
|
23
|
+
} | {
|
|
24
|
+
loading: false;
|
|
25
|
+
variant: Variant<T>;
|
|
26
|
+
audience: {
|
|
27
|
+
id: "baseline";
|
|
28
|
+
};
|
|
29
|
+
isPersonalized: false;
|
|
30
|
+
error: Error;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
package/src/lib/useProfile.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ProfileState } from '@ninetailed/experience.js';
|
|
2
|
-
type UseProfileHookResult = Omit<ProfileState, 'experiences'> & {
|
|
3
|
-
loading: boolean;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Custom hook that provides access to the Ninetailed profile state
|
|
7
|
-
* with the 'experiences' property removed to prevent unnecessary re-renders.
|
|
8
|
-
*
|
|
9
|
-
* This hook handles profile state changes efficiently by:
|
|
10
|
-
* 1. Only updating state when actual changes occur
|
|
11
|
-
* 2. Removing the large 'experiences' object from the state
|
|
12
|
-
* 3. Properly cleaning up subscriptions when components unmount
|
|
13
|
-
*
|
|
14
|
-
* @returns The profile state without the 'experiences' property
|
|
15
|
-
*/
|
|
16
|
-
export declare const useProfile: () => UseProfileHookResult;
|
|
17
|
-
export {};
|
|
1
|
+
import { ProfileState } from '@ninetailed/experience.js';
|
|
2
|
+
type UseProfileHookResult = Omit<ProfileState, 'experiences'> & {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Custom hook that provides access to the Ninetailed profile state
|
|
7
|
+
* with the 'experiences' property removed to prevent unnecessary re-renders.
|
|
8
|
+
*
|
|
9
|
+
* This hook handles profile state changes efficiently by:
|
|
10
|
+
* 1. Only updating state when actual changes occur
|
|
11
|
+
* 2. Removing the large 'experiences' object from the state
|
|
12
|
+
* 3. Properly cleaning up subscriptions when components unmount
|
|
13
|
+
*
|
|
14
|
+
* @returns The profile state without the 'experiences' property
|
|
15
|
+
*/
|
|
16
|
+
export declare const useProfile: () => UseProfileHookResult;
|
|
17
|
+
export {};
|