@uniformdev/canvas-next-rsc 19.201.1 → 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 +68 -26
- package/dist/index.js +94 -55
- package/dist/index.mjs +68 -26
- 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,27 +707,22 @@ 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
|
|
675
716
|
var TestServer = async (props) => {
|
|
676
|
-
var _a, _b, _c, _d
|
|
717
|
+
var _a, _b, _c, _d;
|
|
677
718
|
if ((_a = getServerConfig().ppr) == null ? void 0 : _a.testSuspense) {
|
|
678
719
|
noStore2();
|
|
679
720
|
}
|
|
680
|
-
const { contextInstance, test } = props;
|
|
681
|
-
const isTestDefined = Boolean((_b = contextInstance.manifest.data.project.test) == null ? void 0 : _b[test]);
|
|
682
|
-
if (!isTestDefined && process.env.NODE_ENV !== "production") {
|
|
683
|
-
console.warn(`Test "${test}" is not defined in Uniform manifest.`);
|
|
684
|
-
}
|
|
685
721
|
const { index, event } = runTest(props);
|
|
686
722
|
if (index === null || event === null) {
|
|
687
723
|
return null;
|
|
688
724
|
}
|
|
689
|
-
const component = typeof index === "number" ? (
|
|
725
|
+
const component = typeof index === "number" ? (_d = (_c = (_b = props.slots) == null ? void 0 : _b[CANVAS_TEST_SLOT]) == null ? void 0 : _c.items[index]) != null ? _d : null : null;
|
|
690
726
|
const eventElement = createElement2(ContextTestTransfer, {
|
|
691
727
|
event,
|
|
692
728
|
key: `${props.slotName}-${props.slotIndex}-server-transfer`
|
|
@@ -700,7 +736,7 @@ import {
|
|
|
700
736
|
evaluateNodeVisibilityParameter
|
|
701
737
|
} from "@uniformdev/canvas";
|
|
702
738
|
import { VisibilityRulesWrapperClient } from "@uniformdev/canvas-next-rsc-client";
|
|
703
|
-
import
|
|
739
|
+
import React7 from "react";
|
|
704
740
|
var VisibilityRulesWrapper = (props) => {
|
|
705
741
|
const { context, ...rest } = props;
|
|
706
742
|
let isVisible = null;
|
|
@@ -711,7 +747,7 @@ var VisibilityRulesWrapper = (props) => {
|
|
|
711
747
|
parameter: props.parameter
|
|
712
748
|
});
|
|
713
749
|
}
|
|
714
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ React7.createElement(VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
|
|
715
751
|
};
|
|
716
752
|
|
|
717
753
|
// src/components/UniformComposition.ts
|
|
@@ -824,7 +860,7 @@ var resolveSystemComponent = ({
|
|
|
824
860
|
let resolved = null;
|
|
825
861
|
let suspense = void 0;
|
|
826
862
|
if (component.type === CANVAS_PERSONALIZE_TYPE) {
|
|
827
|
-
resolved = server ?
|
|
863
|
+
resolved = server ? resolveServerPersonalizeComponent({ config }) : PersonalizeClientWrapper;
|
|
828
864
|
suspense = server && ((_a = config.ppr) == null ? void 0 : _a.personalizationSuspense);
|
|
829
865
|
}
|
|
830
866
|
if (component.type === CANVAS_TEST_TYPE) {
|
|
@@ -836,6 +872,10 @@ var resolveSystemComponent = ({
|
|
|
836
872
|
suspense
|
|
837
873
|
};
|
|
838
874
|
};
|
|
875
|
+
var resolveServerPersonalizeComponent = ({ config }) => {
|
|
876
|
+
var _a;
|
|
877
|
+
return ((_a = config.evaluation) == null ? void 0 : _a.personalization) === "hybrid" ? PersonalizeServerHybrid : PersonalizeServer;
|
|
878
|
+
};
|
|
839
879
|
var resolveSlots = ({
|
|
840
880
|
component,
|
|
841
881
|
root,
|
|
@@ -1051,12 +1091,12 @@ import {
|
|
|
1051
1091
|
UniformScript
|
|
1052
1092
|
} from "@uniformdev/canvas-next-rsc-client";
|
|
1053
1093
|
import { Suspense as Suspense2 } from "react";
|
|
1054
|
-
import
|
|
1094
|
+
import React8 from "react";
|
|
1055
1095
|
var UniformContext = async ({
|
|
1056
1096
|
clientContextComponent,
|
|
1057
1097
|
children
|
|
1058
1098
|
}) => {
|
|
1059
|
-
var _a;
|
|
1099
|
+
var _a, _b;
|
|
1060
1100
|
const manifest = await getManifest({
|
|
1061
1101
|
searchParams: {}
|
|
1062
1102
|
});
|
|
@@ -1064,23 +1104,25 @@ var UniformContext = async ({
|
|
|
1064
1104
|
const serverConfig2 = getServerConfig();
|
|
1065
1105
|
const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
|
|
1066
1106
|
const defaultConsent = serverConfig2.defaultConsent || false;
|
|
1067
|
-
|
|
1107
|
+
const experimentalQuirkSerialization = ((_b = serverConfig2.experimental) == null ? void 0 : _b.quirkSerialization) || false;
|
|
1108
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, children, /* @__PURE__ */ React8.createElement(
|
|
1068
1109
|
ContextComponent,
|
|
1069
1110
|
{
|
|
1070
1111
|
manifest,
|
|
1071
1112
|
disableDevTools,
|
|
1072
|
-
defaultConsent
|
|
1113
|
+
defaultConsent,
|
|
1114
|
+
experimentalQuirkSerialization
|
|
1073
1115
|
}
|
|
1074
|
-
), /* @__PURE__ */
|
|
1116
|
+
), /* @__PURE__ */ React8.createElement(Suspense2, { fallback: /* @__PURE__ */ React8.createElement(React8.Fragment, null) }, /* @__PURE__ */ React8.createElement(UniformScript, null)));
|
|
1075
1117
|
};
|
|
1076
1118
|
|
|
1077
1119
|
// src/components/UniformPlayground.tsx
|
|
1078
1120
|
import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, CANVAS_EDITOR_STATE as CANVAS_EDITOR_STATE3 } from "@uniformdev/canvas";
|
|
1079
1121
|
import { notFound as notFound2 } from "next/navigation";
|
|
1080
|
-
import
|
|
1122
|
+
import React9 from "react";
|
|
1081
1123
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1082
1124
|
if (!isDraftModeEnabled({ searchParams })) {
|
|
1083
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1084
1126
|
}
|
|
1085
1127
|
const id = searchParams["id"];
|
|
1086
1128
|
if (!id) {
|
|
@@ -1111,7 +1153,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1111
1153
|
if (!composition) {
|
|
1112
1154
|
notFound2();
|
|
1113
1155
|
}
|
|
1114
|
-
return /* @__PURE__ */
|
|
1156
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1115
1157
|
UniformComposition,
|
|
1116
1158
|
{
|
|
1117
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,46 +711,59 @@ 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
|
|
708
746
|
var TestServer = async (props) => {
|
|
709
|
-
var _a, _b, _c, _d
|
|
747
|
+
var _a, _b, _c, _d;
|
|
710
748
|
if ((_a = getServerConfig().ppr) == null ? void 0 : _a.testSuspense) {
|
|
711
749
|
(0, import_cache2.unstable_noStore)();
|
|
712
750
|
}
|
|
713
|
-
const {
|
|
714
|
-
const isTestDefined = Boolean((_b = contextInstance.manifest.data.project.test) == null ? void 0 : _b[test]);
|
|
715
|
-
if (!isTestDefined && process.env.NODE_ENV !== "production") {
|
|
716
|
-
console.warn(`Test "${test}" is not defined in Uniform manifest.`);
|
|
717
|
-
}
|
|
718
|
-
const { index, event } = (0, import_canvas_next_rsc_shared5.runTest)(props);
|
|
751
|
+
const { index, event } = (0, import_canvas_next_rsc_shared6.runTest)(props);
|
|
719
752
|
if (index === null || event === null) {
|
|
720
753
|
return null;
|
|
721
754
|
}
|
|
722
|
-
const component = typeof index === "number" ? (
|
|
723
|
-
const eventElement = (0,
|
|
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;
|
|
756
|
+
const eventElement = (0, import_react8.createElement)(ContextTestTransfer, {
|
|
724
757
|
event,
|
|
725
758
|
key: `${props.slotName}-${props.slotIndex}-server-transfer`
|
|
726
759
|
});
|
|
727
|
-
return (0,
|
|
760
|
+
return (0, import_react8.createElement)(import_react8.Fragment, void 0, [component, eventElement]);
|
|
728
761
|
};
|
|
729
762
|
|
|
730
763
|
// src/components/VisibilityRulesWrapper.tsx
|
|
731
764
|
var import_canvas7 = require("@uniformdev/canvas");
|
|
732
|
-
var
|
|
733
|
-
var
|
|
765
|
+
var import_canvas_next_rsc_client7 = require("@uniformdev/canvas-next-rsc-client");
|
|
766
|
+
var import_react9 = __toESM(require("react"));
|
|
734
767
|
var VisibilityRulesWrapper = (props) => {
|
|
735
768
|
const { context, ...rest } = props;
|
|
736
769
|
let isVisible = null;
|
|
@@ -741,7 +774,7 @@ var VisibilityRulesWrapper = (props) => {
|
|
|
741
774
|
parameter: props.parameter
|
|
742
775
|
});
|
|
743
776
|
}
|
|
744
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_canvas_next_rsc_client7.VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
|
|
745
778
|
};
|
|
746
779
|
|
|
747
780
|
// src/components/UniformComposition.ts
|
|
@@ -760,7 +793,7 @@ var UniformComposition = async ({
|
|
|
760
793
|
});
|
|
761
794
|
searchParams = props.searchParams;
|
|
762
795
|
}
|
|
763
|
-
const { value: path } = (0,
|
|
796
|
+
const { value: path } = (0, import_canvas_next_rsc_shared7.resolvePath)(props);
|
|
764
797
|
if (!route || route.type === "notFound") {
|
|
765
798
|
(0, import_navigation.notFound)();
|
|
766
799
|
}
|
|
@@ -807,7 +840,7 @@ var UniformComposition = async ({
|
|
|
807
840
|
if (props.mode === "server") {
|
|
808
841
|
const headersValue = (0, import_headers3.headers)();
|
|
809
842
|
const missingQuirkValue = "unknown";
|
|
810
|
-
transfer = (0,
|
|
843
|
+
transfer = (0, import_react10.createElement)(ContextUpdateTransfer, {
|
|
811
844
|
serverContext,
|
|
812
845
|
update: {
|
|
813
846
|
params: props.params,
|
|
@@ -827,11 +860,11 @@ var UniformComposition = async ({
|
|
|
827
860
|
}
|
|
828
861
|
});
|
|
829
862
|
} else if (props.mode === "static") {
|
|
830
|
-
transfer = (0,
|
|
863
|
+
transfer = (0, import_react10.createElement)(ContextUpdateTrigger, {
|
|
831
864
|
path
|
|
832
865
|
});
|
|
833
866
|
}
|
|
834
|
-
return (0,
|
|
867
|
+
return (0, import_react10.createElement)(import_react10.Fragment, void 0, transfer, resolved);
|
|
835
868
|
};
|
|
836
869
|
var isServerComponent = ({
|
|
837
870
|
component,
|
|
@@ -854,11 +887,11 @@ var resolveSystemComponent = ({
|
|
|
854
887
|
let resolved = null;
|
|
855
888
|
let suspense = void 0;
|
|
856
889
|
if (component.type === import_canvas8.CANVAS_PERSONALIZE_TYPE) {
|
|
857
|
-
resolved = server ?
|
|
890
|
+
resolved = server ? resolveServerPersonalizeComponent({ config }) : PersonalizeClientWrapper;
|
|
858
891
|
suspense = server && ((_a = config.ppr) == null ? void 0 : _a.personalizationSuspense);
|
|
859
892
|
}
|
|
860
893
|
if (component.type === import_canvas8.CANVAS_TEST_TYPE) {
|
|
861
|
-
resolved = server ? TestServer :
|
|
894
|
+
resolved = server ? TestServer : import_canvas_next_rsc_client8.TestClient;
|
|
862
895
|
suspense = server && ((_b = config.ppr) == null ? void 0 : _b.testSuspense);
|
|
863
896
|
}
|
|
864
897
|
return {
|
|
@@ -866,6 +899,10 @@ var resolveSystemComponent = ({
|
|
|
866
899
|
suspense
|
|
867
900
|
};
|
|
868
901
|
};
|
|
902
|
+
var resolveServerPersonalizeComponent = ({ config }) => {
|
|
903
|
+
var _a;
|
|
904
|
+
return ((_a = config.evaluation) == null ? void 0 : _a.personalization) === "hybrid" ? PersonalizeServerHybrid : PersonalizeServer;
|
|
905
|
+
};
|
|
869
906
|
var resolveSlots = ({
|
|
870
907
|
component,
|
|
871
908
|
root,
|
|
@@ -983,20 +1020,20 @@ var resolveComponents = ({
|
|
|
983
1020
|
};
|
|
984
1021
|
let element = null;
|
|
985
1022
|
if (wrapInSuspense) {
|
|
986
|
-
element = (0,
|
|
987
|
-
|
|
1023
|
+
element = (0, import_react10.createElement)(
|
|
1024
|
+
import_react10.Suspense,
|
|
988
1025
|
{
|
|
989
1026
|
key,
|
|
990
|
-
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)
|
|
991
1028
|
},
|
|
992
|
-
(0,
|
|
1029
|
+
(0, import_react10.createElement)(resolvedComponent, componentProps)
|
|
993
1030
|
);
|
|
994
1031
|
} else {
|
|
995
|
-
element = (0,
|
|
1032
|
+
element = (0, import_react10.createElement)(resolvedComponent, { ...componentProps, key });
|
|
996
1033
|
}
|
|
997
1034
|
let tagElement = null;
|
|
998
1035
|
if (enrichmentTags == null ? void 0 : enrichmentTags.length) {
|
|
999
|
-
tagElement = (0,
|
|
1036
|
+
tagElement = (0, import_react10.createElement)(ContextUpdateTransfer, {
|
|
1000
1037
|
key: `${slotName}-${componentIndex}-tags`,
|
|
1001
1038
|
update: {
|
|
1002
1039
|
enrichments: enrichmentTags
|
|
@@ -1012,7 +1049,7 @@ var resolveComponents = ({
|
|
|
1012
1049
|
}
|
|
1013
1050
|
const isPlaceholder = (0, import_canvas8.isComponentPlaceholderId)(component == null ? void 0 : component._id);
|
|
1014
1051
|
if (!isPlaceholder || compositionContext.previewMode === "editor") {
|
|
1015
|
-
childNode = (0,
|
|
1052
|
+
childNode = (0, import_react10.createElement)(
|
|
1016
1053
|
import_core.PureContextualEditingComponentWrapper,
|
|
1017
1054
|
{
|
|
1018
1055
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
@@ -1032,8 +1069,8 @@ var resolveComponents = ({
|
|
|
1032
1069
|
if (tagElement) {
|
|
1033
1070
|
elements.push(tagElement);
|
|
1034
1071
|
}
|
|
1035
|
-
childNode = (0,
|
|
1036
|
-
|
|
1072
|
+
childNode = (0, import_react10.createElement)(
|
|
1073
|
+
import_canvas_next_rsc_client8.ClientContextualEditingComponentWrapper,
|
|
1037
1074
|
{
|
|
1038
1075
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
1039
1076
|
isPlaceholder: false,
|
|
@@ -1054,7 +1091,7 @@ var resolveComponents = ({
|
|
|
1054
1091
|
childNode = elements;
|
|
1055
1092
|
}
|
|
1056
1093
|
if (visibilityRules) {
|
|
1057
|
-
childNode = (0,
|
|
1094
|
+
childNode = (0, import_react10.createElement)(
|
|
1058
1095
|
VisibilityRulesWrapper,
|
|
1059
1096
|
{
|
|
1060
1097
|
key: `${slotName}-${componentIndex}-visibility`,
|
|
@@ -1064,8 +1101,8 @@ var resolveComponents = ({
|
|
|
1064
1101
|
childNode
|
|
1065
1102
|
);
|
|
1066
1103
|
}
|
|
1067
|
-
return (0,
|
|
1068
|
-
|
|
1104
|
+
return (0, import_react10.createElement)(
|
|
1105
|
+
import_react10.Fragment,
|
|
1069
1106
|
{
|
|
1070
1107
|
key: !isRoot ? `${slotName}-${componentIndex}` : void 0
|
|
1071
1108
|
},
|
|
@@ -1076,38 +1113,40 @@ var resolveComponents = ({
|
|
|
1076
1113
|
};
|
|
1077
1114
|
|
|
1078
1115
|
// src/components/UniformContext.tsx
|
|
1079
|
-
var
|
|
1080
|
-
var
|
|
1081
|
-
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"));
|
|
1082
1119
|
var UniformContext = async ({
|
|
1083
1120
|
clientContextComponent,
|
|
1084
1121
|
children
|
|
1085
1122
|
}) => {
|
|
1086
|
-
var _a;
|
|
1123
|
+
var _a, _b;
|
|
1087
1124
|
const manifest = await getManifest({
|
|
1088
1125
|
searchParams: {}
|
|
1089
1126
|
});
|
|
1090
|
-
const ContextComponent = clientContextComponent ||
|
|
1127
|
+
const ContextComponent = clientContextComponent || import_canvas_next_rsc_client9.DefaultUniformClientContext;
|
|
1091
1128
|
const serverConfig2 = getServerConfig();
|
|
1092
1129
|
const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
|
|
1093
1130
|
const defaultConsent = serverConfig2.defaultConsent || false;
|
|
1094
|
-
|
|
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(
|
|
1095
1133
|
ContextComponent,
|
|
1096
1134
|
{
|
|
1097
1135
|
manifest,
|
|
1098
1136
|
disableDevTools,
|
|
1099
|
-
defaultConsent
|
|
1137
|
+
defaultConsent,
|
|
1138
|
+
experimentalQuirkSerialization
|
|
1100
1139
|
}
|
|
1101
|
-
), /* @__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)));
|
|
1102
1141
|
};
|
|
1103
1142
|
|
|
1104
1143
|
// src/components/UniformPlayground.tsx
|
|
1105
1144
|
var import_canvas9 = require("@uniformdev/canvas");
|
|
1106
1145
|
var import_navigation2 = require("next/navigation");
|
|
1107
|
-
var
|
|
1146
|
+
var import_react13 = __toESM(require("react"));
|
|
1108
1147
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1109
1148
|
if (!isDraftModeEnabled({ searchParams })) {
|
|
1110
|
-
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"));
|
|
1111
1150
|
}
|
|
1112
1151
|
const id = searchParams["id"];
|
|
1113
1152
|
if (!id) {
|
|
@@ -1138,7 +1177,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1138
1177
|
if (!composition) {
|
|
1139
1178
|
(0, import_navigation2.notFound)();
|
|
1140
1179
|
}
|
|
1141
|
-
return /* @__PURE__ */
|
|
1180
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
1142
1181
|
UniformComposition,
|
|
1143
1182
|
{
|
|
1144
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,27 +707,22 @@ 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
|
|
675
716
|
var TestServer = async (props) => {
|
|
676
|
-
var _a, _b, _c, _d
|
|
717
|
+
var _a, _b, _c, _d;
|
|
677
718
|
if ((_a = getServerConfig().ppr) == null ? void 0 : _a.testSuspense) {
|
|
678
719
|
noStore2();
|
|
679
720
|
}
|
|
680
|
-
const { contextInstance, test } = props;
|
|
681
|
-
const isTestDefined = Boolean((_b = contextInstance.manifest.data.project.test) == null ? void 0 : _b[test]);
|
|
682
|
-
if (!isTestDefined && process.env.NODE_ENV !== "production") {
|
|
683
|
-
console.warn(`Test "${test}" is not defined in Uniform manifest.`);
|
|
684
|
-
}
|
|
685
721
|
const { index, event } = runTest(props);
|
|
686
722
|
if (index === null || event === null) {
|
|
687
723
|
return null;
|
|
688
724
|
}
|
|
689
|
-
const component = typeof index === "number" ? (
|
|
725
|
+
const component = typeof index === "number" ? (_d = (_c = (_b = props.slots) == null ? void 0 : _b[CANVAS_TEST_SLOT]) == null ? void 0 : _c.items[index]) != null ? _d : null : null;
|
|
690
726
|
const eventElement = createElement2(ContextTestTransfer, {
|
|
691
727
|
event,
|
|
692
728
|
key: `${props.slotName}-${props.slotIndex}-server-transfer`
|
|
@@ -700,7 +736,7 @@ import {
|
|
|
700
736
|
evaluateNodeVisibilityParameter
|
|
701
737
|
} from "@uniformdev/canvas";
|
|
702
738
|
import { VisibilityRulesWrapperClient } from "@uniformdev/canvas-next-rsc-client";
|
|
703
|
-
import
|
|
739
|
+
import React7 from "react";
|
|
704
740
|
var VisibilityRulesWrapper = (props) => {
|
|
705
741
|
const { context, ...rest } = props;
|
|
706
742
|
let isVisible = null;
|
|
@@ -711,7 +747,7 @@ var VisibilityRulesWrapper = (props) => {
|
|
|
711
747
|
parameter: props.parameter
|
|
712
748
|
});
|
|
713
749
|
}
|
|
714
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ React7.createElement(VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
|
|
715
751
|
};
|
|
716
752
|
|
|
717
753
|
// src/components/UniformComposition.ts
|
|
@@ -824,7 +860,7 @@ var resolveSystemComponent = ({
|
|
|
824
860
|
let resolved = null;
|
|
825
861
|
let suspense = void 0;
|
|
826
862
|
if (component.type === CANVAS_PERSONALIZE_TYPE) {
|
|
827
|
-
resolved = server ?
|
|
863
|
+
resolved = server ? resolveServerPersonalizeComponent({ config }) : PersonalizeClientWrapper;
|
|
828
864
|
suspense = server && ((_a = config.ppr) == null ? void 0 : _a.personalizationSuspense);
|
|
829
865
|
}
|
|
830
866
|
if (component.type === CANVAS_TEST_TYPE) {
|
|
@@ -836,6 +872,10 @@ var resolveSystemComponent = ({
|
|
|
836
872
|
suspense
|
|
837
873
|
};
|
|
838
874
|
};
|
|
875
|
+
var resolveServerPersonalizeComponent = ({ config }) => {
|
|
876
|
+
var _a;
|
|
877
|
+
return ((_a = config.evaluation) == null ? void 0 : _a.personalization) === "hybrid" ? PersonalizeServerHybrid : PersonalizeServer;
|
|
878
|
+
};
|
|
839
879
|
var resolveSlots = ({
|
|
840
880
|
component,
|
|
841
881
|
root,
|
|
@@ -1051,12 +1091,12 @@ import {
|
|
|
1051
1091
|
UniformScript
|
|
1052
1092
|
} from "@uniformdev/canvas-next-rsc-client";
|
|
1053
1093
|
import { Suspense as Suspense2 } from "react";
|
|
1054
|
-
import
|
|
1094
|
+
import React8 from "react";
|
|
1055
1095
|
var UniformContext = async ({
|
|
1056
1096
|
clientContextComponent,
|
|
1057
1097
|
children
|
|
1058
1098
|
}) => {
|
|
1059
|
-
var _a;
|
|
1099
|
+
var _a, _b;
|
|
1060
1100
|
const manifest = await getManifest({
|
|
1061
1101
|
searchParams: {}
|
|
1062
1102
|
});
|
|
@@ -1064,23 +1104,25 @@ var UniformContext = async ({
|
|
|
1064
1104
|
const serverConfig2 = getServerConfig();
|
|
1065
1105
|
const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
|
|
1066
1106
|
const defaultConsent = serverConfig2.defaultConsent || false;
|
|
1067
|
-
|
|
1107
|
+
const experimentalQuirkSerialization = ((_b = serverConfig2.experimental) == null ? void 0 : _b.quirkSerialization) || false;
|
|
1108
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, children, /* @__PURE__ */ React8.createElement(
|
|
1068
1109
|
ContextComponent,
|
|
1069
1110
|
{
|
|
1070
1111
|
manifest,
|
|
1071
1112
|
disableDevTools,
|
|
1072
|
-
defaultConsent
|
|
1113
|
+
defaultConsent,
|
|
1114
|
+
experimentalQuirkSerialization
|
|
1073
1115
|
}
|
|
1074
|
-
), /* @__PURE__ */
|
|
1116
|
+
), /* @__PURE__ */ React8.createElement(Suspense2, { fallback: /* @__PURE__ */ React8.createElement(React8.Fragment, null) }, /* @__PURE__ */ React8.createElement(UniformScript, null)));
|
|
1075
1117
|
};
|
|
1076
1118
|
|
|
1077
1119
|
// src/components/UniformPlayground.tsx
|
|
1078
1120
|
import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, CANVAS_EDITOR_STATE as CANVAS_EDITOR_STATE3 } from "@uniformdev/canvas";
|
|
1079
1121
|
import { notFound as notFound2 } from "next/navigation";
|
|
1080
|
-
import
|
|
1122
|
+
import React9 from "react";
|
|
1081
1123
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1082
1124
|
if (!isDraftModeEnabled({ searchParams })) {
|
|
1083
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1084
1126
|
}
|
|
1085
1127
|
const id = searchParams["id"];
|
|
1086
1128
|
if (!id) {
|
|
@@ -1111,7 +1153,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1111
1153
|
if (!composition) {
|
|
1112
1154
|
notFound2();
|
|
1113
1155
|
}
|
|
1114
|
-
return /* @__PURE__ */
|
|
1156
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1115
1157
|
UniformComposition,
|
|
1116
1158
|
{
|
|
1117
1159
|
mode: "server",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "19.
|
|
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.
|
|
65
|
-
"@uniformdev/canvas-next-rsc-client": "^19.
|
|
66
|
-
"@uniformdev/canvas-next-rsc-shared": "^19.
|
|
67
|
-
"@uniformdev/canvas-react": "19.
|
|
68
|
-
"@uniformdev/context": "19.
|
|
69
|
-
"@uniformdev/project-map": "19.
|
|
70
|
-
"@uniformdev/redirect": "19.
|
|
71
|
-
"@uniformdev/richtext": "19.
|
|
72
|
-
"@uniformdev/webhooks": "19.
|
|
64
|
+
"@uniformdev/canvas": "19.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
|
}
|