@uniformdev/canvas-next-rsc 19.214.1-alpha.17 → 19.214.1-alpha.32
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/{UniformComposition-IWWzoI_H.d.mts → UniformComposition-D_HC6rSo.d.mts} +2 -3
- package/dist/{UniformComposition-IWWzoI_H.d.ts → UniformComposition-D_HC6rSo.d.ts} +2 -3
- package/dist/component.d.mts +11 -11
- package/dist/component.d.ts +11 -11
- package/dist/config.js +43 -16
- package/dist/config.mjs +43 -16
- package/dist/handler.js +2 -2
- package/dist/handler.mjs +2 -2
- package/dist/index.d.mts +16 -28
- package/dist/index.d.ts +16 -28
- package/dist/index.esm.js +62 -65
- package/dist/index.js +52 -58
- package/dist/index.mjs +62 -65
- package/package.json +16 -16
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,7 +21,7 @@ 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 });
|
|
@@ -63,8 +63,8 @@ var isDevelopmentEnvironment = () => {
|
|
|
63
63
|
var getServerConfig = () => {
|
|
64
64
|
return serverConfig;
|
|
65
65
|
};
|
|
66
|
-
var shouldCacheBeDisabled = (options) => {
|
|
67
|
-
if (isDraftModeEnabled(options)) {
|
|
66
|
+
var shouldCacheBeDisabled = async (options) => {
|
|
67
|
+
if (await isDraftModeEnabled(options)) {
|
|
68
68
|
return { disabled: true, reason: "DRAFT" };
|
|
69
69
|
}
|
|
70
70
|
if (isIncontextEditingEnabled(options)) {
|
|
@@ -78,8 +78,8 @@ var shouldCacheBeDisabled = (options) => {
|
|
|
78
78
|
reason: void 0
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
-
var getCanvasCacheStrategy = (options) => {
|
|
82
|
-
const { disabled, reason } = shouldCacheBeDisabled(options);
|
|
81
|
+
var getCanvasCacheStrategy = async (options) => {
|
|
82
|
+
const { disabled, reason } = await shouldCacheBeDisabled(options);
|
|
83
83
|
const config = getServerConfig();
|
|
84
84
|
if (disabled) {
|
|
85
85
|
if (reason === "DEV" && config.canvasCache) {
|
|
@@ -98,8 +98,8 @@ var getCanvasCacheStrategy = (options) => {
|
|
|
98
98
|
type: "force-cache"
|
|
99
99
|
};
|
|
100
100
|
};
|
|
101
|
-
var getManifestCacheStrategy = (options) => {
|
|
102
|
-
const { disabled, reason } = shouldCacheBeDisabled(options);
|
|
101
|
+
var getManifestCacheStrategy = async (options) => {
|
|
102
|
+
const { disabled, reason } = await shouldCacheBeDisabled(options);
|
|
103
103
|
const config = getServerConfig();
|
|
104
104
|
if (disabled) {
|
|
105
105
|
if (reason === "DEV" && config.manifestCache) {
|
|
@@ -117,8 +117,8 @@ var getManifestCacheStrategy = (options) => {
|
|
|
117
117
|
type: "force-cache"
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
|
-
var getProjectMapCacheStrategy = (options) => {
|
|
121
|
-
const { disabled, reason } = shouldCacheBeDisabled(options);
|
|
120
|
+
var getProjectMapCacheStrategy = async (options) => {
|
|
121
|
+
const { disabled, reason } = await shouldCacheBeDisabled(options);
|
|
122
122
|
const config = getServerConfig();
|
|
123
123
|
if (disabled) {
|
|
124
124
|
if (reason === "DEV" && config.projectMapCache) {
|
|
@@ -227,13 +227,9 @@ var getCanvasClient = (options) => {
|
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
229
|
};
|
|
230
|
-
var getDefaultCanvasClient = ({
|
|
231
|
-
searchParams
|
|
232
|
-
}) => {
|
|
230
|
+
var getDefaultCanvasClient = async (options) => {
|
|
233
231
|
return getCanvasClient({
|
|
234
|
-
cache: getCanvasCacheStrategy(
|
|
235
|
-
searchParams
|
|
236
|
-
})
|
|
232
|
+
cache: await getCanvasCacheStrategy(options)
|
|
237
233
|
});
|
|
238
234
|
};
|
|
239
235
|
|
|
@@ -262,19 +258,13 @@ var getManifestClient = (options) => {
|
|
|
262
258
|
});
|
|
263
259
|
return manifestClient;
|
|
264
260
|
};
|
|
265
|
-
var getDefaultManifestClient = ({
|
|
266
|
-
searchParams
|
|
267
|
-
}) => {
|
|
261
|
+
var getDefaultManifestClient = async (options) => {
|
|
268
262
|
return getManifestClient({
|
|
269
|
-
cache: getManifestCacheStrategy(
|
|
270
|
-
searchParams
|
|
271
|
-
})
|
|
263
|
+
cache: await getManifestCacheStrategy(options)
|
|
272
264
|
});
|
|
273
265
|
};
|
|
274
|
-
var getManifest = (
|
|
275
|
-
const manifestClient = getDefaultManifestClient(
|
|
276
|
-
searchParams
|
|
277
|
-
});
|
|
266
|
+
var getManifest = async (options) => {
|
|
267
|
+
const manifestClient = await getDefaultManifestClient(options);
|
|
278
268
|
return manifestClient.get();
|
|
279
269
|
};
|
|
280
270
|
|
|
@@ -302,13 +292,9 @@ var getProjectMapClient = (options) => {
|
|
|
302
292
|
});
|
|
303
293
|
return manifestClient;
|
|
304
294
|
};
|
|
305
|
-
var getDefaultProjectMapClient = ({
|
|
306
|
-
searchParams
|
|
307
|
-
}) => {
|
|
295
|
+
var getDefaultProjectMapClient = async (options) => {
|
|
308
296
|
return getProjectMapClient({
|
|
309
|
-
cache: getProjectMapCacheStrategy(
|
|
310
|
-
searchParams
|
|
311
|
-
})
|
|
297
|
+
cache: await getProjectMapCacheStrategy(options)
|
|
312
298
|
});
|
|
313
299
|
};
|
|
314
300
|
|
|
@@ -359,11 +345,9 @@ var getRouteClient = (options) => {
|
|
|
359
345
|
});
|
|
360
346
|
return client;
|
|
361
347
|
};
|
|
362
|
-
var getDefaultRouteClient = (
|
|
348
|
+
var getDefaultRouteClient = async (options) => {
|
|
363
349
|
return getRouteClient({
|
|
364
|
-
cache: getCanvasCacheStrategy(
|
|
365
|
-
searchParams
|
|
366
|
-
})
|
|
350
|
+
cache: await getCanvasCacheStrategy(options)
|
|
367
351
|
});
|
|
368
352
|
};
|
|
369
353
|
|
|
@@ -458,11 +442,12 @@ var createServerUniformContext = async (options) => {
|
|
|
458
442
|
var createServerUniformContextFromManifest = async (options) => {
|
|
459
443
|
var _a, _b, _c;
|
|
460
444
|
const quirksEnabled = (_a = getServerConfig().experimental) == null ? void 0 : _a.quirkSerialization;
|
|
445
|
+
const cookieValues = await cookies();
|
|
461
446
|
const context = createUniformContext({
|
|
462
447
|
...options || {},
|
|
463
|
-
serverCookieValue: (_b =
|
|
448
|
+
serverCookieValue: (_b = cookieValues.get(UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _b.value,
|
|
464
449
|
experimental_quirksEnabled: quirksEnabled,
|
|
465
|
-
quirkCookieValue: quirksEnabled ? (_c =
|
|
450
|
+
quirkCookieValue: quirksEnabled ? (_c = cookieValues.get(UNIFORM_DEFAULT_QUIRK_COOKIE_NAME)) == null ? void 0 : _c.value : void 0
|
|
466
451
|
});
|
|
467
452
|
return context;
|
|
468
453
|
};
|
|
@@ -474,7 +459,10 @@ import {
|
|
|
474
459
|
CANVAS_PUBLISHED_STATE,
|
|
475
460
|
getDataSourceVariantFromRouteGetParams
|
|
476
461
|
} from "@uniformdev/canvas";
|
|
477
|
-
import {
|
|
462
|
+
import {
|
|
463
|
+
getBaseUrl,
|
|
464
|
+
resolvePath
|
|
465
|
+
} from "@uniformdev/canvas-next-rsc-shared";
|
|
478
466
|
import { getTargetVariableExpandedUrl } from "@uniformdev/redirect";
|
|
479
467
|
var retrieveCompositionBySlug = async ({
|
|
480
468
|
slug,
|
|
@@ -491,12 +479,12 @@ var retrieveCompositionBySlug = async ({
|
|
|
491
479
|
});
|
|
492
480
|
}
|
|
493
481
|
let result;
|
|
494
|
-
const states = determineState({
|
|
482
|
+
const states = await determineState({
|
|
495
483
|
searchParams
|
|
496
484
|
});
|
|
497
485
|
for (let i = 0; i < states.length; i++) {
|
|
498
486
|
const state = states[i];
|
|
499
|
-
const canvasClient = getDefaultCanvasClient({
|
|
487
|
+
const canvasClient = await getDefaultCanvasClient({
|
|
500
488
|
searchParams
|
|
501
489
|
});
|
|
502
490
|
try {
|
|
@@ -525,16 +513,17 @@ var retrieveCompositionBySlug = async ({
|
|
|
525
513
|
type: "notFound"
|
|
526
514
|
};
|
|
527
515
|
};
|
|
528
|
-
var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
|
|
516
|
+
var retrieveRoute = async ({ params, searchParams: providedSearchParams, skipPrefetch }, fetchOptions) => {
|
|
517
|
+
const searchParams = await providedSearchParams;
|
|
529
518
|
if (!skipPrefetch) {
|
|
530
519
|
void getManifest({
|
|
531
520
|
searchParams
|
|
532
521
|
});
|
|
533
522
|
}
|
|
534
523
|
const { value } = resolvePath({
|
|
535
|
-
params
|
|
524
|
+
params: await params
|
|
536
525
|
});
|
|
537
|
-
const states = determineState({
|
|
526
|
+
const states = await determineState({
|
|
538
527
|
searchParams
|
|
539
528
|
});
|
|
540
529
|
let result;
|
|
@@ -571,7 +560,7 @@ var retrieveRouteByPath = async ({
|
|
|
571
560
|
releaseId
|
|
572
561
|
}) => {
|
|
573
562
|
var _a;
|
|
574
|
-
const client = getDefaultRouteClient({
|
|
563
|
+
const client = await getDefaultRouteClient({
|
|
575
564
|
searchParams
|
|
576
565
|
});
|
|
577
566
|
let queryPath = path;
|
|
@@ -603,8 +592,10 @@ var resolveRedirectHref = (resolveResult, path) => {
|
|
|
603
592
|
const url = new URL(expandedUrl);
|
|
604
593
|
return url.pathname;
|
|
605
594
|
};
|
|
606
|
-
var determineState = ({ searchParams }) => {
|
|
607
|
-
const
|
|
595
|
+
var determineState = async ({ searchParams }) => {
|
|
596
|
+
const isDraftMode = await isDraftModeEnabled({
|
|
597
|
+
searchParams
|
|
598
|
+
});
|
|
608
599
|
const previewEnvironment = isOnVercelPreviewEnvironment();
|
|
609
600
|
const isDevelopment = isDevelopmentEnvironment();
|
|
610
601
|
const isCanvasEditing = isIncontextEditingEnabled({
|
|
@@ -614,7 +605,7 @@ var determineState = ({ searchParams }) => {
|
|
|
614
605
|
if (isCanvasEditing) {
|
|
615
606
|
states = [CANVAS_EDITOR_STATE, CANVAS_DRAFT_STATE];
|
|
616
607
|
} else {
|
|
617
|
-
states =
|
|
608
|
+
states = isDraftMode || previewEnvironment || isDevelopment ? [CANVAS_DRAFT_STATE] : [CANVAS_PUBLISHED_STATE];
|
|
618
609
|
}
|
|
619
610
|
return states;
|
|
620
611
|
};
|
|
@@ -622,7 +613,9 @@ var determineReleaseId = ({
|
|
|
622
613
|
searchParams,
|
|
623
614
|
state
|
|
624
615
|
}) => {
|
|
625
|
-
const draftMode2 = isDraftModeEnabled({
|
|
616
|
+
const draftMode2 = isDraftModeEnabled({
|
|
617
|
+
searchParams
|
|
618
|
+
});
|
|
626
619
|
if (!draftMode2 || state === CANVAS_PUBLISHED_STATE) {
|
|
627
620
|
return void 0;
|
|
628
621
|
}
|
|
@@ -763,12 +756,15 @@ var UniformComposition = async ({
|
|
|
763
756
|
if (props.mode === "static") {
|
|
764
757
|
searchParams = void 0;
|
|
765
758
|
} else if (props.mode === "server") {
|
|
759
|
+
searchParams = await props.searchParams;
|
|
766
760
|
serverContext = props.serverContext || await createServerUniformContext({
|
|
767
|
-
searchParams
|
|
761
|
+
searchParams
|
|
768
762
|
});
|
|
769
|
-
searchParams = props.searchParams;
|
|
770
763
|
}
|
|
771
|
-
const
|
|
764
|
+
const awaitedParams = await props.params;
|
|
765
|
+
const { value: path } = resolvePath2({
|
|
766
|
+
params: awaitedParams
|
|
767
|
+
});
|
|
772
768
|
if (!route || route.type === "notFound") {
|
|
773
769
|
notFound();
|
|
774
770
|
}
|
|
@@ -802,7 +798,7 @@ var UniformComposition = async ({
|
|
|
802
798
|
dynamicInputs: route.dynamicInputs,
|
|
803
799
|
type: "composition",
|
|
804
800
|
isContextualEditing: isIncontextEditingEnabled({ searchParams }),
|
|
805
|
-
isDraftMode: isDraftModeEnabled({ searchParams }),
|
|
801
|
+
isDraftMode: await isDraftModeEnabled({ searchParams }),
|
|
806
802
|
state: route.compositionApiResponse.state,
|
|
807
803
|
path,
|
|
808
804
|
previewMode: determinePreviewMode({ searchParams })
|
|
@@ -817,14 +813,14 @@ var UniformComposition = async ({
|
|
|
817
813
|
});
|
|
818
814
|
let transfer = null;
|
|
819
815
|
if (props.mode === "server") {
|
|
820
|
-
const headersValue = headers();
|
|
816
|
+
const headersValue = await headers();
|
|
821
817
|
const missingQuirkValue = "unknown";
|
|
822
818
|
transfer = createElement3(ContextUpdateTransfer, {
|
|
823
819
|
serverContext,
|
|
824
820
|
update: {
|
|
825
|
-
params:
|
|
821
|
+
params: awaitedParams,
|
|
826
822
|
searchParams,
|
|
827
|
-
cookies: cookies2().getAll().reduce(
|
|
823
|
+
cookies: (await cookies2()).getAll().reduce(
|
|
828
824
|
(acc, cookie) => {
|
|
829
825
|
acc[cookie.name] = cookie.value;
|
|
830
826
|
return acc;
|
|
@@ -1119,7 +1115,7 @@ import {
|
|
|
1119
1115
|
UniformScript
|
|
1120
1116
|
} from "@uniformdev/canvas-next-rsc-client";
|
|
1121
1117
|
import { Suspense as Suspense2 } from "react";
|
|
1122
|
-
import
|
|
1118
|
+
import React9 from "react";
|
|
1123
1119
|
var UniformContext = async ({
|
|
1124
1120
|
clientContextComponent,
|
|
1125
1121
|
children
|
|
@@ -1133,7 +1129,7 @@ var UniformContext = async ({
|
|
|
1133
1129
|
const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
|
|
1134
1130
|
const defaultConsent = serverConfig2.defaultConsent || false;
|
|
1135
1131
|
const experimentalQuirkSerialization = ((_b = serverConfig2.experimental) == null ? void 0 : _b.quirkSerialization) || false;
|
|
1136
|
-
return /* @__PURE__ */
|
|
1132
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, children, /* @__PURE__ */ React9.createElement(
|
|
1137
1133
|
ContextComponent,
|
|
1138
1134
|
{
|
|
1139
1135
|
manifest,
|
|
@@ -1141,18 +1137,19 @@ var UniformContext = async ({
|
|
|
1141
1137
|
defaultConsent,
|
|
1142
1138
|
experimentalQuirkSerialization
|
|
1143
1139
|
}
|
|
1144
|
-
), /* @__PURE__ */
|
|
1140
|
+
), /* @__PURE__ */ React9.createElement(Suspense2, { fallback: /* @__PURE__ */ React9.createElement(React9.Fragment, null) }, /* @__PURE__ */ React9.createElement(UniformScript, null)));
|
|
1145
1141
|
};
|
|
1146
1142
|
|
|
1147
1143
|
// src/components/UniformPlayground.tsx
|
|
1148
1144
|
import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, CANVAS_EDITOR_STATE as CANVAS_EDITOR_STATE3 } from "@uniformdev/canvas";
|
|
1149
1145
|
import { notFound as notFound2 } from "next/navigation";
|
|
1150
|
-
import
|
|
1146
|
+
import React10 from "react";
|
|
1151
1147
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1152
|
-
|
|
1153
|
-
|
|
1148
|
+
const awaitedSearchParams = await searchParams;
|
|
1149
|
+
if (!isDraftModeEnabled({ searchParams: awaitedSearchParams })) {
|
|
1150
|
+
return /* @__PURE__ */ React10.createElement("div", null, /* @__PURE__ */ React10.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1154
1151
|
}
|
|
1155
|
-
const id =
|
|
1152
|
+
const id = awaitedSearchParams["id"];
|
|
1156
1153
|
if (!id) {
|
|
1157
1154
|
notFound2();
|
|
1158
1155
|
}
|
|
@@ -1181,11 +1178,11 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1181
1178
|
if (!composition) {
|
|
1182
1179
|
notFound2();
|
|
1183
1180
|
}
|
|
1184
|
-
return /* @__PURE__ */
|
|
1181
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1185
1182
|
UniformComposition,
|
|
1186
1183
|
{
|
|
1187
1184
|
mode: "server",
|
|
1188
|
-
params:
|
|
1185
|
+
params: void 0,
|
|
1189
1186
|
searchParams,
|
|
1190
1187
|
route: {
|
|
1191
1188
|
type: "composition",
|
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,7 +74,7 @@ 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 });
|
|
@@ -116,8 +116,8 @@ var isDevelopmentEnvironment = () => {
|
|
|
116
116
|
var getServerConfig = () => {
|
|
117
117
|
return import_uniform_server.default;
|
|
118
118
|
};
|
|
119
|
-
var shouldCacheBeDisabled = (options) => {
|
|
120
|
-
if (isDraftModeEnabled(options)) {
|
|
119
|
+
var shouldCacheBeDisabled = async (options) => {
|
|
120
|
+
if (await isDraftModeEnabled(options)) {
|
|
121
121
|
return { disabled: true, reason: "DRAFT" };
|
|
122
122
|
}
|
|
123
123
|
if (isIncontextEditingEnabled(options)) {
|
|
@@ -131,8 +131,8 @@ var shouldCacheBeDisabled = (options) => {
|
|
|
131
131
|
reason: void 0
|
|
132
132
|
};
|
|
133
133
|
};
|
|
134
|
-
var getCanvasCacheStrategy = (options) => {
|
|
135
|
-
const { disabled, reason } = shouldCacheBeDisabled(options);
|
|
134
|
+
var getCanvasCacheStrategy = async (options) => {
|
|
135
|
+
const { disabled, reason } = await shouldCacheBeDisabled(options);
|
|
136
136
|
const config = getServerConfig();
|
|
137
137
|
if (disabled) {
|
|
138
138
|
if (reason === "DEV" && config.canvasCache) {
|
|
@@ -151,8 +151,8 @@ var getCanvasCacheStrategy = (options) => {
|
|
|
151
151
|
type: "force-cache"
|
|
152
152
|
};
|
|
153
153
|
};
|
|
154
|
-
var getManifestCacheStrategy = (options) => {
|
|
155
|
-
const { disabled, reason } = shouldCacheBeDisabled(options);
|
|
154
|
+
var getManifestCacheStrategy = async (options) => {
|
|
155
|
+
const { disabled, reason } = await shouldCacheBeDisabled(options);
|
|
156
156
|
const config = getServerConfig();
|
|
157
157
|
if (disabled) {
|
|
158
158
|
if (reason === "DEV" && config.manifestCache) {
|
|
@@ -170,8 +170,8 @@ var getManifestCacheStrategy = (options) => {
|
|
|
170
170
|
type: "force-cache"
|
|
171
171
|
};
|
|
172
172
|
};
|
|
173
|
-
var getProjectMapCacheStrategy = (options) => {
|
|
174
|
-
const { disabled, reason } = shouldCacheBeDisabled(options);
|
|
173
|
+
var getProjectMapCacheStrategy = async (options) => {
|
|
174
|
+
const { disabled, reason } = await shouldCacheBeDisabled(options);
|
|
175
175
|
const config = getServerConfig();
|
|
176
176
|
if (disabled) {
|
|
177
177
|
if (reason === "DEV" && config.projectMapCache) {
|
|
@@ -280,13 +280,9 @@ var getCanvasClient = (options) => {
|
|
|
280
280
|
}
|
|
281
281
|
});
|
|
282
282
|
};
|
|
283
|
-
var getDefaultCanvasClient = ({
|
|
284
|
-
searchParams
|
|
285
|
-
}) => {
|
|
283
|
+
var getDefaultCanvasClient = async (options) => {
|
|
286
284
|
return getCanvasClient({
|
|
287
|
-
cache: getCanvasCacheStrategy(
|
|
288
|
-
searchParams
|
|
289
|
-
})
|
|
285
|
+
cache: await getCanvasCacheStrategy(options)
|
|
290
286
|
});
|
|
291
287
|
};
|
|
292
288
|
|
|
@@ -315,19 +311,13 @@ var getManifestClient = (options) => {
|
|
|
315
311
|
});
|
|
316
312
|
return manifestClient;
|
|
317
313
|
};
|
|
318
|
-
var getDefaultManifestClient = ({
|
|
319
|
-
searchParams
|
|
320
|
-
}) => {
|
|
314
|
+
var getDefaultManifestClient = async (options) => {
|
|
321
315
|
return getManifestClient({
|
|
322
|
-
cache: getManifestCacheStrategy(
|
|
323
|
-
searchParams
|
|
324
|
-
})
|
|
316
|
+
cache: await getManifestCacheStrategy(options)
|
|
325
317
|
});
|
|
326
318
|
};
|
|
327
|
-
var getManifest = (
|
|
328
|
-
const manifestClient = getDefaultManifestClient(
|
|
329
|
-
searchParams
|
|
330
|
-
});
|
|
319
|
+
var getManifest = async (options) => {
|
|
320
|
+
const manifestClient = await getDefaultManifestClient(options);
|
|
331
321
|
return manifestClient.get();
|
|
332
322
|
};
|
|
333
323
|
|
|
@@ -355,13 +345,9 @@ var getProjectMapClient = (options) => {
|
|
|
355
345
|
});
|
|
356
346
|
return manifestClient;
|
|
357
347
|
};
|
|
358
|
-
var getDefaultProjectMapClient = ({
|
|
359
|
-
searchParams
|
|
360
|
-
}) => {
|
|
348
|
+
var getDefaultProjectMapClient = async (options) => {
|
|
361
349
|
return getProjectMapClient({
|
|
362
|
-
cache: getProjectMapCacheStrategy(
|
|
363
|
-
searchParams
|
|
364
|
-
})
|
|
350
|
+
cache: await getProjectMapCacheStrategy(options)
|
|
365
351
|
});
|
|
366
352
|
};
|
|
367
353
|
|
|
@@ -412,11 +398,9 @@ var getRouteClient = (options) => {
|
|
|
412
398
|
});
|
|
413
399
|
return client;
|
|
414
400
|
};
|
|
415
|
-
var getDefaultRouteClient = (
|
|
401
|
+
var getDefaultRouteClient = async (options) => {
|
|
416
402
|
return getRouteClient({
|
|
417
|
-
cache: getCanvasCacheStrategy(
|
|
418
|
-
searchParams
|
|
419
|
-
})
|
|
403
|
+
cache: await getCanvasCacheStrategy(options)
|
|
420
404
|
});
|
|
421
405
|
};
|
|
422
406
|
|
|
@@ -494,11 +478,12 @@ var createServerUniformContext = async (options) => {
|
|
|
494
478
|
var createServerUniformContextFromManifest = async (options) => {
|
|
495
479
|
var _a, _b, _c;
|
|
496
480
|
const quirksEnabled = (_a = getServerConfig().experimental) == null ? void 0 : _a.quirkSerialization;
|
|
481
|
+
const cookieValues = await (0, import_headers2.cookies)();
|
|
497
482
|
const context = (0, import_canvas_next_rsc_shared.createUniformContext)({
|
|
498
483
|
...options || {},
|
|
499
|
-
serverCookieValue: (_b =
|
|
484
|
+
serverCookieValue: (_b = cookieValues.get(import_context.UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _b.value,
|
|
500
485
|
experimental_quirksEnabled: quirksEnabled,
|
|
501
|
-
quirkCookieValue: quirksEnabled ? (_c =
|
|
486
|
+
quirkCookieValue: quirksEnabled ? (_c = cookieValues.get(import_context.UNIFORM_DEFAULT_QUIRK_COOKIE_NAME)) == null ? void 0 : _c.value : void 0
|
|
502
487
|
});
|
|
503
488
|
return context;
|
|
504
489
|
};
|
|
@@ -522,12 +507,12 @@ var retrieveCompositionBySlug = async ({
|
|
|
522
507
|
});
|
|
523
508
|
}
|
|
524
509
|
let result;
|
|
525
|
-
const states = determineState({
|
|
510
|
+
const states = await determineState({
|
|
526
511
|
searchParams
|
|
527
512
|
});
|
|
528
513
|
for (let i = 0; i < states.length; i++) {
|
|
529
514
|
const state = states[i];
|
|
530
|
-
const canvasClient = getDefaultCanvasClient({
|
|
515
|
+
const canvasClient = await getDefaultCanvasClient({
|
|
531
516
|
searchParams
|
|
532
517
|
});
|
|
533
518
|
try {
|
|
@@ -556,16 +541,17 @@ var retrieveCompositionBySlug = async ({
|
|
|
556
541
|
type: "notFound"
|
|
557
542
|
};
|
|
558
543
|
};
|
|
559
|
-
var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
|
|
544
|
+
var retrieveRoute = async ({ params, searchParams: providedSearchParams, skipPrefetch }, fetchOptions) => {
|
|
545
|
+
const searchParams = await providedSearchParams;
|
|
560
546
|
if (!skipPrefetch) {
|
|
561
547
|
void getManifest({
|
|
562
548
|
searchParams
|
|
563
549
|
});
|
|
564
550
|
}
|
|
565
551
|
const { value } = (0, import_canvas_next_rsc_shared2.resolvePath)({
|
|
566
|
-
params
|
|
552
|
+
params: await params
|
|
567
553
|
});
|
|
568
|
-
const states = determineState({
|
|
554
|
+
const states = await determineState({
|
|
569
555
|
searchParams
|
|
570
556
|
});
|
|
571
557
|
let result;
|
|
@@ -602,7 +588,7 @@ var retrieveRouteByPath = async ({
|
|
|
602
588
|
releaseId
|
|
603
589
|
}) => {
|
|
604
590
|
var _a;
|
|
605
|
-
const client = getDefaultRouteClient({
|
|
591
|
+
const client = await getDefaultRouteClient({
|
|
606
592
|
searchParams
|
|
607
593
|
});
|
|
608
594
|
let queryPath = path;
|
|
@@ -634,8 +620,10 @@ var resolveRedirectHref = (resolveResult, path) => {
|
|
|
634
620
|
const url = new URL(expandedUrl);
|
|
635
621
|
return url.pathname;
|
|
636
622
|
};
|
|
637
|
-
var determineState = ({ searchParams }) => {
|
|
638
|
-
const
|
|
623
|
+
var determineState = async ({ searchParams }) => {
|
|
624
|
+
const isDraftMode = await isDraftModeEnabled({
|
|
625
|
+
searchParams
|
|
626
|
+
});
|
|
639
627
|
const previewEnvironment = isOnVercelPreviewEnvironment();
|
|
640
628
|
const isDevelopment = isDevelopmentEnvironment();
|
|
641
629
|
const isCanvasEditing = isIncontextEditingEnabled({
|
|
@@ -645,7 +633,7 @@ var determineState = ({ searchParams }) => {
|
|
|
645
633
|
if (isCanvasEditing) {
|
|
646
634
|
states = [import_canvas4.CANVAS_EDITOR_STATE, import_canvas4.CANVAS_DRAFT_STATE];
|
|
647
635
|
} else {
|
|
648
|
-
states =
|
|
636
|
+
states = isDraftMode || previewEnvironment || isDevelopment ? [import_canvas4.CANVAS_DRAFT_STATE] : [import_canvas4.CANVAS_PUBLISHED_STATE];
|
|
649
637
|
}
|
|
650
638
|
return states;
|
|
651
639
|
};
|
|
@@ -653,7 +641,9 @@ var determineReleaseId = ({
|
|
|
653
641
|
searchParams,
|
|
654
642
|
state
|
|
655
643
|
}) => {
|
|
656
|
-
const draftMode2 = isDraftModeEnabled({
|
|
644
|
+
const draftMode2 = isDraftModeEnabled({
|
|
645
|
+
searchParams
|
|
646
|
+
});
|
|
657
647
|
if (!draftMode2 || state === import_canvas4.CANVAS_PUBLISHED_STATE) {
|
|
658
648
|
return void 0;
|
|
659
649
|
}
|
|
@@ -789,12 +779,15 @@ var UniformComposition = async ({
|
|
|
789
779
|
if (props.mode === "static") {
|
|
790
780
|
searchParams = void 0;
|
|
791
781
|
} else if (props.mode === "server") {
|
|
782
|
+
searchParams = await props.searchParams;
|
|
792
783
|
serverContext = props.serverContext || await createServerUniformContext({
|
|
793
|
-
searchParams
|
|
784
|
+
searchParams
|
|
794
785
|
});
|
|
795
|
-
searchParams = props.searchParams;
|
|
796
786
|
}
|
|
797
|
-
const
|
|
787
|
+
const awaitedParams = await props.params;
|
|
788
|
+
const { value: path } = (0, import_canvas_next_rsc_shared7.resolvePath)({
|
|
789
|
+
params: awaitedParams
|
|
790
|
+
});
|
|
798
791
|
if (!route || route.type === "notFound") {
|
|
799
792
|
(0, import_navigation.notFound)();
|
|
800
793
|
}
|
|
@@ -828,7 +821,7 @@ var UniformComposition = async ({
|
|
|
828
821
|
dynamicInputs: route.dynamicInputs,
|
|
829
822
|
type: "composition",
|
|
830
823
|
isContextualEditing: isIncontextEditingEnabled({ searchParams }),
|
|
831
|
-
isDraftMode: isDraftModeEnabled({ searchParams }),
|
|
824
|
+
isDraftMode: await isDraftModeEnabled({ searchParams }),
|
|
832
825
|
state: route.compositionApiResponse.state,
|
|
833
826
|
path,
|
|
834
827
|
previewMode: determinePreviewMode({ searchParams })
|
|
@@ -843,14 +836,14 @@ var UniformComposition = async ({
|
|
|
843
836
|
});
|
|
844
837
|
let transfer = null;
|
|
845
838
|
if (props.mode === "server") {
|
|
846
|
-
const headersValue = (0, import_headers3.headers)();
|
|
839
|
+
const headersValue = await (0, import_headers3.headers)();
|
|
847
840
|
const missingQuirkValue = "unknown";
|
|
848
841
|
transfer = (0, import_react10.createElement)(ContextUpdateTransfer, {
|
|
849
842
|
serverContext,
|
|
850
843
|
update: {
|
|
851
|
-
params:
|
|
844
|
+
params: awaitedParams,
|
|
852
845
|
searchParams,
|
|
853
|
-
cookies: (0, import_headers3.cookies)().getAll().reduce(
|
|
846
|
+
cookies: (await (0, import_headers3.cookies)()).getAll().reduce(
|
|
854
847
|
(acc, cookie) => {
|
|
855
848
|
acc[cookie.name] = cookie.value;
|
|
856
849
|
return acc;
|
|
@@ -1172,10 +1165,11 @@ var import_canvas9 = require("@uniformdev/canvas");
|
|
|
1172
1165
|
var import_navigation2 = require("next/navigation");
|
|
1173
1166
|
var import_react13 = __toESM(require("react"));
|
|
1174
1167
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1175
|
-
|
|
1168
|
+
const awaitedSearchParams = await searchParams;
|
|
1169
|
+
if (!isDraftModeEnabled({ searchParams: awaitedSearchParams })) {
|
|
1176
1170
|
return /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1177
1171
|
}
|
|
1178
|
-
const id =
|
|
1172
|
+
const id = awaitedSearchParams["id"];
|
|
1179
1173
|
if (!id) {
|
|
1180
1174
|
(0, import_navigation2.notFound)();
|
|
1181
1175
|
}
|
|
@@ -1208,7 +1202,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1208
1202
|
UniformComposition,
|
|
1209
1203
|
{
|
|
1210
1204
|
mode: "server",
|
|
1211
|
-
params:
|
|
1205
|
+
params: void 0,
|
|
1212
1206
|
searchParams,
|
|
1213
1207
|
route: {
|
|
1214
1208
|
type: "composition",
|