@uniformdev/canvas-next-rsc-shared 19.79.1-alpha.18 → 19.79.1-alpha.25

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
@@ -82,14 +82,11 @@ type UniformServerConfig = {
82
82
  };
83
83
  };
84
84
 
85
- declare const getServerConfig: () => UniformServerConfig;
86
-
87
85
  type PageParameters = {
88
86
  /**
89
87
  * The params object from Next.js router. Used to resolve a composition.
90
88
  */
91
89
  params: {
92
- slug?: string | string[];
93
90
  path?: string | string[];
94
91
  };
95
92
  /**
@@ -182,11 +179,11 @@ declare const runTest: ({ test, component, contextInstance, }: TestProps & {
182
179
  };
183
180
 
184
181
  type ResolvePathResult = {
185
- type: 'slug' | 'path';
182
+ type: 'path';
186
183
  value: string;
187
184
  };
188
185
  declare const resolvePath: ({ params }: Pick<PageParameters, 'params'>) => ResolvePathResult;
189
186
 
190
187
  declare function getBaseUrl(): string;
191
188
 
192
- export { type AppDirectoryContext, type AppDirectoryContextState, type AppDirectoryServerContext, type CacheMode, type ComponentProps, type CompositionContext, type PageParameters, type PersonalizeProps, type PersonalizeWithContextComponentProps, type PlaygroundParameters, type ResolvePathResult, type SlotDefinition, type TestProps, type UniformServerConfig, createUniformContext, getBaseUrl, getServerConfig, resolvePath, runPersonalization, runTest };
189
+ export { type AppDirectoryContext, type AppDirectoryContextState, type AppDirectoryServerContext, type CacheMode, type ComponentProps, type CompositionContext, type PageParameters, type PersonalizeProps, type PersonalizeWithContextComponentProps, type PlaygroundParameters, type ResolvePathResult, type SlotDefinition, type TestProps, type UniformServerConfig, createUniformContext, getBaseUrl, resolvePath, runPersonalization, runTest };
package/dist/index.d.ts CHANGED
@@ -82,14 +82,11 @@ type UniformServerConfig = {
82
82
  };
83
83
  };
84
84
 
85
- declare const getServerConfig: () => UniformServerConfig;
86
-
87
85
  type PageParameters = {
88
86
  /**
89
87
  * The params object from Next.js router. Used to resolve a composition.
90
88
  */
91
89
  params: {
92
- slug?: string | string[];
93
90
  path?: string | string[];
94
91
  };
95
92
  /**
@@ -182,11 +179,11 @@ declare const runTest: ({ test, component, contextInstance, }: TestProps & {
182
179
  };
183
180
 
184
181
  type ResolvePathResult = {
185
- type: 'slug' | 'path';
182
+ type: 'path';
186
183
  value: string;
187
184
  };
188
185
  declare const resolvePath: ({ params }: Pick<PageParameters, 'params'>) => ResolvePathResult;
189
186
 
190
187
  declare function getBaseUrl(): string;
191
188
 
192
- export { type AppDirectoryContext, type AppDirectoryContextState, type AppDirectoryServerContext, type CacheMode, type ComponentProps, type CompositionContext, type PageParameters, type PersonalizeProps, type PersonalizeWithContextComponentProps, type PlaygroundParameters, type ResolvePathResult, type SlotDefinition, type TestProps, type UniformServerConfig, createUniformContext, getBaseUrl, getServerConfig, resolvePath, runPersonalization, runTest };
189
+ export { type AppDirectoryContext, type AppDirectoryContextState, type AppDirectoryServerContext, type CacheMode, type ComponentProps, type CompositionContext, type PageParameters, type PersonalizeProps, type PersonalizeWithContextComponentProps, type PlaygroundParameters, type ResolvePathResult, type SlotDefinition, type TestProps, type UniformServerConfig, createUniformContext, getBaseUrl, resolvePath, runPersonalization, runTest };
package/dist/index.esm.js CHANGED
@@ -1,38 +1,13 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined")
5
- return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
-
9
- // src/config/helpers.ts
10
- var getServerConfig = () => {
11
- let serverConfig;
12
- try {
13
- serverConfig = __require("uniform.server.config.js");
14
- } catch (e) {
15
- serverConfig = {
16
- defaultConsent: false
17
- };
18
- }
19
- return serverConfig;
20
- };
21
-
22
1
  // src/context/createUniformContext.ts
23
2
  import { Context, CookieTransitionDataStore } from "@uniformdev/context";
24
3
 
25
4
  // src/utils/path.ts
26
5
  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
- }
6
+ const value = processPath(params.path || "");
7
+ return {
8
+ type: "path",
9
+ value
10
+ };
36
11
  };
37
12
  var processPath = (value) => {
38
13
  const definedSlug = !Array.isArray(value) ? resolveSlugFromString(value) : resolveSlugFromArray(value);
@@ -82,10 +57,8 @@ var createUniformContext = ({
82
57
  serverCookieValue,
83
58
  ...rest
84
59
  }) => {
85
- var _a;
86
60
  const context = new Context({
87
61
  ...rest,
88
- defaultConsent: (_a = getServerConfig()) == null ? void 0 : _a.defaultConsent,
89
62
  transitionStore: new CookieTransitionDataStore({
90
63
  serverCookieValue
91
64
  })
@@ -175,7 +148,10 @@ var runPersonalization = ({
175
148
  if (variations) {
176
149
  for (let i = 0; i < variations.length; i++) {
177
150
  indexes.push(variations[i].index);
178
- variantIds.push(variations[i].id);
151
+ variantIds.push({
152
+ id: variations[i].id,
153
+ control: variations[i].control
154
+ });
179
155
  }
180
156
  }
181
157
  } else {
@@ -190,7 +166,12 @@ var runPersonalization = ({
190
166
  }
191
167
  }
192
168
  indexes.push(...defaults);
193
- variantIds.push(...defaults.map((i) => componentVariations[i].id));
169
+ variantIds.push(
170
+ ...defaults.map((i) => ({
171
+ id: componentVariations[i].id,
172
+ control: false
173
+ }))
174
+ );
194
175
  }
195
176
  const event = {
196
177
  name: trackingEventName,
@@ -255,7 +236,6 @@ var runTest = ({
255
236
  export {
256
237
  createUniformContext,
257
238
  getBaseUrl,
258
- getServerConfig,
259
239
  resolvePath,
260
240
  runPersonalization,
261
241
  runTest
package/dist/index.js CHANGED
@@ -22,40 +22,22 @@ var src_exports = {};
22
22
  __export(src_exports, {
23
23
  createUniformContext: () => createUniformContext,
24
24
  getBaseUrl: () => getBaseUrl,
25
- getServerConfig: () => getServerConfig,
26
25
  resolvePath: () => resolvePath,
27
26
  runPersonalization: () => runPersonalization,
28
27
  runTest: () => runTest
29
28
  });
30
29
  module.exports = __toCommonJS(src_exports);
31
30
 
32
- // src/config/helpers.ts
33
- var getServerConfig = () => {
34
- let serverConfig;
35
- try {
36
- serverConfig = require("uniform.server.config.js");
37
- } catch (e) {
38
- serverConfig = {
39
- defaultConsent: false
40
- };
41
- }
42
- return serverConfig;
43
- };
44
-
45
31
  // src/context/createUniformContext.ts
46
32
  var import_context = require("@uniformdev/context");
47
33
 
48
34
  // src/utils/path.ts
49
35
  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
- }
36
+ const value = processPath(params.path || "");
37
+ return {
38
+ type: "path",
39
+ value
40
+ };
59
41
  };
60
42
  var processPath = (value) => {
61
43
  const definedSlug = !Array.isArray(value) ? resolveSlugFromString(value) : resolveSlugFromArray(value);
@@ -105,10 +87,8 @@ var createUniformContext = ({
105
87
  serverCookieValue,
106
88
  ...rest
107
89
  }) => {
108
- var _a;
109
90
  const context = new import_context.Context({
110
91
  ...rest,
111
- defaultConsent: (_a = getServerConfig()) == null ? void 0 : _a.defaultConsent,
112
92
  transitionStore: new import_context.CookieTransitionDataStore({
113
93
  serverCookieValue
114
94
  })
@@ -198,7 +178,10 @@ var runPersonalization = ({
198
178
  if (variations) {
199
179
  for (let i = 0; i < variations.length; i++) {
200
180
  indexes.push(variations[i].index);
201
- variantIds.push(variations[i].id);
181
+ variantIds.push({
182
+ id: variations[i].id,
183
+ control: variations[i].control
184
+ });
202
185
  }
203
186
  }
204
187
  } else {
@@ -213,7 +196,12 @@ var runPersonalization = ({
213
196
  }
214
197
  }
215
198
  indexes.push(...defaults);
216
- variantIds.push(...defaults.map((i) => componentVariations[i].id));
199
+ variantIds.push(
200
+ ...defaults.map((i) => ({
201
+ id: componentVariations[i].id,
202
+ control: false
203
+ }))
204
+ );
217
205
  }
218
206
  const event = {
219
207
  name: trackingEventName,
@@ -279,7 +267,6 @@ var runTest = ({
279
267
  0 && (module.exports = {
280
268
  createUniformContext,
281
269
  getBaseUrl,
282
- getServerConfig,
283
270
  resolvePath,
284
271
  runPersonalization,
285
272
  runTest
package/dist/index.mjs CHANGED
@@ -1,38 +1,13 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined")
5
- return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
-
9
- // src/config/helpers.ts
10
- var getServerConfig = () => {
11
- let serverConfig;
12
- try {
13
- serverConfig = __require("uniform.server.config.js");
14
- } catch (e) {
15
- serverConfig = {
16
- defaultConsent: false
17
- };
18
- }
19
- return serverConfig;
20
- };
21
-
22
1
  // src/context/createUniformContext.ts
23
2
  import { Context, CookieTransitionDataStore } from "@uniformdev/context";
24
3
 
25
4
  // src/utils/path.ts
26
5
  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
- }
6
+ const value = processPath(params.path || "");
7
+ return {
8
+ type: "path",
9
+ value
10
+ };
36
11
  };
37
12
  var processPath = (value) => {
38
13
  const definedSlug = !Array.isArray(value) ? resolveSlugFromString(value) : resolveSlugFromArray(value);
@@ -82,10 +57,8 @@ var createUniformContext = ({
82
57
  serverCookieValue,
83
58
  ...rest
84
59
  }) => {
85
- var _a;
86
60
  const context = new Context({
87
61
  ...rest,
88
- defaultConsent: (_a = getServerConfig()) == null ? void 0 : _a.defaultConsent,
89
62
  transitionStore: new CookieTransitionDataStore({
90
63
  serverCookieValue
91
64
  })
@@ -175,7 +148,10 @@ var runPersonalization = ({
175
148
  if (variations) {
176
149
  for (let i = 0; i < variations.length; i++) {
177
150
  indexes.push(variations[i].index);
178
- variantIds.push(variations[i].id);
151
+ variantIds.push({
152
+ id: variations[i].id,
153
+ control: variations[i].control
154
+ });
179
155
  }
180
156
  }
181
157
  } else {
@@ -190,7 +166,12 @@ var runPersonalization = ({
190
166
  }
191
167
  }
192
168
  indexes.push(...defaults);
193
- variantIds.push(...defaults.map((i) => componentVariations[i].id));
169
+ variantIds.push(
170
+ ...defaults.map((i) => ({
171
+ id: componentVariations[i].id,
172
+ control: false
173
+ }))
174
+ );
194
175
  }
195
176
  const event = {
196
177
  name: trackingEventName,
@@ -255,7 +236,6 @@ var runTest = ({
255
236
  export {
256
237
  createUniformContext,
257
238
  getBaseUrl,
258
- getServerConfig,
259
239
  resolvePath,
260
240
  runPersonalization,
261
241
  runTest
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc-shared",
3
- "version": "19.79.1-alpha.18+12234b9350",
3
+ "version": "19.79.1-alpha.25+87cea1cd47",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -26,14 +26,14 @@
26
26
  "devDependencies": {
27
27
  "@types/node": "^20.0.0",
28
28
  "@types/react": "18.2.40",
29
- "eslint": "8.54.0",
29
+ "eslint": "8.57.0",
30
30
  "next": "^14.0.0",
31
31
  "react": "18.2.0",
32
32
  "react-dom": "18.2.0"
33
33
  },
34
34
  "dependencies": {
35
- "@uniformdev/canvas": "19.79.1-alpha.18+12234b9350",
36
- "@uniformdev/context": "19.79.1-alpha.18+12234b9350"
35
+ "@uniformdev/canvas": "19.79.1-alpha.25+87cea1cd47",
36
+ "@uniformdev/context": "19.79.1-alpha.25+87cea1cd47"
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": "12234b9350cfa4209bc7e242701d2dc535ece19e"
49
+ "gitHead": "87cea1cd47c691f7d32b876660d5f7c984bb1d87"
50
50
  }