@uniformdev/canvas-next-rsc 19.195.1-alpha.3 → 19.196.1-alpha.2

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/config.js CHANGED
@@ -28,31 +28,58 @@ var import_path = require("path");
28
28
  var getConfigPath = () => {
29
29
  const possibleExtensions = [".js", ".cjs", ".mjs", ".ts"];
30
30
  let configFilePath;
31
+ let configFileName;
31
32
  for (const extension of possibleExtensions) {
32
- const filePath = (0, import_path.join)(process.cwd(), `uniform.server.config${extension}`);
33
+ const fileName = `uniform.server.config${extension}`;
34
+ const filePath = (0, import_path.join)(process.cwd(), fileName);
33
35
  if ((0, import_fs.existsSync)(filePath)) {
34
36
  configFilePath = filePath;
37
+ configFileName = fileName;
35
38
  break;
36
39
  }
37
40
  }
38
- return configFilePath;
41
+ if (!configFilePath) {
42
+ return void 0;
43
+ }
44
+ return {
45
+ filePath: configFilePath,
46
+ fileName: configFileName
47
+ };
39
48
  };
40
- var withUniformConfig = (nextConfig) => ({
41
- ...nextConfig,
42
- webpack: (config, context) => {
43
- if (nextConfig.webpack) {
44
- nextConfig.webpack(config, context);
45
- }
46
- if (context.isServer) {
47
- const uniformConfigPath = getConfigPath();
48
- if (uniformConfigPath) {
49
- console.log("Using Uniform config from", uniformConfigPath);
50
- config.resolve.alias["uniform.server.config"] = (0, import_path.resolve)(config.context, uniformConfigPath);
49
+ var withUniformConfig = (nextConfig) => {
50
+ var _a, _b, _c;
51
+ const { fileName: uniformConfigFileName } = getConfigPath() || {};
52
+ const turboResolveAliases = {
53
+ ...((_b = (_a = nextConfig.experimental) == null ? void 0 : _a.turbo) == null ? void 0 : _b.resolveAlias) || {}
54
+ };
55
+ if (uniformConfigFileName) {
56
+ console.log("(Turbo) Using Uniform config from", uniformConfigFileName);
57
+ turboResolveAliases["uniform.server.config"] = `./${uniformConfigFileName}`;
58
+ }
59
+ return {
60
+ ...nextConfig,
61
+ experimental: {
62
+ ...nextConfig.experimental || {},
63
+ turbo: {
64
+ ...((_c = nextConfig.experimental) == null ? void 0 : _c.turbo) || {},
65
+ resolveAlias: turboResolveAliases
66
+ }
67
+ },
68
+ webpack: (config, context) => {
69
+ if (nextConfig.webpack) {
70
+ nextConfig.webpack(config, context);
51
71
  }
72
+ if (context.isServer) {
73
+ const { filePath: uniformConfigPath } = getConfigPath() || {};
74
+ if (uniformConfigPath) {
75
+ console.log("Using Uniform config from", uniformConfigPath);
76
+ config.resolve.alias["uniform.server.config"] = (0, import_path.resolve)(config.context, uniformConfigPath);
77
+ }
78
+ }
79
+ return config;
52
80
  }
53
- return config;
54
- }
55
- });
81
+ };
82
+ };
56
83
  // Annotate the CommonJS export names for ESM import in node:
57
84
  0 && (module.exports = {
58
85
  withUniformConfig
package/dist/config.mjs CHANGED
@@ -4,31 +4,58 @@ import { join, resolve } from "path";
4
4
  var getConfigPath = () => {
5
5
  const possibleExtensions = [".js", ".cjs", ".mjs", ".ts"];
6
6
  let configFilePath;
7
+ let configFileName;
7
8
  for (const extension of possibleExtensions) {
8
- const filePath = join(process.cwd(), `uniform.server.config${extension}`);
9
+ const fileName = `uniform.server.config${extension}`;
10
+ const filePath = join(process.cwd(), fileName);
9
11
  if (existsSync(filePath)) {
10
12
  configFilePath = filePath;
13
+ configFileName = fileName;
11
14
  break;
12
15
  }
13
16
  }
14
- return configFilePath;
17
+ if (!configFilePath) {
18
+ return void 0;
19
+ }
20
+ return {
21
+ filePath: configFilePath,
22
+ fileName: configFileName
23
+ };
15
24
  };
16
- var withUniformConfig = (nextConfig) => ({
17
- ...nextConfig,
18
- webpack: (config, context) => {
19
- if (nextConfig.webpack) {
20
- nextConfig.webpack(config, context);
21
- }
22
- if (context.isServer) {
23
- const uniformConfigPath = getConfigPath();
24
- if (uniformConfigPath) {
25
- console.log("Using Uniform config from", uniformConfigPath);
26
- config.resolve.alias["uniform.server.config"] = resolve(config.context, uniformConfigPath);
25
+ var withUniformConfig = (nextConfig) => {
26
+ var _a, _b, _c;
27
+ const { fileName: uniformConfigFileName } = getConfigPath() || {};
28
+ const turboResolveAliases = {
29
+ ...((_b = (_a = nextConfig.experimental) == null ? void 0 : _a.turbo) == null ? void 0 : _b.resolveAlias) || {}
30
+ };
31
+ if (uniformConfigFileName) {
32
+ console.log("(Turbo) Using Uniform config from", uniformConfigFileName);
33
+ turboResolveAliases["uniform.server.config"] = `./${uniformConfigFileName}`;
34
+ }
35
+ return {
36
+ ...nextConfig,
37
+ experimental: {
38
+ ...nextConfig.experimental || {},
39
+ turbo: {
40
+ ...((_c = nextConfig.experimental) == null ? void 0 : _c.turbo) || {},
41
+ resolveAlias: turboResolveAliases
42
+ }
43
+ },
44
+ webpack: (config, context) => {
45
+ if (nextConfig.webpack) {
46
+ nextConfig.webpack(config, context);
27
47
  }
48
+ if (context.isServer) {
49
+ const { filePath: uniformConfigPath } = getConfigPath() || {};
50
+ if (uniformConfigPath) {
51
+ console.log("Using Uniform config from", uniformConfigPath);
52
+ config.resolve.alias["uniform.server.config"] = resolve(config.context, uniformConfigPath);
53
+ }
54
+ }
55
+ return config;
28
56
  }
29
- return config;
30
- }
31
- });
57
+ };
58
+ };
32
59
  export {
33
60
  withUniformConfig
34
61
  };
package/dist/handler.js CHANGED
@@ -100,14 +100,14 @@ var createPreviewGETRouteHandler = (options) => {
100
100
  return new Response("Could not resolve the full path of the preview page", { status: 400 });
101
101
  }
102
102
  if (disable) {
103
- (0, import_headers.draftMode)().disable();
103
+ (await (0, import_headers.draftMode)()).disable();
104
104
  (0, import_navigation.redirect)(pathToRedirectTo);
105
105
  return;
106
106
  }
107
107
  if (secret !== process.env.UNIFORM_PREVIEW_SECRET) {
108
108
  return new Response("Invalid preview secret", { status: 401 });
109
109
  }
110
- (0, import_headers.draftMode)().enable();
110
+ (await (0, import_headers.draftMode)()).enable();
111
111
  const redirectionUrl = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
112
112
  assignRequestQueryToSearchParams(redirectionUrl.searchParams, searchParams);
113
113
  if (isPlayground) {
package/dist/handler.mjs CHANGED
@@ -67,14 +67,14 @@ var createPreviewGETRouteHandler = (options) => {
67
67
  return new Response("Could not resolve the full path of the preview page", { status: 400 });
68
68
  }
69
69
  if (disable) {
70
- draftMode().disable();
70
+ (await draftMode()).disable();
71
71
  redirect(pathToRedirectTo);
72
72
  return;
73
73
  }
74
74
  if (secret !== process.env.UNIFORM_PREVIEW_SECRET) {
75
75
  return new Response("Invalid preview secret", { status: 401 });
76
76
  }
77
- draftMode().enable();
77
+ (await draftMode()).enable();
78
78
  const redirectionUrl = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
79
79
  assignRequestQueryToSearchParams(redirectionUrl.searchParams, searchParams);
80
80
  if (isPlayground) {
package/dist/index.d.mts CHANGED
@@ -14,18 +14,18 @@ type GetCanvasClientOptions = {
14
14
  };
15
15
  declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
16
16
  declare const getDefaultCanvasClient: ({ searchParams, }: {
17
- searchParams: PageParameters["searchParams"];
18
- }) => CanvasClient;
17
+ searchParams: Awaited<PageParameters["searchParams"]>;
18
+ }) => Promise<CanvasClient>;
19
19
 
20
20
  type GetManifestClientOptions = {
21
21
  cache: NonNullable<UniformServerConfig['manifestCache']>;
22
22
  };
23
23
  declare const getManifestClient: (options: GetManifestClientOptions) => ManifestClient;
24
24
  declare const getDefaultManifestClient: ({ searchParams, }: {
25
- searchParams?: PageParameters["searchParams"];
26
- }) => ManifestClient;
27
- declare const getManifest: ({ searchParams }: {
28
- searchParams: PageParameters["searchParams"];
25
+ searchParams?: Awaited<PageParameters["searchParams"]>;
26
+ }) => Promise<ManifestClient>;
27
+ declare const getManifest: ({ searchParams, }: {
28
+ searchParams: Awaited<PageParameters["searchParams"]>;
29
29
  }) => Promise<{
30
30
  project: {
31
31
  id?: string;
@@ -187,16 +187,16 @@ type GetProjectMapClientOptions = {
187
187
  };
188
188
  declare const getProjectMapClient: (options: GetProjectMapClientOptions) => ProjectMapClient;
189
189
  declare const getDefaultProjectMapClient: ({ searchParams, }: {
190
- searchParams: PageParameters["searchParams"];
191
- }) => ProjectMapClient;
190
+ searchParams: Awaited<PageParameters["searchParams"]>;
191
+ }) => Promise<ProjectMapClient>;
192
192
 
193
193
  type GetRouteClientOptions = {
194
194
  cache: NonNullable<UniformServerConfig['canvasCache']>;
195
195
  };
196
196
  declare const getRouteClient: (options: GetRouteClientOptions) => RouteClient;
197
- declare const getDefaultRouteClient: ({ searchParams }: {
198
- searchParams: PageParameters["searchParams"];
199
- }) => RouteClient;
197
+ declare const getDefaultRouteClient: ({ searchParams, }: {
198
+ searchParams: Awaited<PageParameters["searchParams"]>;
199
+ }) => Promise<RouteClient>;
200
200
 
201
201
  type ContextUpdateTransferProps = {
202
202
  update: Partial<AppDirectoryContextState> | (() => Promise<Partial<ContextState> | undefined>);
@@ -223,10 +223,10 @@ type UniformContextProps = {
223
223
  declare const UniformContext: React__default.FC<PropsWithChildren<UniformContextProps>>;
224
224
 
225
225
  type UniformPlaygroundProps = PlaygroundParameters & Omit<UniformCompositionProps, 'params' | 'searchParams' | 'route' | 'mode'>;
226
- declare const UniformPlayground: ({ searchParams, ...rest }: UniformPlaygroundProps) => Promise<React__default.JSX.Element>;
226
+ declare const UniformPlayground: ({ searchParams: providedSearchParams, ...rest }: UniformPlaygroundProps) => Promise<React__default.JSX.Element>;
227
227
 
228
228
  type CreateServerUniformContextProps = Omit<ContextOptions, 'transitionStore' | 'manifest'> & {
229
- searchParams: PageParameters['searchParams'];
229
+ searchParams: Awaited<PageParameters['searchParams']>;
230
230
  };
231
231
  declare const createServerUniformContext: (options: CreateServerUniformContextProps) => Promise<AppDirectoryServerContext>;
232
232
 
@@ -234,12 +234,10 @@ declare const isDraftModeEnabled: ({ searchParams, }: {
234
234
  searchParams: {
235
235
  [key: string]: string | undefined;
236
236
  } | undefined;
237
- }) => boolean;
238
- declare const isIncontextEditingEnabled: ({ searchParams, }: {
239
- searchParams: {
240
- [key: string]: string | undefined;
241
- } | undefined;
242
- }) => boolean;
237
+ }) => Promise<boolean>;
238
+ declare const isIncontextEditingEnabled: ({ searchParams: providedSearchParams, }: {
239
+ searchParams: Awaited<PageParameters["searchParams"]>;
240
+ }) => Promise<boolean>;
243
241
  declare const isOnVercelPreviewEnvironment: () => boolean;
244
242
  declare const isDevelopmentEnvironment: () => boolean;
245
243
 
@@ -251,7 +249,10 @@ type RetrieveCommonOptions = {
251
249
  */
252
250
  skipPrefetch?: boolean;
253
251
  };
254
- type RetrieveRouteOptions = PageParameters & RetrieveCommonOptions;
252
+ type RetrieveRouteOptions = {
253
+ params: Awaited<PageParameters['params']>;
254
+ searchParams: Awaited<PageParameters['searchParams']>;
255
+ } & RetrieveCommonOptions;
255
256
  type RetrieveSlugOptions = Pick<CompositionGetBySlugParameters, 'slug' | 'locale' | 'releaseId' | 'versionId'> & {
256
257
  /**
257
258
  * The searchParams object from Next.js router. Used for signal evaluation.
package/dist/index.d.ts CHANGED
@@ -14,18 +14,18 @@ type GetCanvasClientOptions = {
14
14
  };
15
15
  declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
16
16
  declare const getDefaultCanvasClient: ({ searchParams, }: {
17
- searchParams: PageParameters["searchParams"];
18
- }) => CanvasClient;
17
+ searchParams: Awaited<PageParameters["searchParams"]>;
18
+ }) => Promise<CanvasClient>;
19
19
 
20
20
  type GetManifestClientOptions = {
21
21
  cache: NonNullable<UniformServerConfig['manifestCache']>;
22
22
  };
23
23
  declare const getManifestClient: (options: GetManifestClientOptions) => ManifestClient;
24
24
  declare const getDefaultManifestClient: ({ searchParams, }: {
25
- searchParams?: PageParameters["searchParams"];
26
- }) => ManifestClient;
27
- declare const getManifest: ({ searchParams }: {
28
- searchParams: PageParameters["searchParams"];
25
+ searchParams?: Awaited<PageParameters["searchParams"]>;
26
+ }) => Promise<ManifestClient>;
27
+ declare const getManifest: ({ searchParams, }: {
28
+ searchParams: Awaited<PageParameters["searchParams"]>;
29
29
  }) => Promise<{
30
30
  project: {
31
31
  id?: string;
@@ -187,16 +187,16 @@ type GetProjectMapClientOptions = {
187
187
  };
188
188
  declare const getProjectMapClient: (options: GetProjectMapClientOptions) => ProjectMapClient;
189
189
  declare const getDefaultProjectMapClient: ({ searchParams, }: {
190
- searchParams: PageParameters["searchParams"];
191
- }) => ProjectMapClient;
190
+ searchParams: Awaited<PageParameters["searchParams"]>;
191
+ }) => Promise<ProjectMapClient>;
192
192
 
193
193
  type GetRouteClientOptions = {
194
194
  cache: NonNullable<UniformServerConfig['canvasCache']>;
195
195
  };
196
196
  declare const getRouteClient: (options: GetRouteClientOptions) => RouteClient;
197
- declare const getDefaultRouteClient: ({ searchParams }: {
198
- searchParams: PageParameters["searchParams"];
199
- }) => RouteClient;
197
+ declare const getDefaultRouteClient: ({ searchParams, }: {
198
+ searchParams: Awaited<PageParameters["searchParams"]>;
199
+ }) => Promise<RouteClient>;
200
200
 
201
201
  type ContextUpdateTransferProps = {
202
202
  update: Partial<AppDirectoryContextState> | (() => Promise<Partial<ContextState> | undefined>);
@@ -223,10 +223,10 @@ type UniformContextProps = {
223
223
  declare const UniformContext: React__default.FC<PropsWithChildren<UniformContextProps>>;
224
224
 
225
225
  type UniformPlaygroundProps = PlaygroundParameters & Omit<UniformCompositionProps, 'params' | 'searchParams' | 'route' | 'mode'>;
226
- declare const UniformPlayground: ({ searchParams, ...rest }: UniformPlaygroundProps) => Promise<React__default.JSX.Element>;
226
+ declare const UniformPlayground: ({ searchParams: providedSearchParams, ...rest }: UniformPlaygroundProps) => Promise<React__default.JSX.Element>;
227
227
 
228
228
  type CreateServerUniformContextProps = Omit<ContextOptions, 'transitionStore' | 'manifest'> & {
229
- searchParams: PageParameters['searchParams'];
229
+ searchParams: Awaited<PageParameters['searchParams']>;
230
230
  };
231
231
  declare const createServerUniformContext: (options: CreateServerUniformContextProps) => Promise<AppDirectoryServerContext>;
232
232
 
@@ -234,12 +234,10 @@ declare const isDraftModeEnabled: ({ searchParams, }: {
234
234
  searchParams: {
235
235
  [key: string]: string | undefined;
236
236
  } | undefined;
237
- }) => boolean;
238
- declare const isIncontextEditingEnabled: ({ searchParams, }: {
239
- searchParams: {
240
- [key: string]: string | undefined;
241
- } | undefined;
242
- }) => boolean;
237
+ }) => Promise<boolean>;
238
+ declare const isIncontextEditingEnabled: ({ searchParams: providedSearchParams, }: {
239
+ searchParams: Awaited<PageParameters["searchParams"]>;
240
+ }) => Promise<boolean>;
243
241
  declare const isOnVercelPreviewEnvironment: () => boolean;
244
242
  declare const isDevelopmentEnvironment: () => boolean;
245
243
 
@@ -251,7 +249,10 @@ type RetrieveCommonOptions = {
251
249
  */
252
250
  skipPrefetch?: boolean;
253
251
  };
254
- type RetrieveRouteOptions = PageParameters & RetrieveCommonOptions;
252
+ type RetrieveRouteOptions = {
253
+ params: Awaited<PageParameters['params']>;
254
+ searchParams: Awaited<PageParameters['searchParams']>;
255
+ } & RetrieveCommonOptions;
255
256
  type RetrieveSlugOptions = Pick<CompositionGetBySlugParameters, 'slug' | 'locale' | 'releaseId' | 'versionId'> & {
256
257
  /**
257
258
  * The searchParams object from Next.js router. Used for signal evaluation.
package/dist/index.esm.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM
14
14
  } from "@uniformdev/canvas";
15
15
  import { draftMode } from "next/headers";
16
- var isDraftModeEnabled = ({
16
+ var isDraftModeEnabled = async ({
17
17
  searchParams
18
18
  }) => {
19
19
  if (isDevelopmentEnvironment()) {
@@ -21,14 +21,15 @@ var isDraftModeEnabled = ({
21
21
  }
22
22
  let draftModeEnabled = false;
23
23
  try {
24
- draftModeEnabled = draftMode().isEnabled;
24
+ draftModeEnabled = (await draftMode()).isEnabled;
25
25
  } catch (e) {
26
26
  }
27
27
  return draftModeEnabled || isIncontextEditingEnabled({ searchParams });
28
28
  };
29
- var isIncontextEditingEnabled = ({
30
- searchParams
29
+ var isIncontextEditingEnabled = async ({
30
+ searchParams: providedSearchParams
31
31
  }) => {
32
+ const searchParams = await (providedSearchParams || Promise.resolve(void 0));
32
33
  const containsKey = typeof (searchParams == null ? void 0 : searchParams[IN_CONTEXT_EDITOR_QUERY_STRING_PARAM]) !== "undefined";
33
34
  return containsKey;
34
35
  };
@@ -63,11 +64,11 @@ var isDevelopmentEnvironment = () => {
63
64
  var getServerConfig = () => {
64
65
  return serverConfig;
65
66
  };
66
- var shouldCacheBeDisabled = (options) => {
67
- if (isDraftModeEnabled(options)) {
67
+ var shouldCacheBeDisabled = async (options) => {
68
+ if (await isDraftModeEnabled(options)) {
68
69
  return { disabled: true, reason: "DRAFT" };
69
70
  }
70
- if (isIncontextEditingEnabled(options)) {
71
+ if (await isIncontextEditingEnabled(options)) {
71
72
  return { disabled: true, reason: "INCONTEXT" };
72
73
  }
73
74
  if (isDevelopmentEnvironment()) {
@@ -78,8 +79,8 @@ var shouldCacheBeDisabled = (options) => {
78
79
  reason: void 0
79
80
  };
80
81
  };
81
- var getCanvasCacheStrategy = (options) => {
82
- const { disabled, reason } = shouldCacheBeDisabled(options);
82
+ var getCanvasCacheStrategy = async (options) => {
83
+ const { disabled, reason } = await shouldCacheBeDisabled(options);
83
84
  const config = getServerConfig();
84
85
  if (disabled) {
85
86
  if (reason === "DEV" && config.canvasCache) {
@@ -98,8 +99,8 @@ var getCanvasCacheStrategy = (options) => {
98
99
  type: "force-cache"
99
100
  };
100
101
  };
101
- var getManifestCacheStrategy = (options) => {
102
- const { disabled, reason } = shouldCacheBeDisabled(options);
102
+ var getManifestCacheStrategy = async (options) => {
103
+ const { disabled, reason } = await shouldCacheBeDisabled(options);
103
104
  const config = getServerConfig();
104
105
  if (disabled) {
105
106
  if (reason === "DEV" && config.manifestCache) {
@@ -117,8 +118,8 @@ var getManifestCacheStrategy = (options) => {
117
118
  type: "force-cache"
118
119
  };
119
120
  };
120
- var getProjectMapCacheStrategy = (options) => {
121
- const { disabled, reason } = shouldCacheBeDisabled(options);
121
+ var getProjectMapCacheStrategy = async (options) => {
122
+ const { disabled, reason } = await shouldCacheBeDisabled(options);
122
123
  const config = getServerConfig();
123
124
  if (disabled) {
124
125
  if (reason === "DEV" && config.projectMapCache) {
@@ -227,11 +228,11 @@ var getCanvasClient = (options) => {
227
228
  }
228
229
  });
229
230
  };
230
- var getDefaultCanvasClient = ({
231
+ var getDefaultCanvasClient = async ({
231
232
  searchParams
232
233
  }) => {
233
234
  return getCanvasClient({
234
- cache: getCanvasCacheStrategy({
235
+ cache: await getCanvasCacheStrategy({
235
236
  searchParams
236
237
  })
237
238
  });
@@ -262,17 +263,19 @@ var getManifestClient = (options) => {
262
263
  });
263
264
  return manifestClient;
264
265
  };
265
- var getDefaultManifestClient = ({
266
+ var getDefaultManifestClient = async ({
266
267
  searchParams
267
268
  }) => {
268
269
  return getManifestClient({
269
- cache: getManifestCacheStrategy({
270
+ cache: await getManifestCacheStrategy({
270
271
  searchParams
271
272
  })
272
273
  });
273
274
  };
274
- var getManifest = ({ searchParams }) => {
275
- const manifestClient = getDefaultManifestClient({
275
+ var getManifest = async ({
276
+ searchParams
277
+ }) => {
278
+ const manifestClient = await getDefaultManifestClient({
276
279
  searchParams
277
280
  });
278
281
  return manifestClient.get();
@@ -302,11 +305,11 @@ var getProjectMapClient = (options) => {
302
305
  });
303
306
  return manifestClient;
304
307
  };
305
- var getDefaultProjectMapClient = ({
308
+ var getDefaultProjectMapClient = async ({
306
309
  searchParams
307
310
  }) => {
308
311
  return getProjectMapClient({
309
- cache: getProjectMapCacheStrategy({
312
+ cache: await getProjectMapCacheStrategy({
310
313
  searchParams
311
314
  })
312
315
  });
@@ -359,9 +362,11 @@ var getRouteClient = (options) => {
359
362
  });
360
363
  return client;
361
364
  };
362
- var getDefaultRouteClient = ({ searchParams }) => {
365
+ var getDefaultRouteClient = async ({
366
+ searchParams
367
+ }) => {
363
368
  return getRouteClient({
364
- cache: getCanvasCacheStrategy({
369
+ cache: await getCanvasCacheStrategy({
365
370
  searchParams
366
371
  })
367
372
  });
@@ -455,7 +460,7 @@ var createServerUniformContextFromManifest = async (options) => {
455
460
  var _a;
456
461
  const context = createUniformContext({
457
462
  ...options || {},
458
- serverCookieValue: (_a = cookies().get(UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _a.value
463
+ serverCookieValue: (_a = (await cookies()).get(UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _a.value
459
464
  });
460
465
  return context;
461
466
  };
@@ -484,12 +489,12 @@ var retrieveCompositionBySlug = async ({
484
489
  });
485
490
  }
486
491
  let result;
487
- const states = determineState({
492
+ const states = await determineState({
488
493
  searchParams
489
494
  });
490
495
  for (let i = 0; i < states.length; i++) {
491
496
  const state = states[i];
492
- const canvasClient = getDefaultCanvasClient({
497
+ const canvasClient = await getDefaultCanvasClient({
493
498
  searchParams
494
499
  });
495
500
  try {
@@ -527,7 +532,7 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
527
532
  const { value } = resolvePath({
528
533
  params
529
534
  });
530
- const states = determineState({
535
+ const states = await determineState({
531
536
  searchParams
532
537
  });
533
538
  let result;
@@ -554,11 +559,12 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
554
559
  var retrieveRouteByPath = async ({
555
560
  path,
556
561
  state,
557
- searchParams,
562
+ searchParams: providedSearchParams,
558
563
  fetchOptions
559
564
  }) => {
560
565
  var _a;
561
- const client = getDefaultRouteClient({
566
+ const searchParams = await (providedSearchParams != null ? providedSearchParams : Promise.resolve(void 0));
567
+ const client = await getDefaultRouteClient({
562
568
  searchParams
563
569
  });
564
570
  let queryPath = path;
@@ -589,11 +595,13 @@ var resolveRedirectHref = (resolveResult, path) => {
589
595
  const url = new URL(expandedUrl);
590
596
  return url.pathname;
591
597
  };
592
- var determineState = ({ searchParams }) => {
593
- const draftMode2 = isDraftModeEnabled({ searchParams });
598
+ var determineState = async ({
599
+ searchParams
600
+ }) => {
601
+ const draftMode2 = await isDraftModeEnabled({ searchParams });
594
602
  const previewEnvironment = isOnVercelPreviewEnvironment();
595
603
  const isDevelopment = isDevelopmentEnvironment();
596
- const isCanvasEditing = isIncontextEditingEnabled({
604
+ const isCanvasEditing = await isIncontextEditingEnabled({
597
605
  searchParams
598
606
  });
599
607
  let states;
@@ -725,12 +733,14 @@ var UniformComposition = async ({
725
733
  if (props.mode === "static") {
726
734
  searchParams = void 0;
727
735
  } else if (props.mode === "server") {
736
+ searchParams = await props.searchParams;
728
737
  serverContext = props.serverContext || await createServerUniformContext({
729
- searchParams: props.searchParams
738
+ searchParams
730
739
  });
731
- searchParams = props.searchParams;
732
740
  }
733
- const { value: path } = resolvePath2(props);
741
+ const { value: path } = resolvePath2({
742
+ params: await props.params
743
+ });
734
744
  if (!route || route.type === "notFound") {
735
745
  notFound();
736
746
  }
@@ -760,8 +770,8 @@ var UniformComposition = async ({
760
770
  searchParams,
761
771
  dynamicInputs: route.dynamicInputs,
762
772
  type: "composition",
763
- isContextualEditing: isIncontextEditingEnabled({ searchParams }),
764
- isDraftMode: isDraftModeEnabled({ searchParams }),
773
+ isContextualEditing: await isIncontextEditingEnabled({ searchParams }),
774
+ isDraftMode: await isDraftModeEnabled({ searchParams }),
765
775
  state: route.compositionApiResponse.state,
766
776
  path,
767
777
  previewMode: determinePreviewMode({ searchParams })
@@ -775,14 +785,14 @@ var UniformComposition = async ({
775
785
  });
776
786
  let transfer = null;
777
787
  if (props.mode === "server") {
778
- const headersValue = headers();
788
+ const headersValue = await headers();
779
789
  const missingQuirkValue = "unknown";
780
790
  transfer = createElement3(ContextUpdateTransfer, {
781
791
  serverContext,
782
792
  update: {
783
- params: props.params,
793
+ params: await props.params,
784
794
  searchParams,
785
- cookies: cookies2().getAll().reduce(
795
+ cookies: (await cookies2()).getAll().reduce(
786
796
  (acc, cookie) => {
787
797
  acc[cookie.name] = cookie.value;
788
798
  return acc;
@@ -1076,8 +1086,12 @@ var UniformContext = async ({
1076
1086
  import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, CANVAS_EDITOR_STATE as CANVAS_EDITOR_STATE3 } from "@uniformdev/canvas";
1077
1087
  import { notFound as notFound2 } from "next/navigation";
1078
1088
  import React8 from "react";
1079
- var UniformPlayground = async ({ searchParams, ...rest }) => {
1080
- if (!isDraftModeEnabled({ searchParams })) {
1089
+ var UniformPlayground = async ({
1090
+ searchParams: providedSearchParams,
1091
+ ...rest
1092
+ }) => {
1093
+ const searchParams = await (providedSearchParams != null ? providedSearchParams : {});
1094
+ if (!await isDraftModeEnabled({ searchParams })) {
1081
1095
  return /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement("h1", null, "Playground is only available in draft mode"));
1082
1096
  }
1083
1097
  const id = searchParams["id"];
package/dist/index.js CHANGED
@@ -66,7 +66,7 @@ var import_uniform_server = __toESM(require("uniform.server.config"));
66
66
  // src/utils/draft.ts
67
67
  var import_canvas = require("@uniformdev/canvas");
68
68
  var import_headers = require("next/headers");
69
- var isDraftModeEnabled = ({
69
+ var isDraftModeEnabled = async ({
70
70
  searchParams
71
71
  }) => {
72
72
  if (isDevelopmentEnvironment()) {
@@ -74,14 +74,15 @@ var isDraftModeEnabled = ({
74
74
  }
75
75
  let draftModeEnabled = false;
76
76
  try {
77
- draftModeEnabled = (0, import_headers.draftMode)().isEnabled;
77
+ draftModeEnabled = (await (0, import_headers.draftMode)()).isEnabled;
78
78
  } catch (e) {
79
79
  }
80
80
  return draftModeEnabled || isIncontextEditingEnabled({ searchParams });
81
81
  };
82
- var isIncontextEditingEnabled = ({
83
- searchParams
82
+ var isIncontextEditingEnabled = async ({
83
+ searchParams: providedSearchParams
84
84
  }) => {
85
+ const searchParams = await (providedSearchParams || Promise.resolve(void 0));
85
86
  const containsKey = typeof (searchParams == null ? void 0 : searchParams[import_canvas.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM]) !== "undefined";
86
87
  return containsKey;
87
88
  };
@@ -116,11 +117,11 @@ var isDevelopmentEnvironment = () => {
116
117
  var getServerConfig = () => {
117
118
  return import_uniform_server.default;
118
119
  };
119
- var shouldCacheBeDisabled = (options) => {
120
- if (isDraftModeEnabled(options)) {
120
+ var shouldCacheBeDisabled = async (options) => {
121
+ if (await isDraftModeEnabled(options)) {
121
122
  return { disabled: true, reason: "DRAFT" };
122
123
  }
123
- if (isIncontextEditingEnabled(options)) {
124
+ if (await isIncontextEditingEnabled(options)) {
124
125
  return { disabled: true, reason: "INCONTEXT" };
125
126
  }
126
127
  if (isDevelopmentEnvironment()) {
@@ -131,8 +132,8 @@ var shouldCacheBeDisabled = (options) => {
131
132
  reason: void 0
132
133
  };
133
134
  };
134
- var getCanvasCacheStrategy = (options) => {
135
- const { disabled, reason } = shouldCacheBeDisabled(options);
135
+ var getCanvasCacheStrategy = async (options) => {
136
+ const { disabled, reason } = await shouldCacheBeDisabled(options);
136
137
  const config = getServerConfig();
137
138
  if (disabled) {
138
139
  if (reason === "DEV" && config.canvasCache) {
@@ -151,8 +152,8 @@ var getCanvasCacheStrategy = (options) => {
151
152
  type: "force-cache"
152
153
  };
153
154
  };
154
- var getManifestCacheStrategy = (options) => {
155
- const { disabled, reason } = shouldCacheBeDisabled(options);
155
+ var getManifestCacheStrategy = async (options) => {
156
+ const { disabled, reason } = await shouldCacheBeDisabled(options);
156
157
  const config = getServerConfig();
157
158
  if (disabled) {
158
159
  if (reason === "DEV" && config.manifestCache) {
@@ -170,8 +171,8 @@ var getManifestCacheStrategy = (options) => {
170
171
  type: "force-cache"
171
172
  };
172
173
  };
173
- var getProjectMapCacheStrategy = (options) => {
174
- const { disabled, reason } = shouldCacheBeDisabled(options);
174
+ var getProjectMapCacheStrategy = async (options) => {
175
+ const { disabled, reason } = await shouldCacheBeDisabled(options);
175
176
  const config = getServerConfig();
176
177
  if (disabled) {
177
178
  if (reason === "DEV" && config.projectMapCache) {
@@ -280,11 +281,11 @@ var getCanvasClient = (options) => {
280
281
  }
281
282
  });
282
283
  };
283
- var getDefaultCanvasClient = ({
284
+ var getDefaultCanvasClient = async ({
284
285
  searchParams
285
286
  }) => {
286
287
  return getCanvasClient({
287
- cache: getCanvasCacheStrategy({
288
+ cache: await getCanvasCacheStrategy({
288
289
  searchParams
289
290
  })
290
291
  });
@@ -315,17 +316,19 @@ var getManifestClient = (options) => {
315
316
  });
316
317
  return manifestClient;
317
318
  };
318
- var getDefaultManifestClient = ({
319
+ var getDefaultManifestClient = async ({
319
320
  searchParams
320
321
  }) => {
321
322
  return getManifestClient({
322
- cache: getManifestCacheStrategy({
323
+ cache: await getManifestCacheStrategy({
323
324
  searchParams
324
325
  })
325
326
  });
326
327
  };
327
- var getManifest = ({ searchParams }) => {
328
- const manifestClient = getDefaultManifestClient({
328
+ var getManifest = async ({
329
+ searchParams
330
+ }) => {
331
+ const manifestClient = await getDefaultManifestClient({
329
332
  searchParams
330
333
  });
331
334
  return manifestClient.get();
@@ -355,11 +358,11 @@ var getProjectMapClient = (options) => {
355
358
  });
356
359
  return manifestClient;
357
360
  };
358
- var getDefaultProjectMapClient = ({
361
+ var getDefaultProjectMapClient = async ({
359
362
  searchParams
360
363
  }) => {
361
364
  return getProjectMapClient({
362
- cache: getProjectMapCacheStrategy({
365
+ cache: await getProjectMapCacheStrategy({
363
366
  searchParams
364
367
  })
365
368
  });
@@ -412,9 +415,11 @@ var getRouteClient = (options) => {
412
415
  });
413
416
  return client;
414
417
  };
415
- var getDefaultRouteClient = ({ searchParams }) => {
418
+ var getDefaultRouteClient = async ({
419
+ searchParams
420
+ }) => {
416
421
  return getRouteClient({
417
- cache: getCanvasCacheStrategy({
422
+ cache: await getCanvasCacheStrategy({
418
423
  searchParams
419
424
  })
420
425
  });
@@ -495,7 +500,7 @@ var createServerUniformContextFromManifest = async (options) => {
495
500
  var _a;
496
501
  const context = (0, import_canvas_next_rsc_shared.createUniformContext)({
497
502
  ...options || {},
498
- serverCookieValue: (_a = (0, import_headers2.cookies)().get(import_context.UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _a.value
503
+ serverCookieValue: (_a = (await (0, import_headers2.cookies)()).get(import_context.UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _a.value
499
504
  });
500
505
  return context;
501
506
  };
@@ -519,12 +524,12 @@ var retrieveCompositionBySlug = async ({
519
524
  });
520
525
  }
521
526
  let result;
522
- const states = determineState({
527
+ const states = await determineState({
523
528
  searchParams
524
529
  });
525
530
  for (let i = 0; i < states.length; i++) {
526
531
  const state = states[i];
527
- const canvasClient = getDefaultCanvasClient({
532
+ const canvasClient = await getDefaultCanvasClient({
528
533
  searchParams
529
534
  });
530
535
  try {
@@ -562,7 +567,7 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
562
567
  const { value } = (0, import_canvas_next_rsc_shared2.resolvePath)({
563
568
  params
564
569
  });
565
- const states = determineState({
570
+ const states = await determineState({
566
571
  searchParams
567
572
  });
568
573
  let result;
@@ -589,11 +594,12 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
589
594
  var retrieveRouteByPath = async ({
590
595
  path,
591
596
  state,
592
- searchParams,
597
+ searchParams: providedSearchParams,
593
598
  fetchOptions
594
599
  }) => {
595
600
  var _a;
596
- const client = getDefaultRouteClient({
601
+ const searchParams = await (providedSearchParams != null ? providedSearchParams : Promise.resolve(void 0));
602
+ const client = await getDefaultRouteClient({
597
603
  searchParams
598
604
  });
599
605
  let queryPath = path;
@@ -624,11 +630,13 @@ var resolveRedirectHref = (resolveResult, path) => {
624
630
  const url = new URL(expandedUrl);
625
631
  return url.pathname;
626
632
  };
627
- var determineState = ({ searchParams }) => {
628
- const draftMode2 = isDraftModeEnabled({ searchParams });
633
+ var determineState = async ({
634
+ searchParams
635
+ }) => {
636
+ const draftMode2 = await isDraftModeEnabled({ searchParams });
629
637
  const previewEnvironment = isOnVercelPreviewEnvironment();
630
638
  const isDevelopment = isDevelopmentEnvironment();
631
- const isCanvasEditing = isIncontextEditingEnabled({
639
+ const isCanvasEditing = await isIncontextEditingEnabled({
632
640
  searchParams
633
641
  });
634
642
  let states;
@@ -755,12 +763,14 @@ var UniformComposition = async ({
755
763
  if (props.mode === "static") {
756
764
  searchParams = void 0;
757
765
  } else if (props.mode === "server") {
766
+ searchParams = await props.searchParams;
758
767
  serverContext = props.serverContext || await createServerUniformContext({
759
- searchParams: props.searchParams
768
+ searchParams
760
769
  });
761
- searchParams = props.searchParams;
762
770
  }
763
- const { value: path } = (0, import_canvas_next_rsc_shared6.resolvePath)(props);
771
+ const { value: path } = (0, import_canvas_next_rsc_shared6.resolvePath)({
772
+ params: await props.params
773
+ });
764
774
  if (!route || route.type === "notFound") {
765
775
  (0, import_navigation.notFound)();
766
776
  }
@@ -790,8 +800,8 @@ var UniformComposition = async ({
790
800
  searchParams,
791
801
  dynamicInputs: route.dynamicInputs,
792
802
  type: "composition",
793
- isContextualEditing: isIncontextEditingEnabled({ searchParams }),
794
- isDraftMode: isDraftModeEnabled({ searchParams }),
803
+ isContextualEditing: await isIncontextEditingEnabled({ searchParams }),
804
+ isDraftMode: await isDraftModeEnabled({ searchParams }),
795
805
  state: route.compositionApiResponse.state,
796
806
  path,
797
807
  previewMode: determinePreviewMode({ searchParams })
@@ -805,14 +815,14 @@ var UniformComposition = async ({
805
815
  });
806
816
  let transfer = null;
807
817
  if (props.mode === "server") {
808
- const headersValue = (0, import_headers3.headers)();
818
+ const headersValue = await (0, import_headers3.headers)();
809
819
  const missingQuirkValue = "unknown";
810
820
  transfer = (0, import_react9.createElement)(ContextUpdateTransfer, {
811
821
  serverContext,
812
822
  update: {
813
- params: props.params,
823
+ params: await props.params,
814
824
  searchParams,
815
- cookies: (0, import_headers3.cookies)().getAll().reduce(
825
+ cookies: (await (0, import_headers3.cookies)()).getAll().reduce(
816
826
  (acc, cookie) => {
817
827
  acc[cookie.name] = cookie.value;
818
828
  return acc;
@@ -1103,8 +1113,12 @@ var UniformContext = async ({
1103
1113
  var import_canvas9 = require("@uniformdev/canvas");
1104
1114
  var import_navigation2 = require("next/navigation");
1105
1115
  var import_react12 = __toESM(require("react"));
1106
- var UniformPlayground = async ({ searchParams, ...rest }) => {
1107
- if (!isDraftModeEnabled({ searchParams })) {
1116
+ var UniformPlayground = async ({
1117
+ searchParams: providedSearchParams,
1118
+ ...rest
1119
+ }) => {
1120
+ const searchParams = await (providedSearchParams != null ? providedSearchParams : {});
1121
+ if (!await isDraftModeEnabled({ searchParams })) {
1108
1122
  return /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("h1", null, "Playground is only available in draft mode"));
1109
1123
  }
1110
1124
  const id = searchParams["id"];
package/dist/index.mjs CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM
14
14
  } from "@uniformdev/canvas";
15
15
  import { draftMode } from "next/headers";
16
- var isDraftModeEnabled = ({
16
+ var isDraftModeEnabled = async ({
17
17
  searchParams
18
18
  }) => {
19
19
  if (isDevelopmentEnvironment()) {
@@ -21,14 +21,15 @@ var isDraftModeEnabled = ({
21
21
  }
22
22
  let draftModeEnabled = false;
23
23
  try {
24
- draftModeEnabled = draftMode().isEnabled;
24
+ draftModeEnabled = (await draftMode()).isEnabled;
25
25
  } catch (e) {
26
26
  }
27
27
  return draftModeEnabled || isIncontextEditingEnabled({ searchParams });
28
28
  };
29
- var isIncontextEditingEnabled = ({
30
- searchParams
29
+ var isIncontextEditingEnabled = async ({
30
+ searchParams: providedSearchParams
31
31
  }) => {
32
+ const searchParams = await (providedSearchParams || Promise.resolve(void 0));
32
33
  const containsKey = typeof (searchParams == null ? void 0 : searchParams[IN_CONTEXT_EDITOR_QUERY_STRING_PARAM]) !== "undefined";
33
34
  return containsKey;
34
35
  };
@@ -63,11 +64,11 @@ var isDevelopmentEnvironment = () => {
63
64
  var getServerConfig = () => {
64
65
  return serverConfig;
65
66
  };
66
- var shouldCacheBeDisabled = (options) => {
67
- if (isDraftModeEnabled(options)) {
67
+ var shouldCacheBeDisabled = async (options) => {
68
+ if (await isDraftModeEnabled(options)) {
68
69
  return { disabled: true, reason: "DRAFT" };
69
70
  }
70
- if (isIncontextEditingEnabled(options)) {
71
+ if (await isIncontextEditingEnabled(options)) {
71
72
  return { disabled: true, reason: "INCONTEXT" };
72
73
  }
73
74
  if (isDevelopmentEnvironment()) {
@@ -78,8 +79,8 @@ var shouldCacheBeDisabled = (options) => {
78
79
  reason: void 0
79
80
  };
80
81
  };
81
- var getCanvasCacheStrategy = (options) => {
82
- const { disabled, reason } = shouldCacheBeDisabled(options);
82
+ var getCanvasCacheStrategy = async (options) => {
83
+ const { disabled, reason } = await shouldCacheBeDisabled(options);
83
84
  const config = getServerConfig();
84
85
  if (disabled) {
85
86
  if (reason === "DEV" && config.canvasCache) {
@@ -98,8 +99,8 @@ var getCanvasCacheStrategy = (options) => {
98
99
  type: "force-cache"
99
100
  };
100
101
  };
101
- var getManifestCacheStrategy = (options) => {
102
- const { disabled, reason } = shouldCacheBeDisabled(options);
102
+ var getManifestCacheStrategy = async (options) => {
103
+ const { disabled, reason } = await shouldCacheBeDisabled(options);
103
104
  const config = getServerConfig();
104
105
  if (disabled) {
105
106
  if (reason === "DEV" && config.manifestCache) {
@@ -117,8 +118,8 @@ var getManifestCacheStrategy = (options) => {
117
118
  type: "force-cache"
118
119
  };
119
120
  };
120
- var getProjectMapCacheStrategy = (options) => {
121
- const { disabled, reason } = shouldCacheBeDisabled(options);
121
+ var getProjectMapCacheStrategy = async (options) => {
122
+ const { disabled, reason } = await shouldCacheBeDisabled(options);
122
123
  const config = getServerConfig();
123
124
  if (disabled) {
124
125
  if (reason === "DEV" && config.projectMapCache) {
@@ -227,11 +228,11 @@ var getCanvasClient = (options) => {
227
228
  }
228
229
  });
229
230
  };
230
- var getDefaultCanvasClient = ({
231
+ var getDefaultCanvasClient = async ({
231
232
  searchParams
232
233
  }) => {
233
234
  return getCanvasClient({
234
- cache: getCanvasCacheStrategy({
235
+ cache: await getCanvasCacheStrategy({
235
236
  searchParams
236
237
  })
237
238
  });
@@ -262,17 +263,19 @@ var getManifestClient = (options) => {
262
263
  });
263
264
  return manifestClient;
264
265
  };
265
- var getDefaultManifestClient = ({
266
+ var getDefaultManifestClient = async ({
266
267
  searchParams
267
268
  }) => {
268
269
  return getManifestClient({
269
- cache: getManifestCacheStrategy({
270
+ cache: await getManifestCacheStrategy({
270
271
  searchParams
271
272
  })
272
273
  });
273
274
  };
274
- var getManifest = ({ searchParams }) => {
275
- const manifestClient = getDefaultManifestClient({
275
+ var getManifest = async ({
276
+ searchParams
277
+ }) => {
278
+ const manifestClient = await getDefaultManifestClient({
276
279
  searchParams
277
280
  });
278
281
  return manifestClient.get();
@@ -302,11 +305,11 @@ var getProjectMapClient = (options) => {
302
305
  });
303
306
  return manifestClient;
304
307
  };
305
- var getDefaultProjectMapClient = ({
308
+ var getDefaultProjectMapClient = async ({
306
309
  searchParams
307
310
  }) => {
308
311
  return getProjectMapClient({
309
- cache: getProjectMapCacheStrategy({
312
+ cache: await getProjectMapCacheStrategy({
310
313
  searchParams
311
314
  })
312
315
  });
@@ -359,9 +362,11 @@ var getRouteClient = (options) => {
359
362
  });
360
363
  return client;
361
364
  };
362
- var getDefaultRouteClient = ({ searchParams }) => {
365
+ var getDefaultRouteClient = async ({
366
+ searchParams
367
+ }) => {
363
368
  return getRouteClient({
364
- cache: getCanvasCacheStrategy({
369
+ cache: await getCanvasCacheStrategy({
365
370
  searchParams
366
371
  })
367
372
  });
@@ -455,7 +460,7 @@ var createServerUniformContextFromManifest = async (options) => {
455
460
  var _a;
456
461
  const context = createUniformContext({
457
462
  ...options || {},
458
- serverCookieValue: (_a = cookies().get(UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _a.value
463
+ serverCookieValue: (_a = (await cookies()).get(UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _a.value
459
464
  });
460
465
  return context;
461
466
  };
@@ -484,12 +489,12 @@ var retrieveCompositionBySlug = async ({
484
489
  });
485
490
  }
486
491
  let result;
487
- const states = determineState({
492
+ const states = await determineState({
488
493
  searchParams
489
494
  });
490
495
  for (let i = 0; i < states.length; i++) {
491
496
  const state = states[i];
492
- const canvasClient = getDefaultCanvasClient({
497
+ const canvasClient = await getDefaultCanvasClient({
493
498
  searchParams
494
499
  });
495
500
  try {
@@ -527,7 +532,7 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
527
532
  const { value } = resolvePath({
528
533
  params
529
534
  });
530
- const states = determineState({
535
+ const states = await determineState({
531
536
  searchParams
532
537
  });
533
538
  let result;
@@ -554,11 +559,12 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
554
559
  var retrieveRouteByPath = async ({
555
560
  path,
556
561
  state,
557
- searchParams,
562
+ searchParams: providedSearchParams,
558
563
  fetchOptions
559
564
  }) => {
560
565
  var _a;
561
- const client = getDefaultRouteClient({
566
+ const searchParams = await (providedSearchParams != null ? providedSearchParams : Promise.resolve(void 0));
567
+ const client = await getDefaultRouteClient({
562
568
  searchParams
563
569
  });
564
570
  let queryPath = path;
@@ -589,11 +595,13 @@ var resolveRedirectHref = (resolveResult, path) => {
589
595
  const url = new URL(expandedUrl);
590
596
  return url.pathname;
591
597
  };
592
- var determineState = ({ searchParams }) => {
593
- const draftMode2 = isDraftModeEnabled({ searchParams });
598
+ var determineState = async ({
599
+ searchParams
600
+ }) => {
601
+ const draftMode2 = await isDraftModeEnabled({ searchParams });
594
602
  const previewEnvironment = isOnVercelPreviewEnvironment();
595
603
  const isDevelopment = isDevelopmentEnvironment();
596
- const isCanvasEditing = isIncontextEditingEnabled({
604
+ const isCanvasEditing = await isIncontextEditingEnabled({
597
605
  searchParams
598
606
  });
599
607
  let states;
@@ -725,12 +733,14 @@ var UniformComposition = async ({
725
733
  if (props.mode === "static") {
726
734
  searchParams = void 0;
727
735
  } else if (props.mode === "server") {
736
+ searchParams = await props.searchParams;
728
737
  serverContext = props.serverContext || await createServerUniformContext({
729
- searchParams: props.searchParams
738
+ searchParams
730
739
  });
731
- searchParams = props.searchParams;
732
740
  }
733
- const { value: path } = resolvePath2(props);
741
+ const { value: path } = resolvePath2({
742
+ params: await props.params
743
+ });
734
744
  if (!route || route.type === "notFound") {
735
745
  notFound();
736
746
  }
@@ -760,8 +770,8 @@ var UniformComposition = async ({
760
770
  searchParams,
761
771
  dynamicInputs: route.dynamicInputs,
762
772
  type: "composition",
763
- isContextualEditing: isIncontextEditingEnabled({ searchParams }),
764
- isDraftMode: isDraftModeEnabled({ searchParams }),
773
+ isContextualEditing: await isIncontextEditingEnabled({ searchParams }),
774
+ isDraftMode: await isDraftModeEnabled({ searchParams }),
765
775
  state: route.compositionApiResponse.state,
766
776
  path,
767
777
  previewMode: determinePreviewMode({ searchParams })
@@ -775,14 +785,14 @@ var UniformComposition = async ({
775
785
  });
776
786
  let transfer = null;
777
787
  if (props.mode === "server") {
778
- const headersValue = headers();
788
+ const headersValue = await headers();
779
789
  const missingQuirkValue = "unknown";
780
790
  transfer = createElement3(ContextUpdateTransfer, {
781
791
  serverContext,
782
792
  update: {
783
- params: props.params,
793
+ params: await props.params,
784
794
  searchParams,
785
- cookies: cookies2().getAll().reduce(
795
+ cookies: (await cookies2()).getAll().reduce(
786
796
  (acc, cookie) => {
787
797
  acc[cookie.name] = cookie.value;
788
798
  return acc;
@@ -1076,8 +1086,12 @@ var UniformContext = async ({
1076
1086
  import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, CANVAS_EDITOR_STATE as CANVAS_EDITOR_STATE3 } from "@uniformdev/canvas";
1077
1087
  import { notFound as notFound2 } from "next/navigation";
1078
1088
  import React8 from "react";
1079
- var UniformPlayground = async ({ searchParams, ...rest }) => {
1080
- if (!isDraftModeEnabled({ searchParams })) {
1089
+ var UniformPlayground = async ({
1090
+ searchParams: providedSearchParams,
1091
+ ...rest
1092
+ }) => {
1093
+ const searchParams = await (providedSearchParams != null ? providedSearchParams : {});
1094
+ if (!await isDraftModeEnabled({ searchParams })) {
1081
1095
  return /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement("h1", null, "Playground is only available in draft mode"));
1082
1096
  }
1083
1097
  const id = searchParams["id"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc",
3
- "version": "19.195.1-alpha.3+0a17ec705c",
3
+ "version": "19.196.1-alpha.2+b5b5fd8fb8",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -53,38 +53,39 @@
53
53
  "/dist"
54
54
  ],
55
55
  "devDependencies": {
56
- "@types/node": "20.10.6",
57
- "@types/react": "18.3.3",
56
+ "@types/node": "20.16.14",
57
+ "@types/react": "18.3.11",
58
58
  "eslint": "9.9.0",
59
- "next": "^14.0.0",
60
- "react": "18.3.1",
61
- "react-dom": "18.3.1"
59
+ "next": "15.0.0",
60
+ "react": "19.0.0-rc-65a56d0e-20241020",
61
+ "react-dom": "19.0.0-rc-65a56d0e-20241020",
62
+ "typescript": "5.6.3"
62
63
  },
63
64
  "dependencies": {
64
- "@uniformdev/canvas": "19.195.1-alpha.3+0a17ec705c",
65
- "@uniformdev/canvas-next-rsc-client": "^19.195.1-alpha.3+0a17ec705c",
66
- "@uniformdev/canvas-next-rsc-shared": "^19.195.1-alpha.3+0a17ec705c",
67
- "@uniformdev/canvas-react": "19.195.1-alpha.3+0a17ec705c",
68
- "@uniformdev/context": "19.195.1-alpha.3+0a17ec705c",
69
- "@uniformdev/project-map": "19.195.1-alpha.3+0a17ec705c",
70
- "@uniformdev/redirect": "19.195.1-alpha.3+0a17ec705c",
71
- "@uniformdev/richtext": "19.195.1-alpha.3+0a17ec705c",
72
- "@uniformdev/webhooks": "19.195.1-alpha.3+0a17ec705c",
65
+ "@uniformdev/canvas": "19.196.1-alpha.2+b5b5fd8fb8",
66
+ "@uniformdev/canvas-next-rsc-client": "^19.196.1-alpha.2+b5b5fd8fb8",
67
+ "@uniformdev/canvas-next-rsc-shared": "^19.196.1-alpha.2+b5b5fd8fb8",
68
+ "@uniformdev/canvas-react": "19.196.1-alpha.2+b5b5fd8fb8",
69
+ "@uniformdev/context": "19.196.1-alpha.2+b5b5fd8fb8",
70
+ "@uniformdev/project-map": "19.196.1-alpha.2+b5b5fd8fb8",
71
+ "@uniformdev/redirect": "19.196.1-alpha.2+b5b5fd8fb8",
72
+ "@uniformdev/richtext": "19.196.1-alpha.2+b5b5fd8fb8",
73
+ "@uniformdev/webhooks": "19.196.1-alpha.2+b5b5fd8fb8",
73
74
  "@vercel/edge-config": "^0.4.0",
74
75
  "encoding": "^0.1.13",
75
76
  "server-only": "^0.0.1",
76
77
  "svix": "^1.5.0"
77
78
  },
78
79
  "engines": {
79
- "node": ">=16.14.0"
80
+ "node": ">=18.18.0"
80
81
  },
81
82
  "peerDependencies": {
82
- "next": ">=13.4.7",
83
- "react": ">=18.2",
84
- "react-dom": ">=18.2"
83
+ "next": ">=15.0.0",
84
+ "react": "^18.2.0 || 19.0.0-rc-65a56d0e-20241020",
85
+ "react-dom": "^18.2.0 || 19.0.0-rc-65a56d0e-20241020"
85
86
  },
86
87
  "publishConfig": {
87
88
  "access": "public"
88
89
  },
89
- "gitHead": "0a17ec705cf1f0ecd6a944fd1606a857c491579b"
90
+ "gitHead": "b5b5fd8fb8c08700c600b0761efd6723cee2413f"
90
91
  }