@uniformdev/canvas-next-rsc-shared 19.127.0 → 19.128.1-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
@@ -89,7 +89,6 @@ type PageParameters = {
89
89
  * The params object from Next.js router. Used to resolve a composition.
90
90
  */
91
91
  params: {
92
- slug?: string | string[];
93
92
  path?: string | string[];
94
93
  };
95
94
  /**
@@ -182,7 +181,7 @@ declare const runTest: ({ test, component, contextInstance, }: TestProps & {
182
181
  };
183
182
 
184
183
  type ResolvePathResult = {
185
- type: 'slug' | 'path';
184
+ type: 'path';
186
185
  value: string;
187
186
  };
188
187
  declare const resolvePath: ({ params }: Pick<PageParameters, 'params'>) => ResolvePathResult;
package/dist/index.d.ts CHANGED
@@ -89,7 +89,6 @@ type PageParameters = {
89
89
  * The params object from Next.js router. Used to resolve a composition.
90
90
  */
91
91
  params: {
92
- slug?: string | string[];
93
92
  path?: string | string[];
94
93
  };
95
94
  /**
@@ -182,7 +181,7 @@ declare const runTest: ({ test, component, contextInstance, }: TestProps & {
182
181
  };
183
182
 
184
183
  type ResolvePathResult = {
185
- type: 'slug' | 'path';
184
+ type: 'path';
186
185
  value: string;
187
186
  };
188
187
  declare const resolvePath: ({ params }: Pick<PageParameters, 'params'>) => ResolvePathResult;
package/dist/index.esm.js CHANGED
@@ -24,15 +24,11 @@ import { Context, CookieTransitionDataStore } from "@uniformdev/context";
24
24
 
25
25
  // src/utils/path.ts
26
26
  var resolvePath = ({ params }) => {
27
- if (params.path || Object.keys(params).length === 0) {
28
- const value = processPath(params.path || "");
29
- return {
30
- type: "path",
31
- value
32
- };
33
- } else {
34
- throw new Error("Slug resolution is currently not implemented.");
35
- }
27
+ const value = processPath(params.path || "");
28
+ return {
29
+ type: "path",
30
+ value
31
+ };
36
32
  };
37
33
  var processPath = (value) => {
38
34
  const definedSlug = !Array.isArray(value) ? resolveSlugFromString(value) : resolveSlugFromArray(value);
@@ -175,7 +171,10 @@ var runPersonalization = ({
175
171
  if (variations) {
176
172
  for (let i = 0; i < variations.length; i++) {
177
173
  indexes.push(variations[i].index);
178
- variantIds.push(variations[i].id);
174
+ variantIds.push({
175
+ id: variations[i].id,
176
+ control: variations[i].control
177
+ });
179
178
  }
180
179
  }
181
180
  } else {
@@ -190,7 +189,12 @@ var runPersonalization = ({
190
189
  }
191
190
  }
192
191
  indexes.push(...defaults);
193
- variantIds.push(...defaults.map((i) => componentVariations[i].id));
192
+ variantIds.push(
193
+ ...defaults.map((i) => ({
194
+ id: componentVariations[i].id,
195
+ control: false
196
+ }))
197
+ );
194
198
  }
195
199
  const event = {
196
200
  name: trackingEventName,
package/dist/index.js CHANGED
@@ -47,15 +47,11 @@ var import_context = require("@uniformdev/context");
47
47
 
48
48
  // src/utils/path.ts
49
49
  var resolvePath = ({ params }) => {
50
- if (params.path || Object.keys(params).length === 0) {
51
- const value = processPath(params.path || "");
52
- return {
53
- type: "path",
54
- value
55
- };
56
- } else {
57
- throw new Error("Slug resolution is currently not implemented.");
58
- }
50
+ const value = processPath(params.path || "");
51
+ return {
52
+ type: "path",
53
+ value
54
+ };
59
55
  };
60
56
  var processPath = (value) => {
61
57
  const definedSlug = !Array.isArray(value) ? resolveSlugFromString(value) : resolveSlugFromArray(value);
@@ -198,7 +194,10 @@ var runPersonalization = ({
198
194
  if (variations) {
199
195
  for (let i = 0; i < variations.length; i++) {
200
196
  indexes.push(variations[i].index);
201
- variantIds.push(variations[i].id);
197
+ variantIds.push({
198
+ id: variations[i].id,
199
+ control: variations[i].control
200
+ });
202
201
  }
203
202
  }
204
203
  } else {
@@ -213,7 +212,12 @@ var runPersonalization = ({
213
212
  }
214
213
  }
215
214
  indexes.push(...defaults);
216
- variantIds.push(...defaults.map((i) => componentVariations[i].id));
215
+ variantIds.push(
216
+ ...defaults.map((i) => ({
217
+ id: componentVariations[i].id,
218
+ control: false
219
+ }))
220
+ );
217
221
  }
218
222
  const event = {
219
223
  name: trackingEventName,
package/dist/index.mjs CHANGED
@@ -24,15 +24,11 @@ import { Context, CookieTransitionDataStore } from "@uniformdev/context";
24
24
 
25
25
  // src/utils/path.ts
26
26
  var resolvePath = ({ params }) => {
27
- if (params.path || Object.keys(params).length === 0) {
28
- const value = processPath(params.path || "");
29
- return {
30
- type: "path",
31
- value
32
- };
33
- } else {
34
- throw new Error("Slug resolution is currently not implemented.");
35
- }
27
+ const value = processPath(params.path || "");
28
+ return {
29
+ type: "path",
30
+ value
31
+ };
36
32
  };
37
33
  var processPath = (value) => {
38
34
  const definedSlug = !Array.isArray(value) ? resolveSlugFromString(value) : resolveSlugFromArray(value);
@@ -175,7 +171,10 @@ var runPersonalization = ({
175
171
  if (variations) {
176
172
  for (let i = 0; i < variations.length; i++) {
177
173
  indexes.push(variations[i].index);
178
- variantIds.push(variations[i].id);
174
+ variantIds.push({
175
+ id: variations[i].id,
176
+ control: variations[i].control
177
+ });
179
178
  }
180
179
  }
181
180
  } else {
@@ -190,7 +189,12 @@ var runPersonalization = ({
190
189
  }
191
190
  }
192
191
  indexes.push(...defaults);
193
- variantIds.push(...defaults.map((i) => componentVariations[i].id));
192
+ variantIds.push(
193
+ ...defaults.map((i) => ({
194
+ id: componentVariations[i].id,
195
+ control: false
196
+ }))
197
+ );
194
198
  }
195
199
  const event = {
196
200
  name: trackingEventName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc-shared",
3
- "version": "19.127.0",
3
+ "version": "19.128.1-alpha.11+11cc55c0a1",
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.127.0",
36
- "@uniformdev/context": "19.127.0"
35
+ "@uniformdev/canvas": "19.128.1-alpha.11+11cc55c0a1",
36
+ "@uniformdev/context": "19.128.1-alpha.11+11cc55c0a1"
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": "3757cfe081cf40d019cb9f65d0a26e2a4fbdb1f6"
49
+ "gitHead": "11cc55c0a1f62ac84634af6734dac6168a140161"
50
50
  }