@uniformdev/canvas-next-rsc 19.202.0 → 19.202.1-alpha.9
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-Dw55RFP6.d.mts → UniformComposition-B8budr-b.d.mts} +1 -1
- package/dist/{UniformComposition-Dw55RFP6.d.ts → UniformComposition-B8budr-b.d.ts} +1 -1
- package/dist/component.d.mts +3 -3
- package/dist/component.d.ts +3 -3
- package/dist/component.js +80 -4
- package/dist/component.mjs +80 -4
- package/dist/handler.js +7 -3
- package/dist/handler.mjs +7 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +66 -19
- package/dist/index.js +92 -48
- package/dist/index.mjs +66 -19
- package/package.json +19 -19
|
@@ -64,4 +64,4 @@ type ResolveComponentsOptions = {
|
|
|
64
64
|
mode: UniformCompositionProps['mode'];
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export { type ResolveComponentFunction as R, type UniformCompositionProps as U,
|
|
67
|
+
export { type ResolveComponentFunction as R, type UniformCompositionProps as U, type ResolveComponentResult as a, UniformComposition as b, resolveComposition as r };
|
|
@@ -64,4 +64,4 @@ type ResolveComponentsOptions = {
|
|
|
64
64
|
mode: UniformCompositionProps['mode'];
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export { type ResolveComponentFunction as R, type UniformCompositionProps as U,
|
|
67
|
+
export { type ResolveComponentFunction as R, type UniformCompositionProps as U, type ResolveComponentResult as a, UniformComposition as b, resolveComposition as r };
|
package/dist/component.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ComponentProps, CompositionContext, SlotDefinition } from '@uniformdev/canvas-next-rsc-shared';
|
|
2
2
|
export { ComponentProps, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
import React__default, { PropsWithChildren, ReactNode, Key } from 'react';
|
|
4
|
-
export { R as ResolveComponentFunction,
|
|
4
|
+
export { R as ResolveComponentFunction, a as ResolveComponentResult } from './UniformComposition-B8budr-b.mjs';
|
|
5
5
|
import { ComponentInstance } from '@uniformdev/canvas';
|
|
6
6
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
7
7
|
import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
|
|
8
8
|
export { ClientContextComponent, createClientUniformContext, useInitUniformContext, useUniformContext } from '@uniformdev/canvas-next-rsc-client';
|
|
9
9
|
|
|
10
|
-
declare const DefaultNotImplementedComponent: ({ component }: ComponentProps) => React__default.JSX.Element;
|
|
10
|
+
declare const DefaultNotImplementedComponent: ({ component }: ComponentProps) => React__default.JSX.Element | null;
|
|
11
11
|
|
|
12
12
|
type RichTextComponentProps<TNode extends RichTextNode = RichTextNode> = {
|
|
13
13
|
node: TNode;
|
|
@@ -71,7 +71,7 @@ declare const UniformRichText: React__default.ForwardRefExoticComponent<{
|
|
|
71
71
|
placeholder?: string | ((parameter: {
|
|
72
72
|
id: string;
|
|
73
73
|
}) => string | undefined);
|
|
74
|
-
} & Omit<React__default.HTMLAttributes<HTMLDivElement>, "
|
|
74
|
+
} & Omit<React__default.HTMLAttributes<HTMLDivElement>, "children" | "placeholder"> & React__default.RefAttributes<unknown>>;
|
|
75
75
|
|
|
76
76
|
type UniformRichTextNodeProps = {
|
|
77
77
|
node: RichTextNode;
|
package/dist/component.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ComponentProps, CompositionContext, SlotDefinition } from '@uniformdev/canvas-next-rsc-shared';
|
|
2
2
|
export { ComponentProps, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
import React__default, { PropsWithChildren, ReactNode, Key } from 'react';
|
|
4
|
-
export { R as ResolveComponentFunction,
|
|
4
|
+
export { R as ResolveComponentFunction, a as ResolveComponentResult } from './UniformComposition-B8budr-b.js';
|
|
5
5
|
import { ComponentInstance } from '@uniformdev/canvas';
|
|
6
6
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
7
7
|
import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
|
|
8
8
|
export { ClientContextComponent, createClientUniformContext, useInitUniformContext, useUniformContext } from '@uniformdev/canvas-next-rsc-client';
|
|
9
9
|
|
|
10
|
-
declare const DefaultNotImplementedComponent: ({ component }: ComponentProps) => React__default.JSX.Element;
|
|
10
|
+
declare const DefaultNotImplementedComponent: ({ component }: ComponentProps) => React__default.JSX.Element | null;
|
|
11
11
|
|
|
12
12
|
type RichTextComponentProps<TNode extends RichTextNode = RichTextNode> = {
|
|
13
13
|
node: TNode;
|
|
@@ -71,7 +71,7 @@ declare const UniformRichText: React__default.ForwardRefExoticComponent<{
|
|
|
71
71
|
placeholder?: string | ((parameter: {
|
|
72
72
|
id: string;
|
|
73
73
|
}) => string | undefined);
|
|
74
|
-
} & Omit<React__default.HTMLAttributes<HTMLDivElement>, "
|
|
74
|
+
} & Omit<React__default.HTMLAttributes<HTMLDivElement>, "children" | "placeholder"> & React__default.RefAttributes<unknown>>;
|
|
75
75
|
|
|
76
76
|
type UniformRichTextNodeProps = {
|
|
77
77
|
node: RichTextNode;
|
package/dist/component.js
CHANGED
|
@@ -43,8 +43,78 @@ module.exports = __toCommonJS(component_exports);
|
|
|
43
43
|
|
|
44
44
|
// src/components/DefaultNotImplementedComponent.tsx
|
|
45
45
|
var import_react = __toESM(require("react"));
|
|
46
|
+
var wrapperStyles = {
|
|
47
|
+
display: "flex",
|
|
48
|
+
flexDirection: "column",
|
|
49
|
+
gap: "0.5rem",
|
|
50
|
+
borderLeft: "4px solid #e42535",
|
|
51
|
+
padding: "16px",
|
|
52
|
+
fontSize: "16px",
|
|
53
|
+
borderRadius: "0 8px 8px 0",
|
|
54
|
+
margin: "8px",
|
|
55
|
+
backgroundColor: "rgba(255, 255, 255, 0.45)",
|
|
56
|
+
color: "#1d3557"
|
|
57
|
+
};
|
|
46
58
|
var DefaultNotImplementedComponent = ({ component }) => {
|
|
47
|
-
|
|
59
|
+
var _a, _b;
|
|
60
|
+
const componentType = component == null ? void 0 : component.type;
|
|
61
|
+
if (!componentType) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const proposedFileName = `${componentType[0].toUpperCase()}${componentType.substring(1)}`;
|
|
65
|
+
const probableProps = Object.keys((_a = component.parameters) != null ? _a : {});
|
|
66
|
+
const probableSlots = Object.keys((_b = component.slots) != null ? _b : {});
|
|
67
|
+
const resolvedParameters = probableProps.map((prop) => {
|
|
68
|
+
var _a2;
|
|
69
|
+
const propType = (_a2 = component.parameters) == null ? void 0 : _a2[prop];
|
|
70
|
+
const propTypeValue = (propType == null ? void 0 : propType.type) === "text" ? "string" : "unknown";
|
|
71
|
+
return ` ${prop}: ${propTypeValue}`;
|
|
72
|
+
}).join("\n");
|
|
73
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ import_react.default.createElement("h2", { style: { fontSize: "1.2rem" } }, "Unknown Component"), /* @__PURE__ */ import_react.default.createElement("p", null, "Received request from Uniform to render a component with the public ID: ", /* @__PURE__ */ import_react.default.createElement("code", null, componentType), "."), /* @__PURE__ */ import_react.default.createElement("p", null, /* @__PURE__ */ import_react.default.createElement("code", null, "<UniformComposition />"), " does not have ", /* @__PURE__ */ import_react.default.createElement("code", null, componentType), " mapped to a React component yet."), /* @__PURE__ */ import_react.default.createElement(
|
|
74
|
+
"ul",
|
|
75
|
+
{
|
|
76
|
+
style: {
|
|
77
|
+
listStyleType: "disc",
|
|
78
|
+
marginLeft: "1rem",
|
|
79
|
+
display: "flex",
|
|
80
|
+
flexDirection: "column",
|
|
81
|
+
gap: "0.5rem"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
/* @__PURE__ */ import_react.default.createElement("li", null, "Create a React component and register it with Uniform, for example", /* @__PURE__ */ import_react.default.createElement("pre", null, `
|
|
85
|
+
import {
|
|
86
|
+
ComponentProps,
|
|
87
|
+
UniformSlot,
|
|
88
|
+
} from '@uniformdev/canvas-next-rsc/component';
|
|
89
|
+
|
|
90
|
+
type ${proposedFileName}Parameters = {
|
|
91
|
+
${resolvedParameters}
|
|
92
|
+
};
|
|
93
|
+
type ${proposedFileName}Slots = ${probableSlots.map((slot) => `'${slot}'`).join(" | ")};
|
|
94
|
+
type ${proposedFileName}Props = ComponentProps<${proposedFileName}Parameters, ${proposedFileName}Slots>;
|
|
95
|
+
|
|
96
|
+
export const ${proposedFileName}Component = (props: ${proposedFileName}Props) => {
|
|
97
|
+
return (
|
|
98
|
+
<div>
|
|
99
|
+
<div>
|
|
100
|
+
${probableSlots.map((slot) => `<UniformSlot data={props.component} context={props.context} slot={props.slots.${slot}} />`).join("\n")}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
Add this component mapping to your resolveComponent function on UniformComposition.`)),
|
|
107
|
+
/* @__PURE__ */ import_react.default.createElement("li", null, "Import the component into the file where ", /* @__PURE__ */ import_react.default.createElement("code", null, "<UniformComposition />"), " is defined, for example ", /* @__PURE__ */ import_react.default.createElement("pre", null, `import "../../components/${proposedFileName}.tsx"`))
|
|
108
|
+
), " ", /* @__PURE__ */ import_react.default.createElement("p", null, "Need more help?", " ", /* @__PURE__ */ import_react.default.createElement(
|
|
109
|
+
"a",
|
|
110
|
+
{
|
|
111
|
+
href: "https://docs.uniform.app/docs/learn/tutorials/nextjs-app-router",
|
|
112
|
+
target: "_blank",
|
|
113
|
+
rel: "noreferrer",
|
|
114
|
+
style: { textDecoration: "underline" }
|
|
115
|
+
},
|
|
116
|
+
"Check out the documentation."
|
|
117
|
+
)));
|
|
48
118
|
};
|
|
49
119
|
|
|
50
120
|
// src/components/UniformRichText.tsx
|
|
@@ -64,10 +134,16 @@ var AssetRichTextNode = ({ node }) => {
|
|
|
64
134
|
if (__asset === void 0) {
|
|
65
135
|
return null;
|
|
66
136
|
}
|
|
67
|
-
if (__asset.type
|
|
68
|
-
return null;
|
|
137
|
+
if (__asset.type === "image") {
|
|
138
|
+
return /* @__PURE__ */ import_react2.default.createElement("figure", null, /* @__PURE__ */ import_react2.default.createElement("img", { src: __asset.fields.url.value, alt: (_a = __asset.fields.title) == null ? void 0 : _a.value }), ((_b = __asset.fields.description) == null ? void 0 : _b.value) ? /* @__PURE__ */ import_react2.default.createElement("figcaption", null, __asset.fields.description.value) : null);
|
|
139
|
+
}
|
|
140
|
+
if (__asset.type === "video") {
|
|
141
|
+
return /* @__PURE__ */ import_react2.default.createElement("video", { src: __asset.fields.url.value, controls: true });
|
|
142
|
+
}
|
|
143
|
+
if (__asset.type === "audio") {
|
|
144
|
+
return /* @__PURE__ */ import_react2.default.createElement("audio", { src: __asset.fields.url.value, controls: true });
|
|
69
145
|
}
|
|
70
|
-
return
|
|
146
|
+
return null;
|
|
71
147
|
};
|
|
72
148
|
|
|
73
149
|
// src/components/nodes/HeadingRichTextNode.tsx
|
package/dist/component.mjs
CHANGED
|
@@ -1,7 +1,77 @@
|
|
|
1
1
|
// src/components/DefaultNotImplementedComponent.tsx
|
|
2
2
|
import React from "react";
|
|
3
|
+
var wrapperStyles = {
|
|
4
|
+
display: "flex",
|
|
5
|
+
flexDirection: "column",
|
|
6
|
+
gap: "0.5rem",
|
|
7
|
+
borderLeft: "4px solid #e42535",
|
|
8
|
+
padding: "16px",
|
|
9
|
+
fontSize: "16px",
|
|
10
|
+
borderRadius: "0 8px 8px 0",
|
|
11
|
+
margin: "8px",
|
|
12
|
+
backgroundColor: "rgba(255, 255, 255, 0.45)",
|
|
13
|
+
color: "#1d3557"
|
|
14
|
+
};
|
|
3
15
|
var DefaultNotImplementedComponent = ({ component }) => {
|
|
4
|
-
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const componentType = component == null ? void 0 : component.type;
|
|
18
|
+
if (!componentType) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const proposedFileName = `${componentType[0].toUpperCase()}${componentType.substring(1)}`;
|
|
22
|
+
const probableProps = Object.keys((_a = component.parameters) != null ? _a : {});
|
|
23
|
+
const probableSlots = Object.keys((_b = component.slots) != null ? _b : {});
|
|
24
|
+
const resolvedParameters = probableProps.map((prop) => {
|
|
25
|
+
var _a2;
|
|
26
|
+
const propType = (_a2 = component.parameters) == null ? void 0 : _a2[prop];
|
|
27
|
+
const propTypeValue = (propType == null ? void 0 : propType.type) === "text" ? "string" : "unknown";
|
|
28
|
+
return ` ${prop}: ${propTypeValue}`;
|
|
29
|
+
}).join("\n");
|
|
30
|
+
return /* @__PURE__ */ React.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ React.createElement("h2", { style: { fontSize: "1.2rem" } }, "Unknown Component"), /* @__PURE__ */ React.createElement("p", null, "Received request from Uniform to render a component with the public ID: ", /* @__PURE__ */ React.createElement("code", null, componentType), "."), /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement("code", null, "<UniformComposition />"), " does not have ", /* @__PURE__ */ React.createElement("code", null, componentType), " mapped to a React component yet."), /* @__PURE__ */ React.createElement(
|
|
31
|
+
"ul",
|
|
32
|
+
{
|
|
33
|
+
style: {
|
|
34
|
+
listStyleType: "disc",
|
|
35
|
+
marginLeft: "1rem",
|
|
36
|
+
display: "flex",
|
|
37
|
+
flexDirection: "column",
|
|
38
|
+
gap: "0.5rem"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
/* @__PURE__ */ React.createElement("li", null, "Create a React component and register it with Uniform, for example", /* @__PURE__ */ React.createElement("pre", null, `
|
|
42
|
+
import {
|
|
43
|
+
ComponentProps,
|
|
44
|
+
UniformSlot,
|
|
45
|
+
} from '@uniformdev/canvas-next-rsc/component';
|
|
46
|
+
|
|
47
|
+
type ${proposedFileName}Parameters = {
|
|
48
|
+
${resolvedParameters}
|
|
49
|
+
};
|
|
50
|
+
type ${proposedFileName}Slots = ${probableSlots.map((slot) => `'${slot}'`).join(" | ")};
|
|
51
|
+
type ${proposedFileName}Props = ComponentProps<${proposedFileName}Parameters, ${proposedFileName}Slots>;
|
|
52
|
+
|
|
53
|
+
export const ${proposedFileName}Component = (props: ${proposedFileName}Props) => {
|
|
54
|
+
return (
|
|
55
|
+
<div>
|
|
56
|
+
<div>
|
|
57
|
+
${probableSlots.map((slot) => `<UniformSlot data={props.component} context={props.context} slot={props.slots.${slot}} />`).join("\n")}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
Add this component mapping to your resolveComponent function on UniformComposition.`)),
|
|
64
|
+
/* @__PURE__ */ React.createElement("li", null, "Import the component into the file where ", /* @__PURE__ */ React.createElement("code", null, "<UniformComposition />"), " is defined, for example ", /* @__PURE__ */ React.createElement("pre", null, `import "../../components/${proposedFileName}.tsx"`))
|
|
65
|
+
), " ", /* @__PURE__ */ React.createElement("p", null, "Need more help?", " ", /* @__PURE__ */ React.createElement(
|
|
66
|
+
"a",
|
|
67
|
+
{
|
|
68
|
+
href: "https://docs.uniform.app/docs/learn/tutorials/nextjs-app-router",
|
|
69
|
+
target: "_blank",
|
|
70
|
+
rel: "noreferrer",
|
|
71
|
+
style: { textDecoration: "underline" }
|
|
72
|
+
},
|
|
73
|
+
"Check out the documentation."
|
|
74
|
+
)));
|
|
5
75
|
};
|
|
6
76
|
|
|
7
77
|
// src/components/UniformRichText.tsx
|
|
@@ -25,10 +95,16 @@ var AssetRichTextNode = ({ node }) => {
|
|
|
25
95
|
if (__asset === void 0) {
|
|
26
96
|
return null;
|
|
27
97
|
}
|
|
28
|
-
if (__asset.type
|
|
29
|
-
return null;
|
|
98
|
+
if (__asset.type === "image") {
|
|
99
|
+
return /* @__PURE__ */ React2.createElement("figure", null, /* @__PURE__ */ React2.createElement("img", { src: __asset.fields.url.value, alt: (_a = __asset.fields.title) == null ? void 0 : _a.value }), ((_b = __asset.fields.description) == null ? void 0 : _b.value) ? /* @__PURE__ */ React2.createElement("figcaption", null, __asset.fields.description.value) : null);
|
|
100
|
+
}
|
|
101
|
+
if (__asset.type === "video") {
|
|
102
|
+
return /* @__PURE__ */ React2.createElement("video", { src: __asset.fields.url.value, controls: true });
|
|
103
|
+
}
|
|
104
|
+
if (__asset.type === "audio") {
|
|
105
|
+
return /* @__PURE__ */ React2.createElement("audio", { src: __asset.fields.url.value, controls: true });
|
|
30
106
|
}
|
|
31
|
-
return
|
|
107
|
+
return null;
|
|
32
108
|
};
|
|
33
109
|
|
|
34
110
|
// src/components/nodes/HeadingRichTextNode.tsx
|
package/dist/handler.js
CHANGED
|
@@ -84,13 +84,14 @@ var createPreviewGETRouteHandler = (options) => {
|
|
|
84
84
|
pathToRedirectTo = options.playgroundPath;
|
|
85
85
|
}
|
|
86
86
|
const id = getQueryParam(request, compositionQueryParam.id);
|
|
87
|
-
const slug = getQueryParam(request, compositionQueryParam.slug);
|
|
88
87
|
const path = getQueryParam(request, compositionQueryParam.path);
|
|
88
|
+
const slug = getQueryParam(request, compositionQueryParam.slug);
|
|
89
89
|
const locale = getQueryParam(request, compositionQueryParam.locale);
|
|
90
90
|
const disable = getQueryParam(request, "disable");
|
|
91
91
|
const secret = getQueryParam(request, import_canvas.SECRET_QUERY_STRING_PARAM);
|
|
92
92
|
const referer = request.headers.get("referer");
|
|
93
93
|
const isUniformContextualEditing = getQueryParam(request, import_canvas.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM) === "true" && (0, import_canvas.isAllowedReferrer)(referer || void 0);
|
|
94
|
+
const releaseId = getQueryParam(request, "releaseId");
|
|
94
95
|
if (typeof pathToRedirectTo === "undefined") {
|
|
95
96
|
const resolveFullPath = (options == null ? void 0 : options.resolveFullPath) || resolveFullPathDefault;
|
|
96
97
|
pathToRedirectTo = resolveFullPath({ id, slug, path, locale });
|
|
@@ -110,9 +111,12 @@ var createPreviewGETRouteHandler = (options) => {
|
|
|
110
111
|
(0, import_headers.draftMode)().enable();
|
|
111
112
|
const redirectionUrl = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
|
|
112
113
|
assignRequestQueryToSearchParams(redirectionUrl.searchParams, searchParams);
|
|
113
|
-
if (isPlayground) {
|
|
114
|
+
if (isPlayground || (options == null ? void 0 : options.playgroundPath) && pathToRedirectTo === options.playgroundPath) {
|
|
114
115
|
redirectionUrl.searchParams.set("id", searchParams.get("id") || "");
|
|
115
116
|
}
|
|
117
|
+
if (releaseId) {
|
|
118
|
+
redirectionUrl.searchParams.set("releaseId", releaseId);
|
|
119
|
+
}
|
|
116
120
|
if (!isUniformContextualEditing) {
|
|
117
121
|
contextualEditingQueryParams.forEach((param) => {
|
|
118
122
|
redirectionUrl.searchParams.delete(param);
|
|
@@ -363,7 +367,7 @@ var isSvixMessage = async (request) => {
|
|
|
363
367
|
const wh = new import_svix.Webhook(process.env.UNIFORM_WEBHOOK_SECRET);
|
|
364
368
|
try {
|
|
365
369
|
wh.verify(payload, headers);
|
|
366
|
-
} catch (
|
|
370
|
+
} catch (e) {
|
|
367
371
|
return {
|
|
368
372
|
looksLikeMessage: true,
|
|
369
373
|
validation: false
|
package/dist/handler.mjs
CHANGED
|
@@ -51,13 +51,14 @@ var createPreviewGETRouteHandler = (options) => {
|
|
|
51
51
|
pathToRedirectTo = options.playgroundPath;
|
|
52
52
|
}
|
|
53
53
|
const id = getQueryParam(request, compositionQueryParam.id);
|
|
54
|
-
const slug = getQueryParam(request, compositionQueryParam.slug);
|
|
55
54
|
const path = getQueryParam(request, compositionQueryParam.path);
|
|
55
|
+
const slug = getQueryParam(request, compositionQueryParam.slug);
|
|
56
56
|
const locale = getQueryParam(request, compositionQueryParam.locale);
|
|
57
57
|
const disable = getQueryParam(request, "disable");
|
|
58
58
|
const secret = getQueryParam(request, SECRET_QUERY_STRING_PARAM);
|
|
59
59
|
const referer = request.headers.get("referer");
|
|
60
60
|
const isUniformContextualEditing = getQueryParam(request, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM) === "true" && isAllowedReferrer(referer || void 0);
|
|
61
|
+
const releaseId = getQueryParam(request, "releaseId");
|
|
61
62
|
if (typeof pathToRedirectTo === "undefined") {
|
|
62
63
|
const resolveFullPath = (options == null ? void 0 : options.resolveFullPath) || resolveFullPathDefault;
|
|
63
64
|
pathToRedirectTo = resolveFullPath({ id, slug, path, locale });
|
|
@@ -77,9 +78,12 @@ var createPreviewGETRouteHandler = (options) => {
|
|
|
77
78
|
draftMode().enable();
|
|
78
79
|
const redirectionUrl = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
|
|
79
80
|
assignRequestQueryToSearchParams(redirectionUrl.searchParams, searchParams);
|
|
80
|
-
if (isPlayground) {
|
|
81
|
+
if (isPlayground || (options == null ? void 0 : options.playgroundPath) && pathToRedirectTo === options.playgroundPath) {
|
|
81
82
|
redirectionUrl.searchParams.set("id", searchParams.get("id") || "");
|
|
82
83
|
}
|
|
84
|
+
if (releaseId) {
|
|
85
|
+
redirectionUrl.searchParams.set("releaseId", releaseId);
|
|
86
|
+
}
|
|
83
87
|
if (!isUniformContextualEditing) {
|
|
84
88
|
contextualEditingQueryParams.forEach((param) => {
|
|
85
89
|
redirectionUrl.searchParams.delete(param);
|
|
@@ -330,7 +334,7 @@ var isSvixMessage = async (request) => {
|
|
|
330
334
|
const wh = new Webhook(process.env.UNIFORM_WEBHOOK_SECRET);
|
|
331
335
|
try {
|
|
332
336
|
wh.verify(payload, headers);
|
|
333
|
-
} catch (
|
|
337
|
+
} catch (e) {
|
|
334
338
|
return {
|
|
335
339
|
looksLikeMessage: true,
|
|
336
340
|
validation: false
|
package/dist/index.d.mts
CHANGED
|
@@ -5,8 +5,8 @@ import { ManifestClient } from '@uniformdev/context/api';
|
|
|
5
5
|
import { ProjectMapClient, ProjectMapNode } from '@uniformdev/project-map';
|
|
6
6
|
import { ContextState, ContextOptions } from '@uniformdev/context';
|
|
7
7
|
import React__default, { PropsWithChildren } from 'react';
|
|
8
|
-
import { U as UniformCompositionProps } from './UniformComposition-
|
|
9
|
-
export {
|
|
8
|
+
import { U as UniformCompositionProps } from './UniformComposition-B8budr-b.mjs';
|
|
9
|
+
export { b as UniformComposition, r as resolveComposition } from './UniformComposition-B8budr-b.mjs';
|
|
10
10
|
import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
|
|
11
11
|
|
|
12
12
|
type GetCanvasClientOptions = {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { ManifestClient } from '@uniformdev/context/api';
|
|
|
5
5
|
import { ProjectMapClient, ProjectMapNode } from '@uniformdev/project-map';
|
|
6
6
|
import { ContextState, ContextOptions } from '@uniformdev/context';
|
|
7
7
|
import React__default, { PropsWithChildren } from 'react';
|
|
8
|
-
import { U as UniformCompositionProps } from './UniformComposition-
|
|
9
|
-
export {
|
|
8
|
+
import { U as UniformCompositionProps } from './UniformComposition-B8budr-b.js';
|
|
9
|
+
export { b as UniformComposition, r as resolveComposition } from './UniformComposition-B8budr-b.js';
|
|
10
10
|
import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
|
|
11
11
|
|
|
12
12
|
type GetCanvasClientOptions = {
|
package/dist/index.esm.js
CHANGED
|
@@ -441,7 +441,10 @@ import { createElement as createElement3, Fragment as Fragment3, Suspense } from
|
|
|
441
441
|
import {
|
|
442
442
|
createUniformContext
|
|
443
443
|
} from "@uniformdev/canvas-next-rsc-shared";
|
|
444
|
-
import {
|
|
444
|
+
import {
|
|
445
|
+
UNIFORM_DEFAULT_COOKIE_NAME,
|
|
446
|
+
UNIFORM_DEFAULT_QUIRK_COOKIE_NAME
|
|
447
|
+
} from "@uniformdev/context";
|
|
445
448
|
import { cookies } from "next/headers";
|
|
446
449
|
var createServerUniformContext = async (options) => {
|
|
447
450
|
const manifest = await getManifest(options);
|
|
@@ -452,10 +455,13 @@ var createServerUniformContext = async (options) => {
|
|
|
452
455
|
return context;
|
|
453
456
|
};
|
|
454
457
|
var createServerUniformContextFromManifest = async (options) => {
|
|
455
|
-
var _a;
|
|
458
|
+
var _a, _b, _c;
|
|
459
|
+
const quirksEnabled = (_a = getServerConfig().experimental) == null ? void 0 : _a.quirkSerialization;
|
|
456
460
|
const context = createUniformContext({
|
|
457
461
|
...options || {},
|
|
458
|
-
serverCookieValue: (
|
|
462
|
+
serverCookieValue: (_b = cookies().get(UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _b.value,
|
|
463
|
+
experimental_quirksEnabled: quirksEnabled,
|
|
464
|
+
quirkCookieValue: quirksEnabled ? (_c = cookies().get(UNIFORM_DEFAULT_QUIRK_COOKIE_NAME)) == null ? void 0 : _c.value : void 0
|
|
459
465
|
});
|
|
460
466
|
return context;
|
|
461
467
|
};
|
|
@@ -533,12 +539,17 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
|
|
|
533
539
|
let result;
|
|
534
540
|
for (let i = 0; i < states.length; i++) {
|
|
535
541
|
const state = states[i];
|
|
542
|
+
const releaseId = determineReleaseId({
|
|
543
|
+
searchParams,
|
|
544
|
+
state
|
|
545
|
+
});
|
|
536
546
|
try {
|
|
537
547
|
result = await retrieveRouteByPath({
|
|
538
548
|
path: value,
|
|
539
549
|
state,
|
|
540
550
|
searchParams,
|
|
541
|
-
fetchOptions
|
|
551
|
+
fetchOptions,
|
|
552
|
+
releaseId
|
|
542
553
|
});
|
|
543
554
|
} catch (e) {
|
|
544
555
|
console.warn(`Failed to retrieve route by path: ${value} with state ${state}`, e);
|
|
@@ -555,7 +566,8 @@ var retrieveRouteByPath = async ({
|
|
|
555
566
|
path,
|
|
556
567
|
state,
|
|
557
568
|
searchParams,
|
|
558
|
-
fetchOptions
|
|
569
|
+
fetchOptions,
|
|
570
|
+
releaseId
|
|
559
571
|
}) => {
|
|
560
572
|
var _a;
|
|
561
573
|
const client = getDefaultRouteClient({
|
|
@@ -580,7 +592,8 @@ var retrieveRouteByPath = async ({
|
|
|
580
592
|
state,
|
|
581
593
|
dataSourceVariant: getDataSourceVariantFromRouteGetParams(fetchOptions != null ? fetchOptions : {}, state),
|
|
582
594
|
withComponentIDs: true,
|
|
583
|
-
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing)
|
|
595
|
+
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
|
|
596
|
+
releaseId
|
|
584
597
|
});
|
|
585
598
|
};
|
|
586
599
|
var resolveRedirectHref = (resolveResult, path) => {
|
|
@@ -604,6 +617,16 @@ var determineState = ({ searchParams }) => {
|
|
|
604
617
|
}
|
|
605
618
|
return states;
|
|
606
619
|
};
|
|
620
|
+
var determineReleaseId = ({
|
|
621
|
+
searchParams,
|
|
622
|
+
state
|
|
623
|
+
}) => {
|
|
624
|
+
const draftMode2 = isDraftModeEnabled({ searchParams });
|
|
625
|
+
if (!draftMode2 || state === CANVAS_PUBLISHED_STATE) {
|
|
626
|
+
return void 0;
|
|
627
|
+
}
|
|
628
|
+
return searchParams == null ? void 0 : searchParams.releaseId;
|
|
629
|
+
};
|
|
607
630
|
|
|
608
631
|
// src/components/ContextUpdateTrigger.tsx
|
|
609
632
|
import { ClientContextUpdate } from "@uniformdev/canvas-next-rsc-client";
|
|
@@ -656,6 +679,24 @@ var PersonalizeServer = (props) => {
|
|
|
656
679
|
return createElement(Fragment, void 0, [...components, eventElement]);
|
|
657
680
|
};
|
|
658
681
|
|
|
682
|
+
// src/components/PersonalizeServerHybrid.tsx
|
|
683
|
+
import { PersonalizeClient as PersonalizeClient2 } from "@uniformdev/canvas-next-rsc-client";
|
|
684
|
+
import { runPersonalization as runPersonalization3 } from "@uniformdev/canvas-next-rsc-shared";
|
|
685
|
+
import React5 from "react";
|
|
686
|
+
var PersonalizeServerHybrid = (props) => {
|
|
687
|
+
const { indexes } = runPersonalization3(props);
|
|
688
|
+
return /* @__PURE__ */ React5.createElement(
|
|
689
|
+
PersonalizeClient2,
|
|
690
|
+
{
|
|
691
|
+
component: props.component,
|
|
692
|
+
count: props.count,
|
|
693
|
+
slots: props.slots,
|
|
694
|
+
trackingEventName: props.trackingEventName,
|
|
695
|
+
indexes
|
|
696
|
+
}
|
|
697
|
+
);
|
|
698
|
+
};
|
|
699
|
+
|
|
659
700
|
// src/components/TestServer.ts
|
|
660
701
|
import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
|
|
661
702
|
import {
|
|
@@ -666,9 +707,9 @@ import { createElement as createElement2, Fragment as Fragment2 } from "react";
|
|
|
666
707
|
|
|
667
708
|
// src/components/ContextTestTransfer.tsx
|
|
668
709
|
import { ClientContextTestTransfer } from "@uniformdev/canvas-next-rsc-client";
|
|
669
|
-
import
|
|
710
|
+
import React6 from "react";
|
|
670
711
|
var ContextTestTransfer = ({ event }) => {
|
|
671
|
-
return /* @__PURE__ */
|
|
712
|
+
return /* @__PURE__ */ React6.createElement(ClientContextTestTransfer, { ts: (/* @__PURE__ */ new Date()).valueOf(), event });
|
|
672
713
|
};
|
|
673
714
|
|
|
674
715
|
// src/components/TestServer.ts
|
|
@@ -695,7 +736,7 @@ import {
|
|
|
695
736
|
evaluateNodeVisibilityParameter
|
|
696
737
|
} from "@uniformdev/canvas";
|
|
697
738
|
import { VisibilityRulesWrapperClient } from "@uniformdev/canvas-next-rsc-client";
|
|
698
|
-
import
|
|
739
|
+
import React7 from "react";
|
|
699
740
|
var VisibilityRulesWrapper = (props) => {
|
|
700
741
|
const { context, ...rest } = props;
|
|
701
742
|
let isVisible = null;
|
|
@@ -706,7 +747,7 @@ var VisibilityRulesWrapper = (props) => {
|
|
|
706
747
|
parameter: props.parameter
|
|
707
748
|
});
|
|
708
749
|
}
|
|
709
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ React7.createElement(VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
|
|
710
751
|
};
|
|
711
752
|
|
|
712
753
|
// src/components/UniformComposition.ts
|
|
@@ -819,7 +860,7 @@ var resolveSystemComponent = ({
|
|
|
819
860
|
let resolved = null;
|
|
820
861
|
let suspense = void 0;
|
|
821
862
|
if (component.type === CANVAS_PERSONALIZE_TYPE) {
|
|
822
|
-
resolved = server ?
|
|
863
|
+
resolved = server ? resolveServerPersonalizeComponent({ config }) : PersonalizeClientWrapper;
|
|
823
864
|
suspense = server && ((_a = config.ppr) == null ? void 0 : _a.personalizationSuspense);
|
|
824
865
|
}
|
|
825
866
|
if (component.type === CANVAS_TEST_TYPE) {
|
|
@@ -831,6 +872,10 @@ var resolveSystemComponent = ({
|
|
|
831
872
|
suspense
|
|
832
873
|
};
|
|
833
874
|
};
|
|
875
|
+
var resolveServerPersonalizeComponent = ({ config }) => {
|
|
876
|
+
var _a;
|
|
877
|
+
return ((_a = config.evaluation) == null ? void 0 : _a.personalization) === "hybrid" ? PersonalizeServerHybrid : PersonalizeServer;
|
|
878
|
+
};
|
|
834
879
|
var resolveSlots = ({
|
|
835
880
|
component,
|
|
836
881
|
root,
|
|
@@ -1046,12 +1091,12 @@ import {
|
|
|
1046
1091
|
UniformScript
|
|
1047
1092
|
} from "@uniformdev/canvas-next-rsc-client";
|
|
1048
1093
|
import { Suspense as Suspense2 } from "react";
|
|
1049
|
-
import
|
|
1094
|
+
import React8 from "react";
|
|
1050
1095
|
var UniformContext = async ({
|
|
1051
1096
|
clientContextComponent,
|
|
1052
1097
|
children
|
|
1053
1098
|
}) => {
|
|
1054
|
-
var _a;
|
|
1099
|
+
var _a, _b;
|
|
1055
1100
|
const manifest = await getManifest({
|
|
1056
1101
|
searchParams: {}
|
|
1057
1102
|
});
|
|
@@ -1059,23 +1104,25 @@ var UniformContext = async ({
|
|
|
1059
1104
|
const serverConfig2 = getServerConfig();
|
|
1060
1105
|
const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
|
|
1061
1106
|
const defaultConsent = serverConfig2.defaultConsent || false;
|
|
1062
|
-
|
|
1107
|
+
const experimentalQuirkSerialization = ((_b = serverConfig2.experimental) == null ? void 0 : _b.quirkSerialization) || false;
|
|
1108
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, children, /* @__PURE__ */ React8.createElement(
|
|
1063
1109
|
ContextComponent,
|
|
1064
1110
|
{
|
|
1065
1111
|
manifest,
|
|
1066
1112
|
disableDevTools,
|
|
1067
|
-
defaultConsent
|
|
1113
|
+
defaultConsent,
|
|
1114
|
+
experimentalQuirkSerialization
|
|
1068
1115
|
}
|
|
1069
|
-
), /* @__PURE__ */
|
|
1116
|
+
), /* @__PURE__ */ React8.createElement(Suspense2, { fallback: /* @__PURE__ */ React8.createElement(React8.Fragment, null) }, /* @__PURE__ */ React8.createElement(UniformScript, null)));
|
|
1070
1117
|
};
|
|
1071
1118
|
|
|
1072
1119
|
// src/components/UniformPlayground.tsx
|
|
1073
1120
|
import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, CANVAS_EDITOR_STATE as CANVAS_EDITOR_STATE3 } from "@uniformdev/canvas";
|
|
1074
1121
|
import { notFound as notFound2 } from "next/navigation";
|
|
1075
|
-
import
|
|
1122
|
+
import React9 from "react";
|
|
1076
1123
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1077
1124
|
if (!isDraftModeEnabled({ searchParams })) {
|
|
1078
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1079
1126
|
}
|
|
1080
1127
|
const id = searchParams["id"];
|
|
1081
1128
|
if (!id) {
|
|
@@ -1106,7 +1153,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1106
1153
|
if (!composition) {
|
|
1107
1154
|
notFound2();
|
|
1108
1155
|
}
|
|
1109
|
-
return /* @__PURE__ */
|
|
1156
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1110
1157
|
UniformComposition,
|
|
1111
1158
|
{
|
|
1112
1159
|
mode: "server",
|
package/dist/index.js
CHANGED
|
@@ -472,12 +472,12 @@ async function generateStaticParams() {
|
|
|
472
472
|
|
|
473
473
|
// src/components/UniformComposition.ts
|
|
474
474
|
var import_canvas8 = require("@uniformdev/canvas");
|
|
475
|
-
var
|
|
476
|
-
var
|
|
475
|
+
var import_canvas_next_rsc_client8 = require("@uniformdev/canvas-next-rsc-client");
|
|
476
|
+
var import_canvas_next_rsc_shared7 = require("@uniformdev/canvas-next-rsc-shared");
|
|
477
477
|
var import_core = require("@uniformdev/canvas-react/core");
|
|
478
478
|
var import_headers3 = require("next/headers");
|
|
479
479
|
var import_navigation = require("next/navigation");
|
|
480
|
-
var
|
|
480
|
+
var import_react10 = require("react");
|
|
481
481
|
|
|
482
482
|
// src/context/createServerUniformContext.ts
|
|
483
483
|
var import_canvas_next_rsc_shared = require("@uniformdev/canvas-next-rsc-shared");
|
|
@@ -492,10 +492,13 @@ var createServerUniformContext = async (options) => {
|
|
|
492
492
|
return context;
|
|
493
493
|
};
|
|
494
494
|
var createServerUniformContextFromManifest = async (options) => {
|
|
495
|
-
var _a;
|
|
495
|
+
var _a, _b, _c;
|
|
496
|
+
const quirksEnabled = (_a = getServerConfig().experimental) == null ? void 0 : _a.quirkSerialization;
|
|
496
497
|
const context = (0, import_canvas_next_rsc_shared.createUniformContext)({
|
|
497
498
|
...options || {},
|
|
498
|
-
serverCookieValue: (
|
|
499
|
+
serverCookieValue: (_b = (0, import_headers2.cookies)().get(import_context.UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _b.value,
|
|
500
|
+
experimental_quirksEnabled: quirksEnabled,
|
|
501
|
+
quirkCookieValue: quirksEnabled ? (_c = (0, import_headers2.cookies)().get(import_context.UNIFORM_DEFAULT_QUIRK_COOKIE_NAME)) == null ? void 0 : _c.value : void 0
|
|
499
502
|
});
|
|
500
503
|
return context;
|
|
501
504
|
};
|
|
@@ -568,12 +571,17 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
|
|
|
568
571
|
let result;
|
|
569
572
|
for (let i = 0; i < states.length; i++) {
|
|
570
573
|
const state = states[i];
|
|
574
|
+
const releaseId = determineReleaseId({
|
|
575
|
+
searchParams,
|
|
576
|
+
state
|
|
577
|
+
});
|
|
571
578
|
try {
|
|
572
579
|
result = await retrieveRouteByPath({
|
|
573
580
|
path: value,
|
|
574
581
|
state,
|
|
575
582
|
searchParams,
|
|
576
|
-
fetchOptions
|
|
583
|
+
fetchOptions,
|
|
584
|
+
releaseId
|
|
577
585
|
});
|
|
578
586
|
} catch (e) {
|
|
579
587
|
console.warn(`Failed to retrieve route by path: ${value} with state ${state}`, e);
|
|
@@ -590,7 +598,8 @@ var retrieveRouteByPath = async ({
|
|
|
590
598
|
path,
|
|
591
599
|
state,
|
|
592
600
|
searchParams,
|
|
593
|
-
fetchOptions
|
|
601
|
+
fetchOptions,
|
|
602
|
+
releaseId
|
|
594
603
|
}) => {
|
|
595
604
|
var _a;
|
|
596
605
|
const client = getDefaultRouteClient({
|
|
@@ -615,7 +624,8 @@ var retrieveRouteByPath = async ({
|
|
|
615
624
|
state,
|
|
616
625
|
dataSourceVariant: (0, import_canvas4.getDataSourceVariantFromRouteGetParams)(fetchOptions != null ? fetchOptions : {}, state),
|
|
617
626
|
withComponentIDs: true,
|
|
618
|
-
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing)
|
|
627
|
+
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
|
|
628
|
+
releaseId
|
|
619
629
|
});
|
|
620
630
|
};
|
|
621
631
|
var resolveRedirectHref = (resolveResult, path) => {
|
|
@@ -639,6 +649,16 @@ var determineState = ({ searchParams }) => {
|
|
|
639
649
|
}
|
|
640
650
|
return states;
|
|
641
651
|
};
|
|
652
|
+
var determineReleaseId = ({
|
|
653
|
+
searchParams,
|
|
654
|
+
state
|
|
655
|
+
}) => {
|
|
656
|
+
const draftMode2 = isDraftModeEnabled({ searchParams });
|
|
657
|
+
if (!draftMode2 || state === import_canvas4.CANVAS_PUBLISHED_STATE) {
|
|
658
|
+
return void 0;
|
|
659
|
+
}
|
|
660
|
+
return searchParams == null ? void 0 : searchParams.releaseId;
|
|
661
|
+
};
|
|
642
662
|
|
|
643
663
|
// src/components/ContextUpdateTrigger.tsx
|
|
644
664
|
var import_canvas_next_rsc_client2 = require("@uniformdev/canvas-next-rsc-client");
|
|
@@ -691,17 +711,35 @@ var PersonalizeServer = (props) => {
|
|
|
691
711
|
return (0, import_react5.createElement)(import_react5.Fragment, void 0, [...components, eventElement]);
|
|
692
712
|
};
|
|
693
713
|
|
|
714
|
+
// src/components/PersonalizeServerHybrid.tsx
|
|
715
|
+
var import_canvas_next_rsc_client5 = require("@uniformdev/canvas-next-rsc-client");
|
|
716
|
+
var import_canvas_next_rsc_shared5 = require("@uniformdev/canvas-next-rsc-shared");
|
|
717
|
+
var import_react6 = __toESM(require("react"));
|
|
718
|
+
var PersonalizeServerHybrid = (props) => {
|
|
719
|
+
const { indexes } = (0, import_canvas_next_rsc_shared5.runPersonalization)(props);
|
|
720
|
+
return /* @__PURE__ */ import_react6.default.createElement(
|
|
721
|
+
import_canvas_next_rsc_client5.PersonalizeClient,
|
|
722
|
+
{
|
|
723
|
+
component: props.component,
|
|
724
|
+
count: props.count,
|
|
725
|
+
slots: props.slots,
|
|
726
|
+
trackingEventName: props.trackingEventName,
|
|
727
|
+
indexes
|
|
728
|
+
}
|
|
729
|
+
);
|
|
730
|
+
};
|
|
731
|
+
|
|
694
732
|
// src/components/TestServer.ts
|
|
695
733
|
var import_canvas6 = require("@uniformdev/canvas");
|
|
696
|
-
var
|
|
734
|
+
var import_canvas_next_rsc_shared6 = require("@uniformdev/canvas-next-rsc-shared");
|
|
697
735
|
var import_cache2 = require("next/cache");
|
|
698
|
-
var
|
|
736
|
+
var import_react8 = require("react");
|
|
699
737
|
|
|
700
738
|
// src/components/ContextTestTransfer.tsx
|
|
701
|
-
var
|
|
702
|
-
var
|
|
739
|
+
var import_canvas_next_rsc_client6 = require("@uniformdev/canvas-next-rsc-client");
|
|
740
|
+
var import_react7 = __toESM(require("react"));
|
|
703
741
|
var ContextTestTransfer = ({ event }) => {
|
|
704
|
-
return /* @__PURE__ */
|
|
742
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_canvas_next_rsc_client6.ClientContextTestTransfer, { ts: (/* @__PURE__ */ new Date()).valueOf(), event });
|
|
705
743
|
};
|
|
706
744
|
|
|
707
745
|
// src/components/TestServer.ts
|
|
@@ -710,22 +748,22 @@ var TestServer = async (props) => {
|
|
|
710
748
|
if ((_a = getServerConfig().ppr) == null ? void 0 : _a.testSuspense) {
|
|
711
749
|
(0, import_cache2.unstable_noStore)();
|
|
712
750
|
}
|
|
713
|
-
const { index, event } = (0,
|
|
751
|
+
const { index, event } = (0, import_canvas_next_rsc_shared6.runTest)(props);
|
|
714
752
|
if (index === null || event === null) {
|
|
715
753
|
return null;
|
|
716
754
|
}
|
|
717
755
|
const component = typeof index === "number" ? (_d = (_c = (_b = props.slots) == null ? void 0 : _b[import_canvas6.CANVAS_TEST_SLOT]) == null ? void 0 : _c.items[index]) != null ? _d : null : null;
|
|
718
|
-
const eventElement = (0,
|
|
756
|
+
const eventElement = (0, import_react8.createElement)(ContextTestTransfer, {
|
|
719
757
|
event,
|
|
720
758
|
key: `${props.slotName}-${props.slotIndex}-server-transfer`
|
|
721
759
|
});
|
|
722
|
-
return (0,
|
|
760
|
+
return (0, import_react8.createElement)(import_react8.Fragment, void 0, [component, eventElement]);
|
|
723
761
|
};
|
|
724
762
|
|
|
725
763
|
// src/components/VisibilityRulesWrapper.tsx
|
|
726
764
|
var import_canvas7 = require("@uniformdev/canvas");
|
|
727
|
-
var
|
|
728
|
-
var
|
|
765
|
+
var import_canvas_next_rsc_client7 = require("@uniformdev/canvas-next-rsc-client");
|
|
766
|
+
var import_react9 = __toESM(require("react"));
|
|
729
767
|
var VisibilityRulesWrapper = (props) => {
|
|
730
768
|
const { context, ...rest } = props;
|
|
731
769
|
let isVisible = null;
|
|
@@ -736,7 +774,7 @@ var VisibilityRulesWrapper = (props) => {
|
|
|
736
774
|
parameter: props.parameter
|
|
737
775
|
});
|
|
738
776
|
}
|
|
739
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_canvas_next_rsc_client7.VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
|
|
740
778
|
};
|
|
741
779
|
|
|
742
780
|
// src/components/UniformComposition.ts
|
|
@@ -755,7 +793,7 @@ var UniformComposition = async ({
|
|
|
755
793
|
});
|
|
756
794
|
searchParams = props.searchParams;
|
|
757
795
|
}
|
|
758
|
-
const { value: path } = (0,
|
|
796
|
+
const { value: path } = (0, import_canvas_next_rsc_shared7.resolvePath)(props);
|
|
759
797
|
if (!route || route.type === "notFound") {
|
|
760
798
|
(0, import_navigation.notFound)();
|
|
761
799
|
}
|
|
@@ -802,7 +840,7 @@ var UniformComposition = async ({
|
|
|
802
840
|
if (props.mode === "server") {
|
|
803
841
|
const headersValue = (0, import_headers3.headers)();
|
|
804
842
|
const missingQuirkValue = "unknown";
|
|
805
|
-
transfer = (0,
|
|
843
|
+
transfer = (0, import_react10.createElement)(ContextUpdateTransfer, {
|
|
806
844
|
serverContext,
|
|
807
845
|
update: {
|
|
808
846
|
params: props.params,
|
|
@@ -822,11 +860,11 @@ var UniformComposition = async ({
|
|
|
822
860
|
}
|
|
823
861
|
});
|
|
824
862
|
} else if (props.mode === "static") {
|
|
825
|
-
transfer = (0,
|
|
863
|
+
transfer = (0, import_react10.createElement)(ContextUpdateTrigger, {
|
|
826
864
|
path
|
|
827
865
|
});
|
|
828
866
|
}
|
|
829
|
-
return (0,
|
|
867
|
+
return (0, import_react10.createElement)(import_react10.Fragment, void 0, transfer, resolved);
|
|
830
868
|
};
|
|
831
869
|
var isServerComponent = ({
|
|
832
870
|
component,
|
|
@@ -849,11 +887,11 @@ var resolveSystemComponent = ({
|
|
|
849
887
|
let resolved = null;
|
|
850
888
|
let suspense = void 0;
|
|
851
889
|
if (component.type === import_canvas8.CANVAS_PERSONALIZE_TYPE) {
|
|
852
|
-
resolved = server ?
|
|
890
|
+
resolved = server ? resolveServerPersonalizeComponent({ config }) : PersonalizeClientWrapper;
|
|
853
891
|
suspense = server && ((_a = config.ppr) == null ? void 0 : _a.personalizationSuspense);
|
|
854
892
|
}
|
|
855
893
|
if (component.type === import_canvas8.CANVAS_TEST_TYPE) {
|
|
856
|
-
resolved = server ? TestServer :
|
|
894
|
+
resolved = server ? TestServer : import_canvas_next_rsc_client8.TestClient;
|
|
857
895
|
suspense = server && ((_b = config.ppr) == null ? void 0 : _b.testSuspense);
|
|
858
896
|
}
|
|
859
897
|
return {
|
|
@@ -861,6 +899,10 @@ var resolveSystemComponent = ({
|
|
|
861
899
|
suspense
|
|
862
900
|
};
|
|
863
901
|
};
|
|
902
|
+
var resolveServerPersonalizeComponent = ({ config }) => {
|
|
903
|
+
var _a;
|
|
904
|
+
return ((_a = config.evaluation) == null ? void 0 : _a.personalization) === "hybrid" ? PersonalizeServerHybrid : PersonalizeServer;
|
|
905
|
+
};
|
|
864
906
|
var resolveSlots = ({
|
|
865
907
|
component,
|
|
866
908
|
root,
|
|
@@ -978,20 +1020,20 @@ var resolveComponents = ({
|
|
|
978
1020
|
};
|
|
979
1021
|
let element = null;
|
|
980
1022
|
if (wrapInSuspense) {
|
|
981
|
-
element = (0,
|
|
982
|
-
|
|
1023
|
+
element = (0, import_react10.createElement)(
|
|
1024
|
+
import_react10.Suspense,
|
|
983
1025
|
{
|
|
984
1026
|
key,
|
|
985
|
-
fallback: typeof wrapInSuspense === "boolean" || typeof (wrapInSuspense == null ? void 0 : wrapInSuspense.fallback) === "undefined" ? void 0 : (0,
|
|
1027
|
+
fallback: typeof wrapInSuspense === "boolean" || typeof (wrapInSuspense == null ? void 0 : wrapInSuspense.fallback) === "undefined" ? void 0 : (0, import_react10.createElement)(wrapInSuspense.fallback)
|
|
986
1028
|
},
|
|
987
|
-
(0,
|
|
1029
|
+
(0, import_react10.createElement)(resolvedComponent, componentProps)
|
|
988
1030
|
);
|
|
989
1031
|
} else {
|
|
990
|
-
element = (0,
|
|
1032
|
+
element = (0, import_react10.createElement)(resolvedComponent, { ...componentProps, key });
|
|
991
1033
|
}
|
|
992
1034
|
let tagElement = null;
|
|
993
1035
|
if (enrichmentTags == null ? void 0 : enrichmentTags.length) {
|
|
994
|
-
tagElement = (0,
|
|
1036
|
+
tagElement = (0, import_react10.createElement)(ContextUpdateTransfer, {
|
|
995
1037
|
key: `${slotName}-${componentIndex}-tags`,
|
|
996
1038
|
update: {
|
|
997
1039
|
enrichments: enrichmentTags
|
|
@@ -1007,7 +1049,7 @@ var resolveComponents = ({
|
|
|
1007
1049
|
}
|
|
1008
1050
|
const isPlaceholder = (0, import_canvas8.isComponentPlaceholderId)(component == null ? void 0 : component._id);
|
|
1009
1051
|
if (!isPlaceholder || compositionContext.previewMode === "editor") {
|
|
1010
|
-
childNode = (0,
|
|
1052
|
+
childNode = (0, import_react10.createElement)(
|
|
1011
1053
|
import_core.PureContextualEditingComponentWrapper,
|
|
1012
1054
|
{
|
|
1013
1055
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
@@ -1027,8 +1069,8 @@ var resolveComponents = ({
|
|
|
1027
1069
|
if (tagElement) {
|
|
1028
1070
|
elements.push(tagElement);
|
|
1029
1071
|
}
|
|
1030
|
-
childNode = (0,
|
|
1031
|
-
|
|
1072
|
+
childNode = (0, import_react10.createElement)(
|
|
1073
|
+
import_canvas_next_rsc_client8.ClientContextualEditingComponentWrapper,
|
|
1032
1074
|
{
|
|
1033
1075
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
1034
1076
|
isPlaceholder: false,
|
|
@@ -1049,7 +1091,7 @@ var resolveComponents = ({
|
|
|
1049
1091
|
childNode = elements;
|
|
1050
1092
|
}
|
|
1051
1093
|
if (visibilityRules) {
|
|
1052
|
-
childNode = (0,
|
|
1094
|
+
childNode = (0, import_react10.createElement)(
|
|
1053
1095
|
VisibilityRulesWrapper,
|
|
1054
1096
|
{
|
|
1055
1097
|
key: `${slotName}-${componentIndex}-visibility`,
|
|
@@ -1059,8 +1101,8 @@ var resolveComponents = ({
|
|
|
1059
1101
|
childNode
|
|
1060
1102
|
);
|
|
1061
1103
|
}
|
|
1062
|
-
return (0,
|
|
1063
|
-
|
|
1104
|
+
return (0, import_react10.createElement)(
|
|
1105
|
+
import_react10.Fragment,
|
|
1064
1106
|
{
|
|
1065
1107
|
key: !isRoot ? `${slotName}-${componentIndex}` : void 0
|
|
1066
1108
|
},
|
|
@@ -1071,38 +1113,40 @@ var resolveComponents = ({
|
|
|
1071
1113
|
};
|
|
1072
1114
|
|
|
1073
1115
|
// src/components/UniformContext.tsx
|
|
1074
|
-
var
|
|
1075
|
-
var
|
|
1076
|
-
var
|
|
1116
|
+
var import_canvas_next_rsc_client9 = require("@uniformdev/canvas-next-rsc-client");
|
|
1117
|
+
var import_react11 = require("react");
|
|
1118
|
+
var import_react12 = __toESM(require("react"));
|
|
1077
1119
|
var UniformContext = async ({
|
|
1078
1120
|
clientContextComponent,
|
|
1079
1121
|
children
|
|
1080
1122
|
}) => {
|
|
1081
|
-
var _a;
|
|
1123
|
+
var _a, _b;
|
|
1082
1124
|
const manifest = await getManifest({
|
|
1083
1125
|
searchParams: {}
|
|
1084
1126
|
});
|
|
1085
|
-
const ContextComponent = clientContextComponent ||
|
|
1127
|
+
const ContextComponent = clientContextComponent || import_canvas_next_rsc_client9.DefaultUniformClientContext;
|
|
1086
1128
|
const serverConfig2 = getServerConfig();
|
|
1087
1129
|
const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
|
|
1088
1130
|
const defaultConsent = serverConfig2.defaultConsent || false;
|
|
1089
|
-
|
|
1131
|
+
const experimentalQuirkSerialization = ((_b = serverConfig2.experimental) == null ? void 0 : _b.quirkSerialization) || false;
|
|
1132
|
+
return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, children, /* @__PURE__ */ import_react12.default.createElement(
|
|
1090
1133
|
ContextComponent,
|
|
1091
1134
|
{
|
|
1092
1135
|
manifest,
|
|
1093
1136
|
disableDevTools,
|
|
1094
|
-
defaultConsent
|
|
1137
|
+
defaultConsent,
|
|
1138
|
+
experimentalQuirkSerialization
|
|
1095
1139
|
}
|
|
1096
|
-
), /* @__PURE__ */
|
|
1140
|
+
), /* @__PURE__ */ import_react12.default.createElement(import_react11.Suspense, { fallback: /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null) }, /* @__PURE__ */ import_react12.default.createElement(import_canvas_next_rsc_client9.UniformScript, null)));
|
|
1097
1141
|
};
|
|
1098
1142
|
|
|
1099
1143
|
// src/components/UniformPlayground.tsx
|
|
1100
1144
|
var import_canvas9 = require("@uniformdev/canvas");
|
|
1101
1145
|
var import_navigation2 = require("next/navigation");
|
|
1102
|
-
var
|
|
1146
|
+
var import_react13 = __toESM(require("react"));
|
|
1103
1147
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1104
1148
|
if (!isDraftModeEnabled({ searchParams })) {
|
|
1105
|
-
return /* @__PURE__ */
|
|
1149
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1106
1150
|
}
|
|
1107
1151
|
const id = searchParams["id"];
|
|
1108
1152
|
if (!id) {
|
|
@@ -1133,7 +1177,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1133
1177
|
if (!composition) {
|
|
1134
1178
|
(0, import_navigation2.notFound)();
|
|
1135
1179
|
}
|
|
1136
|
-
return /* @__PURE__ */
|
|
1180
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
1137
1181
|
UniformComposition,
|
|
1138
1182
|
{
|
|
1139
1183
|
mode: "server",
|
package/dist/index.mjs
CHANGED
|
@@ -441,7 +441,10 @@ import { createElement as createElement3, Fragment as Fragment3, Suspense } from
|
|
|
441
441
|
import {
|
|
442
442
|
createUniformContext
|
|
443
443
|
} from "@uniformdev/canvas-next-rsc-shared";
|
|
444
|
-
import {
|
|
444
|
+
import {
|
|
445
|
+
UNIFORM_DEFAULT_COOKIE_NAME,
|
|
446
|
+
UNIFORM_DEFAULT_QUIRK_COOKIE_NAME
|
|
447
|
+
} from "@uniformdev/context";
|
|
445
448
|
import { cookies } from "next/headers";
|
|
446
449
|
var createServerUniformContext = async (options) => {
|
|
447
450
|
const manifest = await getManifest(options);
|
|
@@ -452,10 +455,13 @@ var createServerUniformContext = async (options) => {
|
|
|
452
455
|
return context;
|
|
453
456
|
};
|
|
454
457
|
var createServerUniformContextFromManifest = async (options) => {
|
|
455
|
-
var _a;
|
|
458
|
+
var _a, _b, _c;
|
|
459
|
+
const quirksEnabled = (_a = getServerConfig().experimental) == null ? void 0 : _a.quirkSerialization;
|
|
456
460
|
const context = createUniformContext({
|
|
457
461
|
...options || {},
|
|
458
|
-
serverCookieValue: (
|
|
462
|
+
serverCookieValue: (_b = cookies().get(UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _b.value,
|
|
463
|
+
experimental_quirksEnabled: quirksEnabled,
|
|
464
|
+
quirkCookieValue: quirksEnabled ? (_c = cookies().get(UNIFORM_DEFAULT_QUIRK_COOKIE_NAME)) == null ? void 0 : _c.value : void 0
|
|
459
465
|
});
|
|
460
466
|
return context;
|
|
461
467
|
};
|
|
@@ -533,12 +539,17 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
|
|
|
533
539
|
let result;
|
|
534
540
|
for (let i = 0; i < states.length; i++) {
|
|
535
541
|
const state = states[i];
|
|
542
|
+
const releaseId = determineReleaseId({
|
|
543
|
+
searchParams,
|
|
544
|
+
state
|
|
545
|
+
});
|
|
536
546
|
try {
|
|
537
547
|
result = await retrieveRouteByPath({
|
|
538
548
|
path: value,
|
|
539
549
|
state,
|
|
540
550
|
searchParams,
|
|
541
|
-
fetchOptions
|
|
551
|
+
fetchOptions,
|
|
552
|
+
releaseId
|
|
542
553
|
});
|
|
543
554
|
} catch (e) {
|
|
544
555
|
console.warn(`Failed to retrieve route by path: ${value} with state ${state}`, e);
|
|
@@ -555,7 +566,8 @@ var retrieveRouteByPath = async ({
|
|
|
555
566
|
path,
|
|
556
567
|
state,
|
|
557
568
|
searchParams,
|
|
558
|
-
fetchOptions
|
|
569
|
+
fetchOptions,
|
|
570
|
+
releaseId
|
|
559
571
|
}) => {
|
|
560
572
|
var _a;
|
|
561
573
|
const client = getDefaultRouteClient({
|
|
@@ -580,7 +592,8 @@ var retrieveRouteByPath = async ({
|
|
|
580
592
|
state,
|
|
581
593
|
dataSourceVariant: getDataSourceVariantFromRouteGetParams(fetchOptions != null ? fetchOptions : {}, state),
|
|
582
594
|
withComponentIDs: true,
|
|
583
|
-
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing)
|
|
595
|
+
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
|
|
596
|
+
releaseId
|
|
584
597
|
});
|
|
585
598
|
};
|
|
586
599
|
var resolveRedirectHref = (resolveResult, path) => {
|
|
@@ -604,6 +617,16 @@ var determineState = ({ searchParams }) => {
|
|
|
604
617
|
}
|
|
605
618
|
return states;
|
|
606
619
|
};
|
|
620
|
+
var determineReleaseId = ({
|
|
621
|
+
searchParams,
|
|
622
|
+
state
|
|
623
|
+
}) => {
|
|
624
|
+
const draftMode2 = isDraftModeEnabled({ searchParams });
|
|
625
|
+
if (!draftMode2 || state === CANVAS_PUBLISHED_STATE) {
|
|
626
|
+
return void 0;
|
|
627
|
+
}
|
|
628
|
+
return searchParams == null ? void 0 : searchParams.releaseId;
|
|
629
|
+
};
|
|
607
630
|
|
|
608
631
|
// src/components/ContextUpdateTrigger.tsx
|
|
609
632
|
import { ClientContextUpdate } from "@uniformdev/canvas-next-rsc-client";
|
|
@@ -656,6 +679,24 @@ var PersonalizeServer = (props) => {
|
|
|
656
679
|
return createElement(Fragment, void 0, [...components, eventElement]);
|
|
657
680
|
};
|
|
658
681
|
|
|
682
|
+
// src/components/PersonalizeServerHybrid.tsx
|
|
683
|
+
import { PersonalizeClient as PersonalizeClient2 } from "@uniformdev/canvas-next-rsc-client";
|
|
684
|
+
import { runPersonalization as runPersonalization3 } from "@uniformdev/canvas-next-rsc-shared";
|
|
685
|
+
import React5 from "react";
|
|
686
|
+
var PersonalizeServerHybrid = (props) => {
|
|
687
|
+
const { indexes } = runPersonalization3(props);
|
|
688
|
+
return /* @__PURE__ */ React5.createElement(
|
|
689
|
+
PersonalizeClient2,
|
|
690
|
+
{
|
|
691
|
+
component: props.component,
|
|
692
|
+
count: props.count,
|
|
693
|
+
slots: props.slots,
|
|
694
|
+
trackingEventName: props.trackingEventName,
|
|
695
|
+
indexes
|
|
696
|
+
}
|
|
697
|
+
);
|
|
698
|
+
};
|
|
699
|
+
|
|
659
700
|
// src/components/TestServer.ts
|
|
660
701
|
import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
|
|
661
702
|
import {
|
|
@@ -666,9 +707,9 @@ import { createElement as createElement2, Fragment as Fragment2 } from "react";
|
|
|
666
707
|
|
|
667
708
|
// src/components/ContextTestTransfer.tsx
|
|
668
709
|
import { ClientContextTestTransfer } from "@uniformdev/canvas-next-rsc-client";
|
|
669
|
-
import
|
|
710
|
+
import React6 from "react";
|
|
670
711
|
var ContextTestTransfer = ({ event }) => {
|
|
671
|
-
return /* @__PURE__ */
|
|
712
|
+
return /* @__PURE__ */ React6.createElement(ClientContextTestTransfer, { ts: (/* @__PURE__ */ new Date()).valueOf(), event });
|
|
672
713
|
};
|
|
673
714
|
|
|
674
715
|
// src/components/TestServer.ts
|
|
@@ -695,7 +736,7 @@ import {
|
|
|
695
736
|
evaluateNodeVisibilityParameter
|
|
696
737
|
} from "@uniformdev/canvas";
|
|
697
738
|
import { VisibilityRulesWrapperClient } from "@uniformdev/canvas-next-rsc-client";
|
|
698
|
-
import
|
|
739
|
+
import React7 from "react";
|
|
699
740
|
var VisibilityRulesWrapper = (props) => {
|
|
700
741
|
const { context, ...rest } = props;
|
|
701
742
|
let isVisible = null;
|
|
@@ -706,7 +747,7 @@ var VisibilityRulesWrapper = (props) => {
|
|
|
706
747
|
parameter: props.parameter
|
|
707
748
|
});
|
|
708
749
|
}
|
|
709
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ React7.createElement(VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
|
|
710
751
|
};
|
|
711
752
|
|
|
712
753
|
// src/components/UniformComposition.ts
|
|
@@ -819,7 +860,7 @@ var resolveSystemComponent = ({
|
|
|
819
860
|
let resolved = null;
|
|
820
861
|
let suspense = void 0;
|
|
821
862
|
if (component.type === CANVAS_PERSONALIZE_TYPE) {
|
|
822
|
-
resolved = server ?
|
|
863
|
+
resolved = server ? resolveServerPersonalizeComponent({ config }) : PersonalizeClientWrapper;
|
|
823
864
|
suspense = server && ((_a = config.ppr) == null ? void 0 : _a.personalizationSuspense);
|
|
824
865
|
}
|
|
825
866
|
if (component.type === CANVAS_TEST_TYPE) {
|
|
@@ -831,6 +872,10 @@ var resolveSystemComponent = ({
|
|
|
831
872
|
suspense
|
|
832
873
|
};
|
|
833
874
|
};
|
|
875
|
+
var resolveServerPersonalizeComponent = ({ config }) => {
|
|
876
|
+
var _a;
|
|
877
|
+
return ((_a = config.evaluation) == null ? void 0 : _a.personalization) === "hybrid" ? PersonalizeServerHybrid : PersonalizeServer;
|
|
878
|
+
};
|
|
834
879
|
var resolveSlots = ({
|
|
835
880
|
component,
|
|
836
881
|
root,
|
|
@@ -1046,12 +1091,12 @@ import {
|
|
|
1046
1091
|
UniformScript
|
|
1047
1092
|
} from "@uniformdev/canvas-next-rsc-client";
|
|
1048
1093
|
import { Suspense as Suspense2 } from "react";
|
|
1049
|
-
import
|
|
1094
|
+
import React8 from "react";
|
|
1050
1095
|
var UniformContext = async ({
|
|
1051
1096
|
clientContextComponent,
|
|
1052
1097
|
children
|
|
1053
1098
|
}) => {
|
|
1054
|
-
var _a;
|
|
1099
|
+
var _a, _b;
|
|
1055
1100
|
const manifest = await getManifest({
|
|
1056
1101
|
searchParams: {}
|
|
1057
1102
|
});
|
|
@@ -1059,23 +1104,25 @@ var UniformContext = async ({
|
|
|
1059
1104
|
const serverConfig2 = getServerConfig();
|
|
1060
1105
|
const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
|
|
1061
1106
|
const defaultConsent = serverConfig2.defaultConsent || false;
|
|
1062
|
-
|
|
1107
|
+
const experimentalQuirkSerialization = ((_b = serverConfig2.experimental) == null ? void 0 : _b.quirkSerialization) || false;
|
|
1108
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, children, /* @__PURE__ */ React8.createElement(
|
|
1063
1109
|
ContextComponent,
|
|
1064
1110
|
{
|
|
1065
1111
|
manifest,
|
|
1066
1112
|
disableDevTools,
|
|
1067
|
-
defaultConsent
|
|
1113
|
+
defaultConsent,
|
|
1114
|
+
experimentalQuirkSerialization
|
|
1068
1115
|
}
|
|
1069
|
-
), /* @__PURE__ */
|
|
1116
|
+
), /* @__PURE__ */ React8.createElement(Suspense2, { fallback: /* @__PURE__ */ React8.createElement(React8.Fragment, null) }, /* @__PURE__ */ React8.createElement(UniformScript, null)));
|
|
1070
1117
|
};
|
|
1071
1118
|
|
|
1072
1119
|
// src/components/UniformPlayground.tsx
|
|
1073
1120
|
import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, CANVAS_EDITOR_STATE as CANVAS_EDITOR_STATE3 } from "@uniformdev/canvas";
|
|
1074
1121
|
import { notFound as notFound2 } from "next/navigation";
|
|
1075
|
-
import
|
|
1122
|
+
import React9 from "react";
|
|
1076
1123
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1077
1124
|
if (!isDraftModeEnabled({ searchParams })) {
|
|
1078
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1079
1126
|
}
|
|
1080
1127
|
const id = searchParams["id"];
|
|
1081
1128
|
if (!id) {
|
|
@@ -1106,7 +1153,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1106
1153
|
if (!composition) {
|
|
1107
1154
|
notFound2();
|
|
1108
1155
|
}
|
|
1109
|
-
return /* @__PURE__ */
|
|
1156
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1110
1157
|
UniformComposition,
|
|
1111
1158
|
{
|
|
1112
1159
|
mode: "server",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "19.202.
|
|
3
|
+
"version": "19.202.1-alpha.9+63c059770a",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
16
17
|
"require": "./dist/index.js",
|
|
17
|
-
"import": "./dist/index.esm.js"
|
|
18
|
-
"types": "./dist/index.d.ts"
|
|
18
|
+
"import": "./dist/index.esm.js"
|
|
19
19
|
},
|
|
20
20
|
"./handler": {
|
|
21
21
|
"require": "./dist/handler.js",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"types": "./dist/handler.d.ts"
|
|
24
24
|
},
|
|
25
25
|
"./config": {
|
|
26
|
+
"types": "./dist/config.d.ts",
|
|
26
27
|
"require": "./dist/config.js",
|
|
27
|
-
"import": "./dist/config.mjs"
|
|
28
|
-
"types": "./dist/config.d.ts"
|
|
28
|
+
"import": "./dist/config.mjs"
|
|
29
29
|
},
|
|
30
30
|
"./component": {
|
|
31
|
+
"types": "./dist/component.d.ts",
|
|
31
32
|
"require": "./dist/component.js",
|
|
32
|
-
"import": "./dist/component.mjs"
|
|
33
|
-
"types": "./dist/component.d.ts"
|
|
33
|
+
"import": "./dist/component.mjs"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"typesVersions": {
|
|
@@ -53,23 +53,23 @@
|
|
|
53
53
|
"/dist"
|
|
54
54
|
],
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@types/node": "
|
|
57
|
-
"@types/react": "18.3.
|
|
56
|
+
"@types/node": "22.7.8",
|
|
57
|
+
"@types/react": "18.3.11",
|
|
58
58
|
"eslint": "9.9.0",
|
|
59
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.202.
|
|
65
|
-
"@uniformdev/canvas-next-rsc-client": "^19.202.
|
|
66
|
-
"@uniformdev/canvas-next-rsc-shared": "^19.202.
|
|
67
|
-
"@uniformdev/canvas-react": "19.202.
|
|
68
|
-
"@uniformdev/context": "19.202.
|
|
69
|
-
"@uniformdev/project-map": "19.202.
|
|
70
|
-
"@uniformdev/redirect": "19.202.
|
|
71
|
-
"@uniformdev/richtext": "19.202.
|
|
72
|
-
"@uniformdev/webhooks": "19.202.
|
|
64
|
+
"@uniformdev/canvas": "19.202.1-alpha.9+63c059770a",
|
|
65
|
+
"@uniformdev/canvas-next-rsc-client": "^19.202.1-alpha.9+63c059770a",
|
|
66
|
+
"@uniformdev/canvas-next-rsc-shared": "^19.202.1-alpha.9+63c059770a",
|
|
67
|
+
"@uniformdev/canvas-react": "19.202.1-alpha.9+63c059770a",
|
|
68
|
+
"@uniformdev/context": "19.202.1-alpha.9+63c059770a",
|
|
69
|
+
"@uniformdev/project-map": "19.202.1-alpha.9+63c059770a",
|
|
70
|
+
"@uniformdev/redirect": "19.202.1-alpha.9+63c059770a",
|
|
71
|
+
"@uniformdev/richtext": "19.202.1-alpha.9+63c059770a",
|
|
72
|
+
"@uniformdev/webhooks": "19.202.1-alpha.9+63c059770a",
|
|
73
73
|
"@vercel/edge-config": "^0.4.0",
|
|
74
74
|
"encoding": "^0.1.13",
|
|
75
75
|
"server-only": "^0.0.1",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "63c059770a54fc063a12af0f74eba059143e8074"
|
|
90
90
|
}
|