@amplifyup/sdk 0.1.34 → 0.1.36
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 +30 -2
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +140 -1
- package/dist/index.mjs.map +1 -1
- package/dist/query-6BmINKLR.d.mts +157 -0
- package/dist/query-DjIuJ71C.d.ts +157 -0
- package/dist/react.d.mts +1 -0
- package/dist/react.d.ts +1 -0
- package/dist/react.js +163 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +158 -2
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +147 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +140 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Official JavaScript SDK for [AmplifyUp](https://amplifyup.ai) — event tracking, Edge-resolved page layouts, personalization, and Composer preview on your site.
|
|
4
4
|
|
|
5
|
-
**Full guide:** [docs/
|
|
5
|
+
**Full guide:** [Developer docs](https://amplifyup.ai/docs/developers) · [API](https://amplifyup.ai/docs/api)
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -86,8 +86,36 @@ Field names must match the component registry in AmplifyUp. Connect CMS document
|
|
|
86
86
|
| Production visitors | Edge `/v1/resolve` | Default |
|
|
87
87
|
| Next.js SSG / ISR | Edge `/v1/routes` then `/v1/resolve` | `generateAmplifyStaticParams` + `fetchPageConfigServer` |
|
|
88
88
|
| Composer preview | Orchestrator layout provider | `?preview=true` / Composer iframe |
|
|
89
|
+
| Runtime queries | Edge `/v1/query` | `queryContent` — search, load more, pickers |
|
|
89
90
|
|
|
90
|
-
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.
|
|
91
|
+
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`).
|
|
92
|
+
|
|
93
|
+
## Runtime queries
|
|
94
|
+
|
|
95
|
+
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.
|
|
96
|
+
|
|
97
|
+
Mark a query connection **paginated** in Composer and the list prop gains pagination meta, including the published query spec:
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
'use client';
|
|
101
|
+
import { queryContent, nextPageSpec, searchSpec } from '@amplifyup/sdk/react';
|
|
102
|
+
|
|
103
|
+
// next page
|
|
104
|
+
const more = await queryContent({
|
|
105
|
+
trackingId,
|
|
106
|
+
route: '/insights',
|
|
107
|
+
spec: nextPageSpec(postsPagination),
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// search — keep `?q=` as input only; do not read searchParams on the server page
|
|
111
|
+
const hits = await queryContent({
|
|
112
|
+
trackingId,
|
|
113
|
+
route: '/insights',
|
|
114
|
+
spec: searchSpec(postsPagination, 'title', term),
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Only entities published with that route can be queried, and visitors only see published content. Also available from `@amplifyup/sdk/server`. See the [runtime queries guide](../../docs/sdk-site-setup.md#8-runtime-content-queries).
|
|
91
119
|
|
|
92
120
|
## Track events
|
|
93
121
|
|