@amplifyup/sdk 0.1.77 → 0.1.79

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.
Files changed (48) hide show
  1. package/README.md +93 -28
  2. package/dist/AmplifyRenderer-BNWBrFQN.d.ts +47 -0
  3. package/dist/AmplifyRenderer-CPUr9Bkc.d.mts +47 -0
  4. package/dist/AmplifyRenderer.d.mts +4 -40
  5. package/dist/AmplifyRenderer.d.ts +4 -40
  6. package/dist/AmplifyRenderer.js +119 -17
  7. package/dist/AmplifyRenderer.js.map +1 -1
  8. package/dist/AmplifyRenderer.mjs +119 -17
  9. package/dist/AmplifyRenderer.mjs.map +1 -1
  10. package/dist/cli.d.mts +1 -0
  11. package/dist/cli.d.ts +1 -0
  12. package/dist/cli.js +266 -0
  13. package/dist/cli.js.map +1 -0
  14. package/dist/cli.mjs +260 -0
  15. package/dist/cli.mjs.map +1 -0
  16. package/dist/config.d.mts +18 -0
  17. package/dist/config.d.ts +18 -0
  18. package/dist/config.js +10 -0
  19. package/dist/config.js.map +1 -0
  20. package/dist/config.mjs +8 -0
  21. package/dist/config.mjs.map +1 -0
  22. package/dist/index.d.mts +3 -3
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +6 -5
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +6 -5
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/next.d.mts +9 -0
  29. package/dist/next.d.ts +9 -0
  30. package/dist/next.js +259 -0
  31. package/dist/next.js.map +1 -0
  32. package/dist/next.mjs +253 -0
  33. package/dist/next.mjs.map +1 -0
  34. package/dist/query-DYjs4LQQ.d.mts +262 -0
  35. package/dist/query-Xo9cy-2F.d.ts +262 -0
  36. package/dist/react.d.mts +19 -21
  37. package/dist/react.d.ts +19 -21
  38. package/dist/react.js +1488 -1336
  39. package/dist/react.js.map +1 -1
  40. package/dist/react.mjs +1488 -1337
  41. package/dist/react.mjs.map +1 -1
  42. package/dist/server.d.mts +3 -3
  43. package/dist/server.d.ts +3 -3
  44. package/dist/{types-D4TSd2Yt.d.mts → types-ffQNIQCK.d.mts} +1 -102
  45. package/dist/{types-D4TSd2Yt.d.ts → types-ffQNIQCK.d.ts} +1 -102
  46. package/package.json +17 -2
  47. package/dist/query-B23UsNIv.d.ts +0 -161
  48. package/dist/query-CV8x3oQT.d.mts +0 -161
package/README.md CHANGED
@@ -28,42 +28,37 @@ export default function RootLayout({ children }) {
28
28
  }
29
29
  ```
30
30
 
31
- ### 2. Page content
31
+ ### 2. Component registry
32
32
 
33
- ```tsx
34
- import { AmplifyPageContent, ComponentContextProvider } from '@amplifyup/sdk/react';
35
- import { Hero } from '@/components/Hero';
33
+ Wrap your Next config with `withAmplifyUp`. It builds your **component registry** from `src/components` (or `components/` when there is no `src/`) every time `next dev` or `next build` runs, and keeps it current while you work.
36
34
 
37
- const registry = { Hero };
35
+ ```js
36
+ // next.config.js
37
+ const { withAmplifyUp } = require('@amplifyup/sdk/next');
38
38
 
39
- function renderComponent(componentId, props, slots, context) {
40
- const Component = registry[componentId];
41
- if (!Component) return null;
42
- return (
43
- <ComponentContextProvider
44
- props={props}
45
- slots={slots}
46
- layoutNodeId={context?.layoutNodeId}
47
- componentId={componentId}
48
- >
49
- <Component {...props} />
50
- </ComponentContextProvider>
51
- );
52
- }
39
+ module.exports = withAmplifyUp({
40
+ // your existing Next config
41
+ });
42
+ ```
43
+
44
+ You never register components by hand. Adding a component means adding a file.
45
+
46
+ ### 3. Page content
47
+
48
+ Render `<AmplifyPage />` from the generated registry:
49
+
50
+ ```tsx
51
+ import { AmplifyPage } from '@/.amplifyup/component-registry';
53
52
 
54
53
  export default function Page() {
55
- return (
56
- <AmplifyPageContent
57
- renderComponent={renderComponent}
58
- fallback={<YourStaticPage />}
59
- />
60
- );
54
+ return <AmplifyPage fallback={<YourStaticPage />} />;
61
55
  }
62
56
  ```
