@amplifyup/sdk 0.2.5 → 0.3.1-uat.104.gfd92fe0
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 +29 -1
- package/dist/{AmplifyRenderer-eGtn5k9_.d.mts → AmplifyRenderer-CwAYY8K1.d.mts} +1 -1
- package/dist/{AmplifyRenderer-CTwblDs3.d.ts → AmplifyRenderer-D40crBWY.d.ts} +1 -1
- package/dist/AmplifyRenderer.d.mts +2 -2
- package/dist/AmplifyRenderer.d.ts +2 -2
- package/dist/AmplifyRenderer.js +1 -1
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +1 -1
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +290 -4
- package/dist/index.d.ts +290 -4
- package/dist/index.js +105 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -7
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +100 -7
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +99 -7
- package/dist/next.mjs.map +1 -1
- package/dist/{query-Bs5o-qmw.d.ts → query-BeQibYGm.d.ts} +1 -1
- package/dist/{query-CYRvyIv0.d.mts → query-CwtZtJX8.d.mts} +1 -1
- package/dist/react.d.mts +6 -6
- package/dist/react.d.ts +6 -6
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +2 -2
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/{types-ffQNIQCK.d.ts → types-CxucvIL6.d.mts} +1 -1
- package/dist/{types-ffQNIQCK.d.mts → types-CxucvIL6.d.ts} +1 -1
- package/package.json +8 -7
- package/dist/cli.d.mts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -266
- package/dist/cli.js.map +0 -1
- package/dist/cli.mjs +0 -260
- package/dist/cli.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as PageConfig, C as ContentSource,
|
|
2
|
-
export { Z as ZoneConfig,
|
|
1
|
+
import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as PageDataSnapshot, R as ResolvedPageResourceRef, b as PageTaxonomies, c as CDPAdapter, d as AmplifyUpConfig, e as EventProperties, f as AmplifyPageContextInput, g as AttachedPageEventContext, I as IdentifyInput, h as IdentifyTraits, i as ProfileFieldsInput, j as AmplifyUpTarget } from './types-CxucvIL6.mjs';
|
|
2
|
+
export { Z as ZoneConfig, k as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, l as resolveAmplifyUpUrls } from './types-CxucvIL6.mjs';
|
|
3
3
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
|
|
4
4
|
export { A as AMPLIFYUP_EDITOR_ROUTE, i as isAmplifyUpEditorRoute } from './reservedRoutes-aGgViBDM.mjs';
|
|
5
|
-
export { F as FetchEdgeQueryOptions, a as FetchEdgeSelectOptions, Q as QueryContentError, b as QueryContentOptions, c as QueryFilter, d as QueryFilterOp, e as QueryPagination, f as QueryResult, g as QuerySort, h as QuerySpec, S as SelectVariantsError, i as SelectVariantsOptions, j as SelectVariantsResult, k as fetchEdgeQuery, l as fetchEdgeSelect, n as nextPageSpec, q as queryContent, s as searchSpec, m as selectVariants } from './query-
|
|
5
|
+
export { F as FetchEdgeQueryOptions, a as FetchEdgeSelectOptions, Q as QueryContentError, b as QueryContentOptions, c as QueryFilter, d as QueryFilterOp, e as QueryPagination, f as QueryResult, g as QuerySort, h as QuerySpec, S as SelectVariantsError, i as SelectVariantsOptions, j as SelectVariantsResult, k as fetchEdgeQuery, l as fetchEdgeSelect, n as nextPageSpec, q as queryContent, s as searchSpec, m as selectVariants } from './query-CwtZtJX8.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Storage utilities for instance ID and user ID
|
|
@@ -118,6 +118,292 @@ declare function fetchEdgeResolve(options: {
|
|
|
118
118
|
revalidate?: number | false;
|
|
119
119
|
}): Promise<EdgeResolvedPayload>;
|
|
120
120
|
|
|
121
|
+
/**
|
|
122
|
+
* This file was auto-generated by openapi-typescript.
|
|
123
|
+
* Do not make direct changes to the file.
|
|
124
|
+
*/
|
|
125
|
+
interface paths {
|
|
126
|
+
"/v1/forms/{formId}": {
|
|
127
|
+
parameters: {
|
|
128
|
+
query?: never;
|
|
129
|
+
header?: never;
|
|
130
|
+
path?: never;
|
|
131
|
+
cookie?: never;
|
|
132
|
+
};
|
|
133
|
+
get: operations["getFormDefinition"];
|
|
134
|
+
put?: never;
|
|
135
|
+
post?: never;
|
|
136
|
+
delete?: never;
|
|
137
|
+
options?: never;
|
|
138
|
+
head?: never;
|
|
139
|
+
patch?: never;
|
|
140
|
+
trace?: never;
|
|
141
|
+
};
|
|
142
|
+
"/v1/forms/{formId}/submit": {
|
|
143
|
+
parameters: {
|
|
144
|
+
query?: never;
|
|
145
|
+
header?: never;
|
|
146
|
+
path?: never;
|
|
147
|
+
cookie?: never;
|
|
148
|
+
};
|
|
149
|
+
get?: never;
|
|
150
|
+
put?: never;
|
|
151
|
+
post: operations["submitForm"];
|
|
152
|
+
delete?: never;
|
|
153
|
+
options?: never;
|
|
154
|
+
head?: never;
|
|
155
|
+
patch?: never;
|
|
156
|
+
trace?: never;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
interface components {
|
|
160
|
+
schemas: {
|
|
161
|
+
DeliveryErrorBody: {
|
|
162
|
+
error: string;
|
|
163
|
+
};
|
|
164
|
+
FormDefinition: {
|
|
165
|
+
id: string;
|
|
166
|
+
key: string;
|
|
167
|
+
version: number;
|
|
168
|
+
title?: string;
|
|
169
|
+
intro?: string;
|
|
170
|
+
/** @description Every field, in order. Renderers that ignore `steps` show these on one page. */
|
|
171
|
+
fields: components["schemas"]["FormField"][];
|
|
172
|
+
/** @description Headings, paragraphs and fields per step. Absent means one step with `fields` in order. */
|
|
173
|
+
steps?: components["schemas"]["FormStep"][];
|
|
174
|
+
submit: components["schemas"]["FormSubmitSettings"];
|
|
175
|
+
onSuccess: components["schemas"]["FormOnSuccess"];
|
|
176
|
+
honeypot: components["schemas"]["FormHoneypot"];
|
|
177
|
+
};
|
|
178
|
+
FormField: {
|
|
179
|
+
/** @description Key the submitted value is posted under. */
|
|
180
|
+
key: string;
|
|
181
|
+
type: components["schemas"]["FormFieldType"];
|
|
182
|
+
label?: string;
|
|
183
|
+
required?: boolean;
|
|
184
|
+
placeholder?: string;
|
|
185
|
+
/** @description For `select`, `radio` and `checkboxes`. */
|
|
186
|
+
options?: components["schemas"]["FormFieldOption"][];
|
|
187
|
+
/** @description Initial value; the posted value for `hidden`. */
|
|
188
|
+
defaultValue?: string;
|
|
189
|
+
/** @description Half-width fields sit side by side on wide screens. Defaults to full. */
|
|
190
|
+
width?: components["schemas"]["FormFieldWidth"];
|
|
191
|
+
/** @description For `hidden`: filled from this parameter of the page URL, when present. */
|
|
192
|
+
fromQuery?: components["schemas"]["FormQueryParam"];
|
|
193
|
+
};
|
|
194
|
+
FormFieldOption: {
|
|
195
|
+
label: string;
|
|
196
|
+
value: string;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* @description Delivery API for published forms, as the form packages see it. GET /v1/forms/{formId}?trackingId= → FormDefinition POST /v1/forms/{formId}/submit?trackingId= → SubmitFormSuccess | 422 SubmitFormValidationError Optional header `x-amplifyup-consent: granted | denied` — what the site's consent banner reported.
|
|
200
|
+
*
|
|
201
|
+
* Source of truth for `openapi/delivery.json` (scripts/generate-openapi.mjs). Never carries mapping metadata: what a submission writes to is platform-only.
|
|
202
|
+
* @enum {string}
|
|
203
|
+
*/
|
|
204
|
+
FormFieldType: "text" | "email" | "phone" | "number" | "date" | "textarea" | "select" | "radio" | "checkboxes" | "checkbox" | "consent" | "hidden";
|
|
205
|
+
/** @enum {string} */
|
|
206
|
+
FormFieldWidth: "full" | "half";
|
|
207
|
+
FormHoneypot: {
|
|
208
|
+
/** @description Field name to post empty; bots that fill it are dropped. */
|
|
209
|
+
name: string;
|
|
210
|
+
};
|
|
211
|
+
FormOnSuccess: components["schemas"]["FormSuccessMessage"] | components["schemas"]["FormSuccessRedirect"];
|
|
212
|
+
/**
|
|
213
|
+
* @description UTM parameters a hidden field can be filled from.
|
|
214
|
+
* @enum {string}
|
|
215
|
+
*/
|
|
216
|
+
FormQueryParam: "utm_source" | "utm_medium" | "utm_campaign" | "utm_term" | "utm_content";
|
|
217
|
+
/** @description One page of a multi-step form, in display order. */
|
|
218
|
+
FormStep: {
|
|
219
|
+
title?: string;
|
|
220
|
+
items: components["schemas"]["FormStepItem"][];
|
|
221
|
+
};
|
|
222
|
+
FormStepField: {
|
|
223
|
+
/** @constant */
|
|
224
|
+
kind: "field";
|
|
225
|
+
/** @description A key in `fields`. */
|
|
226
|
+
key: string;
|
|
227
|
+
};
|
|
228
|
+
FormStepItem: components["schemas"]["FormStepField"] | components["schemas"]["FormStepText"];
|
|
229
|
+
FormStepText: {
|
|
230
|
+
/** @enum {string} */
|
|
231
|
+
kind: "heading" | "paragraph";
|
|
232
|
+
text: string;
|
|
233
|
+
};
|
|
234
|
+
FormSubmitSettings: {
|
|
235
|
+
label: string;
|
|
236
|
+
};
|
|
237
|
+
FormSuccessMessage: {
|
|
238
|
+
/** @constant */
|
|
239
|
+
type: "message";
|
|
240
|
+
message: string;
|
|
241
|
+
};
|
|
242
|
+
FormSuccessRedirect: {
|
|
243
|
+
/** @constant */
|
|
244
|
+
type: "redirect";
|
|
245
|
+
url: string;
|
|
246
|
+
};
|
|
247
|
+
/** @description Text for most fields, true/false for `checkbox` and `consent`, the chosen values for `checkboxes`. */
|
|
248
|
+
FormValue: string | boolean | string[];
|
|
249
|
+
SubmitFormRequest: {
|
|
250
|
+
/** @description Field values by key, including the honeypot key. */
|
|
251
|
+
values: {
|
|
252
|
+
[key: string]: components["schemas"]["FormValue"];
|
|
253
|
+
};
|
|
254
|
+
/** @description The page the form was on. Only its path and UTM parameters are kept. */
|
|
255
|
+
page?: string;
|
|
256
|
+
};
|
|
257
|
+
SubmitFormSuccess: {
|
|
258
|
+
onSuccess: components["schemas"]["FormOnSuccess"];
|
|
259
|
+
};
|
|
260
|
+
SubmitFormValidationError: {
|
|
261
|
+
/** @description Message per field key. */
|
|
262
|
+
errors: {
|
|
263
|
+
[key: string]: string;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
responses: never;
|
|
268
|
+
parameters: never;
|
|
269
|
+
requestBodies: never;
|
|
270
|
+
headers: never;
|
|
271
|
+
pathItems: never;
|
|
272
|
+
}
|
|
273
|
+
interface operations {
|
|
274
|
+
getFormDefinition: {
|
|
275
|
+
parameters: {
|
|
276
|
+
query: {
|
|
277
|
+
trackingId: string;
|
|
278
|
+
};
|
|
279
|
+
header?: never;
|
|
280
|
+
path: {
|
|
281
|
+
formId: string;
|
|
282
|
+
};
|
|
283
|
+
cookie?: never;
|
|
284
|
+
};
|
|
285
|
+
requestBody?: never;
|
|
286
|
+
responses: {
|
|
287
|
+
/** @description Published form definition */
|
|
288
|
+
200: {
|
|
289
|
+
headers: {
|
|
290
|
+
[name: string]: unknown;
|
|
291
|
+
};
|
|
292
|
+
content: {
|
|
293
|
+
"application/json": components["schemas"]["FormDefinition"];
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
/** @description Unknown tracking id or no published form */
|
|
297
|
+
404: {
|
|
298
|
+
headers: {
|
|
299
|
+
[name: string]: unknown;
|
|
300
|
+
};
|
|
301
|
+
content: {
|
|
302
|
+
"application/json": components["schemas"]["DeliveryErrorBody"];
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
submitForm: {
|
|
308
|
+
parameters: {
|
|
309
|
+
query: {
|
|
310
|
+
trackingId: string;
|
|
311
|
+
};
|
|
312
|
+
header?: never;
|
|
313
|
+
path: {
|
|
314
|
+
formId: string;
|
|
315
|
+
};
|
|
316
|
+
cookie?: never;
|
|
317
|
+
};
|
|
318
|
+
requestBody: {
|
|
319
|
+
content: {
|
|
320
|
+
"application/json": components["schemas"]["SubmitFormRequest"];
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
responses: {
|
|
324
|
+
/** @description Accepted */
|
|
325
|
+
200: {
|
|
326
|
+
headers: {
|
|
327
|
+
[name: string]: unknown;
|
|
328
|
+
};
|
|
329
|
+
content: {
|
|
330
|
+
"application/json": components["schemas"]["SubmitFormSuccess"];
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
/** @description Unknown tracking id or no published form */
|
|
334
|
+
404: {
|
|
335
|
+
headers: {
|
|
336
|
+
[name: string]: unknown;
|
|
337
|
+
};
|
|
338
|
+
content: {
|
|
339
|
+
"application/json": components["schemas"]["DeliveryErrorBody"];
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
/** @description Field errors */
|
|
343
|
+
422: {
|
|
344
|
+
headers: {
|
|
345
|
+
[name: string]: unknown;
|
|
346
|
+
};
|
|
347
|
+
content: {
|
|
348
|
+
"application/json": components["schemas"]["SubmitFormValidationError"];
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Typed client for published forms on the Amplify UP delivery API.
|
|
357
|
+
* Types are generated from the platform's API spec (see `npm run codegen`).
|
|
358
|
+
*/
|
|
359
|
+
|
|
360
|
+
type Schemas = components['schemas'];
|
|
361
|
+
type FormDefinition = Schemas['FormDefinition'];
|
|
362
|
+
type FormField = Schemas['FormField'];
|
|
363
|
+
type FormFieldType = Schemas['FormFieldType'];
|
|
364
|
+
type FormFieldOption = Schemas['FormFieldOption'];
|
|
365
|
+
type FormOnSuccess = Schemas['FormOnSuccess'];
|
|
366
|
+
type FormValue = Schemas['FormValue'];
|
|
367
|
+
type FormValues = Schemas['SubmitFormRequest']['values'];
|
|
368
|
+
type SubmitOperation = paths['/v1/forms/{formId}/submit']['post'];
|
|
369
|
+
type SubmitAccepted = SubmitOperation['responses'][200]['content']['application/json'];
|
|
370
|
+
type SubmitRejected = SubmitOperation['responses'][422]['content']['application/json'];
|
|
371
|
+
type SubmitFormResult = {
|
|
372
|
+
ok: true;
|
|
373
|
+
onSuccess: SubmitAccepted['onSuccess'];
|
|
374
|
+
} | {
|
|
375
|
+
ok: false;
|
|
376
|
+
errors: SubmitRejected['errors'];
|
|
377
|
+
};
|
|
378
|
+
declare class DeliveryRequestError extends Error {
|
|
379
|
+
readonly status: number;
|
|
380
|
+
constructor(message: string, status: number);
|
|
381
|
+
}
|
|
382
|
+
type FormRequestOptions = {
|
|
383
|
+
fetch?: typeof fetch;
|
|
384
|
+
};
|
|
385
|
+
/** Load the published definition of a form. */
|
|
386
|
+
declare const getFormDefinition: (formId: string, options?: FormRequestOptions) => Promise<FormDefinition>;
|
|
387
|
+
/**
|
|
388
|
+
* Submit a form. Field errors (422) come back as `{ ok: false, errors }`;
|
|
389
|
+
* anything else that fails throws. Never submits from a Composer preview.
|
|
390
|
+
* Sends the visitor's consent (see `setConsent`) and the page it was on;
|
|
391
|
+
* only the page's path and UTM parameters are kept.
|
|
392
|
+
*/
|
|
393
|
+
declare const submitForm: (formId: string, values: FormValues, options?: FormRequestOptions) => Promise<SubmitFormResult>;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* What the site's consent banner reported for this visitor. Amplify UP sends
|
|
397
|
+
* it with form submissions; without it, answers are kept only if the site is
|
|
398
|
+
* set to treat visitors who haven't chosen as agreed.
|
|
399
|
+
*
|
|
400
|
+
* Call `setConsent('granted')` or `setConsent('denied')` whenever your banner
|
|
401
|
+
* learns the visitor's choice, and `setConsent(null)` to forget it.
|
|
402
|
+
*/
|
|
403
|
+
type ConsentState = 'granted' | 'denied';
|
|
404
|
+
declare function setConsent(state: ConsentState | null): void;
|
|
405
|
+
declare function getConsent(): ConsentState | null;
|
|
406
|
+
|
|
121
407
|
/**
|
|
122
408
|
* Map Edge /v1/resolve payload → PageConfig for AmplifyRenderer.
|
|
123
409
|
* Prefers `tree` (full page skeleton with zones spliced in); falls back to
|
|
@@ -593,4 +879,4 @@ declare const verifyAWSConnection: () => {
|
|
|
593
879
|
|
|
594
880
|
declare const _default: AmplifyUpSDK;
|
|
595
881
|
|
|
596
|
-
export { ANON_COOKIE_NAME, AmplifyContentMeta, AmplifyPageContextInput, AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, ContentSource, DWELL_ACTIVITY_IDLE_MS, EdgeResolveError, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, type FetchContentOptions, type FetchContentResult, IdentifyInput, IdentifyTraits, PageConfig, PageDataSnapshot, PageTaxonomies, ProfileFieldsInput, SESSION_COOKIE_NAME, SESSION_IDLE_GAP_MS, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchContent, fetchEdgeResolve, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getSessionId, getStatus, getTarget, getTrackingId, getUserId, identify, init, mapResolvedToPageConfig, normalizeRoute, page, refreshEventTracking, reset, routeChange, setProfileFields, setupComponentViewTracking, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|
|
882
|
+
export { ANON_COOKIE_NAME, AmplifyContentMeta, AmplifyPageContextInput, AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, type ConsentState, ContentSource, DWELL_ACTIVITY_IDLE_MS, DeliveryRequestError, EdgeResolveError, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, type FetchContentOptions, type FetchContentResult, type FormDefinition, type FormField, type FormFieldOption, type FormFieldType, type FormOnSuccess, type FormValue, type FormValues, IdentifyInput, IdentifyTraits, PageConfig, PageDataSnapshot, PageTaxonomies, ProfileFieldsInput, SESSION_COOKIE_NAME, SESSION_IDLE_GAP_MS, type SubmitFormResult, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchContent, fetchEdgeResolve, fetchPageConfig, getConsent, getDiagnostics, getFormDefinition, getInstanceId, getOrchestratorUrl, getSDK, getSessionId, getStatus, getTarget, getTrackingId, getUserId, identify, init, mapResolvedToPageConfig, normalizeRoute, page, refreshEventTracking, reset, routeChange, setConsent, setProfileFields, setupComponentViewTracking, setupEventTracking, submitForm, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as PageConfig, C as ContentSource,
|
|
2
|
-
export { Z as ZoneConfig,
|
|
1
|
+
import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as PageDataSnapshot, R as ResolvedPageResourceRef, b as PageTaxonomies, c as CDPAdapter, d as AmplifyUpConfig, e as EventProperties, f as AmplifyPageContextInput, g as AttachedPageEventContext, I as IdentifyInput, h as IdentifyTraits, i as ProfileFieldsInput, j as AmplifyUpTarget } from './types-CxucvIL6.js';
|
|
2
|
+
export { Z as ZoneConfig, k as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, l as resolveAmplifyUpUrls } from './types-CxucvIL6.js';
|
|
3
3
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
|
|
4
4
|
export { A as AMPLIFYUP_EDITOR_ROUTE, i as isAmplifyUpEditorRoute } from './reservedRoutes-aGgViBDM.js';
|
|
5
|
-
export { F as FetchEdgeQueryOptions, a as FetchEdgeSelectOptions, Q as QueryContentError, b as QueryContentOptions, c as QueryFilter, d as QueryFilterOp, e as QueryPagination, f as QueryResult, g as QuerySort, h as QuerySpec, S as SelectVariantsError, i as SelectVariantsOptions, j as SelectVariantsResult, k as fetchEdgeQuery, l as fetchEdgeSelect, n as nextPageSpec, q as queryContent, s as searchSpec, m as selectVariants } from './query-
|
|
5
|
+
export { F as FetchEdgeQueryOptions, a as FetchEdgeSelectOptions, Q as QueryContentError, b as QueryContentOptions, c as QueryFilter, d as QueryFilterOp, e as QueryPagination, f as QueryResult, g as QuerySort, h as QuerySpec, S as SelectVariantsError, i as SelectVariantsOptions, j as SelectVariantsResult, k as fetchEdgeQuery, l as fetchEdgeSelect, n as nextPageSpec, q as queryContent, s as searchSpec, m as selectVariants } from './query-BeQibYGm.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Storage utilities for instance ID and user ID
|
|
@@ -118,6 +118,292 @@ declare function fetchEdgeResolve(options: {
|
|
|
118
118
|
revalidate?: number | false;
|
|
119
119
|
}): Promise<EdgeResolvedPayload>;
|
|
120
120
|
|
|
121
|
+
/**
|
|
122
|
+
* This file was auto-generated by openapi-typescript.
|
|
123
|
+
* Do not make direct changes to the file.
|
|
124
|
+
*/
|
|
125
|
+
interface paths {
|
|
126
|
+
"/v1/forms/{formId}": {
|
|
127
|
+
parameters: {
|
|
128
|
+
query?: never;
|
|
129
|
+
header?: never;
|
|
130
|
+
path?: never;
|
|
131
|
+
cookie?: never;
|
|
132
|
+
};
|
|
133
|
+
get: operations["getFormDefinition"];
|
|
134
|
+
put?: never;
|
|
135
|
+
post?: never;
|
|
136
|
+
delete?: never;
|
|
137
|
+
options?: never;
|
|
138
|
+
head?: never;
|
|
139
|
+
patch?: never;
|
|
140
|
+
trace?: never;
|
|
141
|
+
};
|
|
142
|
+
"/v1/forms/{formId}/submit": {
|
|
143
|
+
parameters: {
|
|
144
|
+
query?: never;
|
|
145
|
+
header?: never;
|
|
146
|
+
path?: never;
|
|
147
|
+
cookie?: never;
|
|
148
|
+
};
|
|
149
|
+
get?: never;
|
|
150
|
+
put?: never;
|
|
151
|
+
post: operations["submitForm"];
|
|
152
|
+
delete?: never;
|
|
153
|
+
options?: never;
|
|
154
|
+
head?: never;
|
|
155
|
+
patch?: never;
|
|
156
|
+
trace?: never;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
interface components {
|
|
160
|
+
schemas: {
|
|
161
|
+
DeliveryErrorBody: {
|
|
162
|
+
error: string;
|
|
163
|
+
};
|
|
164
|
+
FormDefinition: {
|
|
165
|
+
id: string;
|
|
166
|
+
key: string;
|
|
167
|
+
version: number;
|
|
168
|
+
title?: string;
|
|
169
|
+
intro?: string;
|
|
170
|
+
/** @description Every field, in order. Renderers that ignore `steps` show these on one page. */
|
|
171
|
+
fields: components["schemas"]["FormField"][];
|
|
172
|
+
/** @description Headings, paragraphs and fields per step. Absent means one step with `fields` in order. */
|
|
173
|
+
steps?: components["schemas"]["FormStep"][];
|
|
174
|
+
submit: components["schemas"]["FormSubmitSettings"];
|
|
175
|
+
onSuccess: components["schemas"]["FormOnSuccess"];
|
|
176
|
+
honeypot: components["schemas"]["FormHoneypot"];
|
|
177
|
+
};
|
|
178
|
+
FormField: {
|
|
179
|
+
/** @description Key the submitted value is posted under. */
|
|
180
|
+
key: string;
|
|
181
|
+
type: components["schemas"]["FormFieldType"];
|
|
182
|
+
label?: string;
|
|
183
|
+
required?: boolean;
|
|
184
|
+
placeholder?: string;
|
|
185
|
+
/** @description For `select`, `radio` and `checkboxes`. */
|
|
186
|
+
options?: components["schemas"]["FormFieldOption"][];
|
|
187
|
+
/** @description Initial value; the posted value for `hidden`. */
|
|
188
|
+
defaultValue?: string;
|
|
189
|
+
/** @description Half-width fields sit side by side on wide screens. Defaults to full. */
|
|
190
|
+
width?: components["schemas"]["FormFieldWidth"];
|
|
191
|
+
/** @description For `hidden`: filled from this parameter of the page URL, when present. */
|
|
192
|
+
fromQuery?: components["schemas"]["FormQueryParam"];
|
|
193
|
+
};
|
|
194
|
+
FormFieldOption: {
|
|
195
|
+
label: string;
|
|
196
|
+
value: string;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* @description Delivery API for published forms, as the form packages see it. GET /v1/forms/{formId}?trackingId= → FormDefinition POST /v1/forms/{formId}/submit?trackingId= → SubmitFormSuccess | 422 SubmitFormValidationError Optional header `x-amplifyup-consent: granted | denied` — what the site's consent banner reported.
|
|
200
|
+
*
|
|
201
|
+
* Source of truth for `openapi/delivery.json` (scripts/generate-openapi.mjs). Never carries mapping metadata: what a submission writes to is platform-only.
|
|
202
|
+
* @enum {string}
|
|
203
|
+
*/
|
|
204
|
+
FormFieldType: "text" | "email" | "phone" | "number" | "date" | "textarea" | "select" | "radio" | "checkboxes" | "checkbox" | "consent" | "hidden";
|
|
205
|
+
/** @enum {string} */
|
|
206
|
+
FormFieldWidth: "full" | "half";
|
|
207
|
+
FormHoneypot: {
|
|
208
|
+
/** @description Field name to post empty; bots that fill it are dropped. */
|
|
209
|
+
name: string;
|
|
210
|
+
};
|
|
211
|
+
FormOnSuccess: components["schemas"]["FormSuccessMessage"] | components["schemas"]["FormSuccessRedirect"];
|
|
212
|
+
/**
|
|
213
|
+
* @description UTM parameters a hidden field can be filled from.
|
|
214
|
+
* @enum {string}
|
|
215
|
+
*/
|
|
216
|
+
FormQueryParam: "utm_source" | "utm_medium" | "utm_campaign" | "utm_term" | "utm_content";
|
|
217
|
+
/** @description One page of a multi-step form, in display order. */
|
|
218
|
+
FormStep: {
|
|
219
|
+
title?: string;
|
|
220
|
+
items: components["schemas"]["FormStepItem"][];
|
|
221
|
+
};
|
|
222
|
+
FormStepField: {
|
|
223
|
+
/** @constant */
|
|
224
|
+
kind: "field";
|
|
225
|
+
/** @description A key in `fields`. */
|
|
226
|
+
key: string;
|
|
227
|
+
};
|
|
228
|
+
FormStepItem: components["schemas"]["FormStepField"] | components["schemas"]["FormStepText"];
|
|
229
|
+
FormStepText: {
|
|
230
|
+
/** @enum {string} */
|
|
231
|
+
kind: "heading" | "paragraph";
|
|
232
|
+
text: string;
|
|
233
|
+
};
|
|
234
|
+
FormSubmitSettings: {
|
|
235
|
+
label: string;
|
|
236
|
+
};
|
|
237
|
+
FormSuccessMessage: {
|
|
238
|
+
/** @constant */
|
|
239
|
+
type: "message";
|
|
240
|
+
message: string;
|
|
241
|
+
};
|
|
242
|
+
FormSuccessRedirect: {
|
|
243
|
+
/** @constant */
|
|
244
|
+
type: "redirect";
|
|
245
|
+
url: string;
|
|
246
|
+
};
|
|
247
|
+
/** @description Text for most fields, true/false for `checkbox` and `consent`, the chosen values for `checkboxes`. */
|
|
248
|
+
FormValue: string | boolean | string[];
|
|
249
|
+
SubmitFormRequest: {
|
|
250
|
+
/** @description Field values by key, including the honeypot key. */
|
|
251
|
+
values: {
|
|
252
|
+
[key: string]: components["schemas"]["FormValue"];
|
|
253
|
+
};
|
|
254
|
+
/** @description The page the form was on. Only its path and UTM parameters are kept. */
|
|
255
|
+
page?: string;
|
|
256
|
+
};
|
|
257
|
+
SubmitFormSuccess: {
|
|
258
|
+
onSuccess: components["schemas"]["FormOnSuccess"];
|
|
259
|
+
};
|
|
260
|
+
SubmitFormValidationError: {
|
|
261
|
+
/** @description Message per field key. */
|
|
262
|
+
errors: {
|
|
263
|
+
[key: string]: string;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
responses: never;
|
|
268
|
+
parameters: never;
|
|
269
|
+
requestBodies: never;
|
|
270
|
+
headers: never;
|
|
271
|
+
pathItems: never;
|
|
272
|
+
}
|
|
273
|
+
interface operations {
|
|
274
|
+
getFormDefinition: {
|
|
275
|
+
parameters: {
|
|
276
|
+
query: {
|
|
277
|
+
trackingId: string;
|
|
278
|
+
};
|
|
279
|
+
header?: never;
|
|
280
|
+
path: {
|
|
281
|
+
formId: string;
|
|
282
|
+
};
|
|
283
|
+
cookie?: never;
|
|
284
|
+
};
|
|
285
|
+
requestBody?: never;
|
|
286
|
+
responses: {
|
|
287
|
+
/** @description Published form definition */
|
|
288
|
+
200: {
|
|
289
|
+
headers: {
|
|
290
|
+
[name: string]: unknown;
|
|
291
|
+
};
|
|
292
|
+
content: {
|
|
293
|
+
"application/json": components["schemas"]["FormDefinition"];
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
/** @description Unknown tracking id or no published form */
|
|
297
|
+
404: {
|
|
298
|
+
headers: {
|
|
299
|
+
[name: string]: unknown;
|
|
300
|
+
};
|
|
301
|
+
content: {
|
|
302
|
+
"application/json": components["schemas"]["DeliveryErrorBody"];
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
submitForm: {
|
|
308
|
+
parameters: {
|
|
309
|
+
query: {
|
|
310
|
+
trackingId: string;
|
|
311
|
+
};
|
|
312
|
+
header?: never;
|
|
313
|
+
path: {
|
|
314
|
+
formId: string;
|
|
315
|
+
};
|
|
316
|
+
cookie?: never;
|
|
317
|
+
};
|
|
318
|
+
requestBody: {
|
|
319
|
+
content: {
|
|
320
|
+
"application/json": components["schemas"]["SubmitFormRequest"];
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
responses: {
|
|
324
|
+
/** @description Accepted */
|
|
325
|
+
200: {
|
|
326
|
+
headers: {
|
|
327
|
+
[name: string]: unknown;
|
|
328
|
+
};
|
|
329
|
+
content: {
|
|
330
|
+
"application/json": components["schemas"]["SubmitFormSuccess"];
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
/** @description Unknown tracking id or no published form */
|
|
334
|
+
404: {
|
|
335
|
+
headers: {
|
|
336
|
+
[name: string]: unknown;
|
|
337
|
+
};
|
|
338
|
+
content: {
|
|
339
|
+
"application/json": components["schemas"]["DeliveryErrorBody"];
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
/** @description Field errors */
|
|
343
|
+
422: {
|
|
344
|
+
headers: {
|
|
345
|
+
[name: string]: unknown;
|
|
346
|
+
};
|
|
347
|
+
content: {
|
|
348
|
+
"application/json": components["schemas"]["SubmitFormValidationError"];
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Typed client for published forms on the Amplify UP delivery API.
|
|
357
|
+
* Types are generated from the platform's API spec (see `npm run codegen`).
|
|
358
|
+
*/
|
|
359
|
+
|
|
360
|
+
type Schemas = components['schemas'];
|
|
361
|
+
type FormDefinition = Schemas['FormDefinition'];
|
|
362
|
+
type FormField = Schemas['FormField'];
|
|
363
|
+
type FormFieldType = Schemas['FormFieldType'];
|
|
364
|
+
type FormFieldOption = Schemas['FormFieldOption'];
|
|
365
|
+
type FormOnSuccess = Schemas['FormOnSuccess'];
|
|
366
|
+
type FormValue = Schemas['FormValue'];
|
|
367
|
+
type FormValues = Schemas['SubmitFormRequest']['values'];
|
|
368
|
+
type SubmitOperation = paths['/v1/forms/{formId}/submit']['post'];
|
|
369
|
+
type SubmitAccepted = SubmitOperation['responses'][200]['content']['application/json'];
|
|
370
|
+
type SubmitRejected = SubmitOperation['responses'][422]['content']['application/json'];
|
|
371
|
+
type SubmitFormResult = {
|
|
372
|
+
ok: true;
|
|
373
|
+
onSuccess: SubmitAccepted['onSuccess'];
|
|
374
|
+
} | {
|
|
375
|
+
ok: false;
|
|
376
|
+
errors: SubmitRejected['errors'];
|
|
377
|
+
};
|
|
378
|
+
declare class DeliveryRequestError extends Error {
|
|
379
|
+
readonly status: number;
|
|
380
|
+
constructor(message: string, status: number);
|
|
381
|
+
}
|
|
382
|
+
type FormRequestOptions = {
|
|
383
|
+
fetch?: typeof fetch;
|
|
384
|
+
};
|
|
385
|
+
/** Load the published definition of a form. */
|
|
386
|
+
declare const getFormDefinition: (formId: string, options?: FormRequestOptions) => Promise<FormDefinition>;
|
|
387
|
+
/**
|
|
388
|
+
* Submit a form. Field errors (422) come back as `{ ok: false, errors }`;
|
|
389
|
+
* anything else that fails throws. Never submits from a Composer preview.
|
|
390
|
+
* Sends the visitor's consent (see `setConsent`) and the page it was on;
|
|
391
|
+
* only the page's path and UTM parameters are kept.
|
|
392
|
+
*/
|
|
393
|
+
declare const submitForm: (formId: string, values: FormValues, options?: FormRequestOptions) => Promise<SubmitFormResult>;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* What the site's consent banner reported for this visitor. Amplify UP sends
|
|
397
|
+
* it with form submissions; without it, answers are kept only if the site is
|
|
398
|
+
* set to treat visitors who haven't chosen as agreed.
|
|
399
|
+
*
|
|
400
|
+
* Call `setConsent('granted')` or `setConsent('denied')` whenever your banner
|
|
401
|
+
* learns the visitor's choice, and `setConsent(null)` to forget it.
|
|
402
|
+
*/
|
|
403
|
+
type ConsentState = 'granted' | 'denied';
|
|
404
|
+
declare function setConsent(state: ConsentState | null): void;
|
|
405
|
+
declare function getConsent(): ConsentState | null;
|
|
406
|
+
|
|
121
407
|
/**
|
|
122
408
|
* Map Edge /v1/resolve payload → PageConfig for AmplifyRenderer.
|
|
123
409
|
* Prefers `tree` (full page skeleton with zones spliced in); falls back to
|
|
@@ -593,4 +879,4 @@ declare const verifyAWSConnection: () => {
|
|
|
593
879
|
|
|
594
880
|
declare const _default: AmplifyUpSDK;
|
|
595
881
|
|
|
596
|
-
export { ANON_COOKIE_NAME, AmplifyContentMeta, AmplifyPageContextInput, AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, ContentSource, DWELL_ACTIVITY_IDLE_MS, EdgeResolveError, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, type FetchContentOptions, type FetchContentResult, IdentifyInput, IdentifyTraits, PageConfig, PageDataSnapshot, PageTaxonomies, ProfileFieldsInput, SESSION_COOKIE_NAME, SESSION_IDLE_GAP_MS, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchContent, fetchEdgeResolve, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getSessionId, getStatus, getTarget, getTrackingId, getUserId, identify, init, mapResolvedToPageConfig, normalizeRoute, page, refreshEventTracking, reset, routeChange, setProfileFields, setupComponentViewTracking, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|
|
882
|
+
export { ANON_COOKIE_NAME, AmplifyContentMeta, AmplifyPageContextInput, AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, type ConsentState, ContentSource, DWELL_ACTIVITY_IDLE_MS, DeliveryRequestError, EdgeResolveError, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, type FetchContentOptions, type FetchContentResult, type FormDefinition, type FormField, type FormFieldOption, type FormFieldType, type FormOnSuccess, type FormValue, type FormValues, IdentifyInput, IdentifyTraits, PageConfig, PageDataSnapshot, PageTaxonomies, ProfileFieldsInput, SESSION_COOKIE_NAME, SESSION_IDLE_GAP_MS, type SubmitFormResult, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchContent, fetchEdgeResolve, fetchPageConfig, getConsent, getDiagnostics, getFormDefinition, getInstanceId, getOrchestratorUrl, getSDK, getSessionId, getStatus, getTarget, getTrackingId, getUserId, identify, init, mapResolvedToPageConfig, normalizeRoute, page, refreshEventTracking, reset, routeChange, setConsent, setProfileFields, setupComponentViewTracking, setupEventTracking, submitForm, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|