@amplifyup/sdk 0.1.22 → 0.1.23
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 +65 -38
- package/dist/AmplifyRenderer.d.mts +1 -1
- package/dist/AmplifyRenderer.d.ts +1 -1
- package/dist/AmplifyRenderer.js +111 -14
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +111 -14
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +117 -6
- package/dist/index.d.ts +117 -6
- package/dist/index.js +285 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +280 -15
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +5 -3
- package/dist/react.d.ts +5 -3
- package/dist/react.js +350 -42
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +350 -42
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +26 -8
- package/dist/server.d.ts +26 -8
- package/dist/server.js +277 -20
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +277 -21
- package/dist/server.mjs.map +1 -1
- package/dist/{types-Cy5aWQ5c.d.mts → types-BxpG9Gsy.d.mts} +37 -2
- package/dist/{types-Cy5aWQ5c.d.ts → types-BxpG9Gsy.d.ts} +37 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,99 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export {
|
|
1
|
+
import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, a as CDPAdapter, b as AmplifyUpConfig, E as EventProperties, I as IdentifyInput, c as IdentifyTraits, d as ProfileFieldsInput, e as AmplifyUpTarget, f as EventTrackingConfig$1 } from './types-BxpG9Gsy.mjs';
|
|
2
|
+
export { Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, g as resolveAmplifyUpUrls } from './types-BxpG9Gsy.mjs';
|
|
3
3
|
export { i as isComposerPreview, a as isPreviewRequest } from './preview-BMrIgUvp.mjs';
|
|
4
4
|
|
|
5
|
+
interface FetchContentResult {
|
|
6
|
+
pageConfig: PageConfig | null;
|
|
7
|
+
source: ContentSource;
|
|
8
|
+
meta: AmplifyContentMeta | null;
|
|
9
|
+
error: string | null;
|
|
10
|
+
}
|
|
11
|
+
interface FetchContentOptions {
|
|
12
|
+
route: string;
|
|
13
|
+
trackingId: string;
|
|
14
|
+
anonId?: string | null;
|
|
15
|
+
siteId?: string | null;
|
|
16
|
+
/** Force preview (Composer); otherwise uses isComposerPreview() in browser. */
|
|
17
|
+
preview?: boolean;
|
|
18
|
+
orchestratorUrl: string;
|
|
19
|
+
edgeUrl: string;
|
|
20
|
+
/** Orchestrator layout fetch (SDK instance method or server helper). */
|
|
21
|
+
fetchOrchestratorPage: (route: string, preview: boolean) => Promise<PageConfig | null>;
|
|
22
|
+
fetchFn?: typeof fetch;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Single content entry point:
|
|
26
|
+
* - Composer / preview → orchestrator layout provider (drafts + live edits)
|
|
27
|
+
* - Production visitors → Edge /v1/resolve (personalized + CMS-populated)
|
|
28
|
+
*
|
|
29
|
+
* Production never falls back to the orchestrator on Edge failure —
|
|
30
|
+
* callers should render site fallback instead.
|
|
31
|
+
*/
|
|
32
|
+
declare function fetchContent(options: FetchContentOptions): Promise<FetchContentResult>;
|
|
33
|
+
|
|
34
|
+
/** Mirrors Edge ResolvedComponent — SDK maps this into layoutTree nodes. */
|
|
35
|
+
interface EdgeResolvedComponent {
|
|
36
|
+
instanceId: string;
|
|
37
|
+
componentId: string;
|
|
38
|
+
props: Record<string, unknown>;
|
|
39
|
+
children?: Record<string, EdgeResolvedComponent[]>;
|
|
40
|
+
appliedRules?: string[];
|
|
41
|
+
degraded?: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface EdgeResolvedPayload {
|
|
44
|
+
siteId: string;
|
|
45
|
+
route: string;
|
|
46
|
+
version: number;
|
|
47
|
+
zones: Record<string, EdgeResolvedComponent[]>;
|
|
48
|
+
tree?: EdgeResolvedComponent[];
|
|
49
|
+
meta: {
|
|
50
|
+
variantKeys: Record<string, string>;
|
|
51
|
+
audienceLookup?: {
|
|
52
|
+
status: string;
|
|
53
|
+
durationMs: number;
|
|
54
|
+
};
|
|
55
|
+
decideLookup?: {
|
|
56
|
+
status: string;
|
|
57
|
+
durationMs: number;
|
|
58
|
+
checks: number;
|
|
59
|
+
};
|
|
60
|
+
experiments?: Array<{
|
|
61
|
+
key: string;
|
|
62
|
+
variantKey: string;
|
|
63
|
+
bucket: number;
|
|
64
|
+
}>;
|
|
65
|
+
bot?: unknown;
|
|
66
|
+
resolvedAt: string;
|
|
67
|
+
degraded?: boolean;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
declare class EdgeResolveError extends Error {
|
|
71
|
+
status: number;
|
|
72
|
+
body: unknown;
|
|
73
|
+
constructor(message: string, status: number, body?: unknown);
|
|
74
|
+
}
|
|
75
|
+
declare function fetchEdgeResolve(options: {
|
|
76
|
+
edgeUrl: string;
|
|
77
|
+
trackingId: string;
|
|
78
|
+
route: string;
|
|
79
|
+
anonId?: string | null;
|
|
80
|
+
siteId?: string | null;
|
|
81
|
+
fetch?: typeof fetch;
|
|
82
|
+
}): Promise<EdgeResolvedPayload>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Map Edge /v1/resolve payload → PageConfig for AmplifyRenderer.
|
|
86
|
+
* Prefers `tree` (full page skeleton with zones spliced in); falls back to
|
|
87
|
+
* flattening zone roots when older snapshots lack structure.
|
|
88
|
+
*/
|
|
89
|
+
declare function mapResolvedToPageConfig(payload: EdgeResolvedPayload): PageConfig;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Normalize a route path for Edge resolve requests.
|
|
93
|
+
* Leading slash, no trailing slash (except root), query/hash stripped.
|
|
94
|
+
*/
|
|
95
|
+
declare function normalizeRoute(route: string): string;
|
|
96
|
+
|
|
5
97
|
/**
|
|
6
98
|
* AmplifyUp Tracking SDK
|
|
7
99
|
*
|
|
@@ -32,6 +124,8 @@ declare class AmplifyUpSDK {
|
|
|
32
124
|
private apiGatewayUrl;
|
|
33
125
|
private orchestratorUrl;
|
|
34
126
|
private decisionApiUrl;
|
|
127
|
+
private edgeUrl;
|
|
128
|
+
private siteId;
|
|
35
129
|
private target;
|
|
36
130
|
private initialized;
|
|
37
131
|
/** Prevents overlapping init() from React Strict Mode double-mount */
|
|
@@ -148,9 +242,17 @@ declare class AmplifyUpSDK {
|
|
|
148
242
|
*/
|
|
149
243
|
trackContentView(contentId: string, contentType: string, properties?: EventProperties): void;
|
|
150
244
|
/**
|
|
151
|
-
* Identify
|
|
245
|
+
* Identify a visitor.
|
|
246
|
+
* - identify('user_123') — bare string; server maps via org default type
|
|
247
|
+
* - identify({ email: '...', crm_id: '...' }) — explicit types
|
|
248
|
+
* - identify('user_123', traits) — legacy form
|
|
152
249
|
*/
|
|
153
|
-
identify(
|
|
250
|
+
identify(userIdOrIdentifiers: IdentifyInput, traits?: IdentifyTraits): void;
|
|
251
|
+
/**
|
|
252
|
+
* Set profile fields (partial update). Omitted keys are left alone;
|
|
253
|
+
* an explicit empty value clears the field.
|
|
254
|
+
*/
|
|
255
|
+
setProfileFields(fields: ProfileFieldsInput): void;
|
|
154
256
|
/**
|
|
155
257
|
* Track content engagement (when user interacts with personalized content)
|
|
156
258
|
*/
|
|
@@ -214,6 +316,14 @@ declare class AmplifyUpSDK {
|
|
|
214
316
|
* Get decision API URL
|
|
215
317
|
*/
|
|
216
318
|
getDecisionApiUrl(): string | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* Get Edge Worker URL (production content resolve)
|
|
321
|
+
*/
|
|
322
|
+
getEdgeUrl(): string | undefined;
|
|
323
|
+
/**
|
|
324
|
+
* Optional site id from config (Edge can resolve via trackingId alone).
|
|
325
|
+
*/
|
|
326
|
+
getSiteId(): string | undefined;
|
|
217
327
|
/**
|
|
218
328
|
* Build API URL for fetching page config from the Layout Provider
|
|
219
329
|
*/
|
|
@@ -344,7 +454,8 @@ declare const trackClick: (elementId: string, elementText: string, properties?:
|
|
|
344
454
|
declare const trackFormSubmit: (formId: string, formData?: EventProperties) => void;
|
|
345
455
|
declare const trackFormFieldInteraction: (fieldName: string, fieldValue?: string) => void;
|
|
346
456
|
declare const trackContentView: (contentId: string, contentType: string, properties?: EventProperties) => void;
|
|
347
|
-
declare const identify: (
|
|
457
|
+
declare const identify: (userIdOrIdentifiers: IdentifyInput, traits?: IdentifyTraits) => void;
|
|
458
|
+
declare const setProfileFields: (fields: ProfileFieldsInput) => void;
|
|
348
459
|
declare const trackContentEngagement: (contentId: string, engagementType: "view" | "click" | "dismiss") => void;
|
|
349
460
|
declare const reset: () => void;
|
|
350
461
|
declare const getInstanceId: () => string;
|
|
@@ -394,4 +505,4 @@ declare const verifyAWSConnection: () => {
|
|
|
394
505
|
|
|
395
506
|
declare const _default: AmplifyUpSDK;
|
|
396
507
|
|
|
397
|
-
export { AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, IdentifyTraits, SESSION_IDLE_GAP_MS, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getStatus, getTarget, getTrackingId, getUserId, identify, init, page, refreshEventTracking, reset, routeChange, setupComponentViewTracking, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|
|
508
|
+
export { AmplifyContentMeta, AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, ContentSource, EdgeResolveError, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, type FetchContentOptions, type FetchContentResult, IdentifyInput, IdentifyTraits, PageConfig, ProfileFieldsInput, SESSION_IDLE_GAP_MS, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchContent, fetchEdgeResolve, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getStatus, getTarget, getTrackingId, getUserId, identify, init, mapResolvedToPageConfig, normalizeRoute, page, refreshEventTracking, reset, routeChange, setProfileFields, setupComponentViewTracking, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,99 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export {
|
|
1
|
+
import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, a as CDPAdapter, b as AmplifyUpConfig, E as EventProperties, I as IdentifyInput, c as IdentifyTraits, d as ProfileFieldsInput, e as AmplifyUpTarget, f as EventTrackingConfig$1 } from './types-BxpG9Gsy.js';
|
|
2
|
+
export { Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, g as resolveAmplifyUpUrls } from './types-BxpG9Gsy.js';
|
|
3
3
|
export { i as isComposerPreview, a as isPreviewRequest } from './preview-BMrIgUvp.js';
|
|
4
4
|
|
|
5
|
+
interface FetchContentResult {
|
|
6
|
+
pageConfig: PageConfig | null;
|
|
7
|
+
source: ContentSource;
|
|
8
|
+
meta: AmplifyContentMeta | null;
|
|
9
|
+
error: string | null;
|
|
10
|
+
}
|
|
11
|
+
interface FetchContentOptions {
|
|
12
|
+
route: string;
|
|
13
|
+
trackingId: string;
|
|
14
|
+
anonId?: string | null;
|
|
15
|
+
siteId?: string | null;
|
|
16
|
+
/** Force preview (Composer); otherwise uses isComposerPreview() in browser. */
|
|
17
|
+
preview?: boolean;
|
|
18
|
+
orchestratorUrl: string;
|
|
19
|
+
edgeUrl: string;
|
|
20
|
+
/** Orchestrator layout fetch (SDK instance method or server helper). */
|
|
21
|
+
fetchOrchestratorPage: (route: string, preview: boolean) => Promise<PageConfig | null>;
|
|
22
|
+
fetchFn?: typeof fetch;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Single content entry point:
|
|
26
|
+
* - Composer / preview → orchestrator layout provider (drafts + live edits)
|
|
27
|
+
* - Production visitors → Edge /v1/resolve (personalized + CMS-populated)
|
|
28
|
+
*
|
|
29
|
+
* Production never falls back to the orchestrator on Edge failure —
|
|
30
|
+
* callers should render site fallback instead.
|
|
31
|
+
*/
|
|
32
|
+
declare function fetchContent(options: FetchContentOptions): Promise<FetchContentResult>;
|
|
33
|
+
|
|
34
|
+
/** Mirrors Edge ResolvedComponent — SDK maps this into layoutTree nodes. */
|
|
35
|
+
interface EdgeResolvedComponent {
|
|
36
|
+
instanceId: string;
|
|
37
|
+
componentId: string;
|
|
38
|
+
props: Record<string, unknown>;
|
|
39
|
+
children?: Record<string, EdgeResolvedComponent[]>;
|
|
40
|
+
appliedRules?: string[];
|
|
41
|
+
degraded?: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface EdgeResolvedPayload {
|
|
44
|
+
siteId: string;
|
|
45
|
+
route: string;
|
|
46
|
+
version: number;
|
|
47
|
+
zones: Record<string, EdgeResolvedComponent[]>;
|
|
48
|
+
tree?: EdgeResolvedComponent[];
|
|
49
|
+
meta: {
|
|
50
|
+
variantKeys: Record<string, string>;
|
|
51
|
+
audienceLookup?: {
|
|
52
|
+
status: string;
|
|
53
|
+
durationMs: number;
|
|
54
|
+
};
|
|
55
|
+
decideLookup?: {
|
|
56
|
+
status: string;
|
|
57
|
+
durationMs: number;
|
|
58
|
+
checks: number;
|
|
59
|
+
};
|
|
60
|
+
experiments?: Array<{
|
|
61
|
+
key: string;
|
|
62
|
+
variantKey: string;
|
|
63
|
+
bucket: number;
|
|
64
|
+
}>;
|
|
65
|
+
bot?: unknown;
|
|
66
|
+
resolvedAt: string;
|
|
67
|
+
degraded?: boolean;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
declare class EdgeResolveError extends Error {
|
|
71
|
+
status: number;
|
|
72
|
+
body: unknown;
|
|
73
|
+
constructor(message: string, status: number, body?: unknown);
|
|
74
|
+
}
|
|
75
|
+
declare function fetchEdgeResolve(options: {
|
|
76
|
+
edgeUrl: string;
|
|
77
|
+
trackingId: string;
|
|
78
|
+
route: string;
|
|
79
|
+
anonId?: string | null;
|
|
80
|
+
siteId?: string | null;
|
|
81
|
+
fetch?: typeof fetch;
|
|
82
|
+
}): Promise<EdgeResolvedPayload>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Map Edge /v1/resolve payload → PageConfig for AmplifyRenderer.
|
|
86
|
+
* Prefers `tree` (full page skeleton with zones spliced in); falls back to
|
|
87
|
+
* flattening zone roots when older snapshots lack structure.
|
|
88
|
+
*/
|
|
89
|
+
declare function mapResolvedToPageConfig(payload: EdgeResolvedPayload): PageConfig;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Normalize a route path for Edge resolve requests.
|
|
93
|
+
* Leading slash, no trailing slash (except root), query/hash stripped.
|
|
94
|
+
*/
|
|
95
|
+
declare function normalizeRoute(route: string): string;
|
|
96
|
+
|
|
5
97
|
/**
|
|
6
98
|
* AmplifyUp Tracking SDK
|
|
7
99
|
*
|
|
@@ -32,6 +124,8 @@ declare class AmplifyUpSDK {
|
|
|
32
124
|
private apiGatewayUrl;
|
|
33
125
|
private orchestratorUrl;
|
|
34
126
|
private decisionApiUrl;
|
|
127
|
+
private edgeUrl;
|
|
128
|
+
private siteId;
|
|
35
129
|
private target;
|
|
36
130
|
private initialized;
|
|
37
131
|
/** Prevents overlapping init() from React Strict Mode double-mount */
|
|
@@ -148,9 +242,17 @@ declare class AmplifyUpSDK {
|
|
|
148
242
|
*/
|
|
149
243
|
trackContentView(contentId: string, contentType: string, properties?: EventProperties): void;
|
|
150
244
|
/**
|
|
151
|
-
* Identify
|
|
245
|
+
* Identify a visitor.
|
|
246
|
+
* - identify('user_123') — bare string; server maps via org default type
|
|
247
|
+
* - identify({ email: '...', crm_id: '...' }) — explicit types
|
|
248
|
+
* - identify('user_123', traits) — legacy form
|
|
152
249
|
*/
|
|
153
|
-
identify(
|
|
250
|
+
identify(userIdOrIdentifiers: IdentifyInput, traits?: IdentifyTraits): void;
|
|
251
|
+
/**
|
|
252
|
+
* Set profile fields (partial update). Omitted keys are left alone;
|
|
253
|
+
* an explicit empty value clears the field.
|
|
254
|
+
*/
|
|
255
|
+
setProfileFields(fields: ProfileFieldsInput): void;
|
|
154
256
|
/**
|
|
155
257
|
* Track content engagement (when user interacts with personalized content)
|
|
156
258
|
*/
|
|
@@ -214,6 +316,14 @@ declare class AmplifyUpSDK {
|
|
|
214
316
|
* Get decision API URL
|
|
215
317
|
*/
|
|
216
318
|
getDecisionApiUrl(): string | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* Get Edge Worker URL (production content resolve)
|
|
321
|
+
*/
|
|
322
|
+
getEdgeUrl(): string | undefined;
|
|
323
|
+
/**
|
|
324
|
+
* Optional site id from config (Edge can resolve via trackingId alone).
|
|
325
|
+
*/
|
|
326
|
+
getSiteId(): string | undefined;
|
|
217
327
|
/**
|
|
218
328
|
* Build API URL for fetching page config from the Layout Provider
|
|
219
329
|
*/
|
|
@@ -344,7 +454,8 @@ declare const trackClick: (elementId: string, elementText: string, properties?:
|
|
|
344
454
|
declare const trackFormSubmit: (formId: string, formData?: EventProperties) => void;
|
|
345
455
|
declare const trackFormFieldInteraction: (fieldName: string, fieldValue?: string) => void;
|
|
346
456
|
declare const trackContentView: (contentId: string, contentType: string, properties?: EventProperties) => void;
|
|
347
|
-
declare const identify: (
|
|
457
|
+
declare const identify: (userIdOrIdentifiers: IdentifyInput, traits?: IdentifyTraits) => void;
|
|
458
|
+
declare const setProfileFields: (fields: ProfileFieldsInput) => void;
|
|
348
459
|
declare const trackContentEngagement: (contentId: string, engagementType: "view" | "click" | "dismiss") => void;
|
|
349
460
|
declare const reset: () => void;
|
|
350
461
|
declare const getInstanceId: () => string;
|
|
@@ -394,4 +505,4 @@ declare const verifyAWSConnection: () => {
|
|
|
394
505
|
|
|
395
506
|
declare const _default: AmplifyUpSDK;
|
|
396
507
|
|
|
397
|
-
export { AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, IdentifyTraits, SESSION_IDLE_GAP_MS, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getStatus, getTarget, getTrackingId, getUserId, identify, init, page, refreshEventTracking, reset, routeChange, setupComponentViewTracking, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|
|
508
|
+
export { AmplifyContentMeta, AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, ContentSource, EdgeResolveError, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, type FetchContentOptions, type FetchContentResult, IdentifyInput, IdentifyTraits, PageConfig, ProfileFieldsInput, SESSION_IDLE_GAP_MS, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchContent, fetchEdgeResolve, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getStatus, getTarget, getTrackingId, getUserId, identify, init, mapResolvedToPageConfig, normalizeRoute, page, refreshEventTracking, reset, routeChange, setProfileFields, setupComponentViewTracking, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|