63
57
 
64
- ### 3. Write a component
58
+ ### 4. Write a component
65
59
 
66
60
  ```tsx
61
+ // src/components/Hero.tsx
67
62
  import { Field } from '@amplifyup/sdk/react';
68
63
  import type { Fields } from '@amplifyup/sdk/react';
69
64
 
@@ -84,6 +79,72 @@ That's the whole loop. The rest of this section is the detail.
84
79
 
85
80
  ---
86
81
 
82
+ ## Component registry
83
+
84
+ The SDK owns how layout components are found and rendered. Your site supplies the components; the SDK builds the lookup, renders each component, and gives it the context `Field`, `Slot`, `Image` and `RichText` read. Writing that lookup yourself is not supported.
85
+
86
+ ### How components are found
87
+
88
+ | File | Registry name |
89
+ | --- | --- |
90
+ | `src/components/Hero.tsx` | `Hero` |
91
+ | `src/components/Hero/index.tsx` | `Hero` |
92
+ | `src/components/marketing/promo-card.tsx` | `promo-card` |
93
+
94
+ - Each file needs a default export, or a named export with the same name as the file (`export function Hero`).
95
+ - Names match the component ID in AmplifyUp regardless of case and separators, so `Hero`, `hero` and `HERO` are the same component, and so are `promo-card` and `PromoCard`.
96
+ - Tests, stories and type files are skipped. Files that don't export a component are listed as skipped when the registry builds.
97
+ - Two files that resolve to the same name stop the build and name both files.
98
+
99
+ ### Settings
100
+
101
+ `amplifyup.config.ts` in your project root is optional. Use it when your components live elsewhere:
102
+
103
+ ```ts
104
+ import { defineAmplifyConfig } from '@amplifyup/sdk/config';
105
+
106
+ export default defineAmplifyConfig({
107
+ components: {
108
+ roots: ['src/components', 'src/marketing'],
109
+ exclude: ['**/internal/**'],
110
+ },
111
+ });
112
+ ```
113
+
114
+ | Setting | Default |
115
+ | --- | --- |
116
+ | `roots` | `['src/components']`, or `['components']` without `src/` |
117
+ | `exclude` | none (tests, stories and type files are always skipped) |
118
+ | `output` | `.amplifyup/component-registry` next to your first root |
119
+
120
+ The generated `.amplifyup` folder ignores itself in git. Don't edit it.
121
+
122
+ ### Without the Next plugin
123
+
124
+ For CI steps or non-Next builds, run the CLI before your build:
125
+
126
+ ```bash
127
+ npx amplifyup registry # build once
128
+ npx amplifyup registry --watch # rebuild as files are added, renamed or removed
129
+ ```
130
+
131
+ ### Missing components
132
+
133
+ If a page uses a component that isn't in your registry, Composer shows a placeholder naming it, and the live page renders nothing in its place. Add a file with that name to your components folder.
134
+
135
+ ---
136
+
137
+ ## Upgrading from 0.1
138
+
139
+ 0.2.0 removes hand-written rendering. `renderComponent` and the `ComponentContextProvider` export are gone, and passing `renderComponent` throws an error that points here.
140
+
141
+ 1. Delete your component lookup object and your `renderComponent` function.
142
+ 2. Wrap `next.config` with `withAmplifyUp` (see [Component registry](#2-component-registry)).
143
+ 3. Replace `<AmplifyPageContent renderComponent={…} />` with `<AmplifyPage />` from `@/.amplifyup/component-registry`. Every other prop (`fallback`, `pageConfig`, loading and empty states) stays the same.
144
+ 4. Check that each component file name matches its component ID in AmplifyUp (see [How components are found](#how-components-are-found)).
145
+
146
+ ---
147
+
87
148
  ## Working with `fields`
88
149
 
89
150
  Every component receives a `fields` prop. It is not raw CMS data — every entry is a **field envelope**:
@@ -431,7 +492,7 @@ export function TwoColumn() {
431
492
  }
432
493
  ```
