@amplifyup/sdk 0.1.60 → 0.1.62

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.
@@ -60,6 +60,7 @@ declare function selectVariants(options: SelectVariantsOptions): Promise<SelectV
60
60
  * Page resolve covers data known at Deploy. Visitor-triggered data — search,
61
61
  * load more, pickers — runs here: the browser asks AmplifyUp, AmplifyUp asks
62
62
  * the CMS. Only entities published with the page can be queried.
63
+ * Results are plain CMS rows, not Field envelopes, and are not canvas-editable.
63
64
  */
64
65
 
65
66
  type QueryFilterOp = 'eq' | 'neq' | 'in' | 'nin' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'exists';
@@ -60,6 +60,7 @@ declare function selectVariants(options: SelectVariantsOptions): Promise<SelectV
60
60
  * Page resolve covers data known at Deploy. Visitor-triggered data — search,
61
61
  * load more, pickers — runs here: the browser asks AmplifyUp, AmplifyUp asks
62
62
  * the CMS. Only entities published with the page can be queried.
63
+ * Results are plain CMS rows, not Field envelopes, and are not canvas-editable.
63
64
  */
64
65
 
65
66
  type QueryFilterOp = 'eq' | 'neq' | 'in' | 'nin' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'exists';
package/dist/react.d.mts CHANGED
@@ -2,15 +2,16 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-Db_eLrfU.mjs';
3
3
  export { Z as ZoneConfig } from './types-Db_eLrfU.mjs';
4
4
  import React__default, { ReactNode } from 'react';
5
- export { AmplifyRenderer } from './AmplifyRenderer.mjs';
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-DaJlqU-Z.mjs';
5
+ import { L as LayoutComponentProps, F as Field$1 } from './AmplifyRenderer-W7eqltSj.mjs';
6
+ export { A as AmplifyRenderer, b as Fields, I as ImageValue, a as isBrandedFields, i as isFieldEnvelope, t as toFieldEnvelopes } from './AmplifyRenderer-W7eqltSj.mjs';
7
+ 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-DIZjc7st.mjs';
7
8
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
8
9
 
9
10
  type RenderComponentContext = {
10
11
  /** Unique layout-tree node id — required when multiple instances share a component type. */
11
12
  layoutNodeId: string;
12
13
  };
