@uniformdev/context-react 20.6.1 → 20.6.2-alpha.11

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 CHANGED
@@ -86,6 +86,8 @@ 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[];
91
93
  /** A React component to use to render a selected variant. */
package/dist/index.d.ts CHANGED
@@ -86,6 +86,8 @@ 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[];
91
93
  /** A React component to use to render a selected variant. */
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,21 @@ function PersonalizeStandard({
120
121
  component,
121
122
  wrapperComponent,
122
123
  name,
124
+ algorithm,
123
125
  count = 1
124
126
  }) {
125
127
  const { context } = useUniformContext();
126
128
  const scores = useScores();
129
+ const quirks = useQuirks();
127
130
  const { variations: personalizedVariations, personalized: personalizationOccurred } = useMemo(
128
131
  () => context.personalize({
129
132
  name,
130
133
  variations,
131
- take: count
134
+ take: count,
135
+ algorithm
132
136
  }),
133
137
  // eslint-disable-next-line react-hooks/exhaustive-deps
134
- [scores, context, count, name, variations]
138
+ [scores, quirks, context, count, name, variations]
135
139
  );
136
140
  const Wrapper = wrapperComponent != null ? wrapperComponent : ({ children }) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
137
141
  const Component = component;
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,21 @@ function PersonalizeStandard({
162
163
  component,
163
164
  wrapperComponent,
164
165
  name,
166
+ algorithm,
165
167
  count = 1
166
168
  }) {
167
169
  const { context } = useUniformContext();
168
170
  const scores = useScores();
171
+ const quirks = useQuirks();
169
172
  const { variations: personalizedVariations, personalized: personalizationOccurred } = (0, import_react7.useMemo)(
170
173
  () => context.personalize({
171
174
  name,
172
175
  variations,
173
- take: count
176
+ take: count,
177
+ algorithm
174
178
  }),
175
179
  // eslint-disable-next-line react-hooks/exhaustive-deps
176
- [scores, context, count, name, variations]
180
+ [scores, quirks, context, count, name, variations]
177
181
  );
178
182
  const Wrapper = wrapperComponent != null ? wrapperComponent : ({ children }) => /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, children);
179
183
  const Component = component;
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,21 @@ function PersonalizeStandard({
120
121
  component,
121
122
  wrapperComponent,
122
123
  name,
124
+ algorithm,
123
125
  count = 1
124
126
  }) {
125
127
  const { context } = useUniformContext();
126
128
  const scores = useScores();
129
+ const quirks = useQuirks();
127
130
  const { variations: personalizedVariations, personalized: personalizationOccurred } = useMemo(
128
131
  () => context.personalize({
129
132
  name,
130
133
  variations,
131
- take: count
134
+ take: count,
135
+ algorithm
132
136
  }),
133
137
  // eslint-disable-next-line react-hooks/exhaustive-deps
134
- [scores, context, count, name, variations]
138
+ [scores, quirks, context, count, name, variations]
135
139
  );
136
140
  const Wrapper = wrapperComponent != null ? wrapperComponent : ({ children }) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
137
141
  const Component = component;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/context-react",
3
- "version": "20.6.1",
3
+ "version": "20.6.2-alpha.11+af78064791",
4
4
  "description": "Uniform Context React integration package",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -30,7 +30,7 @@
30
30
  "react-dom": "18.3.1"
31
31
  },
32
32
  "dependencies": {
33
- "@uniformdev/context": "20.6.1",
33
+ "@uniformdev/context": "20.6.2-alpha.11+af78064791",
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": "6416edea60b972d5b18ec052c401d1a39f8df667"
47
+ "gitHead": "af78064791c47044f8ba447bbe1221f672f6de3e"
48
48
  }