@uniformdev/context-react 20.34.1 → 20.34.2-alpha.67

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
@@ -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
 
@@ -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
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
 
@@ -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
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;
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;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/context-react",
3
- "version": "20.34.1",
3
+ "version": "20.34.2-alpha.67+d830718b43",
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.34.1",
33
+ "@uniformdev/context": "20.34.2-alpha.67+d830718b43",
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": "e118be221d19f1e59da7c5845bc3e784e0b42cf3"
47
+ "gitHead": "d830718b43d1c26a8f6c22434975882eae4cbb3d"
48
48
  }