433
494
 
434
- `<Slot>` takes only `name` and `className`. It reads the slot content from `ComponentContextProvider`, so you never thread a `slots` prop through your component.
495
+ `<Slot>` takes only `name` and `className`. The SDK hands each component its slot content when it renders it, so you never thread a `slots` prop through your component.
435
496
 
436
497
  ```tsx
437
498
  // ✗ — Slot has no `slots` prop
@@ -476,7 +537,9 @@ In development the SDK tells you exactly what is wrong. Production is silent.
476
537
  | `title has no write target; rendered read-only.` | A row field the SDK can't trace to a record | Bind the list to a connection, or query with the published spec |
477
538
  | `Field value={…} requires name="…" for computed values` | You passed `value` without `name` | Add `name={fields.x.name}` |
478
539
  | `Field needs field={fields.yourProp} (or value + name for computed values)` | No binding at all | Pass `field=` |
479
- | `Slot "left" used outside ComponentContextProvider` | The component wasn't wrapped when rendered | Wrap it in `renderComponent` |
540
+ | `Slot "left" only works inside a component rendered from your component registry` | `Slot` is used in a component the SDK didn't render | Use `Slot` only inside components in your components folder |
541
+ | `No component in your component registry matches "Hero"` | The page uses a component your site doesn't have | Add `Hero.tsx` (or a matching name) to your components folder |
542
+ | `renderComponent was removed in @amplifyup/sdk 0.2.0` | Code from 0.1 is still passing a render function | Follow [Upgrading from 0.1](#upgrading-from-01) |
480
543
 
481
544
  ---
482
545
 
@@ -550,6 +613,8 @@ Pass `pageContext` at provider/init for From-page components. Do not wait until
550
613
 
551
614
  The SDK maps Edge's resolved tree into `layoutTree` and renders it. Edge already applies personalization and CMS projection — the site does not call CMS or Decision APIs for layout. After paint, the overlay calls `POST /v1/select` (or `selectVariants()`) then `/v1/resolve?variants=` so decisions stay on the edge (`clientPersonalization`).
552
615
 
616
+ Wrap your whole site in `AmplifyUpProvider` so every page is tracked. The overlay only runs on pages that render `AmplifyPageContent` (or `AmplifyRenderer` without a `pageConfig`). Pages you build yourself are tracked but never request a layout.
617
+
553
618
  ## Runtime queries
554
619
 
555
620
  Page resolve covers data known at Deploy. For data a visitor asks for — search, load more, a picker — use `queryContent`. The browser asks AmplifyUp, AmplifyUp asks your content source, so no CMS credentials or query syntax live in your site.
@@ -0,0 +1,47 @@
1
+ import * as react from 'react';
2
+ import { ComponentType, ReactNode } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { P as PageConfig } from './types-ffQNIQCK.js';
5
+
6
+ declare const REGISTRY_BRAND: unique symbol;
7
+ type SiteComponent = ComponentType<any>;
8
+ type ComponentRegistry = {
9
+ readonly [REGISTRY_BRAND]: true;
10
+ /** Components by registry name (file name), as generated. */
11
+ readonly components: Readonly<Record<string, SiteComponent>>;
12
+ /** Looks up a layout component ID with the shared matching rule. */
13
+ resolve: (componentId: string) => SiteComponent | undefined;
14
+ };
15
+ /** Called by the generated `component-registry` module — sites don't call this by hand. */
16
+ declare const defineComponentRegistry: (components: Record<string, SiteComponent>) => ComponentRegistry;
17
+
18
+ interface AmplifyRendererProps {
19
+ /** The generated component registry (see `withAmplifyUp`). */
20
+ registry: ComponentRegistry;
21
+ /**
22
+ * Optional page config for server-side rendering (SSR/SSG)
23
+ * If provided, the component will use this instead of fetching client-side
24
+ */
25
+ pageConfig?: PageConfig;
26
+ /**
27
+ * Optional loading component
28
+ */
29
+ loadingComponent?: ReactNode;
30
+ /**
31
+ * Optional error component
32
+ */
33
+ errorComponent?: (error: string) => ReactNode;
34
+ /**
35
+ * Optional empty state component (when no content is configured)
36
+ */
37
+ emptyComponent?: ReactNode;
38
+ /**
39
+ * Force Composer page-slot wrapper (avoids SSR miss when window isn't available yet).
40
+ * When true, root components stay under [data-slot-source="page"] so hierarchy can climb to Page.
41
+ */
42
+ composerPreview?: boolean;
43
+ }
44
+ declare function AmplifyRendererInner(rendererProps: AmplifyRendererProps): react_jsx_runtime.JSX.Element | null;
45
+ declare const AmplifyRenderer: react.MemoExoticComponent<typeof AmplifyRendererInner>;
46
+
47
+ export { AmplifyRenderer as A, type ComponentRegistry as C, defineComponentRegistry as d };
@@ -0,0 +1,47 @@
1
+ import * as react from 'react';
2
+ import { ComponentType, ReactNode } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { P as PageConfig } from './types-ffQNIQCK.mjs';
5
+
6
+ declare const REGISTRY_BRAND: unique symbol;
7
+ type SiteComponent = ComponentType<any>;
8
+ type ComponentRegistry = {
9
+ readonly [REGISTRY_BRAND]: true;
10
+ /** Components by registry name (file name), as generated. */
11
+ readonly components: Readonly<Record<string, SiteComponent>>;
12
+ /** Looks up a layout component ID with the shared matching rule. */
13
+ resolve: (componentId: string) => SiteComponent | undefined;
14
+ };
15
+ /** Called by the generated `component-registry` module — sites don't call this by hand. */
16
+ declare const defineComponentRegistry: (components: Record<string, SiteComponent>) => ComponentRegistry;
17
+
18
+ interface AmplifyRendererProps {
19
+ /** The generated component registry (see `withAmplifyUp`). */
20
+ registry: ComponentRegistry;
21
+ /**
22
+ * Optional page config for server-side rendering (SSR/SSG)
23
+ * If provided, the component will use this instead of fetching client-side
24
+ */
25
+ pageConfig?: PageConfig;
26
+ /**
27
+ * Optional loading component
28
+ */
29
+ loadingComponent?: ReactNode;
30
+ /**
31
+ * Optional error component
32
+ */
33
+ errorComponent?: (error: string) => ReactNode;
34
+ /**
35
+ * Optional empty state component (when no content is configured)
36
+ */
37
+ emptyComponent?: ReactNode;
38
+ /**
39
+ * Force Composer page-slot wrapper (avoids SSR miss when window isn't available yet).
40
+ * When true, root components stay under [data-slot-source="page"] so hierarchy can climb to Page.
41
+ */
42
+ composerPreview?: boolean;
43
+ }
44
+ declare function AmplifyRendererInner(rendererProps: AmplifyRendererProps): react_jsx_runtime.JSX.Element | null;
45
+ declare const AmplifyRenderer: react.MemoExoticComponent<typeof AmplifyRendererInner>;
46
+
47
+ export { AmplifyRenderer as A, type ComponentRegistry as C, defineComponentRegistry as d };
@@ -1,40 +1,4 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { L as LayoutComponentProps, P as PageConfig } from './types-D4TSd2Yt.mjs';
5
-
6
- interface AmplifyRendererProps {
7
- /**
8
- * Component renderer function that maps componentId to React component
9
- * This is site-specific and must be provided by the developer
10
- */
11
- renderComponent: (componentId: string, props: LayoutComponentProps, slots?: Record<string, ReactNode>, context?: {
12
- layoutNodeId: string;
13
- }) => ReactNode;
14
- /**
15
- * Optional page config for server-side rendering (SSR/SSG)
16
- * If provided, the component will use this instead of fetching client-side
17
- */
18
- pageConfig?: PageConfig;
19
- /**
20
- * Optional loading component
21
- */
22
- loadingComponent?: ReactNode;
23
- /**
24
- * Optional error component
25
- */
26
- errorComponent?: (error: string) => ReactNode;
27
- /**
28
- * Optional empty state component (when no content is configured)
29
- */
30
- emptyComponent?: ReactNode;
31
- /**
32
- * Force Composer page-slot wrapper (avoids SSR miss when window isn't available yet).
33
- * When true, root components stay under [data-slot-source="page"] so hierarchy can climb to Page.
34
- */
35
- composerPreview?: boolean;
36
- }
37
- declare function AmplifyRendererInner({ renderComponent, pageConfig: serverPageConfig, loadingComponent, errorComponent, emptyComponent, composerPreview, }: AmplifyRendererProps): react_jsx_runtime.JSX.Element | null;
38
- declare const AmplifyRenderer: react.MemoExoticComponent<typeof AmplifyRendererInner>;
39
-
40
- export { AmplifyRenderer };
1
+ import 'react';
2
+ import 'react/jsx-runtime';
3
+ export { A as AmplifyRenderer } from './AmplifyRenderer-CPUr9Bkc.mjs';
4
+ import './types-ffQNIQCK.mjs';
@@ -1,40 +1,4 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { L as LayoutComponentProps, P as PageConfig } from './types-D4TSd2Yt.js';
5
-
6
- interface AmplifyRendererProps {
7
- /**
8
- * Component renderer function that maps componentId to React component
9
- * This is site-specific and must be provided by the developer
10
- */
11
- renderComponent: (componentId: string, props: LayoutComponentProps, slots?: Record<string, ReactNode>, context?: {
12
- layoutNodeId: string;
13
- }) => ReactNode;
14
- /**
15
- * Optional page config for server-side rendering (SSR/SSG)
16
- * If provided, the component will use this instead of fetching client-side
17
- */
18
- pageConfig?: PageConfig;
19
- /**
20
- * Optional loading component
21
- */
22
- loadingComponent?: ReactNode;
23
- /**
24
- * Optional error component
25
- */
26
- errorComponent?: (error: string) => ReactNode;
27
- /**
28
- * Optional empty state component (when no content is configured)
29
- */
30
- emptyComponent?: ReactNode;
31
- /**
32
- * Force Composer page-slot wrapper (avoids SSR miss when window isn't available yet).
33
- * When true, root components stay under [data-slot-source="page"] so hierarchy can climb to Page.
34
- */
35
- composerPreview?: boolean;
36
- }
37
- declare function AmplifyRendererInner({ renderComponent, pageConfig: serverPageConfig, loadingComponent, errorComponent, emptyComponent, composerPreview, }: AmplifyRendererProps): react_jsx_runtime.JSX.Element | null;
38
- declare const AmplifyRenderer: react.MemoExoticComponent<typeof AmplifyRendererInner>;
39
-
40
- export { AmplifyRenderer };
1
+ import 'react';
2
+ import 'react/jsx-runtime';
3
+ export { A as AmplifyRenderer } from './AmplifyRenderer-BNWBrFQN.js';
4
+ import './types-ffQNIQCK.js';
@@ -168,6 +168,7 @@ var AWSAdapter = class {
168
168
  return;
169
169
  }
170
170
  const trackingId = eventData?.trackingId || this.config?.trackingId;
171
+ const debug = this.config?.debug;
171
172
  const query = trackingId ? `?tid=${encodeURIComponent(trackingId)}` : "";
172
173
  const url = `${this.apiGatewayUrl}${endpoint}${query}`;
173
174
  try {
@@ -182,15 +183,15 @@ var AWSAdapter = class {
182
183
  keepalive: true
183
184
  });
184
185
  if (!response.ok) {
185
- if (this.config.debug) {
186
+ if (debug) {
186
187
  console.warn(`AmplifyUp SDK: Event tracking failed: ${response.status} ${response.statusText}`);
187
188
  }
188
- } else if (this.config.debug) {
189
+ } else if (debug) {
189
190
  const result = await response.json().catch(() => ({}));
190
191
  console.log("AmplifyUp SDK: Event tracked", result);
191
192
  }
192
193
  } catch (error) {
193
- if (this.config.debug) {
194
+ if (debug) {
194
195
  console.error("AmplifyUp SDK: Event tracking error:", error);
195
196
  }
196
197
  }
@@ -3565,6 +3566,14 @@ function getSDK(adapter) {
3565
3566
  var trackContentView = (contentId, contentType, properties) => getSDK().trackContentView(contentId, contentType, properties);
3566
3567
  var refreshEventTracking = () => getSDK().refreshEventTracking();
3567
3568
  getSDK();
3569
+ var PageContentRegistryContext = react.createContext(null);
3570
+ function useRegisterPageContent(enabled = true) {
3571
+ const register = react.useContext(PageContentRegistryContext);
3572
+ react.useEffect(() => {
3573
+ if (!enabled || !register) return;
3574
+ return register();
3575
+ }, [enabled, register]);
3576
+ }
3568
3577
  function useInComposer(force = false) {
3569
3578
  const [detected, setDetected] = react.useState(false);
3570
3579
  react.useEffect(() => {
@@ -3703,7 +3712,89 @@ function MaybeComposerProvider({
3703
3712
  }) {
3704
3713
  return /* @__PURE__ */ jsxRuntime.jsx(ComposerProvider, { enabled, children: /* @__PURE__ */ jsxRuntime.jsx(ComposerNodeContext.Provider, { value: enabled ? layoutNodeId : void 0, children }) });
3705
3714
  }
3706
- react.createContext(null);
3715
+ var ComponentContext = react.createContext(null);
3716
+ function ComponentContextProvider({
3717
+ children,
3718
+ slots,
3719
+ props,
3720
+ layoutNodeId,
3721
+ componentId
3722
+ }) {
3723
+ const next = hydratePageResourceProps(props || {}, getPageResourceFields());
3724
+ return /* @__PURE__ */ jsxRuntime.jsx(
3725
+ ComponentContext.Provider,
3726
+ {
3727
+ value: { slots, props: next, layoutNodeId, componentId },
3728
+ children
3729
+ }
3730
+ );
3731
+ }
3732
+ var REGISTRY_BRAND = Symbol.for("amplifyup.componentRegistry");
3733
+ var isComponentRegistry = (value) => !!value && typeof value === "object" && value[REGISTRY_BRAND] === true;
3734
+ var warnedMissing = /* @__PURE__ */ new Set();
3735
+ var warnMissingOnce = (componentId) => {
3736
+ if (warnedMissing.has(componentId)) return;
3737
+ warnedMissing.add(componentId);
3738
+ console.warn(
3739
+ `[Amplify UP] No component in your component registry matches "${componentId}". Add a file with that name to your components folder.`
3740
+ );
3741
+ };
3742
+ var MissingComponentHint = ({ componentId }) => /* @__PURE__ */ jsxRuntime.jsxs(
3743
+ "div",
3744
+ {
3745
+ "data-amplifyup-missing-component": componentId,
3746
+ style: {
3747
+ margin: "0.5rem 0",
3748
+ padding: "0.75rem 1rem",
3749
+ border: "1.5px dashed currentColor",
3750
+ borderRadius: 8,
3751
+ opacity: 0.7,
3752
+ fontSize: 14,
3753
+ textAlign: "center"
3754
+ },
3755
+ children: [
3756
+ "\u201C",
3757
+ componentId,
3758
+ "\u201D isn\u2019t set up on this site yet."
3759
+ ]
3760
+ }
3761
+ );
3762
+ var RegistryComponent = ({
3763
+ registry,
3764
+ componentId,
3765
+ props,
3766
+ slots,
3767
+ layoutNodeId,
3768
+ composerPreview
3769
+ }) => {
3770
+ const Component2 = registry.resolve(componentId);
3771
+ if (!Component2) {
3772
+ warnMissingOnce(componentId);
3773
+ return composerPreview ? /* @__PURE__ */ jsxRuntime.jsx(MissingComponentHint, { componentId }) : null;
3774
+ }
3775
+ return /* @__PURE__ */ jsxRuntime.jsx(
3776
+ ComponentContextProvider,
3777
+ {
3778
+ props,
3779
+ slots,
3780
+ layoutNodeId,
3781
+ componentId,
3782
+ children: /* @__PURE__ */ jsxRuntime.jsx(Component2, { ...props })
3783
+ }
3784
+ );
3785
+ };
3786
+ var assertComponentRegistry = (owner, props) => {
3787
+ if ("renderComponent" in props) {
3788
+ throw new Error(
3789
+ `[Amplify UP] ${owner}: renderComponent was removed in @amplifyup/sdk 0.2.0. Components now load automatically \u2014 wrap next.config with withAmplifyUp and render <AmplifyPage /> from the generated component registry. See "Upgrading from 0.1" in the SDK README.`
3790
+ );
3791
+ }
3792
+ if (!isComponentRegistry(props.registry)) {
3793
+ throw new Error(
3794
+ `[Amplify UP] ${owner} needs your component registry. Render <AmplifyPage /> from the generated .amplifyup/component-registry module (created by withAmplifyUp or \`amplifyup registry\`).`
3795
+ );
3796
+ }
3797
+ };
3707
3798
  var usePathname = null;
