@uniformdev/canvas-next-rsc 19.211.1-alpha.2 → 19.212.2-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/{UniformComposition-D_HC6rSo.d.mts → UniformComposition-IWWzoI_H.d.mts} +3 -2
- package/dist/{UniformComposition-D_HC6rSo.d.ts → UniformComposition-IWWzoI_H.d.ts} +3 -2
- package/dist/component.d.mts +11 -11
- package/dist/component.d.ts +11 -11
- package/dist/config.js +16 -43
- package/dist/config.mjs +16 -43
- package/dist/handler.js +2 -2
- package/dist/handler.mjs +2 -2
- package/dist/index.d.mts +28 -16
- package/dist/index.d.ts +28 -16
- package/dist/index.esm.js +65 -62
- package/dist/index.js +58 -52
- package/dist/index.mjs +65 -62
- package/package.json +16 -16
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 = ({
|
|
17
17
|
searchParams
|
|
18
18
|
}) => {
|
|
19
19
|
if (isDevelopmentEnvironment()) {
|
|
@@ -21,7 +21,7 @@ var isDraftModeEnabled = async ({
|
|
|
21
21
|
}
|
|
22
22
|
let draftModeEnabled = false;
|
|
23
23
|
try {
|
|
24
|
-
draftModeEnabled =
|
|
24
|
+
draftModeEnabled = 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 =
|
|
67
|
-
if (
|
|
66
|
+
var shouldCacheBeDisabled = (options) => {
|
|
67
|
+
if (isDraftModeEnabled(options)) {
|
|
68
68
|
return { disabled: true, reason: "DRAFT" };
|
|
69
69
|
}
|
|
70
70
|
if (isIncontextEditingEnabled(options)) {
|
|
@@ -78,8 +78,8 @@ var shouldCacheBeDisabled = async (options) => {
|
|
|
78
78
|
reason: void 0
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
-
var getCanvasCacheStrategy =
|
|
82
|
-
const { disabled, reason } =
|
|
81
|
+
var getCanvasCacheStrategy = (options) => {
|
|
82
|
+
const { disabled, reason } = shouldCacheBeDisabled(options);
|
|
83
83
|
const config = getServerConfig();
|
|
84
84
|
if (disabled) {
|
|
85
85
|
if (reason === "DEV" && config.canvasCache) {
|
|
@@ -98,8 +98,8 @@ var getCanvasCacheStrategy = async (options) => {
|
|
|
98
98
|
type: "force-cache"
|
|
99
99
|
};
|
|
100
100
|
};
|
|
101
|
-
var getManifestCacheStrategy =
|
|
102
|
-
const { disabled, reason } =
|
|
101
|
+
var getManifestCacheStrategy = (options) => {
|
|
102
|
+
const { disabled, reason } = shouldCacheBeDisabled(options);
|
|
103
103
|
const config = getServerConfig();
|
|
104
104
|
if (disabled) {
|
|
105
105
|
if (reason === "DEV" && config.manifestCache) {
|
|
@@ -117,8 +117,8 @@ var getManifestCacheStrategy = async (options) => {
|
|
|
117
117
|
type: "force-cache"
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
|
-
var getProjectMapCacheStrategy =
|
|
121
|
-
const { disabled, reason } =
|
|
120
|
+
var getProjectMapCacheStrategy = (options) => {
|
|
121
|
+
const { disabled, reason } = shouldCacheBeDisabled(options);
|
|
122
122
|
const config = getServerConfig();
|
|
123
123
|
if (disabled) {
|
|
124
124
|
if (reason === "DEV" && config.projectMapCache) {
|
|
@@ -227,9 +227,13 @@ var getCanvasClient = (options) => {
|
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
229
|
};
|
|
230
|
-
var getDefaultCanvasClient =
|
|
230
|
+
var getDefaultCanvasClient = ({
|
|
231
|
+
searchParams
|
|
232
|
+
}) => {
|
|
231
233
|
return getCanvasClient({
|
|
232
|
-
cache:
|
|
234
|
+
cache: getCanvasCacheStrategy({
|
|
235
|
+
searchParams
|
|
236
|
+
})
|
|
233
237
|
});
|
|
234
238
|
};
|
|
235
239
|
|
|
@@ -258,13 +262,19 @@ var getManifestClient = (options) => {
|
|
|
258
262
|
});
|
|
259
263
|
return manifestClient;
|
|
260
264
|
};
|
|
261
|
-
var getDefaultManifestClient =
|
|
265
|
+
var getDefaultManifestClient = ({
|
|
266
|
+
searchParams
|
|
267
|
+
}) => {
|
|
262
268
|
return getManifestClient({
|
|
263
|
-
cache:
|
|
269
|
+
cache: getManifestCacheStrategy({
|
|
270
|
+
searchParams
|
|
271
|
+
})
|
|
264
272
|
});
|
|
265
273
|
};
|
|
266
|
-
var getManifest =
|
|
267
|
-
const manifestClient =
|
|
274
|
+
var getManifest = ({ searchParams }) => {
|
|
275
|
+
const manifestClient = getDefaultManifestClient({
|
|
276
|
+
searchParams
|
|
277
|
+
});
|
|
268
278
|
return manifestClient.get();
|
|
269
279
|
};
|
|
270
280
|
|
|
@@ -292,9 +302,13 @@ var getProjectMapClient = (options) => {
|
|
|
292
302
|
});
|
|
293
303
|
return manifestClient;
|
|
294
304
|
};
|
|
295
|
-
var getDefaultProjectMapClient =
|
|
305
|
+
var getDefaultProjectMapClient = ({
|
|
306
|
+
searchParams
|
|
307
|
+
}) => {
|
|
296
308
|
return getProjectMapClient({
|
|
297
|
-
cache:
|
|
309
|
+
cache: getProjectMapCacheStrategy({
|
|
310
|
+
searchParams
|
|
311
|
+
})
|
|
298
312
|
});
|
|
299
313
|
};
|
|
300
314
|
|
|
@@ -345,9 +359,11 @@ var getRouteClient = (options) => {
|
|
|
345
359
|
});
|
|
346
360
|
return client;
|
|
347
361
|
};
|
|
348
|
-
var getDefaultRouteClient =
|
|
362
|
+
var getDefaultRouteClient = ({ searchParams }) => {
|
|
349
363
|
return getRouteClient({
|
|
350
|
-
cache:
|
|
364
|
+
cache: getCanvasCacheStrategy({
|
|
365
|
+
searchParams
|
|
366
|
+
})
|
|
351
367
|
});
|
|
352
368
|
};
|
|
353
369
|
|
|
@@ -442,12 +458,11 @@ var createServerUniformContext = async (options) => {
|
|
|
442
458
|
var createServerUniformContextFromManifest = async (options) => {
|
|
443
459
|
var _a, _b, _c;
|
|
444
460
|
const quirksEnabled = (_a = getServerConfig().experimental) == null ? void 0 : _a.quirkSerialization;
|
|
445
|
-
const cookieValues = await cookies();
|
|
446
461
|
const context = createUniformContext({
|
|
447
462
|
...options || {},
|
|
448
|
-
serverCookieValue: (_b =
|
|
463
|
+
serverCookieValue: (_b = cookies().get(UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _b.value,
|
|
449
464
|
experimental_quirksEnabled: quirksEnabled,
|
|
450
|
-
quirkCookieValue: quirksEnabled ? (_c =
|
|
465
|
+
quirkCookieValue: quirksEnabled ? (_c = cookies().get(UNIFORM_DEFAULT_QUIRK_COOKIE_NAME)) == null ? void 0 : _c.value : void 0
|
|
451
466
|
});
|
|
452
467
|
return context;
|
|
453
468
|
};
|
|
@@ -459,10 +474,7 @@ import {
|
|
|
459
474
|
CANVAS_PUBLISHED_STATE,
|
|
460
475
|
getDataSourceVariantFromRouteGetParams
|
|
461
476
|
} from "@uniformdev/canvas";
|
|
462
|
-
import {
|
|
463
|
-
getBaseUrl,
|
|
464
|
-
resolvePath
|
|
465
|
-
} from "@uniformdev/canvas-next-rsc-shared";
|
|
477
|
+
import { getBaseUrl, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
|
|
466
478
|
import { getTargetVariableExpandedUrl } from "@uniformdev/redirect";
|
|
467
479
|
var retrieveCompositionBySlug = async ({
|
|
468
480
|
slug,
|
|
@@ -479,12 +491,12 @@ var retrieveCompositionBySlug = async ({
|
|
|
479
491
|
});
|
|
480
492
|
}
|
|
481
493
|
let result;
|
|
482
|
-
const states =
|
|
494
|
+
const states = determineState({
|
|
483
495
|
searchParams
|
|
484
496
|
});
|
|
485
497
|
for (let i = 0; i < states.length; i++) {
|
|
486
498
|
const state = states[i];
|
|
487
|
-
const canvasClient =
|
|
499
|
+
const canvasClient = getDefaultCanvasClient({
|
|
488
500
|
searchParams
|
|
489
501
|
});
|
|
490
502
|
try {
|
|
@@ -513,17 +525,16 @@ var retrieveCompositionBySlug = async ({
|
|
|
513
525
|
type: "notFound"
|
|
514
526
|
};
|
|
515
527
|
};
|
|
516
|
-
var retrieveRoute = async ({ params, searchParams
|
|
517
|
-
const searchParams = await providedSearchParams;
|
|
528
|
+
var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
|
|
518
529
|
if (!skipPrefetch) {
|
|
519
530
|
void getManifest({
|
|
520
531
|
searchParams
|
|
521
532
|
});
|
|
522
533
|
}
|
|
523
534
|
const { value } = resolvePath({
|
|
524
|
-
params
|
|
535
|
+
params
|
|
525
536
|
});
|
|
526
|
-
const states =
|
|
537
|
+
const states = determineState({
|
|
527
538
|
searchParams
|
|
528
539
|
});
|
|
529
540
|
let result;
|
|
@@ -560,7 +571,7 @@ var retrieveRouteByPath = async ({
|
|
|
560
571
|
releaseId
|
|
561
572
|
}) => {
|
|
562
573
|
var _a;
|
|
563
|
-
const client =
|
|
574
|
+
const client = getDefaultRouteClient({
|
|
564
575
|
searchParams
|
|
565
576
|
});
|
|
566
577
|
let queryPath = path;
|
|
@@ -592,10 +603,8 @@ var resolveRedirectHref = (resolveResult, path) => {
|
|
|
592
603
|
const url = new URL(expandedUrl);
|
|
593
604
|
return url.pathname;
|
|
594
605
|
};
|
|
595
|
-
var determineState =
|
|
596
|
-
const
|
|
597
|
-
searchParams
|
|
598
|
-
});
|
|
606
|
+
var determineState = ({ searchParams }) => {
|
|
607
|
+
const draftMode2 = isDraftModeEnabled({ searchParams });
|
|
599
608
|
const previewEnvironment = isOnVercelPreviewEnvironment();
|
|
600
609
|
const isDevelopment = isDevelopmentEnvironment();
|
|
601
610
|
const isCanvasEditing = isIncontextEditingEnabled({
|
|
@@ -605,7 +614,7 @@ var determineState = async ({ searchParams }) => {
|
|
|
605
614
|
if (isCanvasEditing) {
|
|
606
615
|
states = [CANVAS_EDITOR_STATE, CANVAS_DRAFT_STATE];
|
|
607
616
|
} else {
|
|
608
|
-
states =
|
|
617
|
+
states = draftMode2 || previewEnvironment || isDevelopment ? [CANVAS_DRAFT_STATE] : [CANVAS_PUBLISHED_STATE];
|
|
609
618
|
}
|
|
610
619
|
return states;
|
|
611
620
|
};
|
|
@@ -613,9 +622,7 @@ var determineReleaseId = ({
|
|
|
613
622
|
searchParams,
|
|
614
623
|
state
|
|
615
624
|
}) => {
|
|
616
|
-
const draftMode2 = isDraftModeEnabled({
|
|
617
|
-
searchParams
|
|
618
|
-
});
|
|
625
|
+
const draftMode2 = isDraftModeEnabled({ searchParams });
|
|
619
626
|
if (!draftMode2 || state === CANVAS_PUBLISHED_STATE) {
|
|
620
627
|
return void 0;
|
|
621
628
|
}
|
|
@@ -756,15 +763,12 @@ var UniformComposition = async ({
|
|
|
756
763
|
if (props.mode === "static") {
|
|
757
764
|
searchParams = void 0;
|
|
758
765
|
} else if (props.mode === "server") {
|
|
759
|
-
searchParams = await props.searchParams;
|
|
760
766
|
serverContext = props.serverContext || await createServerUniformContext({
|
|
761
|
-
searchParams
|
|
767
|
+
searchParams: props.searchParams
|
|
762
768
|
});
|
|
769
|
+
searchParams = props.searchParams;
|
|
763
770
|
}
|
|
764
|
-
const
|
|
765
|
-
const { value: path } = resolvePath2({
|
|
766
|
-
params: awaitedParams
|
|
767
|
-
});
|
|
771
|
+
const { value: path } = resolvePath2(props);
|
|
768
772
|
if (!route || route.type === "notFound") {
|
|
769
773
|
notFound();
|
|
770
774
|
}
|
|
@@ -798,7 +802,7 @@ var UniformComposition = async ({
|
|
|
798
802
|
dynamicInputs: route.dynamicInputs,
|
|
799
803
|
type: "composition",
|
|
800
804
|
isContextualEditing: isIncontextEditingEnabled({ searchParams }),
|
|
801
|
-
isDraftMode:
|
|
805
|
+
isDraftMode: isDraftModeEnabled({ searchParams }),
|
|
802
806
|
state: route.compositionApiResponse.state,
|
|
803
807
|
path,
|
|
804
808
|
previewMode: determinePreviewMode({ searchParams })
|
|
@@ -813,14 +817,14 @@ var UniformComposition = async ({
|
|
|
813
817
|
});
|
|
814
818
|
let transfer = null;
|
|
815
819
|
if (props.mode === "server") {
|
|
816
|
-
const headersValue =
|
|
820
|
+
const headersValue = headers();
|
|
817
821
|
const missingQuirkValue = "unknown";
|
|
818
822
|
transfer = createElement3(ContextUpdateTransfer, {
|
|
819
823
|
serverContext,
|
|
820
824
|
update: {
|
|
821
|
-
params:
|
|
825
|
+
params: props.params,
|
|
822
826
|
searchParams,
|
|
823
|
-
cookies:
|
|
827
|
+
cookies: cookies2().getAll().reduce(
|
|
824
828
|
(acc, cookie) => {
|
|
825
829
|
acc[cookie.name] = cookie.value;
|
|
826
830
|
return acc;
|
|
@@ -1115,7 +1119,7 @@ import {
|
|
|
1115
1119
|
UniformScript
|
|
1116
1120
|
} from "@uniformdev/canvas-next-rsc-client";
|
|
1117
1121
|
import { Suspense as Suspense2 } from "react";
|
|
1118
|
-
import
|
|
1122
|
+
import React8 from "react";
|
|
1119
1123
|
var UniformContext = async ({
|
|
1120
1124
|
clientContextComponent,
|
|
1121
1125
|
children
|
|
@@ -1129,7 +1133,7 @@ var UniformContext = async ({
|
|
|
1129
1133
|
const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
|
|
1130
1134
|
const defaultConsent = serverConfig2.defaultConsent || false;
|
|
1131
1135
|
const experimentalQuirkSerialization = ((_b = serverConfig2.experimental) == null ? void 0 : _b.quirkSerialization) || false;
|
|
1132
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, children, /* @__PURE__ */ React8.createElement(
|
|
1133
1137
|
ContextComponent,
|
|
1134
1138
|
{
|
|
1135
1139
|
manifest,
|
|
@@ -1137,19 +1141,18 @@ var UniformContext = async ({
|
|
|
1137
1141
|
defaultConsent,
|
|
1138
1142
|
experimentalQuirkSerialization
|
|
1139
1143
|
}
|
|
1140
|
-
), /* @__PURE__ */
|
|
1144
|
+
), /* @__PURE__ */ React8.createElement(Suspense2, { fallback: /* @__PURE__ */ React8.createElement(React8.Fragment, null) }, /* @__PURE__ */ React8.createElement(UniformScript, null)));
|
|
1141
1145
|
};
|
|
1142
1146
|
|
|
1143
1147
|
// src/components/UniformPlayground.tsx
|
|
1144
1148
|
import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, CANVAS_EDITOR_STATE as CANVAS_EDITOR_STATE3 } from "@uniformdev/canvas";
|
|
1145
1149
|
import { notFound as notFound2 } from "next/navigation";
|
|
1146
|
-
import
|
|
1150
|
+
import React9 from "react";
|
|
1147
1151
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
return /* @__PURE__ */ React10.createElement("div", null, /* @__PURE__ */ React10.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1152
|
+
if (!isDraftModeEnabled({ searchParams })) {
|
|
1153
|
+
return /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1151
1154
|
}
|
|
1152
|
-
const id =
|
|
1155
|
+
const id = searchParams["id"];
|
|
1153
1156
|
if (!id) {
|
|
1154
1157
|
notFound2();
|
|
1155
1158
|
}
|
|
@@ -1178,11 +1181,11 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1178
1181
|
if (!composition) {
|
|
1179
1182
|
notFound2();
|
|
1180
1183
|
}
|
|
1181
|
-
return /* @__PURE__ */
|
|
1184
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1182
1185
|
UniformComposition,
|
|
1183
1186
|
{
|
|
1184
1187
|
mode: "server",
|
|
1185
|
-
params:
|
|
1188
|
+
params: {},
|
|
1186
1189
|
searchParams,
|
|
1187
1190
|
route: {
|
|
1188
1191
|
type: "composition",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.212.2-alpha.2+bda012917f",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -56,35 +56,35 @@
|
|
|
56
56
|
"@types/node": "22.7.8",
|
|
57
57
|
"@types/react": "18.3.11",
|
|
58
58
|
"eslint": "9.9.0",
|
|
59
|
-
"next": "
|
|
59
|
+
"next": "^14.0.0",
|
|
60
60
|
"react": "18.3.1",
|
|
61
61
|
"react-dom": "18.3.1"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@uniformdev/canvas": "19.
|
|
65
|
-
"@uniformdev/canvas-next-rsc-client": "^19.
|
|
66
|
-
"@uniformdev/canvas-next-rsc-shared": "^19.
|
|
67
|
-
"@uniformdev/canvas-react": "19.
|
|
68
|
-
"@uniformdev/context": "19.
|
|
69
|
-
"@uniformdev/project-map": "19.
|
|
70
|
-
"@uniformdev/redirect": "19.
|
|
71
|
-
"@uniformdev/richtext": "19.
|
|
72
|
-
"@uniformdev/webhooks": "19.
|
|
64
|
+
"@uniformdev/canvas": "19.212.2-alpha.2+bda012917f",
|
|
65
|
+
"@uniformdev/canvas-next-rsc-client": "^19.212.2-alpha.2+bda012917f",
|
|
66
|
+
"@uniformdev/canvas-next-rsc-shared": "^19.212.2-alpha.2+bda012917f",
|
|
67
|
+
"@uniformdev/canvas-react": "19.212.2-alpha.2+bda012917f",
|
|
68
|
+
"@uniformdev/context": "19.212.2-alpha.2+bda012917f",
|
|
69
|
+
"@uniformdev/project-map": "19.212.2-alpha.2+bda012917f",
|
|
70
|
+
"@uniformdev/redirect": "19.212.2-alpha.2+bda012917f",
|
|
71
|
+
"@uniformdev/richtext": "19.212.2-alpha.2+bda012917f",
|
|
72
|
+
"@uniformdev/webhooks": "19.212.2-alpha.2+bda012917f",
|
|
73
73
|
"@vercel/edge-config": "^0.4.0",
|
|
74
74
|
"encoding": "^0.1.13",
|
|
75
75
|
"server-only": "^0.0.1",
|
|
76
76
|
"svix": "^1.5.0"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
|
-
"node": "
|
|
79
|
+
"node": ">=16.14.0"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"next": ">=
|
|
83
|
-
"react": "
|
|
84
|
-
"react-dom": "
|
|
82
|
+
"next": ">=13.4.7",
|
|
83
|
+
"react": ">=18.2",
|
|
84
|
+
"react-dom": ">=18.2"
|
|
85
85
|
},
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "bda012917f3dd9c8eac49fa1ab49d1de577853ef"
|
|
90
90
|
}
|