13
- type RenderComponentFn = (componentId: string, props: Record<string, any>, slots?: Record<string, ReactNode>, context?: RenderComponentContext) => ReactNode;
14
+ type RenderComponentFn = (componentId: string, props: LayoutComponentProps, slots?: Record<string, ReactNode>, context?: RenderComponentContext) => ReactNode;
14
15
  interface AmplifyPageContentProps {
15
16
  /**
16
17
  * Native page content shown to visitors when no AmplifyUp layout is configured.
@@ -43,12 +44,6 @@ interface AmplifyPageContentProps {
43
44
  */
44
45
  declare function AmplifyPageContent({ fallback, renderComponent, pageConfig: pageConfigProp, forceComposerPreview, previewLoadingComponent, previewEmptyComponent, loadingComponent, emptyComponent, errorComponent, }: AmplifyPageContentProps): react_jsx_runtime.JSX.Element | null;
45
46
 
46
- declare function useLiveComposerProps(layoutNodeId: string | undefined, props: Record<string, any>): Record<string, any>;
47
- /**
48
- * Live props for this layout node (CMS fields + settings).
49
- * Same values `<Field>` reads — use this when you want to render yourself.
50
- */
51
- declare function useComponentProps<T extends Record<string, any> = Record<string, any>>(): T;
52
47
  declare function ComponentContextProvider({ children, slots, props, layoutNodeId, componentId, }: {
53
48
  children: ReactNode;
54
49
  slots?: Record<string, ReactNode>;
@@ -87,44 +82,39 @@ declare function Slot({ name, className, }: {
87
82
  className?: string;
88
83
  }): react_jsx_runtime.JSX.Element | null;
89
84
  declare function Field(props: {
90
- /** Field value from your component props. Do not also pass `name`. */
85
+ /** Envelope from `props.fields` (`{ value, name }`). */
86
+ field?: Field$1<unknown>;
87
+ /** Computed value — requires `name`. */
91
88
  value?: unknown;
92
- /**
93
- * @deprecated Prefer `value={…}`. Still used as the Composer save key when
94
- * the same value appears on more than one prop.
95
- */
89
+ /** Required with `value` for computed values. */
96
90
  name?: string;
97
- fallback?: ReactNode;
98
91
  className?: string;
99
92
  render?: (value: any) => ReactNode;
100
93
  }): string | number | true | Iterable<React__default.ReactNode> | react_jsx_runtime.JSX.Element | null;
101
94
  /**
102
95
  * RichText - Renders a markdown (or HTML string) value as formatted HTML.
103
96
  *
104
- * Pass the field value from your component props (`value={body}`). Values are
105
- * Markdown for portability across CMS platforms.
97
+ * Pass a field envelope: `<RichText field={fields.body} />`.
98
+ * Values are Markdown for portability across CMS platforms.
106
99
  *
107
100
  * @example
108
101
  * ```tsx
109
- * function Article({ title, body }: { title: string; body: string }) {
102
+ * function Article({ fields }: { fields: Fields<{ title: string; body: string }> }) {
110
103
  * return (
111
104
  * <article>
112
- * <h1><Field value={title} /></h1>
113
- * <RichText value={body} className="prose" />
105
+ * <h1><Field field={fields.title} /></h1>
106
+ * <RichText field={fields.body} className="prose" />
114
107
  * </article>
115
108
  * );
116
109
  * }
117
110
  * ```
118
111
  */
119
112
  declare function RichText(props: {
120
- /** Markdown (or HTML) string from your component props. Do not also pass `name`. */
113
+ field?: Field$1<string | null>;
114
+ /** Computed markdown — requires `name`. */
121
115
  value?: string | null;
122
- /**
123
- * @deprecated Prefer `value={…}`. Still used as the Composer save key when
124
- * the same value appears on more than one prop.
125
- */
116
+ /** Required with `value` for computed values. */
126
117
  name?: string;
127
- fallback?: ReactNode;
128
118
  className?: string;
129
119
  as?: keyof JSX.IntrinsicElements;
130
120
  /** String children are treated as the markdown value (same as `value`). */
@@ -133,29 +123,37 @@ declare function RichText(props: {
133
123
  /**
134
124
  * Image — renders a provider-backed image value as `<img>`.
135
125
  *
136
- * Pass the portable `{ url, alt?, width?, height? }` (or URL string) from your
137
- * component props via `value`. AmplifyUp does not host image files.
126
+ * Pass a field envelope: `<Image field={fields.backgroundImage} />`.
127
+ * AmplifyUp does not host image files.
138
128
  *
139
129
  * @example
140
130
  * ```tsx
141
- * function Hero({ backgroundImage }: { backgroundImage: { url: string } }) {
131
+ * function Hero({ fields }: { fields: Fields<{ backgroundImage: ImageValue }> }) {
142
132
  * return (
143
- * <Image value={backgroundImage} className="h-full w-full object-cover" />
133
+ * <Image field={fields.backgroundImage} className="h-full w-full object-cover" />
144
134
  * );
145
135
  * }
146
136
  * ```
147
137
  */
148
138
  declare function Image(props: {
149
- /** Portable image or URL string from your component props. Do not also pass `name`. */
139
+ field?: Field$1<unknown>;
140
+ /** Computed image — requires `name`. */
150
141
  value?: unknown;
151
- /**
152
- * @deprecated Will be removed. Use `value={…}` and omit `name`.
153
- * Do not pass `name` together with `value`.
154
- */
142
+ /** Required with `value` for computed values. */
155
143
  name?: string;
156
144
  alt?: string;
157
145
  } & Omit<React__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
158
146
 
147
+ declare function ComposerProvider({ layoutNodeId, children, }: {
148
+ layoutNodeId?: string;
149
+ children: ReactNode;
150
+ }): react_jsx_runtime.JSX.Element;
151
+ declare function MaybeComposerProvider({ enabled, layoutNodeId, children, }: {
152
+ enabled: boolean;
153
+ layoutNodeId?: string;
154
+ children: ReactNode;
155
+ }): react_jsx_runtime.JSX.Element;
156
+
159
157
  interface AmplifyUpContextType {
160
158
  pageConfig: PageConfig | null;
161
159
  loading: boolean;
@@ -175,4 +173,4 @@ interface AmplifyUpProviderProps {
175
173
  declare function AmplifyUpProvider({ children, config, pageContext, }: AmplifyUpProviderProps): react_jsx_runtime.JSX.Element;
176
174
  declare function useAmplifyUp(): AmplifyUpContextType;
177
175
 
178
- export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ContentSource, Field, Image, PageConfig, RichText, Slot, useAmplifyUp, useComponentProps, useLiveComposerProps };
176
+ export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };
package/dist/react.d.ts CHANGED
@@ -2,15 +2,16 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-Db_eLrfU.js';
3
3
  export { Z as ZoneConfig } from './types-Db_eLrfU.js';
4
4
  import React__default, { ReactNode } from 'react';
5
- export { AmplifyRenderer } from './AmplifyRenderer.js';
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-BqApXxQi.js';
5
+ import { L as LayoutComponentProps, F as Field$1 } from './AmplifyRenderer-BQ8-H2H4.js';
6
+ export { A as AmplifyRenderer, b as Fields, I as ImageValue, a as isBrandedFields, i as isFieldEnvelope, t as toFieldEnvelopes } from './AmplifyRenderer-BQ8-H2H4.js';
7
+ 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-3AXnQgzO.js';
7
8
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
8
9
 
9
10
  type RenderComponentContext = {
10
11
  /** Unique layout-tree node id — required when multiple instances share a component type. */
11
12
  layoutNodeId: string;
12
13
  };
13
- type RenderComponentFn = (componentId: string, props: Record<string, any>, slots?: Record<string, ReactNode>, context?: RenderComponentContext) => ReactNode;
14
+ type RenderComponentFn = (componentId: string, props: LayoutComponentProps, slots?: Record<string, ReactNode>, context?: RenderComponentContext) => ReactNode;
14
15
  interface AmplifyPageContentProps {
15
16
  /**
16
17
  * Native page content shown to visitors when no AmplifyUp layout is configured.
@@ -43,12 +44,6 @@ interface AmplifyPageContentProps {
43
44
  */
44
45
  declare function AmplifyPageContent({ fallback, renderComponent, pageConfig: pageConfigProp, forceComposerPreview, previewLoadingComponent, previewEmptyComponent, loadingComponent, emptyComponent, errorComponent, }: AmplifyPageContentProps): react_jsx_runtime.JSX.Element | null;
45
46
 
46
- declare function useLiveComposerProps(layoutNodeId: string | undefined, props: Record<string, any>): Record<string, any>;
47
- /**
48
- * Live props for this layout node (CMS fields + settings).
49
- * Same values `<Field>` reads — use this when you want to render yourself.
50
- */
51
- declare function useComponentProps<T extends Record<string, any> = Record<string, any>>(): T;
52
47
  declare function ComponentContextProvider({ children, slots, props, layoutNodeId, componentId, }: {
53
48
  children: ReactNode;
54
49
  slots?: Record<string, ReactNode>;
@@ -87,44 +82,39 @@ declare function Slot({ name, className, }: {
87
82
  className?: string;
88
83
  }): react_jsx_runtime.JSX.Element | null;
89
84
  declare function Field(props: {
90
- /** Field value from your component props. Do not also pass `name`. */
85
+ /** Envelope from `props.fields` (`{ value, name }`). */
86
+ field?: Field$1<unknown>;
87
+ /** Computed value — requires `name`. */
91
88
  value?: unknown;
92
- /**
93
- * @deprecated Prefer `value={…}`. Still used as the Composer save key when
94
- * the same value appears on more than one prop.
95
- */
89
+ /** Required with `value` for computed values. */
96
90
  name?: string;
97
- fallback?: ReactNode;
98
91
  className?: string;
99
92
  render?: (value: any) => ReactNode;
100
93
  }): string | number | true | Iterable<React__default.ReactNode> | react_jsx_runtime.JSX.Element | null;
101
94
  /**
102
95
  * RichText - Renders a markdown (or HTML string) value as formatted HTML.
103
96
  *
104
- * Pass the field value from your component props (`value={body}`). Values are
105
- * Markdown for portability across CMS platforms.
97
+ * Pass a field envelope: `<RichText field={fields.body} />`.
98
+ * Values are Markdown for portability across CMS platforms.
106
99
  *
107
100
  * @example
108
101
  * ```tsx
109
- * function Article({ title, body }: { title: string; body: string }) {
102
+ * function Article({ fields }: { fields: Fields<{ title: string; body: string }> }) {
110
103
  * return (
111
104
  * <article>
112
- * <h1><Field value={title} /></h1>
113
- * <RichText value={body} className="prose" />
105
+ * <h1><Field field={fields.title} /></h1>
106
+ * <RichText field={fields.body} className="prose" />
114
107
  * </article>
115
108
  * );
116
109
  * }
117
110
  * ```
118
111
  */
119
112
  declare function RichText(props: {
120
- /** Markdown (or HTML) string from your component props. Do not also pass `name`. */
113
+ field?: Field$1<string | null>;
114
+ /** Computed markdown — requires `name`. */
121
115
  value?: string | null;
122
- /**
123
- * @deprecated Prefer `value={…}`. Still used as the Composer save key when
124
- * the same value appears on more than one prop.
125
- */
116
+ /** Required with `value` for computed values. */
126
117
  name?: string;
127
- fallback?: ReactNode;
128
118
  className?: string;
129
119
  as?: keyof JSX.IntrinsicElements;
130
120
  /** String children are treated as the markdown value (same as `value`). */
@@ -133,29 +123,37 @@ declare function RichText(props: {
133
123
  /**
134
124
  * Image — renders a provider-backed image value as `<img>`.
135
125
  *
136
- * Pass the portable `{ url, alt?, width?, height? }` (or URL string) from your
137
- * component props via `value`. AmplifyUp does not host image files.
126
+ * Pass a field envelope: `<Image field={fields.backgroundImage} />`.
127
+ * AmplifyUp does not host image files.
138
128
  *
139
129
  * @example
140
130
  * ```tsx
141
- * function Hero({ backgroundImage }: { backgroundImage: { url: string } }) {
131
+ * function Hero({ fields }: { fields: Fields<{ backgroundImage: ImageValue }> }) {
142
132
  * return (
143
- * <Image value={backgroundImage} className="h-full w-full object-cover" />
133
+ * <Image field={fields.backgroundImage} className="h-full w-full object-cover" />
144
134
  * );
145
135
  * }
146
136
  * ```
147
137
  */
148
138
  declare function Image(props: {
149
- /** Portable image or URL string from your component props. Do not also pass `name`. */
139
+ field?: Field$1<unknown>;
140
+ /** Computed image — requires `name`. */
150
141
  value?: unknown;
151
- /**
152
- * @deprecated Will be removed. Use `value={…}` and omit `name`.
153
- * Do not pass `name` together with `value`.
154
- */
142
+ /** Required with `value` for computed values. */
155
143
  name?: string;
156
144
  alt?: string;
157
145
  } & Omit<React__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
158
146
 
147
+ declare function ComposerProvider({ layoutNodeId, children, }: {
148
+ layoutNodeId?: string;
149
+ children: ReactNode;
150
+ }): react_jsx_runtime.JSX.Element;
151
+ declare function MaybeComposerProvider({ enabled, layoutNodeId, children, }: {
152
+ enabled: boolean;
153
+ layoutNodeId?: string;
154
+ children: ReactNode;
155
+ }): react_jsx_runtime.JSX.Element;
156
+
159
157
  interface AmplifyUpContextType {
160
158
  pageConfig: PageConfig | null;
161
159
  loading: boolean;
@@ -175,4 +173,4 @@ interface AmplifyUpProviderProps {
175
173
  declare function AmplifyUpProvider({ children, config, pageContext, }: AmplifyUpProviderProps): react_jsx_runtime.JSX.Element;
176
174
  declare function useAmplifyUp(): AmplifyUpContextType;
177
175
 
178
- export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ContentSource, Field, Image, PageConfig, RichText, Slot, useAmplifyUp, useComponentProps, useLiveComposerProps };
176
+ export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };