@uniformdev/context-react 20.7.1-alpha.12 → 20.7.1-alpha.121
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/LICENSE.txt +1 -1
- package/dist/index.d.mts +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.esm.js +14 -6
- package/dist/index.js +14 -6
- package/dist/index.mjs +14 -6
- package/package.json +5 -5
package/LICENSE.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
©
|
|
1
|
+
© 2025 Uniform Systems, Inc. All Rights Reserved.
|
|
2
2
|
See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
3
|
import react__default, { ReactNode, ReactElement, HTMLAttributes } from 'react';
|
|
4
4
|
|
|
@@ -86,8 +86,12 @@ type PersonalizeComponentProps<TVariation extends PersonalizedVariant> = {
|
|
|
86
86
|
* This name is emitted to analytics after personalization executes.
|
|
87
87
|
*/
|
|
88
88
|
name: string;
|
|
89
|
+
/** The algorithm to use for personalization, if not the default. */
|
|
90
|
+
algorithm?: string;
|
|
89
91
|
/** The possible variations of the content to render depending on personalization conditions */
|
|
90
92
|
variations: TVariation[];
|
|
93
|
+
/** Composition metadata where the personalization is being rendered for analytics tracking */
|
|
94
|
+
compositionMetadata?: CompositionMetadata;
|
|
91
95
|
/** A React component to use to render a selected variant. */
|
|
92
96
|
component: PersonalizedVariationComponent<TVariation>;
|
|
93
97
|
/** A React component that will be used to wrap all personalized variants. If no variants match, the wrapper is not rendered. */
|
|
@@ -103,6 +107,8 @@ interface TestComponentProps<TVariation extends TestVariant> {
|
|
|
103
107
|
name: string;
|
|
104
108
|
/** Variation list that this test will selected from. */
|
|
105
109
|
variations: TVariation[];
|
|
110
|
+
/** Composition metadata where the A/B test is being rendered for analytics tracking */
|
|
111
|
+
compositionMetadata?: CompositionMetadata;
|
|
106
112
|
/**
|
|
107
113
|
* Determines what should be rendered if testing is in a "loading" state.
|
|
108
114
|
* default: shows the default variation while loading
|
|
@@ -210,6 +216,8 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
210
216
|
unselectable?: "on" | "off" | undefined;
|
|
211
217
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
212
218
|
is?: string | undefined;
|
|
219
|
+
exportparts?: string | undefined;
|
|
220
|
+
part?: string | undefined;
|
|
213
221
|
"aria-activedescendant"?: string | undefined;
|
|
214
222
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
215
223
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -284,7 +292,7 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
284
292
|
onBlurCapture?: react.FocusEventHandler<HTMLElement> | undefined;
|
|
285
293
|
onChange?: react.FormEventHandler<HTMLElement> | undefined;
|
|
286
294
|
onChangeCapture?: react.FormEventHandler<HTMLElement> | undefined;
|
|
287
|
-
onBeforeInput?: react.
|
|
295
|
+
onBeforeInput?: react.InputEventHandler<HTMLElement> | undefined;
|
|
288
296
|
onBeforeInputCapture?: react.FormEventHandler<HTMLElement> | undefined;
|
|
289
297
|
onInput?: react.FormEventHandler<HTMLElement> | undefined;
|
|
290
298
|
onInputCapture?: react.FormEventHandler<HTMLElement> | undefined;
|
|
@@ -334,8 +342,6 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
334
342
|
onProgressCapture?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
335
343
|
onRateChange?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
336
344
|
onRateChangeCapture?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
337
|
-
onResize?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
338
|
-
onResizeCapture?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
339
345
|
onSeeked?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
340
346
|
onSeekedCapture?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
341
347
|
onSeeking?: react.ReactEventHandler<HTMLElement> | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
3
|
import react__default, { ReactNode, ReactElement, HTMLAttributes } from 'react';
|
|
4
4
|
|
|
@@ -86,8 +86,12 @@ type PersonalizeComponentProps<TVariation extends PersonalizedVariant> = {
|
|
|
86
86
|
* This name is emitted to analytics after personalization executes.
|
|
87
87
|
*/
|
|
88
88
|
name: string;
|
|
89
|
+
/** The algorithm to use for personalization, if not the default. */
|
|
90
|
+
algorithm?: string;
|
|
89
91
|
/** The possible variations of the content to render depending on personalization conditions */
|
|
90
92
|
variations: TVariation[];
|
|
93
|
+
/** Composition metadata where the personalization is being rendered for analytics tracking */
|
|
94
|
+
compositionMetadata?: CompositionMetadata;
|
|
91
95
|
/** A React component to use to render a selected variant. */
|
|
92
96
|
component: PersonalizedVariationComponent<TVariation>;
|
|
93
97
|
/** A React component that will be used to wrap all personalized variants. If no variants match, the wrapper is not rendered. */
|
|
@@ -103,6 +107,8 @@ interface TestComponentProps<TVariation extends TestVariant> {
|
|
|
103
107
|
name: string;
|
|
104
108
|
/** Variation list that this test will selected from. */
|
|
105
109
|
variations: TVariation[];
|
|
110
|
+
/** Composition metadata where the A/B test is being rendered for analytics tracking */
|
|
111
|
+
compositionMetadata?: CompositionMetadata;
|
|
106
112
|
/**
|
|
107
113
|
* Determines what should be rendered if testing is in a "loading" state.
|
|
108
114
|
* default: shows the default variation while loading
|
|
@@ -210,6 +216,8 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
210
216
|
unselectable?: "on" | "off" | undefined;
|
|
211
217
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
212
218
|
is?: string | undefined;
|
|
219
|
+
exportparts?: string | undefined;
|
|
220
|
+
part?: string | undefined;
|
|
213
221
|
"aria-activedescendant"?: string | undefined;
|
|
214
222
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
215
223
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -284,7 +292,7 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
284
292
|
onBlurCapture?: react.FocusEventHandler<HTMLElement> | undefined;
|
|
285
293
|
onChange?: react.FormEventHandler<HTMLElement> | undefined;
|
|
286
294
|
onChangeCapture?: react.FormEventHandler<HTMLElement> | undefined;
|
|
287
|
-
onBeforeInput?: react.
|
|
295
|
+
onBeforeInput?: react.InputEventHandler<HTMLElement> | undefined;
|
|
288
296
|
onBeforeInputCapture?: react.FormEventHandler<HTMLElement> | undefined;
|
|
289
297
|
onInput?: react.FormEventHandler<HTMLElement> | undefined;
|
|
290
298
|
onInputCapture?: react.FormEventHandler<HTMLElement> | undefined;
|
|
@@ -334,8 +342,6 @@ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilit
|
|
|
334
342
|
onProgressCapture?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
335
343
|
onRateChange?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
336
344
|
onRateChangeCapture?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
337
|
-
onResize?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
338
|
-
onResizeCapture?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
339
345
|
onSeeked?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
340
346
|
onSeekedCapture?: react.ReactEventHandler<HTMLElement> | undefined;
|
|
341
347
|
onSeeking?: react.ReactEventHandler<HTMLElement> | undefined;
|
package/dist/index.esm.js
CHANGED
|
@@ -83,7 +83,8 @@ function PersonalizeEdge(props) {
|
|
|
83
83
|
const { variations, count, component } = props;
|
|
84
84
|
const options = {
|
|
85
85
|
name: props.name,
|
|
86
|
-
count: count != null ? count : 1
|
|
86
|
+
count: count != null ? count : 1,
|
|
87
|
+
algorithm: props.algorithm
|
|
87
88
|
};
|
|
88
89
|
const Component = component;
|
|
89
90
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
@@ -120,18 +121,23 @@ function PersonalizeStandard({
|
|
|
120
121
|
component,
|
|
121
122
|
wrapperComponent,
|
|
122
123
|
name,
|
|
123
|
-
|
|
124
|
+
algorithm,
|
|
125
|
+
count = 1,
|
|
126
|
+
compositionMetadata
|
|
124
127
|
}) {
|
|
125
128
|
const { context } = useUniformContext();
|
|
126
129
|
const scores = useScores();
|
|
130
|
+
const quirks = useQuirks();
|
|
127
131
|
const { variations: personalizedVariations, personalized: personalizationOccurred } = useMemo(
|
|
128
132
|
() => context.personalize({
|
|
129
133
|
name,
|
|
130
134
|
variations,
|
|
131
|
-
take: count
|
|
135
|
+
take: count,
|
|
136
|
+
algorithm,
|
|
137
|
+
compositionMetadata
|
|
132
138
|
}),
|
|
133
139
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
|
-
[scores, context, count, name, variations]
|
|
140
|
+
[scores, quirks, context, count, name, variations, compositionMetadata]
|
|
135
141
|
);
|
|
136
142
|
const Wrapper = wrapperComponent != null ? wrapperComponent : ({ children }) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
|
|
137
143
|
const Component = component;
|
|
@@ -201,12 +207,14 @@ import React5 from "react";
|
|
|
201
207
|
var TestStandard = ({
|
|
202
208
|
name,
|
|
203
209
|
variations,
|
|
204
|
-
component
|
|
210
|
+
component,
|
|
211
|
+
compositionMetadata
|
|
205
212
|
}) => {
|
|
206
213
|
const { context } = useUniformContext();
|
|
207
214
|
const { result } = context.test({
|
|
208
215
|
name,
|
|
209
|
-
variations
|
|
216
|
+
variations,
|
|
217
|
+
compositionMetadata
|
|
210
218
|
});
|
|
211
219
|
if (!result) {
|
|
212
220
|
return null;
|
package/dist/index.js
CHANGED
|
@@ -125,7 +125,8 @@ function PersonalizeEdge(props) {
|
|
|
125
125
|
const { variations, count, component } = props;
|
|
126
126
|
const options = {
|
|
127
127
|
name: props.name,
|
|
128
|
-
count: count != null ? count : 1
|
|
128
|
+
count: count != null ? count : 1,
|
|
129
|
+
algorithm: props.algorithm
|
|
129
130
|
};
|
|
130
131
|
const Component = component;
|
|
131
132
|
return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, /* @__PURE__ */ import_react6.default.createElement(
|
|
@@ -162,18 +163,23 @@ function PersonalizeStandard({
|
|
|
162
163
|
component,
|
|
163
164
|
wrapperComponent,
|
|
164
165
|
name,
|
|
165
|
-
|
|
166
|
+
algorithm,
|
|
167
|
+
count = 1,
|
|
168
|
+
compositionMetadata
|
|
166
169
|
}) {
|
|
167
170
|
const { context } = useUniformContext();
|
|
168
171
|
const scores = useScores();
|
|
172
|
+
const quirks = useQuirks();
|
|
169
173
|
const { variations: personalizedVariations, personalized: personalizationOccurred } = (0, import_react7.useMemo)(
|
|
170
174
|
() => context.personalize({
|
|
171
175
|
name,
|
|
172
176
|
variations,
|
|
173
|
-
take: count
|
|
177
|
+
take: count,
|
|
178
|
+
algorithm,
|
|
179
|
+
compositionMetadata
|
|
174
180
|
}),
|
|
175
181
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
176
|
-
[scores, context, count, name, variations]
|
|
182
|
+
[scores, quirks, context, count, name, variations, compositionMetadata]
|
|
177
183
|
);
|
|
178
184
|
const Wrapper = wrapperComponent != null ? wrapperComponent : ({ children }) => /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, children);
|
|
179
185
|
const Component = component;
|
|
@@ -243,12 +249,14 @@ var import_react10 = __toESM(require("react"));
|
|
|
243
249
|
var TestStandard = ({
|
|
244
250
|
name,
|
|
245
251
|
variations,
|
|
246
|
-
component
|
|
252
|
+
component,
|
|
253
|
+
compositionMetadata
|
|
247
254
|
}) => {
|
|
248
255
|
const { context } = useUniformContext();
|
|
249
256
|
const { result } = context.test({
|
|
250
257
|
name,
|
|
251
|
-
variations
|
|
258
|
+
variations,
|
|
259
|
+
compositionMetadata
|
|
252
260
|
});
|
|
253
261
|
if (!result) {
|
|
254
262
|
return null;
|
package/dist/index.mjs
CHANGED
|
@@ -83,7 +83,8 @@ function PersonalizeEdge(props) {
|
|
|
83
83
|
const { variations, count, component } = props;
|
|
84
84
|
const options = {
|
|
85
85
|
name: props.name,
|
|
86
|
-
count: count != null ? count : 1
|
|
86
|
+
count: count != null ? count : 1,
|
|
87
|
+
algorithm: props.algorithm
|
|
87
88
|
};
|
|
88
89
|
const Component = component;
|
|
89
90
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
@@ -120,18 +121,23 @@ function PersonalizeStandard({
|
|
|
120
121
|
component,
|
|
121
122
|
wrapperComponent,
|
|
122
123
|
name,
|
|
123
|
-
|
|
124
|
+
algorithm,
|
|
125
|
+
count = 1,
|
|
126
|
+
compositionMetadata
|
|
124
127
|
}) {
|
|
125
128
|
const { context } = useUniformContext();
|
|
126
129
|
const scores = useScores();
|
|
130
|
+
const quirks = useQuirks();
|
|
127
131
|
const { variations: personalizedVariations, personalized: personalizationOccurred } = useMemo(
|
|
128
132
|
() => context.personalize({
|
|
129
133
|
name,
|
|
130
134
|
variations,
|
|
131
|
-
take: count
|
|
135
|
+
take: count,
|
|
136
|
+
algorithm,
|
|
137
|
+
compositionMetadata
|
|
132
138
|
}),
|
|
133
139
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
|
-
[scores, context, count, name, variations]
|
|
140
|
+
[scores, quirks, context, count, name, variations, compositionMetadata]
|
|
135
141
|
);
|
|
136
142
|
const Wrapper = wrapperComponent != null ? wrapperComponent : ({ children }) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
|
|
137
143
|
const Component = component;
|
|
@@ -201,12 +207,14 @@ import React5 from "react";
|
|
|
201
207
|
var TestStandard = ({
|
|
202
208
|
name,
|
|
203
209
|
variations,
|
|
204
|
-
component
|
|
210
|
+
component,
|
|
211
|
+
compositionMetadata
|
|
205
212
|
}) => {
|
|
206
213
|
const { context } = useUniformContext();
|
|
207
214
|
const { result } = context.test({
|
|
208
215
|
name,
|
|
209
|
-
variations
|
|
216
|
+
variations,
|
|
217
|
+
compositionMetadata
|
|
210
218
|
});
|
|
211
219
|
if (!result) {
|
|
212
220
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/context-react",
|
|
3
|
-
"version": "20.7.1-alpha.
|
|
3
|
+
"version": "20.7.1-alpha.121+a4f284458c",
|
|
4
4
|
"description": "Uniform Context React integration package",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"test": "jest --maxWorkers=1",
|
|
23
23
|
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
|
|
24
24
|
"format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
|
|
25
|
-
"document": "api-extractor run --local"
|
|
25
|
+
"document:prebuild": "api-extractor run --local"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/react": "18.3.
|
|
28
|
+
"@types/react": "18.3.24",
|
|
29
29
|
"react": "18.3.1",
|
|
30
30
|
"react-dom": "18.3.1"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@uniformdev/context": "20.7.1-alpha.
|
|
33
|
+
"@uniformdev/context": "20.7.1-alpha.121+a4f284458c",
|
|
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": "a4f284458cffb24442299a5210bdad47c05aada3"
|
|
48
48
|
}
|