3708
3799
  if (typeof window !== "undefined") {
3709
3800
  try {
@@ -3790,22 +3881,33 @@ function NodeWithFields({
3790
3881
  componentId,
3791
3882
  props,
3792
3883
  slots,
3793
- renderComponent,
3884
+ registry,
3794
3885
  composerPreview
3795
3886
  }) {
3796
- return /* @__PURE__ */ jsxRuntime.jsx(MaybeComposerProvider, { enabled: !!composerPreview, layoutNodeId: nodeId, children: renderComponent(componentId, props, slots, {
3797
- layoutNodeId: nodeId
3798
- }) });
3887
+ return /* @__PURE__ */ jsxRuntime.jsx(MaybeComposerProvider, { enabled: !!composerPreview, layoutNodeId: nodeId, children: /* @__PURE__ */ jsxRuntime.jsx(
3888
+ RegistryComponent,
3889
+ {
3890
+ registry,
3891
+ componentId,
3892
+ props,
3893
+ slots,
3894
+ layoutNodeId: nodeId,
3895
+ composerPreview: !!composerPreview
3896
+ }
3897
+ ) });
3799
3898
  }
3800
- function AmplifyRendererInner({
3801
- renderComponent,
3802
- pageConfig: serverPageConfig,
3803
- loadingComponent,
3804
- errorComponent,
3805
- emptyComponent,
3806
- composerPreview
3807
- }) {
3899
+ function AmplifyRendererInner(rendererProps) {
3900
+ assertComponentRegistry("AmplifyRenderer", rendererProps);
3901
+ const {
3902
+ registry,
3903
+ pageConfig: serverPageConfig,
3904
+ loadingComponent,
3905
+ errorComponent,
3906
+ emptyComponent,
3907
+ composerPreview
3908
+ } = rendererProps;
3808
3909
  const clientHook = useAmplifyUp();
3910
+ useRegisterPageContent(!serverPageConfig);
3809
3911
  const composerPreviewFlag = useComposerPreviewFlag(!!composerPreview);
3810
3912
  const pageConfig = serverPageConfig || clientHook.pageConfig || null;
3811
3913
  const loading = serverPageConfig ? false : clientHook.loading;
@@ -4139,7 +4241,7 @@ function AmplifyRendererInner({
4139
4241
  componentId: node.componentId,
4140
4242
  props: nodeRenderProps(node),
4141
4243
  slots: slotsToPass,
4142
- renderComponent,
4244
+ registry,
4143
4245
  composerPreview: composerPreviewFlag
4144
4246
  }
4145
4247
  )