@amplifyup/sdk 0.1.48 → 0.1.50
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/README.md +5 -3
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/react.d.mts +45 -16
- package/dist/react.d.ts +45 -16
- package/dist/react.js +80 -100
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +81 -100
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.d.mts
CHANGED
|
@@ -5,8 +5,6 @@ import React, { ReactNode } from 'react';
|
|
|
5
5
|
export { AmplifyRenderer } from './AmplifyRenderer.mjs';
|
|
6
6
|
export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-CWFb7rSm.mjs';
|
|
7
7
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
|
|
8
|
-
export { fetchPageConfigServer } from './server.mjs';
|
|
9
|
-
import './reservedRoutes-aGgViBDM.mjs';
|
|
10
8
|
|
|
11
9
|
type RenderComponentContext = {
|
|
12
10
|
/** Unique layout-tree node id — required when multiple instances share a component type. */
|
|
@@ -88,42 +86,73 @@ declare function Slot({ name, className, }: {
|
|
|
88
86
|
name: string;
|
|
89
87
|
className?: string;
|
|
90
88
|
}): react_jsx_runtime.JSX.Element | null;
|
|
91
|
-
declare function Field(
|
|
92
|
-
name
|
|
89
|
+
declare function Field(props: {
|
|
90
|
+
/** Field value from your component props. Do not also pass `name`. */
|
|
91
|
+
value?: unknown;
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated Will be removed. Use `value={…}` instead and omit `name`.
|
|
94
|
+
* Do not pass `name` together with `value`.
|
|
95
|
+
*/
|
|
96
|
+
name?: string;
|
|
93
97
|
fallback?: ReactNode;
|
|
94
98
|
className?: string;
|
|
95
99
|
render?: (value: any) => ReactNode;
|
|
96
100
|
}): string | number | true | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
|
|
97
101
|
/**
|
|
98
|
-
* RichText - Renders a markdown (or HTML string)
|
|
102
|
+
* RichText - Renders a markdown (or HTML string) value as formatted HTML.
|
|
99
103
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
104
|
+
* Pass the field value from your component props (`value={body}`). Values are
|
|
105
|
+
* Markdown for portability across CMS platforms.
|
|
102
106
|
*
|
|
103
107
|
* @example
|
|
104
108
|
* ```tsx
|
|
105
|
-
*
|
|
109
|
+
* function Article({ title, body }: { title: string; body: string }) {
|
|
110
|
+
* return (
|
|
111
|
+
* <article>
|
|
112
|
+
* <h1><Field value={title} /></h1>
|
|
113
|
+
* <RichText value={body} className="prose" />
|
|
114
|
+
* </article>
|
|
115
|
+
* );
|
|
116
|
+
* }
|
|
106
117
|
* ```
|
|
107
118
|
*/
|
|
108
|
-
declare function RichText(
|
|
109
|
-
name
|
|
119
|
+
declare function RichText(props: {
|
|
120
|
+
/** Markdown (or HTML) string from your component props. Do not also pass `name`. */
|
|
121
|
+
value?: string | null;
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated Will be removed. Use `value={…}` (or string children) and omit `name`.
|
|
124
|
+
* Do not pass `name` together with `value`.
|
|
125
|
+
*/
|
|
126
|
+
name?: string;
|
|
110
127
|
fallback?: ReactNode;
|
|
111
128
|
className?: string;
|
|
112
129
|
as?: keyof JSX.IntrinsicElements;
|
|
130
|
+
/** String children are treated as the markdown value (same as `value`). */
|
|
131
|
+
children?: ReactNode;
|
|
113
132
|
}): react_jsx_runtime.JSX.Element | null;
|
|
114
133
|
/**
|
|
115
|
-
* Image — renders a provider-backed image
|
|
134
|
+
* Image — renders a provider-backed image value as `<img>`.
|
|
116
135
|
*
|
|
117
|
-
*
|
|
118
|
-
* AmplifyUp does not host image files
|
|
136
|
+
* Pass the portable `{ url, alt?, width?, height? }` (or URL string) from your
|
|
137
|
+
* component props via `value`. AmplifyUp does not host image files.
|
|
119
138
|
*
|
|
120
139
|
* @example
|
|
121
140
|
* ```tsx
|
|
122
|
-
*
|
|
141
|
+
* function Hero({ backgroundImage }: { backgroundImage: { url: string } }) {
|
|
142
|
+
* return (
|
|
143
|
+
* <Image value={backgroundImage} className="h-full w-full object-cover" />
|
|
144
|
+
* );
|
|
145
|
+
* }
|
|
123
146
|
* ```
|
|
124
147
|
*/
|
|
125
|
-
declare function Image(
|
|
126
|
-
name
|
|
148
|
+
declare function Image(props: {
|
|
149
|
+
/** Portable image or URL string from your component props. Do not also pass `name`. */
|
|
150
|
+
value?: unknown;
|
|
151
|
+
/**
|
|
152
|
+
* @deprecated Will be removed. Use `value={…}` and omit `name`.
|
|
153
|
+
* Do not pass `name` together with `value`.
|
|
154
|
+
*/
|
|
155
|
+
name?: string;
|
|
127
156
|
alt?: string;
|
|
128
157
|
} & Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
|
|
129
158
|
|
package/dist/react.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ import React, { ReactNode } from 'react';
|
|
|
5
5
|
export { AmplifyRenderer } from './AmplifyRenderer.js';
|
|
6
6
|
export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-L7zSmLFX.js';
|
|
7
7
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
|
|
8
|
-
export { fetchPageConfigServer } from './server.js';
|
|
9
|
-
import './reservedRoutes-aGgViBDM.js';
|
|
10
8
|
|
|
11
9
|
type RenderComponentContext = {
|
|
12
10
|
/** Unique layout-tree node id — required when multiple instances share a component type. */
|
|
@@ -88,42 +86,73 @@ declare function Slot({ name, className, }: {
|
|
|
88
86
|
name: string;
|
|
89
87
|
className?: string;
|
|
90
88
|
}): react_jsx_runtime.JSX.Element | null;
|
|
91
|
-
declare function Field(
|
|
92
|
-
name
|
|
89
|
+
declare function Field(props: {
|
|
90
|
+
/** Field value from your component props. Do not also pass `name`. */
|
|
91
|
+
value?: unknown;
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated Will be removed. Use `value={…}` instead and omit `name`.
|
|
94
|
+
* Do not pass `name` together with `value`.
|
|
95
|
+
*/
|
|
96
|
+
name?: string;
|
|
93
97
|
fallback?: ReactNode;
|
|
94
98
|
className?: string;
|
|
95
99
|
render?: (value: any) => ReactNode;
|
|
96
100
|
}): string | number | true | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
|
|
97
101
|
/**
|
|
98
|
-
* RichText - Renders a markdown (or HTML string)
|
|
102
|
+
* RichText - Renders a markdown (or HTML string) value as formatted HTML.
|
|
99
103
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
104
|
+
* Pass the field value from your component props (`value={body}`). Values are
|
|
105
|
+
* Markdown for portability across CMS platforms.
|
|
102
106
|
*
|
|
103
107
|
* @example
|
|
104
108
|
* ```tsx
|
|
105
|
-
*
|
|
109
|
+
* function Article({ title, body }: { title: string; body: string }) {
|
|
110
|
+
* return (
|
|
111
|
+
* <article>
|
|
112
|
+
* <h1><Field value={title} /></h1>
|
|
113
|
+
* <RichText value={body} className="prose" />
|
|
114
|
+
* </article>
|
|
115
|
+
* );
|
|
116
|
+
* }
|
|
106
117
|
* ```
|
|
107
118
|
*/
|
|
108
|
-
declare function RichText(
|
|
109
|
-
name
|
|
119
|
+
declare function RichText(props: {
|
|
120
|
+
/** Markdown (or HTML) string from your component props. Do not also pass `name`. */
|
|
121
|
+
value?: string | null;
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated Will be removed. Use `value={…}` (or string children) and omit `name`.
|
|
124
|
+
* Do not pass `name` together with `value`.
|
|
125
|
+
*/
|
|
126
|
+
name?: string;
|
|
110
127
|
fallback?: ReactNode;
|
|
111
128
|
className?: string;
|
|
112
129
|
as?: keyof JSX.IntrinsicElements;
|
|
130
|
+
/** String children are treated as the markdown value (same as `value`). */
|
|
131
|
+
children?: ReactNode;
|
|
113
132
|
}): react_jsx_runtime.JSX.Element | null;
|
|
114
133
|
/**
|
|
115
|
-
* Image — renders a provider-backed image
|
|
134
|
+
* Image — renders a provider-backed image value as `<img>`.
|
|
116
135
|
*
|
|
117
|
-
*
|
|
118
|
-
* AmplifyUp does not host image files
|
|
136
|
+
* Pass the portable `{ url, alt?, width?, height? }` (or URL string) from your
|
|
137
|
+
* component props via `value`. AmplifyUp does not host image files.
|
|
119
138
|
*
|
|
120
139
|
* @example
|
|
121
140
|
* ```tsx
|
|
122
|
-
*
|
|
141
|
+
* function Hero({ backgroundImage }: { backgroundImage: { url: string } }) {
|
|
142
|
+
* return (
|
|
143
|
+
* <Image value={backgroundImage} className="h-full w-full object-cover" />
|
|
144
|
+
* );
|
|
145
|
+
* }
|
|
123
146
|
* ```
|
|
124
147
|
*/
|
|
125
|
-
declare function Image(
|
|
126
|
-
name
|
|
148
|
+
declare function Image(props: {
|
|
149
|
+
/** Portable image or URL string from your component props. Do not also pass `name`. */
|
|
150
|
+
value?: unknown;
|
|
151
|
+
/**
|
|
152
|
+
* @deprecated Will be removed. Use `value={…}` and omit `name`.
|
|
153
|
+
* Do not pass `name` together with `value`.
|
|
154
|
+
*/
|
|
155
|
+
name?: string;
|
|
127
156
|
alt?: string;
|
|
128
157
|
} & Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
|
|
129
158
|
|
package/dist/react.js
CHANGED
|
@@ -3885,6 +3885,23 @@ function formatFieldValue(value) {
|
|
|
3885
3885
|
}
|
|
3886
3886
|
return "";
|
|
3887
3887
|
}
|
|
3888
|
+
function warnProjectionProps(component, name, hasExplicitValue) {
|
|
3889
|
+
if (process.env.NODE_ENV === "production") return;
|
|
3890
|
+
if (hasExplicitValue && name) {
|
|
3891
|
+
console.warn(
|
|
3892
|
+
`[AmplifyUp SDK] ${component}: pass either value={\u2026} or deprecated name="\u2026", not both. Prefer value={\u2026} and omit name.`
|
|
3893
|
+
);
|
|
3894
|
+
return;
|
|
3895
|
+
}
|
|
3896
|
+
if (name) {
|
|
3897
|
+
console.warn(
|
|
3898
|
+
`[AmplifyUp SDK] ${component} \`name\` is deprecated and will be removed. Prefer value={${name}} from your component props and omit name.`
|
|
3899
|
+
);
|
|
3900
|
+
}
|
|
3901
|
+
}
|
|
3902
|
+
function hasOwnProp(props, key) {
|
|
3903
|
+
return Object.prototype.hasOwnProperty.call(props, key);
|
|
3904
|
+
}
|
|
3888
3905
|
function isLinkListItem(value) {
|
|
3889
3906
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
3890
3907
|
}
|
|
@@ -3912,21 +3929,23 @@ function renderLinkList(items, className) {
|
|
|
3912
3929
|
);
|
|
3913
3930
|
}) });
|
|
3914
3931
|
}
|
|
3915
|
-
function Field({
|
|
3916
|
-
name,
|
|
3917
|
-
fallback,
|
|
3918
|
-
className,
|
|
3919
|
-
render
|
|
3920
|
-
}) {
|
|
3932
|
+
function Field(props) {
|
|
3933
|
+
const { value, name, fallback, className, render } = props;
|
|
3921
3934
|
const context = React.useContext(ComponentContext);
|
|
3922
3935
|
const composerEdit = useComposerEditMode();
|
|
3936
|
+
const hasExplicitValue = hasOwnProp(props, "value");
|
|
3937
|
+
const sourceValue = hasExplicitValue ? value : name ? context?.props?.[name] : void 0;
|
|
3938
|
+
const editName = hasExplicitValue ? "" : name || "";
|
|
3923
3939
|
const fieldValue = useFieldOverlay(
|
|
3924
3940
|
context?.layoutNodeId,
|
|
3925
|
-
|
|
3926
|
-
|
|
3941
|
+
editName,
|
|
3942
|
+
sourceValue
|
|
3927
3943
|
);
|
|
3928
|
-
|
|
3929
|
-
|
|
3944
|
+
warnProjectionProps("Field", name, hasExplicitValue);
|
|
3945
|
+
if (!context && !hasExplicitValue) {
|
|
3946
|
+
console.warn(
|
|
3947
|
+
"[AmplifyUp SDK] Field needs a `value` prop (or deprecated `name` alone)"
|
|
3948
|
+
);
|
|
3930
3949
|
return fallback ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback }) : null;
|
|
3931
3950
|
}
|
|
3932
3951
|
if (render) {
|
|
@@ -3939,11 +3958,11 @@ function Field({
|
|
|
3939
3958
|
const text = formatFieldValue(fieldValue);
|
|
3940
3959
|
const showVisualFallback = !text && isReactNodeFallback(fallback);
|
|
3941
3960
|
const emptyBlockField = isComposerEmptyText(fieldValue) && classNameIsBlock(className);
|
|
3942
|
-
if (composerEdit && canInlineEdit(
|
|
3961
|
+
if (composerEdit && editName && context && canInlineEdit(editName, fieldValue) && !showVisualFallback && !emptyBlockField) {
|
|
3943
3962
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3944
3963
|
ComposerInlineField,
|
|
3945
3964
|
{
|
|
3946
|
-
name,
|
|
3965
|
+
name: editName,
|
|
3947
3966
|
value: fieldValue,
|
|
3948
3967
|
fallback,
|
|
3949
3968
|
className,
|
|
@@ -3968,34 +3987,46 @@ function markdownToHtml(markdown) {
|
|
|
3968
3987
|
return markdown;
|
|
3969
3988
|
}
|
|
3970
3989
|
}
|
|
3971
|
-
function RichText({
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3990
|
+
function RichText(props) {
|
|
3991
|
+
const {
|
|
3992
|
+
value,
|
|
3993
|
+
name,
|
|
3994
|
+
fallback,
|
|
3995
|
+
className,
|
|
3996
|
+
as: Tag = "div",
|
|
3997
|
+
children
|
|
3998
|
+
} = props;
|
|
3977
3999
|
const context = React.useContext(ComponentContext);
|
|
3978
4000
|
const composerEdit = useComposerEditMode();
|
|
4001
|
+
const childrenValue = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
|
|
4002
|
+
const hasValueProp = hasOwnProp(props, "value");
|
|
4003
|
+
const hasExplicitValue = hasValueProp || childrenValue !== void 0;
|
|
4004
|
+
const sourceValue = hasValueProp ? value : childrenValue !== void 0 ? childrenValue : name ? context?.props?.[name] : void 0;
|
|
4005
|
+
const editName = hasExplicitValue ? "" : name || "";
|
|
3979
4006
|
const fieldValue = useFieldOverlay(
|
|
3980
4007
|
context?.layoutNodeId,
|
|
3981
|
-
|
|
3982
|
-
|
|
4008
|
+
editName,
|
|
4009
|
+
sourceValue
|
|
3983
4010
|
);
|
|
3984
|
-
if (!context) {
|
|
3985
|
-
console.warn(
|
|
4011
|
+
if (!context && !hasExplicitValue) {
|
|
4012
|
+
console.warn(
|
|
4013
|
+
"[AmplifyUp SDK] RichText needs a `value` prop (or string children), or deprecated `name` alone"
|
|
4014
|
+
);
|
|
3986
4015
|
return fallback ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback }) : null;
|
|
3987
4016
|
}
|
|
4017
|
+
warnProjectionProps("RichText", name, hasExplicitValue);
|
|
4018
|
+
const canEdit = !!editName && !!context && canInlineEdit(editName, fieldValue);
|
|
3988
4019
|
if (isComposerEmptyText(fieldValue)) {
|
|
3989
|
-
if (composerEdit &&
|
|
4020
|
+
if (composerEdit && canEdit && !isReactNodeFallback(fallback) && !classNameIsBlock(className)) {
|
|
3990
4021
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3991
4022
|
ComposerInlineField,
|
|
3992
4023
|
{
|
|
3993
|
-
name,
|
|
4024
|
+
name: editName,
|
|
3994
4025
|
value: fieldValue,
|
|
3995
4026
|
fallback: typeof fallback === "string" || typeof fallback === "number" ? fallback : void 0,
|
|
3996
4027
|
className,
|
|
3997
|
-
layoutNodeId: context
|
|
3998
|
-
componentId: context
|
|
4028
|
+
layoutNodeId: context?.layoutNodeId,
|
|
4029
|
+
componentId: context?.componentId
|
|
3999
4030
|
}
|
|
4000
4031
|
);
|
|
4001
4032
|
}
|
|
@@ -4021,22 +4052,22 @@ function RichText({
|
|
|
4021
4052
|
Tag,
|
|
4022
4053
|
{
|
|
4023
4054
|
className,
|
|
4024
|
-
"data-amplifyup-field":
|
|
4025
|
-
"data-amplifyup-node-id": context
|
|
4055
|
+
"data-amplifyup-field": editName || void 0,
|
|
4056
|
+
"data-amplifyup-node-id": context?.layoutNodeId || void 0,
|
|
4026
4057
|
dangerouslySetInnerHTML: { __html: html }
|
|
4027
4058
|
}
|
|
4028
4059
|
);
|
|
4029
4060
|
}
|
|
4030
|
-
if (composerEdit &&
|
|
4061
|
+
if (composerEdit && canEdit) {
|
|
4031
4062
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4032
4063
|
ComposerInlineHtml,
|
|
4033
4064
|
{
|
|
4034
|
-
name,
|
|
4065
|
+
name: editName,
|
|
4035
4066
|
html,
|
|
4036
4067
|
className,
|
|
4037
4068
|
Tag,
|
|
4038
|
-
layoutNodeId: context
|
|
4039
|
-
componentId: context
|
|
4069
|
+
layoutNodeId: context?.layoutNodeId,
|
|
4070
|
+
componentId: context?.componentId
|
|
4040
4071
|
}
|
|
4041
4072
|
);
|
|
4042
4073
|
}
|
|
@@ -4052,23 +4083,28 @@ function imageSrc(value) {
|
|
|
4052
4083
|
if (isPortableImageValue(value)) return value.url.trim();
|
|
4053
4084
|
return "";
|
|
4054
4085
|
}
|
|
4055
|
-
function Image({
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4086
|
+
function Image(props) {
|
|
4087
|
+
const {
|
|
4088
|
+
value,
|
|
4089
|
+
name,
|
|
4090
|
+
alt: altProp,
|
|
4091
|
+
className,
|
|
4092
|
+
width: widthProp,
|
|
4093
|
+
height: heightProp,
|
|
4094
|
+
...imgProps
|
|
4095
|
+
} = props;
|
|
4063
4096
|
const context = React.useContext(ComponentContext);
|
|
4097
|
+
const hasExplicitValue = hasOwnProp(props, "value");
|
|
4098
|
+
const sourceValue = hasExplicitValue ? value : name ? context?.props?.[name] : void 0;
|
|
4064
4099
|
const fieldValue = useFieldOverlay(
|
|
4065
4100
|
context?.layoutNodeId,
|
|
4066
|
-
name,
|
|
4067
|
-
|
|
4101
|
+
hasExplicitValue ? "" : name || "",
|
|
4102
|
+
sourceValue
|
|
4068
4103
|
);
|
|
4069
|
-
|
|
4104
|
+
warnProjectionProps("Image", name, hasExplicitValue);
|
|
4105
|
+
if (!context && !hasExplicitValue) {
|
|
4070
4106
|
console.warn(
|
|
4071
|
-
|
|
4107
|
+
"[AmplifyUp SDK] Image needs a `value` prop (or deprecated `name` alone)"
|
|
4072
4108
|
);
|
|
4073
4109
|
return null;
|
|
4074
4110
|
}
|
|
@@ -4635,61 +4671,6 @@ function AmplifyPageContent({
|
|
|
4635
4671
|
}
|
|
4636
4672
|
);
|
|
4637
4673
|
}
|
|
4638
|
-
|
|
4639
|
-
// src/server.tsx
|
|
4640
|
-
var AMPLIFY_DEFAULT_REVALIDATE = 60;
|
|
4641
|
-
async function fetchPageConfigServer(route, trackingId, preview = false, options) {
|
|
4642
|
-
const target = resolveAmplifyUpTarget({
|
|
4643
|
-
configTarget: options?.target
|
|
4644
|
-
});
|
|
4645
|
-
const { orchestratorUrl, edgeUrl } = resolveAmplifyUpUrls(target);
|
|
4646
|
-
const previewFlag = preview || (options?.searchParams ? isPreviewRequest(options.searchParams) : false);
|
|
4647
|
-
const workingFlag = options?.searchParams ? isWorkingContentRequest(options.searchParams) : false;
|
|
4648
|
-
const fetchOrchestratorPage = async (pageRoute, isPreview) => {
|
|
4649
|
-
const params = new URLSearchParams({
|
|
4650
|
-
route: pageRoute,
|
|
4651
|
-
trackingId
|
|
4652
|
-
});
|
|
4653
|
-
if (isPreview) params.set("preview", "true");
|
|
4654
|
-
if (workingFlag) params.set("working", "true");
|
|
4655
|
-
if (options?.searchParams) {
|
|
4656
|
-
const sp = options.searchParams instanceof URLSearchParams ? options.searchParams : new URLSearchParams(
|
|
4657
|
-
Object.entries(options.searchParams).flatMap(
|
|
4658
|
-
([k, v]) => v == null ? [] : Array.isArray(v) ? v.map((item) => [k, item]) : [[k, v]]
|
|
4659
|
-
)
|
|
4660
|
-
);
|
|
4661
|
-
const zoneId = sp.get("zoneId");
|
|
4662
|
-
const compositionId = sp.get("compositionId");
|
|
4663
|
-
if (zoneId) params.set("zoneId", zoneId);
|
|
4664
|
-
if (compositionId) params.set("compositionId", compositionId);
|
|
4665
|
-
}
|
|
4666
|
-
const url = `${orchestratorUrl}/api/layout/provider?${params.toString()}`;
|
|
4667
|
-
try {
|
|
4668
|
-
const res = await fetch(url, {
|
|
4669
|
-
cache: "no-store",
|
|
4670
|
-
headers: { Accept: "application/json" }
|
|
4671
|
-
});
|
|
4672
|
-
if (!res.ok) return null;
|
|
4673
|
-
const data = await res.json();
|
|
4674
|
-
return data.page || null;
|
|
4675
|
-
} catch {
|
|
4676
|
-
return null;
|
|
4677
|
-
}
|
|
4678
|
-
};
|
|
4679
|
-
const result = await fetchContent({
|
|
4680
|
-
route,
|
|
4681
|
-
trackingId,
|
|
4682
|
-
anonId: options?.anonId,
|
|
4683
|
-
siteId: options?.siteId,
|
|
4684
|
-
preview: previewFlag,
|
|
4685
|
-
orchestratorUrl,
|
|
4686
|
-
edgeUrl,
|
|
4687
|
-
fetchOrchestratorPage,
|
|
4688
|
-
revalidate: previewFlag ? void 0 : options?.revalidate ?? AMPLIFY_DEFAULT_REVALIDATE,
|
|
4689
|
-
variantKeys: previewFlag ? void 0 : options?.variantKeys
|
|
4690
|
-
});
|
|
4691
|
-
return result.pageConfig;
|
|
4692
|
-
}
|
|
4693
4674
|
var usePathname = null;
|
|
4694
4675
|
if (typeof window !== "undefined") {
|
|
4695
4676
|
try {
|
|
@@ -4906,7 +4887,6 @@ exports.QueryContentError = QueryContentError;
|
|
|
4906
4887
|
exports.RichText = RichText;
|
|
4907
4888
|
exports.SelectVariantsError = SelectVariantsError;
|
|
4908
4889
|
exports.Slot = Slot;
|
|
4909
|
-
exports.fetchPageConfigServer = fetchPageConfigServer;
|
|
4910
4890
|
exports.isComposerPreview = isComposerPreview;
|
|
4911
4891
|
exports.isPreviewRequest = isPreviewRequest;
|
|
4912
4892
|
exports.isWorkingContentRequest = isWorkingContentRequest;
|