@amplifyup/sdk 0.1.0
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 +106 -0
- package/dist/AmplifyRenderer.d.mts +31 -0
- package/dist/AmplifyRenderer.d.ts +31 -0
- package/dist/AmplifyRenderer.js +1708 -0
- package/dist/AmplifyRenderer.js.map +1 -0
- package/dist/AmplifyRenderer.mjs +1706 -0
- package/dist/AmplifyRenderer.mjs.map +1 -0
- package/dist/index.d.mts +309 -0
- package/dist/index.d.ts +309 -0
- package/dist/index.js +1445 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1415 -0
- package/dist/index.mjs.map +1 -0
- package/dist/react.d.mts +89 -0
- package/dist/react.d.ts +89 -0
- package/dist/react.js +1966 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +1958 -0
- package/dist/react.mjs.map +1 -0
- package/dist/server.d.mts +21 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.js +1398 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +1396 -0
- package/dist/server.mjs.map +1 -0
- package/dist/types-B9nHG2Cl.d.mts +109 -0
- package/dist/types-B9nHG2Cl.d.ts +109 -0
- package/package.json +72 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { C as CDPAdapter, A as AmplifyUpConfig, E as EventProperties, I as IdentifyTraits, a as EventTrackingConfig$1 } from './types-B9nHG2Cl.mjs';
|
|
2
|
+
export { P as PageConfig, Z as ZoneConfig } from './types-B9nHG2Cl.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AmplifyUp Tracking SDK
|
|
6
|
+
*
|
|
7
|
+
* Event tracking and personalization SDK for Pure AWS architecture.
|
|
8
|
+
*
|
|
9
|
+
* Uses AWS API Gateway for event ingestion and AWS Decision API for personalization.
|
|
10
|
+
* All runtime data (events, profiles, decisions) lives in AWS.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface EventTrackingConfig {
|
|
14
|
+
eventName: string;
|
|
15
|
+
eventType: string;
|
|
16
|
+
selector?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
properties?: string[];
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare class AmplifyUpSDK {
|
|
22
|
+
private adapter;
|
|
23
|
+
private config;
|
|
24
|
+
private apiGatewayUrl;
|
|
25
|
+
private orchestratorUrl;
|
|
26
|
+
private decisionApiUrl;
|
|
27
|
+
private initialized;
|
|
28
|
+
private highlightingEnabled;
|
|
29
|
+
private componentRegistry;
|
|
30
|
+
private messageListener;
|
|
31
|
+
private mutationObserver;
|
|
32
|
+
private isVisualEditorMode;
|
|
33
|
+
private eventSelectionMode;
|
|
34
|
+
private eventSelectionClickHandler;
|
|
35
|
+
private eventTrackingConfig;
|
|
36
|
+
private attachedEventListeners;
|
|
37
|
+
private trackingIntervals;
|
|
38
|
+
private trackingCleanup;
|
|
39
|
+
constructor(adapter?: CDPAdapter);
|
|
40
|
+
/**
|
|
41
|
+
* Detect if we're running in visual editor mode
|
|
42
|
+
* Returns true if:
|
|
43
|
+
* 1. Preview mode flag is set by proxy
|
|
44
|
+
* 2. We're in an iframe AND parent is from orchestrator domain
|
|
45
|
+
* 3. OR visualEditor/preview query parameter is present
|
|
46
|
+
*/
|
|
47
|
+
private detectVisualEditorMode;
|
|
48
|
+
/**
|
|
49
|
+
* Check if we're in preview/composer mode (should disable tracking)
|
|
50
|
+
*/
|
|
51
|
+
private isPreviewMode;
|
|
52
|
+
/**
|
|
53
|
+
* Get production URLs
|
|
54
|
+
*
|
|
55
|
+
* URLs are baked in at build time via tsup.config.ts
|
|
56
|
+
*
|
|
57
|
+
* API Gateway endpoints:
|
|
58
|
+
* - /v1/track - Event tracking (ingestion)
|
|
59
|
+
* - /v1/page - Page view tracking (ingestion)
|
|
60
|
+
* - /v1/personalize - Decision engine (personalization)
|
|
61
|
+
*/
|
|
62
|
+
private getProductionUrls;
|
|
63
|
+
/**
|
|
64
|
+
* Initialize the SDK
|
|
65
|
+
* Automatically reads env vars and sets up tracking
|
|
66
|
+
*/
|
|
67
|
+
init(config: AmplifyUpConfig): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Check if SDK is initialized
|
|
70
|
+
*/
|
|
71
|
+
isInitialized(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Clear all tracking intervals and event listeners
|
|
74
|
+
*/
|
|
75
|
+
private clearTrackingIntervals;
|
|
76
|
+
/**
|
|
77
|
+
* Track a page view
|
|
78
|
+
*/
|
|
79
|
+
page(url: string, properties?: EventProperties): void;
|
|
80
|
+
/**
|
|
81
|
+
* Track an event
|
|
82
|
+
*/
|
|
83
|
+
track(eventName: string, properties?: EventProperties): void;
|
|
84
|
+
/**
|
|
85
|
+
* Track a button click or CTA interaction
|
|
86
|
+
*/
|
|
87
|
+
trackClick(elementId: string, elementText: string, properties?: EventProperties): void;
|
|
88
|
+
/**
|
|
89
|
+
* Track form submission
|
|
90
|
+
*/
|
|
91
|
+
trackFormSubmit(formId: string, formData?: EventProperties): void;
|
|
92
|
+
/**
|
|
93
|
+
* Track form field interaction
|
|
94
|
+
*/
|
|
95
|
+
trackFormFieldInteraction(fieldName: string, fieldValue?: string): void;
|
|
96
|
+
/**
|
|
97
|
+
* Track product/content view
|
|
98
|
+
*/
|
|
99
|
+
trackContentView(contentId: string, contentType: string, properties?: EventProperties): void;
|
|
100
|
+
/**
|
|
101
|
+
* Identify user (when they sign up or log in)
|
|
102
|
+
*/
|
|
103
|
+
identify(userId: string, traits?: IdentifyTraits): void;
|
|
104
|
+
/**
|
|
105
|
+
* Track content engagement (when user interacts with personalized content)
|
|
106
|
+
*/
|
|
107
|
+
trackContentEngagement(contentId: string, engagementType: 'view' | 'click' | 'dismiss'): void;
|
|
108
|
+
/**
|
|
109
|
+
* Reset user identity (logout)
|
|
110
|
+
*/
|
|
111
|
+
reset(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Get instance ID (anonymous ID)
|
|
114
|
+
*/
|
|
115
|
+
getInstanceId(): string;
|
|
116
|
+
/**
|
|
117
|
+
* Get user ID
|
|
118
|
+
*/
|
|
119
|
+
getUserId(): string | null;
|
|
120
|
+
/**
|
|
121
|
+
* Get tracking ID
|
|
122
|
+
*/
|
|
123
|
+
getTrackingId(): string | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Get diagnostic information
|
|
126
|
+
* Useful for debugging from browser console
|
|
127
|
+
*/
|
|
128
|
+
getDiagnostics(): {
|
|
129
|
+
initialized: boolean;
|
|
130
|
+
instanceId: string;
|
|
131
|
+
userId: string | null;
|
|
132
|
+
trackingId: string | undefined;
|
|
133
|
+
config: {
|
|
134
|
+
apiGatewayUrl?: string;
|
|
135
|
+
decisionApiUrl?: string;
|
|
136
|
+
orchestratorUrl?: string;
|
|
137
|
+
debug?: boolean;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Test tracking by sending a test event
|
|
142
|
+
*/
|
|
143
|
+
testTracking(): void;
|
|
144
|
+
/**
|
|
145
|
+
* Verify AWS API Gateway connectivity
|
|
146
|
+
* Checks if AWS adapter is initialized and can send events
|
|
147
|
+
*/
|
|
148
|
+
verifyAWSConnection(): {
|
|
149
|
+
connected: boolean;
|
|
150
|
+
message: string;
|
|
151
|
+
details?: any;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Get status summary (for console debugging)
|
|
155
|
+
*/
|
|
156
|
+
getStatus(): string;
|
|
157
|
+
/**
|
|
158
|
+
* Get orchestrator URL
|
|
159
|
+
*/
|
|
160
|
+
getOrchestratorUrl(): string | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Get decision API URL
|
|
163
|
+
*/
|
|
164
|
+
getDecisionApiUrl(): string | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Build API URL for fetching page config from the Layout Provider
|
|
167
|
+
*/
|
|
168
|
+
buildLayoutProviderUrl(route: string, preview?: boolean): string;
|
|
169
|
+
/**
|
|
170
|
+
* Fetch page configuration from orchestrator's Layout Provider
|
|
171
|
+
*/
|
|
172
|
+
fetchPageConfig(route: string, preview?: boolean): Promise<any>;
|
|
173
|
+
/**
|
|
174
|
+
* Set up view-level event tracking based on configuration
|
|
175
|
+
*/
|
|
176
|
+
setupEventTracking(eventConfig: EventTrackingConfig[]): void;
|
|
177
|
+
/**
|
|
178
|
+
* Attach event listeners to page elements based on view-level configuration
|
|
179
|
+
*/
|
|
180
|
+
private attachEventListeners;
|
|
181
|
+
/**
|
|
182
|
+
* Map event type from config to DOM event type
|
|
183
|
+
*/
|
|
184
|
+
private mapEventType;
|
|
185
|
+
/**
|
|
186
|
+
* Handle a tracked event and send to AWS API Gateway
|
|
187
|
+
*/
|
|
188
|
+
private handleTrackedEvent;
|
|
189
|
+
/**
|
|
190
|
+
* Set up view tracking using IntersectionObserver
|
|
191
|
+
*/
|
|
192
|
+
private setupViewTracking;
|
|
193
|
+
/**
|
|
194
|
+
* Clean up all attached event listeners
|
|
195
|
+
*/
|
|
196
|
+
cleanupEventTracking(): void;
|
|
197
|
+
/**
|
|
198
|
+
* Manually trigger event tracking setup (useful after dynamic content loads)
|
|
199
|
+
*/
|
|
200
|
+
refreshEventTracking(): void;
|
|
201
|
+
/**
|
|
202
|
+
* Set up postMessage listener for highlighting commands from orchestrator
|
|
203
|
+
*/
|
|
204
|
+
private setupHighlightingListener;
|
|
205
|
+
/**
|
|
206
|
+
* Enable/disable event selection mode
|
|
207
|
+
* When enabled, clicks on elements send element info to parent for event configuration
|
|
208
|
+
*/
|
|
209
|
+
private setEventSelectionMode;
|
|
210
|
+
/**
|
|
211
|
+
* Generate a CSS selector for an element
|
|
212
|
+
*/
|
|
213
|
+
private generateSelectorForElement;
|
|
214
|
+
/**
|
|
215
|
+
* Enable component highlighting
|
|
216
|
+
*/
|
|
217
|
+
private enableHighlighting;
|
|
218
|
+
/**
|
|
219
|
+
* Set up MutationObserver to watch for new components being added
|
|
220
|
+
*/
|
|
221
|
+
private setupMutationObserver;
|
|
222
|
+
/**
|
|
223
|
+
* Disable component highlighting
|
|
224
|
+
*/
|
|
225
|
+
private disableHighlighting;
|
|
226
|
+
/**
|
|
227
|
+
* Build component hierarchy for ancestor selection
|
|
228
|
+
*/
|
|
229
|
+
private buildComponentHierarchy;
|
|
230
|
+
/**
|
|
231
|
+
* Send selection message to orchestrator (includes element bounds for overlay positioning).
|
|
232
|
+
*/
|
|
233
|
+
private sendSelectionMessage;
|
|
234
|
+
/**
|
|
235
|
+
* Send component tree to orchestrator
|
|
236
|
+
* Note: Component tree is now sent from AmplifyRenderer based on layoutTree from pageConfig
|
|
237
|
+
* This method is kept for backwards compatibility but is no longer used
|
|
238
|
+
*/
|
|
239
|
+
private sendComponentTree;
|
|
240
|
+
/**
|
|
241
|
+
* Apply component highlights
|
|
242
|
+
*/
|
|
243
|
+
private applyComponentHighlights;
|
|
244
|
+
/**
|
|
245
|
+
* Cleanup: Remove message listener and observers
|
|
246
|
+
*/
|
|
247
|
+
cleanup(): void;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get or create the SDK instance
|
|
251
|
+
*/
|
|
252
|
+
declare function getSDK(adapter?: CDPAdapter): AmplifyUpSDK;
|
|
253
|
+
/**
|
|
254
|
+
* Initialize the SDK (convenience function)
|
|
255
|
+
*/
|
|
256
|
+
declare function init(config: AmplifyUpConfig): Promise<void>;
|
|
257
|
+
declare const page: (url: string, properties?: EventProperties) => void;
|
|
258
|
+
declare const track: (eventName: string, properties?: EventProperties) => void;
|
|
259
|
+
declare const trackClick: (elementId: string, elementText: string, properties?: EventProperties) => void;
|
|
260
|
+
declare const trackFormSubmit: (formId: string, formData?: EventProperties) => void;
|
|
261
|
+
declare const trackFormFieldInteraction: (fieldName: string, fieldValue?: string) => void;
|
|
262
|
+
declare const trackContentView: (contentId: string, contentType: string, properties?: EventProperties) => void;
|
|
263
|
+
declare const identify: (userId: string, traits?: IdentifyTraits) => void;
|
|
264
|
+
declare const trackContentEngagement: (contentId: string, engagementType: "view" | "click" | "dismiss") => void;
|
|
265
|
+
declare const reset: () => void;
|
|
266
|
+
declare const getInstanceId: () => string;
|
|
267
|
+
declare const getUserId: () => string | null;
|
|
268
|
+
declare const getTrackingId: () => string | undefined;
|
|
269
|
+
declare const getOrchestratorUrl: () => string | undefined;
|
|
270
|
+
declare const buildLayoutProviderUrl: (route: string, preview?: boolean) => string;
|
|
271
|
+
declare const buildPageRenderUrl: (route: string, preview?: boolean) => string;
|
|
272
|
+
declare const fetchPageConfig: (route: string, preview?: boolean) => Promise<any>;
|
|
273
|
+
declare const setupEventTracking: (config: EventTrackingConfig$1[]) => void;
|
|
274
|
+
declare const cleanupEventTracking: () => void;
|
|
275
|
+
declare const refreshEventTracking: () => void;
|
|
276
|
+
declare const getDiagnostics: () => {
|
|
277
|
+
initialized: boolean;
|
|
278
|
+
instanceId: string;
|
|
279
|
+
userId: string | null;
|
|
280
|
+
trackingId: string | undefined;
|
|
281
|
+
config: {
|
|
282
|
+
apiGatewayUrl?: string;
|
|
283
|
+
decisionApiUrl?: string;
|
|
284
|
+
orchestratorUrl?: string;
|
|
285
|
+
debug?: boolean;
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
declare const getStatus: () => {
|
|
289
|
+
initialized: boolean;
|
|
290
|
+
instanceId: string;
|
|
291
|
+
userId: string | null;
|
|
292
|
+
trackingId: string | undefined;
|
|
293
|
+
config: {
|
|
294
|
+
apiGatewayUrl?: string;
|
|
295
|
+
decisionApiUrl?: string;
|
|
296
|
+
orchestratorUrl?: string;
|
|
297
|
+
debug?: boolean;
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
declare const testTracking: () => void;
|
|
301
|
+
declare const verifyAWSConnection: () => {
|
|
302
|
+
connected: boolean;
|
|
303
|
+
message: string;
|
|
304
|
+
details?: any;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
declare const _default: AmplifyUpSDK;
|
|
308
|
+
|
|
309
|
+
export { AmplifyUpConfig, AmplifyUpSDK, CDPAdapter, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, IdentifyTraits, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getStatus, getTrackingId, getUserId, identify, init, page, refreshEventTracking, reset, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { C as CDPAdapter, A as AmplifyUpConfig, E as EventProperties, I as IdentifyTraits, a as EventTrackingConfig$1 } from './types-B9nHG2Cl.js';
|
|
2
|
+
export { P as PageConfig, Z as ZoneConfig } from './types-B9nHG2Cl.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AmplifyUp Tracking SDK
|
|
6
|
+
*
|
|
7
|
+
* Event tracking and personalization SDK for Pure AWS architecture.
|
|
8
|
+
*
|
|
9
|
+
* Uses AWS API Gateway for event ingestion and AWS Decision API for personalization.
|
|
10
|
+
* All runtime data (events, profiles, decisions) lives in AWS.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface EventTrackingConfig {
|
|
14
|
+
eventName: string;
|
|
15
|
+
eventType: string;
|
|
16
|
+
selector?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
properties?: string[];
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare class AmplifyUpSDK {
|
|
22
|
+
private adapter;
|
|
23
|
+
private config;
|
|
24
|
+
private apiGatewayUrl;
|
|
25
|
+
private orchestratorUrl;
|
|
26
|
+
private decisionApiUrl;
|
|
27
|
+
private initialized;
|
|
28
|
+
private highlightingEnabled;
|
|
29
|
+
private componentRegistry;
|
|
30
|
+
private messageListener;
|
|
31
|
+
private mutationObserver;
|
|
32
|
+
private isVisualEditorMode;
|
|
33
|
+
private eventSelectionMode;
|
|
34
|
+
private eventSelectionClickHandler;
|
|
35
|
+
private eventTrackingConfig;
|
|
36
|
+
private attachedEventListeners;
|
|
37
|
+
private trackingIntervals;
|
|
38
|
+
private trackingCleanup;
|
|
39
|
+
constructor(adapter?: CDPAdapter);
|
|
40
|
+
/**
|
|
41
|
+
* Detect if we're running in visual editor mode
|
|
42
|
+
* Returns true if:
|
|
43
|
+
* 1. Preview mode flag is set by proxy
|
|
44
|
+
* 2. We're in an iframe AND parent is from orchestrator domain
|
|
45
|
+
* 3. OR visualEditor/preview query parameter is present
|
|
46
|
+
*/
|
|
47
|
+
private detectVisualEditorMode;
|
|
48
|
+
/**
|
|
49
|
+
* Check if we're in preview/composer mode (should disable tracking)
|
|
50
|
+
*/
|
|
51
|
+
private isPreviewMode;
|
|
52
|
+
/**
|
|
53
|
+
* Get production URLs
|
|
54
|
+
*
|
|
55
|
+
* URLs are baked in at build time via tsup.config.ts
|
|
56
|
+
*
|
|
57
|
+
* API Gateway endpoints:
|
|
58
|
+
* - /v1/track - Event tracking (ingestion)
|
|
59
|
+
* - /v1/page - Page view tracking (ingestion)
|
|
60
|
+
* - /v1/personalize - Decision engine (personalization)
|
|
61
|
+
*/
|
|
62
|
+
private getProductionUrls;
|
|
63
|
+
/**
|
|
64
|
+
* Initialize the SDK
|
|
65
|
+
* Automatically reads env vars and sets up tracking
|
|
66
|
+
*/
|
|
67
|
+
init(config: AmplifyUpConfig): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Check if SDK is initialized
|
|
70
|
+
*/
|
|
71
|
+
isInitialized(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Clear all tracking intervals and event listeners
|
|
74
|
+
*/
|
|
75
|
+
private clearTrackingIntervals;
|
|
76
|
+
/**
|
|
77
|
+
* Track a page view
|
|
78
|
+
*/
|
|
79
|
+
page(url: string, properties?: EventProperties): void;
|
|
80
|
+
/**
|
|
81
|
+
* Track an event
|
|
82
|
+
*/
|
|
83
|
+
track(eventName: string, properties?: EventProperties): void;
|
|
84
|
+
/**
|
|
85
|
+
* Track a button click or CTA interaction
|
|
86
|
+
*/
|
|
87
|
+
trackClick(elementId: string, elementText: string, properties?: EventProperties): void;
|
|
88
|
+
/**
|
|
89
|
+
* Track form submission
|
|
90
|
+
*/
|
|
91
|
+
trackFormSubmit(formId: string, formData?: EventProperties): void;
|
|
92
|
+
/**
|
|
93
|
+
* Track form field interaction
|
|
94
|
+
*/
|
|
95
|
+
trackFormFieldInteraction(fieldName: string, fieldValue?: string): void;
|
|
96
|
+
/**
|
|
97
|
+
* Track product/content view
|
|
98
|
+
*/
|
|
99
|
+
trackContentView(contentId: string, contentType: string, properties?: EventProperties): void;
|
|
100
|
+
/**
|
|
101
|
+
* Identify user (when they sign up or log in)
|
|
102
|
+
*/
|
|
103
|
+
identify(userId: string, traits?: IdentifyTraits): void;
|
|
104
|
+
/**
|
|
105
|
+
* Track content engagement (when user interacts with personalized content)
|
|
106
|
+
*/
|
|
107
|
+
trackContentEngagement(contentId: string, engagementType: 'view' | 'click' | 'dismiss'): void;
|
|
108
|
+
/**
|
|
109
|
+
* Reset user identity (logout)
|
|
110
|
+
*/
|
|
111
|
+
reset(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Get instance ID (anonymous ID)
|
|
114
|
+
*/
|
|
115
|
+
getInstanceId(): string;
|
|
116
|
+
/**
|
|
117
|
+
* Get user ID
|
|
118
|
+
*/
|
|
119
|
+
getUserId(): string | null;
|
|
120
|
+
/**
|
|
121
|
+
* Get tracking ID
|
|
122
|
+
*/
|
|
123
|
+
getTrackingId(): string | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Get diagnostic information
|
|
126
|
+
* Useful for debugging from browser console
|
|
127
|
+
*/
|
|
128
|
+
getDiagnostics(): {
|
|
129
|
+
initialized: boolean;
|
|
130
|
+
instanceId: string;
|
|
131
|
+
userId: string | null;
|
|
132
|
+
trackingId: string | undefined;
|
|
133
|
+
config: {
|
|
134
|
+
apiGatewayUrl?: string;
|
|
135
|
+
decisionApiUrl?: string;
|
|
136
|
+
orchestratorUrl?: string;
|
|
137
|
+
debug?: boolean;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Test tracking by sending a test event
|
|
142
|
+
*/
|
|
143
|
+
testTracking(): void;
|
|
144
|
+
/**
|
|
145
|
+
* Verify AWS API Gateway connectivity
|
|
146
|
+
* Checks if AWS adapter is initialized and can send events
|
|
147
|
+
*/
|
|
148
|
+
verifyAWSConnection(): {
|
|
149
|
+
connected: boolean;
|
|
150
|
+
message: string;
|
|
151
|
+
details?: any;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Get status summary (for console debugging)
|
|
155
|
+
*/
|
|
156
|
+
getStatus(): string;
|
|
157
|
+
/**
|
|
158
|
+
* Get orchestrator URL
|
|
159
|
+
*/
|
|
160
|
+
getOrchestratorUrl(): string | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Get decision API URL
|
|
163
|
+
*/
|
|
164
|
+
getDecisionApiUrl(): string | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Build API URL for fetching page config from the Layout Provider
|
|
167
|
+
*/
|
|
168
|
+
buildLayoutProviderUrl(route: string, preview?: boolean): string;
|
|
169
|
+
/**
|
|
170
|
+
* Fetch page configuration from orchestrator's Layout Provider
|
|
171
|
+
*/
|
|
172
|
+
fetchPageConfig(route: string, preview?: boolean): Promise<any>;
|
|
173
|
+
/**
|
|
174
|
+
* Set up view-level event tracking based on configuration
|
|
175
|
+
*/
|
|
176
|
+
setupEventTracking(eventConfig: EventTrackingConfig[]): void;
|
|
177
|
+
/**
|
|
178
|
+
* Attach event listeners to page elements based on view-level configuration
|
|
179
|
+
*/
|
|
180
|
+
private attachEventListeners;
|
|
181
|
+
/**
|
|
182
|
+
* Map event type from config to DOM event type
|
|
183
|
+
*/
|
|
184
|
+
private mapEventType;
|
|
185
|
+
/**
|
|
186
|
+
* Handle a tracked event and send to AWS API Gateway
|
|
187
|
+
*/
|
|
188
|
+
private handleTrackedEvent;
|
|
189
|
+
/**
|
|
190
|
+
* Set up view tracking using IntersectionObserver
|
|
191
|
+
*/
|
|
192
|
+
private setupViewTracking;
|
|
193
|
+
/**
|
|
194
|
+
* Clean up all attached event listeners
|
|
195
|
+
*/
|
|
196
|
+
cleanupEventTracking(): void;
|
|
197
|
+
/**
|
|
198
|
+
* Manually trigger event tracking setup (useful after dynamic content loads)
|
|
199
|
+
*/
|
|
200
|
+
refreshEventTracking(): void;
|
|
201
|
+
/**
|
|
202
|
+
* Set up postMessage listener for highlighting commands from orchestrator
|
|
203
|
+
*/
|
|
204
|
+
private setupHighlightingListener;
|
|
205
|
+
/**
|
|
206
|
+
* Enable/disable event selection mode
|
|
207
|
+
* When enabled, clicks on elements send element info to parent for event configuration
|
|
208
|
+
*/
|
|
209
|
+
private setEventSelectionMode;
|
|
210
|
+
/**
|
|
211
|
+
* Generate a CSS selector for an element
|
|
212
|
+
*/
|
|
213
|
+
private generateSelectorForElement;
|
|
214
|
+
/**
|
|
215
|
+
* Enable component highlighting
|
|
216
|
+
*/
|
|
217
|
+
private enableHighlighting;
|
|
218
|
+
/**
|
|
219
|
+
* Set up MutationObserver to watch for new components being added
|
|
220
|
+
*/
|
|
221
|
+
private setupMutationObserver;
|
|
222
|
+
/**
|
|
223
|
+
* Disable component highlighting
|
|
224
|
+
*/
|
|
225
|
+
private disableHighlighting;
|
|
226
|
+
/**
|
|
227
|
+
* Build component hierarchy for ancestor selection
|
|
228
|
+
*/
|
|
229
|
+
private buildComponentHierarchy;
|
|
230
|
+
/**
|
|
231
|
+
* Send selection message to orchestrator (includes element bounds for overlay positioning).
|
|
232
|
+
*/
|
|
233
|
+
private sendSelectionMessage;
|
|
234
|
+
/**
|
|
235
|
+
* Send component tree to orchestrator
|
|
236
|
+
* Note: Component tree is now sent from AmplifyRenderer based on layoutTree from pageConfig
|
|
237
|
+
* This method is kept for backwards compatibility but is no longer used
|
|
238
|
+
*/
|
|
239
|
+
private sendComponentTree;
|
|
240
|
+
/**
|
|
241
|
+
* Apply component highlights
|
|
242
|
+
*/
|
|
243
|
+
private applyComponentHighlights;
|
|
244
|
+
/**
|
|
245
|
+
* Cleanup: Remove message listener and observers
|
|
246
|
+
*/
|
|
247
|
+
cleanup(): void;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get or create the SDK instance
|
|
251
|
+
*/
|
|
252
|
+
declare function getSDK(adapter?: CDPAdapter): AmplifyUpSDK;
|
|
253
|
+
/**
|
|
254
|
+
* Initialize the SDK (convenience function)
|
|
255
|
+
*/
|
|
256
|
+
declare function init(config: AmplifyUpConfig): Promise<void>;
|
|
257
|
+
declare const page: (url: string, properties?: EventProperties) => void;
|
|
258
|
+
declare const track: (eventName: string, properties?: EventProperties) => void;
|
|
259
|
+
declare const trackClick: (elementId: string, elementText: string, properties?: EventProperties) => void;
|
|
260
|
+
declare const trackFormSubmit: (formId: string, formData?: EventProperties) => void;
|
|
261
|
+
declare const trackFormFieldInteraction: (fieldName: string, fieldValue?: string) => void;
|
|
262
|
+
declare const trackContentView: (contentId: string, contentType: string, properties?: EventProperties) => void;
|
|
263
|
+
declare const identify: (userId: string, traits?: IdentifyTraits) => void;
|
|
264
|
+
declare const trackContentEngagement: (contentId: string, engagementType: "view" | "click" | "dismiss") => void;
|
|
265
|
+
declare const reset: () => void;
|
|
266
|
+
declare const getInstanceId: () => string;
|
|
267
|
+
declare const getUserId: () => string | null;
|
|
268
|
+
declare const getTrackingId: () => string | undefined;
|
|
269
|
+
declare const getOrchestratorUrl: () => string | undefined;
|
|
270
|
+
declare const buildLayoutProviderUrl: (route: string, preview?: boolean) => string;
|
|
271
|
+
declare const buildPageRenderUrl: (route: string, preview?: boolean) => string;
|
|
272
|
+
declare const fetchPageConfig: (route: string, preview?: boolean) => Promise<any>;
|
|
273
|
+
declare const setupEventTracking: (config: EventTrackingConfig$1[]) => void;
|
|
274
|
+
declare const cleanupEventTracking: () => void;
|
|
275
|
+
declare const refreshEventTracking: () => void;
|
|
276
|
+
declare const getDiagnostics: () => {
|
|
277
|
+
initialized: boolean;
|
|
278
|
+
instanceId: string;
|
|
279
|
+
userId: string | null;
|
|
280
|
+
trackingId: string | undefined;
|
|
281
|
+
config: {
|
|
282
|
+
apiGatewayUrl?: string;
|
|
283
|
+
decisionApiUrl?: string;
|
|
284
|
+
orchestratorUrl?: string;
|
|
285
|
+
debug?: boolean;
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
declare const getStatus: () => {
|
|
289
|
+
initialized: boolean;
|
|
290
|
+
instanceId: string;
|
|
291
|
+
userId: string | null;
|
|
292
|
+
trackingId: string | undefined;
|
|
293
|
+
config: {
|
|
294
|
+
apiGatewayUrl?: string;
|
|
295
|
+
decisionApiUrl?: string;
|
|
296
|
+
orchestratorUrl?: string;
|
|
297
|
+
debug?: boolean;
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
declare const testTracking: () => void;
|
|
301
|
+
declare const verifyAWSConnection: () => {
|
|
302
|
+
connected: boolean;
|
|
303
|
+
message: string;
|
|
304
|
+
details?: any;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
declare const _default: AmplifyUpSDK;
|
|
308
|
+
|
|
309
|
+
export { AmplifyUpConfig, AmplifyUpSDK, CDPAdapter, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, IdentifyTraits, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getStatus, getTrackingId, getUserId, identify, init, page, refreshEventTracking, reset, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|