@uniformdev/canvas-next-rsc 20.7.1-alpha.12 → 20.7.1-alpha.120
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/LICENSE.txt +1 -1
- package/dist/config.d.mts +7 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.js +12 -18
- package/dist/config.mjs +12 -18
- package/dist/handler.js +10 -1
- package/dist/handler.mjs +10 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +49 -44
- package/dist/index.js +53 -48
- package/dist/index.mjs +49 -44
- package/package.json +19 -19
package/LICENSE.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
©
|
|
1
|
+
© 2025 Uniform Systems, Inc. All Rights Reserved.
|
|
2
2
|
See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
|
package/dist/config.d.mts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { NextConfig } from 'next';
|
|
2
2
|
export { UniformServerConfig } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Wraps the Next.js config to set up the Uniform server config alias.
|
|
6
|
+
* This enables the `uniform.server.config` import to resolve to the project's config file.
|
|
7
|
+
*
|
|
8
|
+
* @param nextConfig - The Next.js configuration object
|
|
9
|
+
* @returns The modified Next.js configuration with Uniform config alias set up
|
|
10
|
+
*/
|
|
4
11
|
declare const withUniformConfig: (nextConfig: NextConfig) => NextConfig;
|
|
5
12
|
|
|
6
13
|
export { withUniformConfig };
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { NextConfig } from 'next';
|
|
2
2
|
export { UniformServerConfig } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Wraps the Next.js config to set up the Uniform server config alias.
|
|
6
|
+
* This enables the `uniform.server.config` import to resolve to the project's config file.
|
|
7
|
+
*
|
|
8
|
+
* @param nextConfig - The Next.js configuration object
|
|
9
|
+
* @returns The modified Next.js configuration with Uniform config alias set up
|
|
10
|
+
*/
|
|
4
11
|
declare const withUniformConfig: (nextConfig: NextConfig) => NextConfig;
|
|
5
12
|
|
|
6
13
|
export { withUniformConfig };
|
package/dist/config.js
CHANGED
|
@@ -47,34 +47,28 @@ var getConfigPath = () => {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
var withUniformConfig = (nextConfig) => {
|
|
50
|
-
var _a
|
|
51
|
-
const { fileName: uniformConfigFileName } = getConfigPath() || {};
|
|
52
|
-
const
|
|
53
|
-
...(
|
|
50
|
+
var _a;
|
|
51
|
+
const { fileName: uniformConfigFileName, filePath: uniformConfigFilePath } = getConfigPath() || {};
|
|
52
|
+
const turbopackResolveAlias = {
|
|
53
|
+
...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias
|
|
54
54
|
};
|
|
55
55
|
if (uniformConfigFileName) {
|
|
56
|
-
console.log("(
|
|
57
|
-
|
|
56
|
+
console.log("(Turbopack) Using Uniform config from", uniformConfigFileName);
|
|
57
|
+
turbopackResolveAlias["uniform.server.config"] = `./${uniformConfigFileName}`;
|
|
58
58
|
}
|
|
59
59
|
return {
|
|
60
60
|
...nextConfig,
|
|
61
|
-
|
|
62
|
-
...nextConfig.
|
|
63
|
-
|
|
64
|
-
...((_c = nextConfig.experimental) == null ? void 0 : _c.turbo) || {},
|
|
65
|
-
resolveAlias: turboResolveAliases
|
|
66
|
-
}
|
|
61
|
+
turbopack: {
|
|
62
|
+
...nextConfig.turbopack,
|
|
63
|
+
resolveAlias: turbopackResolveAlias
|
|
67
64
|
},
|
|
68
65
|
webpack: (config, context) => {
|
|
69
66
|
if (nextConfig.webpack) {
|
|
70
67
|
nextConfig.webpack(config, context);
|
|
71
68
|
}
|
|
72
|
-
if (context.isServer) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
console.log("Using Uniform config from", uniformConfigPath);
|
|
76
|
-
config.resolve.alias["uniform.server.config"] = (0, import_path.resolve)(config.context, uniformConfigPath);
|
|
77
|
-
}
|
|
69
|
+
if (context.isServer && uniformConfigFilePath) {
|
|
70
|
+
console.log("(Webpack) Using Uniform config from", uniformConfigFilePath);
|
|
71
|
+
config.resolve.alias["uniform.server.config"] = (0, import_path.resolve)(config.context, uniformConfigFilePath);
|
|
78
72
|
}
|
|
79
73
|
return config;
|
|
80
74
|
}
|
package/dist/config.mjs
CHANGED
|
@@ -23,34 +23,28 @@ var getConfigPath = () => {
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
var withUniformConfig = (nextConfig) => {
|
|
26
|
-
var _a
|
|
27
|
-
const { fileName: uniformConfigFileName } = getConfigPath() || {};
|
|
28
|
-
const
|
|
29
|
-
...(
|
|
26
|
+
var _a;
|
|
27
|
+
const { fileName: uniformConfigFileName, filePath: uniformConfigFilePath } = getConfigPath() || {};
|
|
28
|
+
const turbopackResolveAlias = {
|
|
29
|
+
...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias
|
|
30
30
|
};
|
|
31
31
|
if (uniformConfigFileName) {
|
|
32
|
-
console.log("(
|
|
33
|
-
|
|
32
|
+
console.log("(Turbopack) Using Uniform config from", uniformConfigFileName);
|
|
33
|
+
turbopackResolveAlias["uniform.server.config"] = `./${uniformConfigFileName}`;
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
36
|
...nextConfig,
|
|
37
|
-
|
|
38
|
-
...nextConfig.
|
|
39
|
-
|
|
40
|
-
...((_c = nextConfig.experimental) == null ? void 0 : _c.turbo) || {},
|
|
41
|
-
resolveAlias: turboResolveAliases
|
|
42
|
-
}
|
|
37
|
+
turbopack: {
|
|
38
|
+
...nextConfig.turbopack,
|
|
39
|
+
resolveAlias: turbopackResolveAlias
|
|
43
40
|
},
|
|
44
41
|
webpack: (config, context) => {
|
|
45
42
|
if (nextConfig.webpack) {
|
|
46
43
|
nextConfig.webpack(config, context);
|
|
47
44
|
}
|
|
48
|
-
if (context.isServer) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
console.log("Using Uniform config from", uniformConfigPath);
|
|
52
|
-
config.resolve.alias["uniform.server.config"] = resolve(config.context, uniformConfigPath);
|
|
53
|
-
}
|
|
45
|
+
if (context.isServer && uniformConfigFilePath) {
|
|
46
|
+
console.log("(Webpack) Using Uniform config from", uniformConfigFilePath);
|
|
47
|
+
config.resolve.alias["uniform.server.config"] = resolve(config.context, uniformConfigFilePath);
|
|
54
48
|
}
|
|
55
49
|
return config;
|
|
56
50
|
}
|
package/dist/handler.js
CHANGED
|
@@ -204,9 +204,18 @@ var env = {
|
|
|
204
204
|
};
|
|
205
205
|
|
|
206
206
|
// src/utils/tag.ts
|
|
207
|
+
var encodePathForTag = (path) => {
|
|
208
|
+
return path.split("/").map((segment) => {
|
|
209
|
+
if (/[^\x00-\x7F]/.test(segment)) {
|
|
210
|
+
return encodeURIComponent(segment);
|
|
211
|
+
}
|
|
212
|
+
return segment;
|
|
213
|
+
}).join("/");
|
|
214
|
+
};
|
|
207
215
|
var buildPathTag = (path) => {
|
|
208
216
|
const actualPath = path.startsWith("/") ? path : `/${path}`;
|
|
209
|
-
|
|
217
|
+
const encodedPath = encodePathForTag(actualPath);
|
|
218
|
+
return `path:${encodedPath}`.toLowerCase();
|
|
210
219
|
};
|
|
211
220
|
var buildCompositionTag = (compositionId) => {
|
|
212
221
|
return `composition:${compositionId}`.toLowerCase();
|
package/dist/handler.mjs
CHANGED
|
@@ -171,9 +171,18 @@ var env = {
|
|
|
171
171
|
};
|
|
172
172
|
|
|
173
173
|
// src/utils/tag.ts
|
|
174
|
+
var encodePathForTag = (path) => {
|
|
175
|
+
return path.split("/").map((segment) => {
|
|
176
|
+
if (/[^\x00-\x7F]/.test(segment)) {
|
|
177
|
+
return encodeURIComponent(segment);
|
|
178
|
+
}
|
|
179
|
+
return segment;
|
|
180
|
+
}).join("/");
|
|
181
|
+
};
|
|
174
182
|
var buildPathTag = (path) => {
|
|
175
183
|
const actualPath = path.startsWith("/") ? path : `/${path}`;
|
|
176
|
-
|
|
184
|
+
const encodedPath = encodePathForTag(actualPath);
|
|
185
|
+
return `path:${encodedPath}`.toLowerCase();
|
|
177
186
|
};
|
|
178
187
|
var buildCompositionTag = (compositionId) => {
|
|
179
188
|
return `composition:${compositionId}`.toLowerCase();
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -24,13 +24,12 @@ var isDraftModeEnabled = async ({
|
|
|
24
24
|
draftModeEnabled = (await draftMode()).isEnabled;
|
|
25
25
|
} catch (e) {
|
|
26
26
|
}
|
|
27
|
-
return draftModeEnabled
|
|
27
|
+
return draftModeEnabled;
|
|
28
28
|
};
|
|
29
29
|
var isIncontextEditingEnabled = ({
|
|
30
30
|
searchParams
|
|
31
31
|
}) => {
|
|
32
|
-
|
|
33
|
-
return containsKey;
|
|
32
|
+
return (searchParams == null ? void 0 : searchParams[IN_CONTEXT_EDITOR_QUERY_STRING_PARAM]) === "true";
|
|
34
33
|
};
|
|
35
34
|
var determinePreviewMode = ({
|
|
36
35
|
searchParams
|
|
@@ -67,9 +66,6 @@ var shouldCacheBeDisabled = async (options) => {
|
|
|
67
66
|
if (await isDraftModeEnabled(options)) {
|
|
68
67
|
return { disabled: true, reason: "DRAFT" };
|
|
69
68
|
}
|
|
70
|
-
if (isIncontextEditingEnabled(options)) {
|
|
71
|
-
return { disabled: true, reason: "INCONTEXT" };
|
|
72
|
-
}
|
|
73
69
|
if (isDevelopmentEnvironment()) {
|
|
74
70
|
return { disabled: true, reason: "DEV" };
|
|
75
71
|
}
|
|
@@ -154,9 +150,18 @@ var env = {
|
|
|
154
150
|
};
|
|
155
151
|
|
|
156
152
|
// src/utils/tag.ts
|
|
153
|
+
var encodePathForTag = (path) => {
|
|
154
|
+
return path.split("/").map((segment) => {
|
|
155
|
+
if (/[^\x00-\x7F]/.test(segment)) {
|
|
156
|
+
return encodeURIComponent(segment);
|
|
157
|
+
}
|
|
158
|
+
return segment;
|
|
159
|
+
}).join("/");
|
|
160
|
+
};
|
|
157
161
|
var buildPathTag = (path) => {
|
|
158
162
|
const actualPath = path.startsWith("/") ? path : `/${path}`;
|
|
159
|
-
|
|
163
|
+
const encodedPath = encodePathForTag(actualPath);
|
|
164
|
+
return `path:${encodedPath}`.toLowerCase();
|
|
160
165
|
};
|
|
161
166
|
var buildCompositionTag = (compositionId) => {
|
|
162
167
|
return `composition:${compositionId}`.toLowerCase();
|
|
@@ -529,10 +534,17 @@ var retrieveRoute = async ({ params, searchParams: providedSearchParams, skipPre
|
|
|
529
534
|
let result;
|
|
530
535
|
for (let i = 0; i < states.length; i++) {
|
|
531
536
|
const state = states[i];
|
|
532
|
-
const
|
|
537
|
+
const releaseIdFromSearchParams = await determineReleaseId({
|
|
533
538
|
searchParams,
|
|
534
539
|
state
|
|
535
540
|
});
|
|
541
|
+
const releaseIdFromFetchOptions = fetchOptions == null ? void 0 : fetchOptions.releaseId;
|
|
542
|
+
if (releaseIdFromSearchParams && releaseIdFromFetchOptions && releaseIdFromSearchParams !== releaseIdFromFetchOptions) {
|
|
543
|
+
console.warn(
|
|
544
|
+
"retrieveRoute: releaseId provided in both searchParams and fetchOptions, using fetchOptions"
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
const releaseId = releaseIdFromFetchOptions != null ? releaseIdFromFetchOptions : releaseIdFromSearchParams;
|
|
536
548
|
try {
|
|
537
549
|
result = await retrieveRouteByPath({
|
|
538
550
|
path: value,
|
|
@@ -597,23 +609,16 @@ var determineState = async ({ searchParams }) => {
|
|
|
597
609
|
searchParams
|
|
598
610
|
});
|
|
599
611
|
const previewEnvironment = isOnVercelPreviewEnvironment();
|
|
600
|
-
const isDevelopment = isDevelopmentEnvironment();
|
|
601
612
|
const isCanvasEditing = isIncontextEditingEnabled({
|
|
602
613
|
searchParams
|
|
603
614
|
});
|
|
604
|
-
|
|
605
|
-
if (isCanvasEditing) {
|
|
606
|
-
states = [CANVAS_EDITOR_STATE, CANVAS_DRAFT_STATE];
|
|
607
|
-
} else {
|
|
608
|
-
states = isDraftMode || previewEnvironment || isDevelopment ? [CANVAS_DRAFT_STATE] : [CANVAS_PUBLISHED_STATE];
|
|
609
|
-
}
|
|
610
|
-
return states;
|
|
615
|
+
return isDraftMode || previewEnvironment ? (isCanvasEditing ? [CANVAS_EDITOR_STATE] : []).concat([CANVAS_DRAFT_STATE]) : [CANVAS_PUBLISHED_STATE];
|
|
611
616
|
};
|
|
612
|
-
var determineReleaseId = ({
|
|
617
|
+
var determineReleaseId = async ({
|
|
613
618
|
searchParams,
|
|
614
619
|
state
|
|
615
620
|
}) => {
|
|
616
|
-
const draftMode2 = isDraftModeEnabled({
|
|
621
|
+
const draftMode2 = await isDraftModeEnabled({
|
|
617
622
|
searchParams
|
|
618
623
|
});
|
|
619
624
|
if (!draftMode2 || state === CANVAS_PUBLISHED_STATE) {
|
|
@@ -631,19 +636,17 @@ var ContextUpdateTrigger = ({ path }) => {
|
|
|
631
636
|
|
|
632
637
|
// src/components/PersonalizeClientWrapper.tsx
|
|
633
638
|
import { PersonalizeClient } from "@uniformdev/canvas-next-rsc-client";
|
|
634
|
-
import { runPersonalization } from "@uniformdev/canvas-next-rsc-shared";
|
|
635
639
|
import React3 from "react";
|
|
636
|
-
var PersonalizeClientWrapper = (
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
});
|
|
641
|
-
return /* @__PURE__ */ React3.createElement(PersonalizeClient, { ...props, indexes });
|
|
640
|
+
var PersonalizeClientWrapper = ({
|
|
641
|
+
contextInstance,
|
|
642
|
+
...props
|
|
643
|
+
}) => {
|
|
644
|
+
return /* @__PURE__ */ React3.createElement(PersonalizeClient, { ...props, indexes: [] });
|
|
642
645
|
};
|
|
643
646
|
|
|
644
647
|
// src/components/PersonalizeServer.ts
|
|
645
648
|
import { CANVAS_PERSONALIZE_SLOT } from "@uniformdev/canvas";
|
|
646
|
-
import { runPersonalization
|
|
649
|
+
import { runPersonalization } from "@uniformdev/canvas-next-rsc-shared";
|
|
647
650
|
import { unstable_noStore as noStore } from "next/cache";
|
|
648
651
|
import { createElement, Fragment } from "react";
|
|
649
652
|
|
|
@@ -660,7 +663,7 @@ var PersonalizeServer = (props) => {
|
|
|
660
663
|
if ((_a = getServerConfig().ppr) == null ? void 0 : _a.personalizationSuspense) {
|
|
661
664
|
noStore();
|
|
662
665
|
}
|
|
663
|
-
const { indexes, event } =
|
|
666
|
+
const { indexes, event } = runPersonalization(props);
|
|
664
667
|
const slot = (_b = props.slots) == null ? void 0 : _b[CANVAS_PERSONALIZE_SLOT];
|
|
665
668
|
const components = indexes.map((index) => {
|
|
666
669
|
const component = slot.items[index];
|
|
@@ -675,20 +678,14 @@ var PersonalizeServer = (props) => {
|
|
|
675
678
|
|
|
676
679
|
// src/components/PersonalizeServerHybrid.tsx
|
|
677
680
|
import { PersonalizeClient as PersonalizeClient2 } from "@uniformdev/canvas-next-rsc-client";
|
|
678
|
-
import { runPersonalization as
|
|
681
|
+
import { runPersonalization as runPersonalization2 } from "@uniformdev/canvas-next-rsc-shared";
|
|
679
682
|
import React5 from "react";
|
|
680
|
-
var PersonalizeServerHybrid = (
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
count: props.count,
|
|
687
|
-
slots: props.slots,
|
|
688
|
-
trackingEventName: props.trackingEventName,
|
|
689
|
-
indexes
|
|
690
|
-
}
|
|
691
|
-
);
|
|
683
|
+
var PersonalizeServerHybrid = ({
|
|
684
|
+
contextInstance,
|
|
685
|
+
...props
|
|
686
|
+
}) => {
|
|
687
|
+
const { indexes } = runPersonalization2({ ...props, contextInstance });
|
|
688
|
+
return /* @__PURE__ */ React5.createElement(PersonalizeClient2, { ...props, indexes });
|
|
692
689
|
};
|
|
693
690
|
|
|
694
691
|
// src/components/TestServer.ts
|
|
@@ -751,6 +748,7 @@ var UniformComposition = async ({
|
|
|
751
748
|
route,
|
|
752
749
|
...props
|
|
753
750
|
}) => {
|
|
751
|
+
var _a;
|
|
754
752
|
let searchParams;
|
|
755
753
|
let serverContext = void 0;
|
|
756
754
|
if (props.mode === "static") {
|
|
@@ -775,10 +773,10 @@ var UniformComposition = async ({
|
|
|
775
773
|
const state = route.compositionApiResponse.state;
|
|
776
774
|
if (state === CANVAS_DRAFT_STATE2 || state === CANVAS_EDITOR_STATE2) {
|
|
777
775
|
walkNodeTree(route.compositionApiResponse.composition, (node) => {
|
|
778
|
-
var
|
|
776
|
+
var _a2, _b;
|
|
779
777
|
if (node.type === "component" && node.node.parameters) {
|
|
780
778
|
const contextualEditing = node.node.parameters[CANVAS_CONTEXTUAL_EDITING_PARAM];
|
|
781
|
-
const editableFields = (_b = (
|
|
779
|
+
const editableFields = (_b = (_a2 = contextualEditing == null ? void 0 : contextualEditing.value) == null ? void 0 : _a2.editableParameters) != null ? _b : [];
|
|
782
780
|
Object.keys(node.node.parameters).forEach((key) => {
|
|
783
781
|
const parameter = node.node.parameters[key];
|
|
784
782
|
if (parameter.type === "text") {
|
|
@@ -795,7 +793,8 @@ var UniformComposition = async ({
|
|
|
795
793
|
composition: route.compositionApiResponse.composition,
|
|
796
794
|
matchedRoute: route.matchedRoute,
|
|
797
795
|
searchParams,
|
|
798
|
-
|
|
796
|
+
// provide default non-undefined values to avoid serialization issues
|
|
797
|
+
dynamicInputs: (_a = route.dynamicInputs) != null ? _a : {},
|
|
799
798
|
type: "composition",
|
|
800
799
|
isContextualEditing: isIncontextEditingEnabled({ searchParams }),
|
|
801
800
|
isDraftMode: await isDraftModeEnabled({ searchParams }),
|
|
@@ -827,6 +826,11 @@ var UniformComposition = async ({
|
|
|
827
826
|
},
|
|
828
827
|
{}
|
|
829
828
|
),
|
|
829
|
+
compositionMetadata: {
|
|
830
|
+
compositionId: route.compositionApiResponse.composition._id,
|
|
831
|
+
matchedRoute: route.matchedRoute,
|
|
832
|
+
dynamicInputs: route.dynamicInputs
|
|
833
|
+
},
|
|
830
834
|
quirks: {
|
|
831
835
|
"vc-country": headersValue.get("x-vercel-ip-country") || missingQuirkValue,
|
|
832
836
|
"vc-region": headersValue.get("x-vercel-ip-country-region") || missingQuirkValue,
|
|
@@ -1146,7 +1150,8 @@ import { notFound as notFound2 } from "next/navigation";
|
|
|
1146
1150
|
import React10 from "react";
|
|
1147
1151
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1148
1152
|
const awaitedSearchParams = await searchParams;
|
|
1149
|
-
|
|
1153
|
+
const isDraftMode = await isDraftModeEnabled({ searchParams: awaitedSearchParams });
|
|
1154
|
+
if (!isDraftMode) {
|
|
1150
1155
|
return /* @__PURE__ */ React10.createElement("div", null, /* @__PURE__ */ React10.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1151
1156
|
}
|
|
1152
1157
|
const id = awaitedSearchParams["id"];
|
package/dist/index.js
CHANGED
|
@@ -77,13 +77,12 @@ var isDraftModeEnabled = async ({
|
|
|
77
77
|
draftModeEnabled = (await (0, import_headers.draftMode)()).isEnabled;
|
|
78
78
|
} catch (e) {
|
|
79
79
|
}
|
|
80
|
-
return draftModeEnabled
|
|
80
|
+
return draftModeEnabled;
|
|
81
81
|
};
|
|
82
82
|
var isIncontextEditingEnabled = ({
|
|
83
83
|
searchParams
|
|
84
84
|
}) => {
|
|
85
|
-
|
|
86
|
-
return containsKey;
|
|
85
|
+
return (searchParams == null ? void 0 : searchParams[import_canvas.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM]) === "true";
|
|
87
86
|
};
|
|
88
87
|
var determinePreviewMode = ({
|
|
89
88
|
searchParams
|
|
@@ -120,9 +119,6 @@ var shouldCacheBeDisabled = async (options) => {
|
|
|
120
119
|
if (await isDraftModeEnabled(options)) {
|
|
121
120
|
return { disabled: true, reason: "DRAFT" };
|
|
122
121
|
}
|
|
123
|
-
if (isIncontextEditingEnabled(options)) {
|
|
124
|
-
return { disabled: true, reason: "INCONTEXT" };
|
|
125
|
-
}
|
|
126
122
|
if (isDevelopmentEnvironment()) {
|
|
127
123
|
return { disabled: true, reason: "DEV" };
|
|
128
124
|
}
|
|
@@ -207,9 +203,18 @@ var env = {
|
|
|
207
203
|
};
|
|
208
204
|
|
|
209
205
|
// src/utils/tag.ts
|
|
206
|
+
var encodePathForTag = (path) => {
|
|
207
|
+
return path.split("/").map((segment) => {
|
|
208
|
+
if (/[^\x00-\x7F]/.test(segment)) {
|
|
209
|
+
return encodeURIComponent(segment);
|
|
210
|
+
}
|
|
211
|
+
return segment;
|
|
212
|
+
}).join("/");
|
|
213
|
+
};
|
|
210
214
|
var buildPathTag = (path) => {
|
|
211
215
|
const actualPath = path.startsWith("/") ? path : `/${path}`;
|
|
212
|
-
|
|
216
|
+
const encodedPath = encodePathForTag(actualPath);
|
|
217
|
+
return `path:${encodedPath}`.toLowerCase();
|
|
213
218
|
};
|
|
214
219
|
var buildCompositionTag = (compositionId) => {
|
|
215
220
|
return `composition:${compositionId}`.toLowerCase();
|
|
@@ -457,7 +462,7 @@ async function generateStaticParams() {
|
|
|
457
462
|
// src/components/UniformComposition.ts
|
|
458
463
|
var import_canvas8 = require("@uniformdev/canvas");
|
|
459
464
|
var import_canvas_next_rsc_client8 = require("@uniformdev/canvas-next-rsc-client");
|
|
460
|
-
var
|
|
465
|
+
var import_canvas_next_rsc_shared6 = require("@uniformdev/canvas-next-rsc-shared");
|
|
461
466
|
var import_core = require("@uniformdev/canvas-react/core");
|
|
462
467
|
var import_headers3 = require("next/headers");
|
|
463
468
|
var import_navigation = require("next/navigation");
|
|
@@ -557,10 +562,17 @@ var retrieveRoute = async ({ params, searchParams: providedSearchParams, skipPre
|
|
|
557
562
|
let result;
|
|
558
563
|
for (let i = 0; i < states.length; i++) {
|
|
559
564
|
const state = states[i];
|
|
560
|
-
const
|
|
565
|
+
const releaseIdFromSearchParams = await determineReleaseId({
|
|
561
566
|
searchParams,
|
|
562
567
|
state
|
|
563
568
|
});
|
|
569
|
+
const releaseIdFromFetchOptions = fetchOptions == null ? void 0 : fetchOptions.releaseId;
|
|
570
|
+
if (releaseIdFromSearchParams && releaseIdFromFetchOptions && releaseIdFromSearchParams !== releaseIdFromFetchOptions) {
|
|
571
|
+
console.warn(
|
|
572
|
+
"retrieveRoute: releaseId provided in both searchParams and fetchOptions, using fetchOptions"
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
const releaseId = releaseIdFromFetchOptions != null ? releaseIdFromFetchOptions : releaseIdFromSearchParams;
|
|
564
576
|
try {
|
|
565
577
|
result = await retrieveRouteByPath({
|
|
566
578
|
path: value,
|
|
@@ -625,23 +637,16 @@ var determineState = async ({ searchParams }) => {
|
|
|
625
637
|
searchParams
|
|
626
638
|
});
|
|
627
639
|
const previewEnvironment = isOnVercelPreviewEnvironment();
|
|
628
|
-
const isDevelopment = isDevelopmentEnvironment();
|
|
629
640
|
const isCanvasEditing = isIncontextEditingEnabled({
|
|
630
641
|
searchParams
|
|
631
642
|
});
|
|
632
|
-
|
|
633
|
-
if (isCanvasEditing) {
|
|
634
|
-
states = [import_canvas4.CANVAS_EDITOR_STATE, import_canvas4.CANVAS_DRAFT_STATE];
|
|
635
|
-
} else {
|
|
636
|
-
states = isDraftMode || previewEnvironment || isDevelopment ? [import_canvas4.CANVAS_DRAFT_STATE] : [import_canvas4.CANVAS_PUBLISHED_STATE];
|
|
637
|
-
}
|
|
638
|
-
return states;
|
|
643
|
+
return isDraftMode || previewEnvironment ? (isCanvasEditing ? [import_canvas4.CANVAS_EDITOR_STATE] : []).concat([import_canvas4.CANVAS_DRAFT_STATE]) : [import_canvas4.CANVAS_PUBLISHED_STATE];
|
|
639
644
|
};
|
|
640
|
-
var determineReleaseId = ({
|
|
645
|
+
var determineReleaseId = async ({
|
|
641
646
|
searchParams,
|
|
642
647
|
state
|
|
643
648
|
}) => {
|
|
644
|
-
const draftMode2 = isDraftModeEnabled({
|
|
649
|
+
const draftMode2 = await isDraftModeEnabled({
|
|
645
650
|
searchParams
|
|
646
651
|
});
|
|
647
652
|
if (!draftMode2 || state === import_canvas4.CANVAS_PUBLISHED_STATE) {
|
|
@@ -659,19 +664,17 @@ var ContextUpdateTrigger = ({ path }) => {
|
|
|
659
664
|
|
|
660
665
|
// src/components/PersonalizeClientWrapper.tsx
|
|
661
666
|
var import_canvas_next_rsc_client3 = require("@uniformdev/canvas-next-rsc-client");
|
|
662
|
-
var import_canvas_next_rsc_shared3 = require("@uniformdev/canvas-next-rsc-shared");
|
|
663
667
|
var import_react3 = __toESM(require("react"));
|
|
664
|
-
var PersonalizeClientWrapper = (
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
});
|
|
669
|
-
return /* @__PURE__ */ import_react3.default.createElement(import_canvas_next_rsc_client3.PersonalizeClient, { ...props, indexes });
|
|
668
|
+
var PersonalizeClientWrapper = ({
|
|
669
|
+
contextInstance,
|
|
670
|
+
...props
|
|
671
|
+
}) => {
|
|
672
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_canvas_next_rsc_client3.PersonalizeClient, { ...props, indexes: [] });
|
|
670
673
|
};
|
|
671
674
|
|
|
672
675
|
// src/components/PersonalizeServer.ts
|
|
673
676
|
var import_canvas5 = require("@uniformdev/canvas");
|
|
674
|
-
var
|
|
677
|
+
var import_canvas_next_rsc_shared3 = require("@uniformdev/canvas-next-rsc-shared");
|
|
675
678
|
var import_cache = require("next/cache");
|
|
676
679
|
var import_react5 = require("react");
|
|
677
680
|
|
|
@@ -688,7 +691,7 @@ var PersonalizeServer = (props) => {
|
|
|
688
691
|
if ((_a = getServerConfig().ppr) == null ? void 0 : _a.personalizationSuspense) {
|
|
689
692
|
(0, import_cache.unstable_noStore)();
|
|
690
693
|
}
|
|
691
|
-
const { indexes, event } = (0,
|
|
694
|
+
const { indexes, event } = (0, import_canvas_next_rsc_shared3.runPersonalization)(props);
|
|
692
695
|
const slot = (_b = props.slots) == null ? void 0 : _b[import_canvas5.CANVAS_PERSONALIZE_SLOT];
|
|
693
696
|
const components = indexes.map((index) => {
|
|
694
697
|
const component = slot.items[index];
|
|
@@ -703,25 +706,19 @@ var PersonalizeServer = (props) => {
|
|
|
703
706
|
|
|
704
707
|
// src/components/PersonalizeServerHybrid.tsx
|
|
705
708
|
var import_canvas_next_rsc_client5 = require("@uniformdev/canvas-next-rsc-client");
|
|
706
|
-
var
|
|
709
|
+
var import_canvas_next_rsc_shared4 = require("@uniformdev/canvas-next-rsc-shared");
|
|
707
710
|
var import_react6 = __toESM(require("react"));
|
|
708
|
-
var PersonalizeServerHybrid = (
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
count: props.count,
|
|
715
|
-
slots: props.slots,
|
|
716
|
-
trackingEventName: props.trackingEventName,
|
|
717
|
-
indexes
|
|
718
|
-
}
|
|
719
|
-
);
|
|
711
|
+
var PersonalizeServerHybrid = ({
|
|
712
|
+
contextInstance,
|
|
713
|
+
...props
|
|
714
|
+
}) => {
|
|
715
|
+
const { indexes } = (0, import_canvas_next_rsc_shared4.runPersonalization)({ ...props, contextInstance });
|
|
716
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_canvas_next_rsc_client5.PersonalizeClient, { ...props, indexes });
|
|
720
717
|
};
|
|
721
718
|
|
|
722
719
|
// src/components/TestServer.ts
|
|
723
720
|
var import_canvas6 = require("@uniformdev/canvas");
|
|
724
|
-
var
|
|
721
|
+
var import_canvas_next_rsc_shared5 = require("@uniformdev/canvas-next-rsc-shared");
|
|
725
722
|
var import_cache2 = require("next/cache");
|
|
726
723
|
var import_react8 = require("react");
|
|
727
724
|
|
|
@@ -738,7 +735,7 @@ var TestServer = async (props) => {
|
|
|
738
735
|
if ((_a = getServerConfig().ppr) == null ? void 0 : _a.testSuspense) {
|
|
739
736
|
(0, import_cache2.unstable_noStore)();
|
|
740
737
|
}
|
|
741
|
-
const { index, event } = (0,
|
|
738
|
+
const { index, event } = (0, import_canvas_next_rsc_shared5.runTest)(props);
|
|
742
739
|
if (index === null || event === null) {
|
|
743
740
|
return null;
|
|
744
741
|
}
|
|
@@ -774,6 +771,7 @@ var UniformComposition = async ({
|
|
|
774
771
|
route,
|
|
775
772
|
...props
|
|
776
773
|
}) => {
|
|
774
|
+
var _a;
|
|
777
775
|
let searchParams;
|
|
778
776
|
let serverContext = void 0;
|
|
779
777
|
if (props.mode === "static") {
|
|
@@ -785,7 +783,7 @@ var UniformComposition = async ({
|
|
|
785
783
|
});
|
|
786
784
|
}
|
|
787
785
|
const awaitedParams = await props.params;
|
|
788
|
-
const { value: path } = (0,
|
|
786
|
+
const { value: path } = (0, import_canvas_next_rsc_shared6.resolvePath)({
|
|
789
787
|
params: awaitedParams
|
|
790
788
|
});
|
|
791
789
|
if (!route || route.type === "notFound") {
|
|
@@ -798,10 +796,10 @@ var UniformComposition = async ({
|
|
|
798
796
|
const state = route.compositionApiResponse.state;
|
|
799
797
|
if (state === import_canvas8.CANVAS_DRAFT_STATE || state === import_canvas8.CANVAS_EDITOR_STATE) {
|
|
800
798
|
(0, import_canvas8.walkNodeTree)(route.compositionApiResponse.composition, (node) => {
|
|
801
|
-
var
|
|
799
|
+
var _a2, _b;
|
|
802
800
|
if (node.type === "component" && node.node.parameters) {
|
|
803
801
|
const contextualEditing = node.node.parameters[import_canvas8.CANVAS_CONTEXTUAL_EDITING_PARAM];
|
|
804
|
-
const editableFields = (_b = (
|
|
802
|
+
const editableFields = (_b = (_a2 = contextualEditing == null ? void 0 : contextualEditing.value) == null ? void 0 : _a2.editableParameters) != null ? _b : [];
|
|
805
803
|
Object.keys(node.node.parameters).forEach((key) => {
|
|
806
804
|
const parameter = node.node.parameters[key];
|
|
807
805
|
if (parameter.type === "text") {
|
|
@@ -818,7 +816,8 @@ var UniformComposition = async ({
|
|
|
818
816
|
composition: route.compositionApiResponse.composition,
|
|
819
817
|
matchedRoute: route.matchedRoute,
|
|
820
818
|
searchParams,
|
|
821
|
-
|
|
819
|
+
// provide default non-undefined values to avoid serialization issues
|
|
820
|
+
dynamicInputs: (_a = route.dynamicInputs) != null ? _a : {},
|
|
822
821
|
type: "composition",
|
|
823
822
|
isContextualEditing: isIncontextEditingEnabled({ searchParams }),
|
|
824
823
|
isDraftMode: await isDraftModeEnabled({ searchParams }),
|
|
@@ -850,6 +849,11 @@ var UniformComposition = async ({
|
|
|
850
849
|
},
|
|
851
850
|
{}
|
|
852
851
|
),
|
|
852
|
+
compositionMetadata: {
|
|
853
|
+
compositionId: route.compositionApiResponse.composition._id,
|
|
854
|
+
matchedRoute: route.matchedRoute,
|
|
855
|
+
dynamicInputs: route.dynamicInputs
|
|
856
|
+
},
|
|
853
857
|
quirks: {
|
|
854
858
|
"vc-country": headersValue.get("x-vercel-ip-country") || missingQuirkValue,
|
|
855
859
|
"vc-region": headersValue.get("x-vercel-ip-country-region") || missingQuirkValue,
|
|
@@ -1166,7 +1170,8 @@ var import_navigation2 = require("next/navigation");
|
|
|
1166
1170
|
var import_react13 = __toESM(require("react"));
|
|
1167
1171
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1168
1172
|
const awaitedSearchParams = await searchParams;
|
|
1169
|
-
|
|
1173
|
+
const isDraftMode = await isDraftModeEnabled({ searchParams: awaitedSearchParams });
|
|
1174
|
+
if (!isDraftMode) {
|
|
1170
1175
|
return /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1171
1176
|
}
|
|
1172
1177
|
const id = awaitedSearchParams["id"];
|
package/dist/index.mjs
CHANGED
|
@@ -24,13 +24,12 @@ var isDraftModeEnabled = async ({
|
|
|
24
24
|
draftModeEnabled = (await draftMode()).isEnabled;
|
|
25
25
|
} catch (e) {
|
|
26
26
|
}
|
|
27
|
-
return draftModeEnabled
|
|
27
|
+
return draftModeEnabled;
|
|
28
28
|
};
|
|
29
29
|
var isIncontextEditingEnabled = ({
|
|
30
30
|
searchParams
|
|
31
31
|
}) => {
|
|
32
|
-
|
|
33
|
-
return containsKey;
|
|
32
|
+
return (searchParams == null ? void 0 : searchParams[IN_CONTEXT_EDITOR_QUERY_STRING_PARAM]) === "true";
|
|
34
33
|
};
|
|
35
34
|
var determinePreviewMode = ({
|
|
36
35
|
searchParams
|
|
@@ -67,9 +66,6 @@ var shouldCacheBeDisabled = async (options) => {
|
|
|
67
66
|
if (await isDraftModeEnabled(options)) {
|
|
68
67
|
return { disabled: true, reason: "DRAFT" };
|
|
69
68
|
}
|
|
70
|
-
if (isIncontextEditingEnabled(options)) {
|
|
71
|
-
return { disabled: true, reason: "INCONTEXT" };
|
|
72
|
-
}
|
|
73
69
|
if (isDevelopmentEnvironment()) {
|
|
74
70
|
return { disabled: true, reason: "DEV" };
|
|
75
71
|
}
|
|
@@ -154,9 +150,18 @@ var env = {
|
|
|
154
150
|
};
|
|
155
151
|
|
|
156
152
|
// src/utils/tag.ts
|
|
153
|
+
var encodePathForTag = (path) => {
|
|
154
|
+
return path.split("/").map((segment) => {
|
|
155
|
+
if (/[^\x00-\x7F]/.test(segment)) {
|
|
156
|
+
return encodeURIComponent(segment);
|
|
157
|
+
}
|
|
158
|
+
return segment;
|
|
159
|
+
}).join("/");
|
|
160
|
+
};
|
|
157
161
|
var buildPathTag = (path) => {
|
|
158
162
|
const actualPath = path.startsWith("/") ? path : `/${path}`;
|
|
159
|
-
|
|
163
|
+
const encodedPath = encodePathForTag(actualPath);
|
|
164
|
+
return `path:${encodedPath}`.toLowerCase();
|
|
160
165
|
};
|
|
161
166
|
var buildCompositionTag = (compositionId) => {
|
|
162
167
|
return `composition:${compositionId}`.toLowerCase();
|
|
@@ -529,10 +534,17 @@ var retrieveRoute = async ({ params, searchParams: providedSearchParams, skipPre
|
|
|
529
534
|
let result;
|
|
530
535
|
for (let i = 0; i < states.length; i++) {
|
|
531
536
|
const state = states[i];
|
|
532
|
-
const
|
|
537
|
+
const releaseIdFromSearchParams = await determineReleaseId({
|
|
533
538
|
searchParams,
|
|
534
539
|
state
|
|
535
540
|
});
|
|
541
|
+
const releaseIdFromFetchOptions = fetchOptions == null ? void 0 : fetchOptions.releaseId;
|
|
542
|
+
if (releaseIdFromSearchParams && releaseIdFromFetchOptions && releaseIdFromSearchParams !== releaseIdFromFetchOptions) {
|
|
543
|
+
console.warn(
|
|
544
|
+
"retrieveRoute: releaseId provided in both searchParams and fetchOptions, using fetchOptions"
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
const releaseId = releaseIdFromFetchOptions != null ? releaseIdFromFetchOptions : releaseIdFromSearchParams;
|
|
536
548
|
try {
|
|
537
549
|
result = await retrieveRouteByPath({
|
|
538
550
|
path: value,
|
|
@@ -597,23 +609,16 @@ var determineState = async ({ searchParams }) => {
|
|
|
597
609
|
searchParams
|
|
598
610
|
});
|
|
599
611
|
const previewEnvironment = isOnVercelPreviewEnvironment();
|
|
600
|
-
const isDevelopment = isDevelopmentEnvironment();
|
|
601
612
|
const isCanvasEditing = isIncontextEditingEnabled({
|
|
602
613
|
searchParams
|
|
603
614
|
});
|
|
604
|
-
|
|
605
|
-
if (isCanvasEditing) {
|
|
606
|
-
states = [CANVAS_EDITOR_STATE, CANVAS_DRAFT_STATE];
|
|
607
|
-
} else {
|
|
608
|
-
states = isDraftMode || previewEnvironment || isDevelopment ? [CANVAS_DRAFT_STATE] : [CANVAS_PUBLISHED_STATE];
|
|
609
|
-
}
|
|
610
|
-
return states;
|
|
615
|
+
return isDraftMode || previewEnvironment ? (isCanvasEditing ? [CANVAS_EDITOR_STATE] : []).concat([CANVAS_DRAFT_STATE]) : [CANVAS_PUBLISHED_STATE];
|
|
611
616
|
};
|
|
612
|
-
var determineReleaseId = ({
|
|
617
|
+
var determineReleaseId = async ({
|
|
613
618
|
searchParams,
|
|
614
619
|
state
|
|
615
620
|
}) => {
|
|
616
|
-
const draftMode2 = isDraftModeEnabled({
|
|
621
|
+
const draftMode2 = await isDraftModeEnabled({
|
|
617
622
|
searchParams
|
|
618
623
|
});
|
|
619
624
|
if (!draftMode2 || state === CANVAS_PUBLISHED_STATE) {
|
|
@@ -631,19 +636,17 @@ var ContextUpdateTrigger = ({ path }) => {
|
|
|
631
636
|
|
|
632
637
|
// src/components/PersonalizeClientWrapper.tsx
|
|
633
638
|
import { PersonalizeClient } from "@uniformdev/canvas-next-rsc-client";
|
|
634
|
-
import { runPersonalization } from "@uniformdev/canvas-next-rsc-shared";
|
|
635
639
|
import React3 from "react";
|
|
636
|
-
var PersonalizeClientWrapper = (
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
});
|
|
641
|
-
return /* @__PURE__ */ React3.createElement(PersonalizeClient, { ...props, indexes });
|
|
640
|
+
var PersonalizeClientWrapper = ({
|
|
641
|
+
contextInstance,
|
|
642
|
+
...props
|
|
643
|
+
}) => {
|
|
644
|
+
return /* @__PURE__ */ React3.createElement(PersonalizeClient, { ...props, indexes: [] });
|
|
642
645
|
};
|
|
643
646
|
|
|
644
647
|
// src/components/PersonalizeServer.ts
|
|
645
648
|
import { CANVAS_PERSONALIZE_SLOT } from "@uniformdev/canvas";
|
|
646
|
-
import { runPersonalization
|
|
649
|
+
import { runPersonalization } from "@uniformdev/canvas-next-rsc-shared";
|
|
647
650
|
import { unstable_noStore as noStore } from "next/cache";
|
|
648
651
|
import { createElement, Fragment } from "react";
|
|
649
652
|
|
|
@@ -660,7 +663,7 @@ var PersonalizeServer = (props) => {
|
|
|
660
663
|
if ((_a = getServerConfig().ppr) == null ? void 0 : _a.personalizationSuspense) {
|
|
661
664
|
noStore();
|
|
662
665
|
}
|
|
663
|
-
const { indexes, event } =
|
|
666
|
+
const { indexes, event } = runPersonalization(props);
|
|
664
667
|
const slot = (_b = props.slots) == null ? void 0 : _b[CANVAS_PERSONALIZE_SLOT];
|
|
665
668
|
const components = indexes.map((index) => {
|
|
666
669
|
const component = slot.items[index];
|
|
@@ -675,20 +678,14 @@ var PersonalizeServer = (props) => {
|
|
|
675
678
|
|
|
676
679
|
// src/components/PersonalizeServerHybrid.tsx
|
|
677
680
|
import { PersonalizeClient as PersonalizeClient2 } from "@uniformdev/canvas-next-rsc-client";
|
|
678
|
-
import { runPersonalization as
|
|
681
|
+
import { runPersonalization as runPersonalization2 } from "@uniformdev/canvas-next-rsc-shared";
|
|
679
682
|
import React5 from "react";
|
|
680
|
-
var PersonalizeServerHybrid = (
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
count: props.count,
|
|
687
|
-
slots: props.slots,
|
|
688
|
-
trackingEventName: props.trackingEventName,
|
|
689
|
-
indexes
|
|
690
|
-
}
|
|
691
|
-
);
|
|
683
|
+
var PersonalizeServerHybrid = ({
|
|
684
|
+
contextInstance,
|
|
685
|
+
...props
|
|
686
|
+
}) => {
|
|
687
|
+
const { indexes } = runPersonalization2({ ...props, contextInstance });
|
|
688
|
+
return /* @__PURE__ */ React5.createElement(PersonalizeClient2, { ...props, indexes });
|
|
692
689
|
};
|
|
693
690
|
|
|
694
691
|
// src/components/TestServer.ts
|
|
@@ -751,6 +748,7 @@ var UniformComposition = async ({
|
|
|
751
748
|
route,
|
|
752
749
|
...props
|
|
753
750
|
}) => {
|
|
751
|
+
var _a;
|
|
754
752
|
let searchParams;
|
|
755
753
|
let serverContext = void 0;
|
|
756
754
|
if (props.mode === "static") {
|
|
@@ -775,10 +773,10 @@ var UniformComposition = async ({
|
|
|
775
773
|
const state = route.compositionApiResponse.state;
|
|
776
774
|
if (state === CANVAS_DRAFT_STATE2 || state === CANVAS_EDITOR_STATE2) {
|
|
777
775
|
walkNodeTree(route.compositionApiResponse.composition, (node) => {
|
|
778
|
-
var
|
|
776
|
+
var _a2, _b;
|
|
779
777
|
if (node.type === "component" && node.node.parameters) {
|
|
780
778
|
const contextualEditing = node.node.parameters[CANVAS_CONTEXTUAL_EDITING_PARAM];
|
|
781
|
-
const editableFields = (_b = (
|
|
779
|
+
const editableFields = (_b = (_a2 = contextualEditing == null ? void 0 : contextualEditing.value) == null ? void 0 : _a2.editableParameters) != null ? _b : [];
|
|
782
780
|
Object.keys(node.node.parameters).forEach((key) => {
|
|
783
781
|
const parameter = node.node.parameters[key];
|
|
784
782
|
if (parameter.type === "text") {
|
|
@@ -795,7 +793,8 @@ var UniformComposition = async ({
|
|
|
795
793
|
composition: route.compositionApiResponse.composition,
|
|
796
794
|
matchedRoute: route.matchedRoute,
|
|
797
795
|
searchParams,
|
|
798
|
-
|
|
796
|
+
// provide default non-undefined values to avoid serialization issues
|
|
797
|
+
dynamicInputs: (_a = route.dynamicInputs) != null ? _a : {},
|
|
799
798
|
type: "composition",
|
|
800
799
|
isContextualEditing: isIncontextEditingEnabled({ searchParams }),
|
|
801
800
|
isDraftMode: await isDraftModeEnabled({ searchParams }),
|
|
@@ -827,6 +826,11 @@ var UniformComposition = async ({
|
|
|
827
826
|
},
|
|
828
827
|
{}
|
|
829
828
|
),
|
|
829
|
+
compositionMetadata: {
|
|
830
|
+
compositionId: route.compositionApiResponse.composition._id,
|
|
831
|
+
matchedRoute: route.matchedRoute,
|
|
832
|
+
dynamicInputs: route.dynamicInputs
|
|
833
|
+
},
|
|
830
834
|
quirks: {
|
|
831
835
|
"vc-country": headersValue.get("x-vercel-ip-country") || missingQuirkValue,
|
|
832
836
|
"vc-region": headersValue.get("x-vercel-ip-country-region") || missingQuirkValue,
|
|
@@ -1146,7 +1150,8 @@ import { notFound as notFound2 } from "next/navigation";
|
|
|
1146
1150
|
import React10 from "react";
|
|
1147
1151
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1148
1152
|
const awaitedSearchParams = await searchParams;
|
|
1149
|
-
|
|
1153
|
+
const isDraftMode = await isDraftModeEnabled({ searchParams: awaitedSearchParams });
|
|
1154
|
+
if (!isDraftMode) {
|
|
1150
1155
|
return /* @__PURE__ */ React10.createElement("div", null, /* @__PURE__ */ React10.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1151
1156
|
}
|
|
1152
1157
|
const id = awaitedSearchParams["id"];
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "20.7.1-alpha.
|
|
3
|
+
"version": "20.7.1-alpha.120+5160373551",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
7
7
|
"dev": "tsup --watch",
|
|
8
8
|
"lint": "eslint \"src/**/*.{ts,tsx}\" --fix",
|
|
9
|
-
"test": "jest --maxWorkers=1 --passWithNoTests"
|
|
9
|
+
"test": "jest --maxWorkers=1 --passWithNoTests",
|
|
10
|
+
"document": "api-extractor run --local"
|
|
10
11
|
},
|
|
11
12
|
"sideEffects": false,
|
|
12
13
|
"main": "dist/index.js",
|
|
@@ -18,9 +19,9 @@
|
|
|
18
19
|
"import": "./dist/index.esm.js"
|
|
19
20
|
},
|
|
20
21
|
"./handler": {
|
|
22
|
+
"types": "./dist/handler.d.ts",
|
|
21
23
|
"require": "./dist/handler.js",
|
|
22
|
-
"import": "./dist/handler.mjs"
|
|
23
|
-
"types": "./dist/handler.d.ts"
|
|
24
|
+
"import": "./dist/handler.mjs"
|
|
24
25
|
},
|
|
25
26
|
"./config": {
|
|
26
27
|
"types": "./dist/config.d.ts",
|
|
@@ -53,23 +54,22 @@
|
|
|
53
54
|
"/dist"
|
|
54
55
|
],
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"@types/node": "
|
|
57
|
-
"@types/react": "18.3.
|
|
58
|
-
"
|
|
59
|
-
"next": "15.1.0",
|
|
57
|
+
"@types/node": "24.3.1",
|
|
58
|
+
"@types/react": "18.3.24",
|
|
59
|
+
"next": "15.2.5",
|
|
60
60
|
"react": "18.3.1",
|
|
61
61
|
"react-dom": "18.3.1"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@uniformdev/canvas": "20.7.1-alpha.
|
|
65
|
-
"@uniformdev/canvas-next-rsc-client": "^20.7.1-alpha.
|
|
66
|
-
"@uniformdev/canvas-next-rsc-shared": "^20.7.1-alpha.
|
|
67
|
-
"@uniformdev/canvas-react": "20.7.1-alpha.
|
|
68
|
-
"@uniformdev/context": "20.7.1-alpha.
|
|
69
|
-
"@uniformdev/project-map": "20.7.1-alpha.
|
|
70
|
-
"@uniformdev/redirect": "20.7.1-alpha.
|
|
71
|
-
"@uniformdev/richtext": "20.7.1-alpha.
|
|
72
|
-
"@uniformdev/webhooks": "20.7.1-alpha.
|
|
64
|
+
"@uniformdev/canvas": "20.7.1-alpha.120+5160373551",
|
|
65
|
+
"@uniformdev/canvas-next-rsc-client": "^20.7.1-alpha.120+5160373551",
|
|
66
|
+
"@uniformdev/canvas-next-rsc-shared": "^20.7.1-alpha.120+5160373551",
|
|
67
|
+
"@uniformdev/canvas-react": "20.7.1-alpha.120+5160373551",
|
|
68
|
+
"@uniformdev/context": "20.7.1-alpha.120+5160373551",
|
|
69
|
+
"@uniformdev/project-map": "20.7.1-alpha.120+5160373551",
|
|
70
|
+
"@uniformdev/redirect": "20.7.1-alpha.120+5160373551",
|
|
71
|
+
"@uniformdev/richtext": "20.7.1-alpha.120+5160373551",
|
|
72
|
+
"@uniformdev/webhooks": "20.7.1-alpha.120+5160373551",
|
|
73
73
|
"@vercel/edge-config": "^0.4.0",
|
|
74
74
|
"encoding": "^0.1.13",
|
|
75
75
|
"server-only": "^0.0.1",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"node": "^18.18.0 || ^19.8.0 || >= 20.0.0"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"next": ">=15.
|
|
82
|
+
"next": ">=15.2.3",
|
|
83
83
|
"react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",
|
|
84
84
|
"react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0"
|
|
85
85
|
},
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "5160373551e91f6ef481c9f3687cad238e379591"
|
|
90
90
|
}
|