@uniformdev/canvas-next-rsc 19.199.0 → 19.199.1-alpha.10
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-IWWzoI_H.d.mts} +16 -1
- package/dist/{UniformComposition-Dw55RFP6.d.ts → UniformComposition-IWWzoI_H.d.ts} +16 -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 +103 -33
- package/dist/index.js +128 -62
- package/dist/index.mjs +103 -33
- package/package.json +19 -19
|
@@ -28,11 +28,22 @@ type UniformCompositionProps = PageParameters & {
|
|
|
28
28
|
* Function to map composition components to React components.
|
|
29
29
|
*/
|
|
30
30
|
resolveComponent: ResolveComponentFunction;
|
|
31
|
+
/**
|
|
32
|
+
* Function to map empty placeholders to React components.
|
|
33
|
+
*/
|
|
34
|
+
resolveEmptyPlaceholder?: ResolveEmptyPlaceholderFunction;
|
|
31
35
|
} & (UniformStaticCompositionProps | UniformServerCompositionProps);
|
|
32
36
|
declare const UniformComposition: React.FC<UniformCompositionProps>;
|
|
33
37
|
type ResolveComponentFunction = (options: {
|
|
34
38
|
component: ComponentInstance;
|
|
35
39
|
}) => ResolveComponentResult;
|
|
40
|
+
type ResolveEmptyPlaceholderFunction = (options: ResolveEmptyPlaceholderOptions) => ResolveEmptyPlaceholderResult;
|
|
41
|
+
type ResolveEmptyPlaceholderOptions = {
|
|
42
|
+
parentComponent: ComponentInstance | undefined;
|
|
43
|
+
component: ComponentInstance;
|
|
44
|
+
slotName: string;
|
|
45
|
+
slotIndex: number;
|
|
46
|
+
};
|
|
36
47
|
type ResolveComponentResult = {
|
|
37
48
|
component: ComponentType<ComponentProps<any, any>> | null;
|
|
38
49
|
includeContext?: boolean;
|
|
@@ -40,6 +51,9 @@ type ResolveComponentResult = {
|
|
|
40
51
|
fallback: ComponentType<any> | undefined;
|
|
41
52
|
};
|
|
42
53
|
};
|
|
54
|
+
type ResolveEmptyPlaceholderResult = {
|
|
55
|
+
component: ComponentType<ComponentProps<any, any>> | null;
|
|
56
|
+
};
|
|
43
57
|
declare const resolveComposition: (props: Omit<ResolveComponentsOptions, "slotName" | "slotIndex" | "target"> & {
|
|
44
58
|
composition: ComponentInstance;
|
|
45
59
|
compositionContext: CompositionContext;
|
|
@@ -60,8 +74,9 @@ type ResolveComponentsOptions = {
|
|
|
60
74
|
slotName: string | undefined;
|
|
61
75
|
slotIndex: number | undefined;
|
|
62
76
|
resolveComponent: ResolveComponentFunction;
|
|
77
|
+
resolveEmptyPlaceholder: ResolveEmptyPlaceholderFunction | undefined;
|
|
63
78
|
compositionContext: CompositionContext;
|
|
64
79
|
mode: UniformCompositionProps['mode'];
|
|
65
80
|
};
|
|
66
81
|
|
|
67
|
-
export { type ResolveComponentFunction as R, type UniformCompositionProps as U,
|
|
82
|
+
export { type ResolveComponentFunction as R, type UniformCompositionProps as U, type ResolveComponentResult as a, UniformComposition as b, resolveComposition as r };
|
|
@@ -28,11 +28,22 @@ type UniformCompositionProps = PageParameters & {
|
|
|
28
28
|
* Function to map composition components to React components.
|
|
29
29
|
*/
|
|
30
30
|
resolveComponent: ResolveComponentFunction;
|
|
31
|
+
/**
|
|
32
|
+
* Function to map empty placeholders to React components.
|
|
33
|
+
*/
|
|
34
|
+
resolveEmptyPlaceholder?: ResolveEmptyPlaceholderFunction;
|
|
31
35
|
} & (UniformStaticCompositionProps | UniformServerCompositionProps);
|
|
32
36
|
declare const UniformComposition: React.FC<UniformCompositionProps>;
|
|
33
37
|
type ResolveComponentFunction = (options: {
|
|
34
38
|
component: ComponentInstance;
|
|
35
39
|
}) => ResolveComponentResult;
|
|
40
|
+
type ResolveEmptyPlaceholderFunction = (options: ResolveEmptyPlaceholderOptions) => ResolveEmptyPlaceholderResult;
|
|
41
|
+
type ResolveEmptyPlaceholderOptions = {
|
|
42
|
+
parentComponent: ComponentInstance | undefined;
|
|
43
|
+
component: ComponentInstance;
|
|
44
|
+
slotName: string;
|
|
45
|
+
slotIndex: number;
|
|
46
|
+
};
|
|
36
47
|
type ResolveComponentResult = {
|
|
37
48
|
component: ComponentType<ComponentProps<any, any>> | null;
|
|
38
49
|
includeContext?: boolean;
|
|
@@ -40,6 +51,9 @@ type ResolveComponentResult = {
|
|
|
40
51
|
fallback: ComponentType<any> | undefined;
|
|
41
52
|
};
|
|
42
53
|
};
|
|
54
|
+
type ResolveEmptyPlaceholderResult = {
|
|
55
|
+
component: ComponentType<ComponentProps<any, any>> | null;
|
|
56
|
+
};
|
|
43
57
|
declare const resolveComposition: (props: Omit<ResolveComponentsOptions, "slotName" | "slotIndex" | "target"> & {
|
|
44
58
|
composition: ComponentInstance;
|
|
45
59
|
compositionContext: CompositionContext;
|
|
@@ -60,8 +74,9 @@ type ResolveComponentsOptions = {
|
|
|
60
74
|
slotName: string | undefined;
|
|
61
75
|
slotIndex: number | undefined;
|
|
62
76
|
resolveComponent: ResolveComponentFunction;
|
|
77
|
+
resolveEmptyPlaceholder: ResolveEmptyPlaceholderFunction | undefined;
|
|
63
78
|
compositionContext: CompositionContext;
|
|
64
79
|
mode: UniformCompositionProps['mode'];
|
|
65
80
|
};
|
|
66
81
|
|
|
67
|
-
export { type ResolveComponentFunction as R, type UniformCompositionProps as U,
|
|
82
|
+
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-IWWzoI_H.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-IWWzoI_H.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-IWWzoI_H.mjs';
|
|
9
|
+
export { b as UniformComposition, r as resolveComposition } from './UniformComposition-IWWzoI_H.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-IWWzoI_H.js';
|
|
9
|
+
export { b as UniformComposition, r as resolveComposition } from './UniformComposition-IWWzoI_H.js';
|
|
10
10
|
import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
|
|
11
11
|
|
|
12
12
|
type GetCanvasClientOptions = {
|