@uniformdev/canvas-next-rsc-shared 19.147.1-alpha.3 → 19.147.1-alpha.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/dist/index.d.mts CHANGED
@@ -87,6 +87,16 @@ type UniformServerConfig = {
87
87
  */
88
88
  vercelVisualEditing?: boolean;
89
89
  };
90
+ ppr?: {
91
+ /**
92
+ * Whether or not to wrap personalization components in a suspense boundary.
93
+ */
94
+ personalizationSuspense?: boolean;
95
+ /**
96
+ * Whether or not to wrap test components in a suspense boundary.
97
+ */
98
+ testSuspense?: boolean;
99
+ };
90
100
  };
91
101
 
92
102
  type PageParameters = {
@@ -179,10 +189,10 @@ declare const runTest: ({ test, component, contextInstance, }: TestProps & {
179
189
  slotName: string | undefined;
180
190
  slotIndex: number | undefined;
181
191
  } & {
182
- contextInstance: Pick<ContextInstance, 'test'> | undefined;
192
+ contextInstance: Pick<ContextInstance, 'test' | 'manifest'> | undefined;
183
193
  }) => {
184
194
  index: number | null;
185
- event: TestEvent;
195
+ event: TestEvent | null;
186
196
  };
187
197
 
188
198
  type ResolvePathResult = {
package/dist/index.d.ts CHANGED
@@ -87,6 +87,16 @@ type UniformServerConfig = {
87
87
  */
88
88
  vercelVisualEditing?: boolean;
89
89
  };
90
+ ppr?: {
91
+ /**
92
+ * Whether or not to wrap personalization components in a suspense boundary.
93
+ */
94
+ personalizationSuspense?: boolean;
95
+ /**
96
+ * Whether or not to wrap test components in a suspense boundary.
97
+ */
98
+ testSuspense?: boolean;
99
+ };
90
100
  };
91
101
 
92
102
  type PageParameters = {
@@ -179,10 +189,10 @@ declare const runTest: ({ test, component, contextInstance, }: TestProps & {
179
189
  slotName: string | undefined;
180
190
  slotIndex: number | undefined;
181
191
  } & {
182
- contextInstance: Pick<ContextInstance, 'test'> | undefined;
192
+ contextInstance: Pick<ContextInstance, 'test' | 'manifest'> | undefined;
183
193
  }) => {
184
194
  index: number | null;
185
- event: TestEvent;
195
+ event: TestEvent | null;
186
196
  };
187
197
 
188
198
  type ResolvePathResult = {
package/dist/index.esm.js CHANGED
@@ -192,11 +192,19 @@ var runTest = ({
192
192
  component,
193
193
  contextInstance
194
194
  }) => {
195
- var _a;
196
- const slot = ((_a = component.slots) == null ? void 0 : _a[CANVAS_TEST_SLOT]) || [];
195
+ var _a, _b;
196
+ const isTestDefined = Boolean((_a = contextInstance == null ? void 0 : contextInstance.manifest.data.project.test) == null ? void 0 : _a[test]);
197
+ if (!isTestDefined && process.env.NODE_ENV !== "production") {
198
+ console.warn(`Test "${test}" is not defined in Uniform manifest.`);
199
+ return {
200
+ index: null,
201
+ event: null
202
+ };
203
+ }
204
+ const slot = ((_b = component.slots) == null ? void 0 : _b[CANVAS_TEST_SLOT]) || [];
197
205
  const componentVariations = slot.map((v, i) => {
198
- var _a2, _b, _c;
199
- const contextTag = (_b = (_a2 = v.parameters) == null ? void 0 : _a2[CANVAS_TEST_VARIANT_PARAM]) == null ? void 0 : _b.value;
206
+ var _a2, _b2, _c;
207
+ const contextTag = (_b2 = (_a2 = v.parameters) == null ? void 0 : _a2[CANVAS_TEST_VARIANT_PARAM]) == null ? void 0 : _b2.value;
200
208
  const id = (_c = contextTag == null ? void 0 : contextTag.id) != null ? _c : "testId" in v ? v.testId : `ab-${i}-${v.type}`;
201
209
  return {
202
210
  id,
package/dist/index.js CHANGED
@@ -222,11 +222,19 @@ var runTest = ({
222
222
  component,
223
223
  contextInstance
224
224
  }) => {
225
- var _a;
226
- const slot = ((_a = component.slots) == null ? void 0 : _a[import_canvas2.CANVAS_TEST_SLOT]) || [];
225
+ var _a, _b;
226
+ const isTestDefined = Boolean((_a = contextInstance == null ? void 0 : contextInstance.manifest.data.project.test) == null ? void 0 : _a[test]);
227
+ if (!isTestDefined && process.env.NODE_ENV !== "production") {
228
+ console.warn(`Test "${test}" is not defined in Uniform manifest.`);
229
+ return {
230
+ index: null,
231
+ event: null
232
+ };
233
+ }
234
+ const slot = ((_b = component.slots) == null ? void 0 : _b[import_canvas2.CANVAS_TEST_SLOT]) || [];
227
235
  const componentVariations = slot.map((v, i) => {
228
- var _a2, _b, _c;
229
- const contextTag = (_b = (_a2 = v.parameters) == null ? void 0 : _a2[import_canvas2.CANVAS_TEST_VARIANT_PARAM]) == null ? void 0 : _b.value;
236
+ var _a2, _b2, _c;
237
+ const contextTag = (_b2 = (_a2 = v.parameters) == null ? void 0 : _a2[import_canvas2.CANVAS_TEST_VARIANT_PARAM]) == null ? void 0 : _b2.value;
230
238
  const id = (_c = contextTag == null ? void 0 : contextTag.id) != null ? _c : "testId" in v ? v.testId : `ab-${i}-${v.type}`;
231
239
  return {
232
240
  id,
package/dist/index.mjs CHANGED
@@ -192,11 +192,19 @@ var runTest = ({
192
192
  component,
193
193
  contextInstance
194
194
  }) => {
195
- var _a;
196
- const slot = ((_a = component.slots) == null ? void 0 : _a[CANVAS_TEST_SLOT]) || [];
195
+ var _a, _b;
196
+ const isTestDefined = Boolean((_a = contextInstance == null ? void 0 : contextInstance.manifest.data.project.test) == null ? void 0 : _a[test]);
197
+ if (!isTestDefined && process.env.NODE_ENV !== "production") {
198
+ console.warn(`Test "${test}" is not defined in Uniform manifest.`);
199
+ return {
200
+ index: null,
201
+ event: null
202
+ };
203
+ }
204
+ const slot = ((_b = component.slots) == null ? void 0 : _b[CANVAS_TEST_SLOT]) || [];
197
205
  const componentVariations = slot.map((v, i) => {
198
- var _a2, _b, _c;
199
- const contextTag = (_b = (_a2 = v.parameters) == null ? void 0 : _a2[CANVAS_TEST_VARIANT_PARAM]) == null ? void 0 : _b.value;
206
+ var _a2, _b2, _c;
207
+ const contextTag = (_b2 = (_a2 = v.parameters) == null ? void 0 : _a2[CANVAS_TEST_VARIANT_PARAM]) == null ? void 0 : _b2.value;
200
208
  const id = (_c = contextTag == null ? void 0 : contextTag.id) != null ? _c : "testId" in v ? v.testId : `ab-${i}-${v.type}`;
201
209
  return {
202
210
  id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc-shared",
3
- "version": "19.147.1-alpha.3+1af8304702",
3
+ "version": "19.147.1-alpha.6+b883293105",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -32,8 +32,8 @@
32
32
  "react-dom": "18.2.0"
33
33
  },
34
34
  "dependencies": {
35
- "@uniformdev/canvas": "19.147.1-alpha.3+1af8304702",
36
- "@uniformdev/context": "19.147.1-alpha.3+1af8304702"
35
+ "@uniformdev/canvas": "19.147.1-alpha.6+b883293105",
36
+ "@uniformdev/context": "19.147.1-alpha.6+b883293105"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=16.14.0"
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "1af830470251c963f96bad096f543cfd3b612ffe"
49
+ "gitHead": "b883293105d84f5b52f2d947957dac638c12c6f6"
50
50
  }