@uniformdev/context-react 20.35.0 → 20.35.1-alpha.210
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/dist/index.d.mts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.esm.js +10 -6
- package/dist/index.js +10 -6
- package/dist/index.mjs +10 -6
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Quirks, ScoreVector, Context, PersonalizedVariant, TestVariant, EnrichmentData } from '@uniformdev/context';
|
|
1
|
+
import { Quirks, ScoreVector, Context, PersonalizedVariant, CompositionMetadata, TestVariant, EnrichmentData } from '@uniformdev/context';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import react__default, { ReactNode, ReactElement, HTMLAttributes } from 'react';
|
|
3
|
+
import react__default, { ReactNode, ReactElement, HTMLAttributes, JSX } from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Provides reactive access to the Uniform Context's current visitor quirks values
|
|
@@ -90,6 +90,8 @@ type PersonalizeComponentProps<TVariation extends PersonalizedVariant> = {
|
|
|
90
90
|
algorithm?: string;
|
|
91
91
|
/** The possible variations of the content to render depending on personalization conditions */
|
|
92
92
|
variations: TVariation[];
|
|
93
|
+
/** Composition metadata where the personalization is being rendered for analytics tracking */
|
|
94
|
+
compositionMetadata?: CompositionMetadata;
|
|
93
95
|
/** A React component to use to render a selected variant. */
|
|
94
96
|
component: PersonalizedVariationComponent<TVariation>;
|
|
95
97
|
/** A React component that will be used to wrap all personalized variants. If no variants match, the wrapper is not rendered. */
|
|
@@ -105,6 +107,8 @@ interface TestComponentProps<TVariation extends TestVariant> {
|
|
|
105
107
|
name: string;
|
|
106
108
|
/** Variation list that this test will selected from. */
|
|
107
109
|
variations: TVariation[];
|
|
110
|
+
/** Composition metadata where the A/B test is being rendered for analytics tracking */
|
|
111
|
+
compositionMetadata?: CompositionMetadata;
|
|
108
112
|
/**
|
|
109
113
|
* Determines what should be rendered if testing is in a "loading" state.
|
|
110
114
|
* default: shows the default variation while loading
|
|
@@ -162,7 +166,7 @@ type TrackProps = TrackFragmentProps & HTMLAttributes<HTMLElement> & {
|
|
|
162
166
|
* only on page load, but does not render a wrapping tag.
|
|
163
167
|
*/
|
|
164
168
|
declare const Track: ({ behavior, children, tagName, threshold, disableVisibilityTrigger, ...rest }: TrackProps) => react.DOMElement<{
|
|
165
|
-
ref: react.RefObject<HTMLElement>;
|
|
169
|
+
ref: react.RefObject<HTMLElement | null>;
|
|
166
170
|
defaultChecked?: boolean | undefined;
|
|
167
171
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
168
172
|
suppressContentEditableWarning?: boolean | undefined;
|
|
@@ -210,6 +214,10 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
210
214
|
results?: number | undefined;
|
|
211
215
|
security?: string | undefined;
|
|
212
216
|
unselectable?: "on" | "off" | undefined;
|
|
217
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined;
|
|
218
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
219
|
+
popoverTarget?: string | undefined;
|
|
220
|
+
inert?: boolean | undefined;
|
|
213
221
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
214
222
|
is?: string | undefined;
|
|
215
223
|
exportparts?: string | undefined;
|
|
@@ -418,6 +426,8 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
418
426
|
onLostPointerCaptureCapture?: react.PointerEventHandler<HTMLElement> | undefined;
|
|
419
427
|
onScroll?: react.UIEventHandler<HTMLElement> | undefined;
|
|
420
428
|
onScrollCapture?: react.UIEventHandler<HTMLElement> | undefined;
|
|
429
|
+
onScrollEnd?: react.UIEventHandler<HTMLElement> | undefined;
|
|
430
|
+
onScrollEndCapture?: react.UIEventHandler<HTMLElement> | undefined;
|
|
421
431
|
onWheel?: react.WheelEventHandler<HTMLElement> | undefined;
|
|
422
432
|
onWheelCapture?: react.WheelEventHandler<HTMLElement> | undefined;
|
|
423
433
|
onAnimationStart?: react.AnimationEventHandler<HTMLElement> | undefined;
|
|
@@ -426,8 +436,16 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
426
436
|
onAnimationEndCapture?: react.AnimationEventHandler<HTMLElement> | undefined;
|
|
427
437
|
onAnimationIteration?: react.AnimationEventHandler<HTMLElement> | undefined;
|
|
428
438
|
onAnimationIterationCapture?: react.AnimationEventHandler<HTMLElement> | undefined;
|
|
439
|
+
onToggle?: react.ToggleEventHandler<HTMLElement> | undefined;
|
|
440
|
+
onBeforeToggle?: react.ToggleEventHandler<HTMLElement> | undefined;
|
|
441
|
+
onTransitionCancel?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
442
|
+
onTransitionCancelCapture?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
429
443
|
onTransitionEnd?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
430
444
|
onTransitionEndCapture?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
445
|
+
onTransitionRun?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
446
|
+
onTransitionRunCapture?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
447
|
+
onTransitionStart?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
448
|
+
onTransitionStartCapture?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
431
449
|
'data-track-on-view-wrapper'?: string;
|
|
432
450
|
}, HTMLElement>;
|
|
433
451
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Quirks, ScoreVector, Context, PersonalizedVariant, TestVariant, EnrichmentData } from '@uniformdev/context';
|
|
1
|
+
import { Quirks, ScoreVector, Context, PersonalizedVariant, CompositionMetadata, TestVariant, EnrichmentData } from '@uniformdev/context';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import react__default, { ReactNode, ReactElement, HTMLAttributes } from 'react';
|
|
3
|
+
import react__default, { ReactNode, ReactElement, HTMLAttributes, JSX } from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Provides reactive access to the Uniform Context's current visitor quirks values
|
|
@@ -90,6 +90,8 @@ type PersonalizeComponentProps<TVariation extends PersonalizedVariant> = {
|
|
|
90
90
|
algorithm?: string;
|
|
91
91
|
/** The possible variations of the content to render depending on personalization conditions */
|
|
92
92
|
variations: TVariation[];
|
|
93
|
+
/** Composition metadata where the personalization is being rendered for analytics tracking */
|
|
94
|
+
compositionMetadata?: CompositionMetadata;
|
|
93
95
|
/** A React component to use to render a selected variant. */
|
|
94
96
|
component: PersonalizedVariationComponent<TVariation>;
|
|
95
97
|
/** A React component that will be used to wrap all personalized variants. If no variants match, the wrapper is not rendered. */
|
|
@@ -105,6 +107,8 @@ interface TestComponentProps<TVariation extends TestVariant> {
|
|
|
105
107
|
name: string;
|
|
106
108
|
/** Variation list that this test will selected from. */
|
|
107
109
|
variations: TVariation[];
|
|
110
|
+
/** Composition metadata where the A/B test is being rendered for analytics tracking */
|
|
111
|
+
compositionMetadata?: CompositionMetadata;
|
|
108
112
|
/**
|
|
109
113
|
* Determines what should be rendered if testing is in a "loading" state.
|
|
110
114
|
* default: shows the default variation while loading
|
|
@@ -162,7 +166,7 @@ type TrackProps = TrackFragmentProps & HTMLAttributes<HTMLElement> & {
|
|
|
162
166
|
* only on page load, but does not render a wrapping tag.
|
|
163
167
|
*/
|
|
164
168
|
declare const Track: ({ behavior, children, tagName, threshold, disableVisibilityTrigger, ...rest }: TrackProps) => react.DOMElement<{
|
|
165
|
-
ref: react.RefObject<HTMLElement>;
|
|
169
|
+
ref: react.RefObject<HTMLElement | null>;
|
|
166
170
|
defaultChecked?: boolean | undefined;
|
|
167
171
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
168
172
|
suppressContentEditableWarning?: boolean | undefined;
|
|
@@ -210,6 +214,10 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
210
214
|
results?: number | undefined;
|
|
211
215
|
security?: string | undefined;
|
|
212
216
|
unselectable?: "on" | "off" | undefined;
|
|
217
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined;
|
|
218
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
219
|
+
popoverTarget?: string | undefined;
|
|
220
|
+
inert?: boolean | undefined;
|
|
213
221
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
214
222
|
is?: string | undefined;
|
|
215
223
|
exportparts?: string | undefined;
|
|
@@ -418,6 +426,8 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
418
426
|
onLostPointerCaptureCapture?: react.PointerEventHandler<HTMLElement> | undefined;
|
|
419
427
|
onScroll?: react.UIEventHandler<HTMLElement> | undefined;
|
|
420
428
|
onScrollCapture?: react.UIEventHandler<HTMLElement> | undefined;
|
|
429
|
+
onScrollEnd?: react.UIEventHandler<HTMLElement> | undefined;
|
|
430
|
+
onScrollEndCapture?: react.UIEventHandler<HTMLElement> | undefined;
|
|
421
431
|
onWheel?: react.WheelEventHandler<HTMLElement> | undefined;
|
|
422
432
|
onWheelCapture?: react.WheelEventHandler<HTMLElement> | undefined;
|
|
423
433
|
onAnimationStart?: react.AnimationEventHandler<HTMLElement> | undefined;
|
|
@@ -426,8 +436,16 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
426
436
|
onAnimationEndCapture?: react.AnimationEventHandler<HTMLElement> | undefined;
|
|
427
437
|
onAnimationIteration?: react.AnimationEventHandler<HTMLElement> | undefined;
|
|
428
438
|
onAnimationIterationCapture?: react.AnimationEventHandler<HTMLElement> | undefined;
|
|
439
|
+
onToggle?: react.ToggleEventHandler<HTMLElement> | undefined;
|
|
440
|
+
onBeforeToggle?: react.ToggleEventHandler<HTMLElement> | undefined;
|
|
441
|
+
onTransitionCancel?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
442
|
+
onTransitionCancelCapture?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
429
443
|
onTransitionEnd?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
430
444
|
onTransitionEndCapture?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
445
|
+
onTransitionRun?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
446
|
+
onTransitionRunCapture?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
447
|
+
onTransitionStart?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
448
|
+
onTransitionStartCapture?: react.TransitionEventHandler<HTMLElement> | undefined;
|
|
431
449
|
'data-track-on-view-wrapper'?: string;
|
|
432
450
|
}, HTMLElement>;
|
|
433
451
|
|
package/dist/index.esm.js
CHANGED
|
@@ -122,7 +122,8 @@ function PersonalizeStandard({
|
|
|
122
122
|
wrapperComponent,
|
|
123
123
|
name,
|
|
124
124
|
algorithm,
|
|
125
|
-
count = 1
|
|
125
|
+
count = 1,
|
|
126
|
+
compositionMetadata
|
|
126
127
|
}) {
|
|
127
128
|
const { context } = useUniformContext();
|
|
128
129
|
const scores = useScores();
|
|
@@ -132,10 +133,11 @@ function PersonalizeStandard({
|
|
|
132
133
|
name,
|
|
133
134
|
variations,
|
|
134
135
|
take: count,
|
|
135
|
-
algorithm
|
|
136
|
+
algorithm,
|
|
137
|
+
compositionMetadata
|
|
136
138
|
}),
|
|
137
139
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
|
-
[scores, quirks, context, count, name, variations]
|
|
140
|
+
[scores, quirks, context, count, name, variations, compositionMetadata]
|
|
139
141
|
);
|
|
140
142
|
const Wrapper = wrapperComponent != null ? wrapperComponent : ({ children }) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
|
|
141
143
|
const Component = component;
|
|
@@ -205,12 +207,14 @@ import React5 from "react";
|
|
|
205
207
|
var TestStandard = ({
|
|
206
208
|
name,
|
|
207
209
|
variations,
|
|
208
|
-
component
|
|
210
|
+
component,
|
|
211
|
+
compositionMetadata
|
|
209
212
|
}) => {
|
|
210
213
|
const { context } = useUniformContext();
|
|
211
214
|
const { result } = context.test({
|
|
212
215
|
name,
|
|
213
|
-
variations
|
|
216
|
+
variations,
|
|
217
|
+
compositionMetadata
|
|
214
218
|
});
|
|
215
219
|
if (!result) {
|
|
216
220
|
return null;
|
|
@@ -265,7 +269,7 @@ var Track = ({
|
|
|
265
269
|
const [lastUrl, setLastUrl] = useState3();
|
|
266
270
|
const [hasTracked, setHasTracked] = useState3(false);
|
|
267
271
|
const wrapperEl = useRef(null);
|
|
268
|
-
const disconnect = useRef();
|
|
272
|
+
const disconnect = useRef(null);
|
|
269
273
|
useEffect3(() => {
|
|
270
274
|
const urlHasChanged = lastUrl !== currentUrl;
|
|
271
275
|
if (urlHasChanged) {
|
package/dist/index.js
CHANGED
|
@@ -164,7 +164,8 @@ function PersonalizeStandard({
|
|
|
164
164
|
wrapperComponent,
|
|
165
165
|
name,
|
|
166
166
|
algorithm,
|
|
167
|
-
count = 1
|
|
167
|
+
count = 1,
|
|
168
|
+
compositionMetadata
|
|
168
169
|
}) {
|
|
169
170
|
const { context } = useUniformContext();
|
|
170
171
|
const scores = useScores();
|
|
@@ -174,10 +175,11 @@ function PersonalizeStandard({
|
|
|
174
175
|
name,
|
|
175
176
|
variations,
|
|
176
177
|
take: count,
|
|
177
|
-
algorithm
|
|
178
|
+
algorithm,
|
|
179
|
+
compositionMetadata
|
|
178
180
|
}),
|
|
179
181
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
180
|
-
[scores, quirks, context, count, name, variations]
|
|
182
|
+
[scores, quirks, context, count, name, variations, compositionMetadata]
|
|
181
183
|
);
|
|
182
184
|
const Wrapper = wrapperComponent != null ? wrapperComponent : ({ children }) => /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, children);
|
|
183
185
|
const Component = component;
|
|
@@ -247,12 +249,14 @@ var import_react10 = __toESM(require("react"));
|
|
|
247
249
|
var TestStandard = ({
|
|
248
250
|
name,
|
|
249
251
|
variations,
|
|
250
|
-
component
|
|
252
|
+
component,
|
|
253
|
+
compositionMetadata
|
|
251
254
|
}) => {
|
|
252
255
|
const { context } = useUniformContext();
|
|
253
256
|
const { result } = context.test({
|
|
254
257
|
name,
|
|
255
|
-
variations
|
|
258
|
+
variations,
|
|
259
|
+
compositionMetadata
|
|
256
260
|
});
|
|
257
261
|
if (!result) {
|
|
258
262
|
return null;
|
|
@@ -307,7 +311,7 @@ var Track = ({
|
|
|
307
311
|
const [lastUrl, setLastUrl] = (0, import_react13.useState)();
|
|
308
312
|
const [hasTracked, setHasTracked] = (0, import_react13.useState)(false);
|
|
309
313
|
const wrapperEl = (0, import_react13.useRef)(null);
|
|
310
|
-
const disconnect = (0, import_react13.useRef)();
|
|
314
|
+
const disconnect = (0, import_react13.useRef)(null);
|
|
311
315
|
(0, import_react13.useEffect)(() => {
|
|
312
316
|
const urlHasChanged = lastUrl !== currentUrl;
|
|
313
317
|
if (urlHasChanged) {
|
package/dist/index.mjs
CHANGED
|
@@ -122,7 +122,8 @@ function PersonalizeStandard({
|
|
|
122
122
|
wrapperComponent,
|
|
123
123
|
name,
|
|
124
124
|
algorithm,
|
|
125
|
-
count = 1
|
|
125
|
+
count = 1,
|
|
126
|
+
compositionMetadata
|
|
126
127
|
}) {
|
|
127
128
|
const { context } = useUniformContext();
|
|
128
129
|
const scores = useScores();
|
|
@@ -132,10 +133,11 @@ function PersonalizeStandard({
|
|
|
132
133
|
name,
|
|
133
134
|
variations,
|
|
134
135
|
take: count,
|
|
135
|
-
algorithm
|
|
136
|
+
algorithm,
|
|
137
|
+
compositionMetadata
|
|
136
138
|
}),
|
|
137
139
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
|
-
[scores, quirks, context, count, name, variations]
|
|
140
|
+
[scores, quirks, context, count, name, variations, compositionMetadata]
|
|
139
141
|
);
|
|
140
142
|
const Wrapper = wrapperComponent != null ? wrapperComponent : ({ children }) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
|
|
141
143
|
const Component = component;
|
|
@@ -205,12 +207,14 @@ import React5 from "react";
|
|
|
205
207
|
var TestStandard = ({
|
|
206
208
|
name,
|
|
207
209
|
variations,
|
|
208
|
-
component
|
|
210
|
+
component,
|
|
211
|
+
compositionMetadata
|
|
209
212
|
}) => {
|
|
210
213
|
const { context } = useUniformContext();
|
|
211
214
|
const { result } = context.test({
|
|
212
215
|
name,
|
|
213
|
-
variations
|
|
216
|
+
variations,
|
|
217
|
+
compositionMetadata
|
|
214
218
|
});
|
|
215
219
|
if (!result) {
|
|
216
220
|
return null;
|
|
@@ -265,7 +269,7 @@ var Track = ({
|
|
|
265
269
|
const [lastUrl, setLastUrl] = useState3();
|
|
266
270
|
const [hasTracked, setHasTracked] = useState3(false);
|
|
267
271
|
const wrapperEl = useRef(null);
|
|
268
|
-
const disconnect = useRef();
|
|
272
|
+
const disconnect = useRef(null);
|
|
269
273
|
useEffect3(() => {
|
|
270
274
|
const urlHasChanged = lastUrl !== currentUrl;
|
|
271
275
|
if (urlHasChanged) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/context-react",
|
|
3
|
-
"version": "20.35.
|
|
3
|
+
"version": "20.35.1-alpha.210+4fa236da76",
|
|
4
4
|
"description": "Uniform Context React integration package",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"build": "tsup",
|
|
20
20
|
"dev": "tsup --watch",
|
|
21
21
|
"clean": "rimraf dist",
|
|
22
|
-
"test": "
|
|
22
|
+
"test": "vitest run",
|
|
23
23
|
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
|
|
24
24
|
"format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
|
|
25
25
|
"document:prebuild": "api-extractor run --local"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/react": "
|
|
29
|
-
"react": "
|
|
30
|
-
"react-dom": "
|
|
28
|
+
"@types/react": "19.2.2",
|
|
29
|
+
"react": "19.2.1",
|
|
30
|
+
"react-dom": "19.2.1"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@uniformdev/context": "20.35.
|
|
33
|
+
"@uniformdev/context": "20.35.1-alpha.210+4fa236da76",
|
|
34
34
|
"cookie": "1.0.1",
|
|
35
35
|
"dequal": "2.0.3"
|
|
36
36
|
},
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "4fa236da76e057582eae6c2595a2fa763fda886a"
|
|
48
48
|
}
|