@amplifyup/sdk 0.1.1 → 0.1.2
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 +23 -18
- package/dist/AmplifyRenderer.d.mts +1 -1
- package/dist/AmplifyRenderer.d.ts +1 -1
- package/dist/AmplifyRenderer.js +112 -36
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +112 -36
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +117 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -37
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +144 -49
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +144 -49
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +6 -2
- package/dist/server.d.ts +6 -2
- package/dist/server.js +77 -1385
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +76 -1386
- package/dist/server.mjs.map +1 -1
- package/dist/{types-B9nHG2Cl.d.mts → types-Xv9P55Dj.d.mts} +51 -1
- package/dist/{types-B9nHG2Cl.d.ts → types-Xv9P55Dj.d.ts} +51 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CDPAdapter, A as AmplifyUpConfig, E as EventProperties, I as IdentifyTraits, a as EventTrackingConfig$1 } from './types-
|
|
2
|
-
export { P as PageConfig, Z as ZoneConfig } from './types-
|
|
1
|
+
import { C as CDPAdapter, A as AmplifyUpConfig, E as EventProperties, I as IdentifyTraits, a as AmplifyUpTarget, b as EventTrackingConfig$1 } from './types-Xv9P55Dj.mjs';
|
|
2
|
+
export { P as PageConfig, Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, c as resolveAmplifyUpUrls } from './types-Xv9P55Dj.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AmplifyUp Tracking SDK
|
|
@@ -24,7 +24,12 @@ declare class AmplifyUpSDK {
|
|
|
24
24
|
private apiGatewayUrl;
|
|
25
25
|
private orchestratorUrl;
|
|
26
26
|
private decisionApiUrl;
|
|
27
|
+
private target;
|
|
27
28
|
private initialized;
|
|
29
|
+
/** Prevents overlapping init() from React Strict Mode double-mount */
|
|
30
|
+
private initPromise;
|
|
31
|
+
/** Ensures auto page() on init fires once per page load */
|
|
32
|
+
private initialPageSent;
|
|
28
33
|
private highlightingEnabled;
|
|
29
34
|
private componentRegistry;
|
|
30
35
|
private messageListener;
|
|
@@ -49,22 +54,12 @@ declare class AmplifyUpSDK {
|
|
|
49
54
|
* Check if we're in preview/composer mode (should disable tracking)
|
|
50
55
|
*/
|
|
51
56
|
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
57
|
/**
|
|
64
58
|
* Initialize the SDK
|
|
65
|
-
*
|
|
59
|
+
* Resolves local | dev | production targets for ingestion + personalization URLs.
|
|
66
60
|
*/
|
|
67
61
|
init(config: AmplifyUpConfig): Promise<void>;
|
|
62
|
+
private performInit;
|
|
68
63
|
/**
|
|
69
64
|
* Check if SDK is initialized
|
|
70
65
|
*/
|
|
@@ -130,6 +125,7 @@ declare class AmplifyUpSDK {
|
|
|
130
125
|
instanceId: string;
|
|
131
126
|
userId: string | null;
|
|
132
127
|
trackingId: string | undefined;
|
|
128
|
+
target: AmplifyUpTarget;
|
|
133
129
|
config: {
|
|
134
130
|
apiGatewayUrl?: string;
|
|
135
131
|
decisionApiUrl?: string;
|
|
@@ -137,6 +133,7 @@ declare class AmplifyUpSDK {
|
|
|
137
133
|
debug?: boolean;
|
|
138
134
|
};
|
|
139
135
|
};
|
|
136
|
+
getTarget(): AmplifyUpTarget;
|
|
140
137
|
/**
|
|
141
138
|
* Test tracking by sending a test event
|
|
142
139
|
*/
|
|
@@ -266,6 +263,7 @@ declare const reset: () => void;
|
|
|
266
263
|
declare const getInstanceId: () => string;
|
|
267
264
|
declare const getUserId: () => string | null;
|
|
268
265
|
declare const getTrackingId: () => string | undefined;
|
|
266
|
+
declare const getTarget: () => AmplifyUpTarget;
|
|
269
267
|
declare const getOrchestratorUrl: () => string | undefined;
|
|
270
268
|
declare const buildLayoutProviderUrl: (route: string, preview?: boolean) => string;
|
|
271
269
|
declare const buildPageRenderUrl: (route: string, preview?: boolean) => string;
|
|
@@ -278,6 +276,7 @@ declare const getDiagnostics: () => {
|
|
|
278
276
|
instanceId: string;
|
|
279
277
|
userId: string | null;
|
|
280
278
|
trackingId: string | undefined;
|
|
279
|
+
target: AmplifyUpTarget;
|
|
281
280
|
config: {
|
|
282
281
|
apiGatewayUrl?: string;
|
|
283
282
|
decisionApiUrl?: string;
|
|
@@ -290,6 +289,7 @@ declare const getStatus: () => {
|
|
|
290
289
|
instanceId: string;
|
|
291
290
|
userId: string | null;
|
|
292
291
|
trackingId: string | undefined;
|
|
292
|
+
target: AmplifyUpTarget;
|
|
293
293
|
config: {
|
|
294
294
|
apiGatewayUrl?: string;
|
|
295
295
|
decisionApiUrl?: string;
|
|
@@ -306,4 +306,4 @@ declare const verifyAWSConnection: () => {
|
|
|
306
306
|
|
|
307
307
|
declare const _default: AmplifyUpSDK;
|
|
308
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 };
|
|
309
|
+
export { AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, IdentifyTraits, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getStatus, getTarget, getTrackingId, getUserId, identify, init, page, refreshEventTracking, reset, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CDPAdapter, A as AmplifyUpConfig, E as EventProperties, I as IdentifyTraits, a as EventTrackingConfig$1 } from './types-
|
|
2
|
-
export { P as PageConfig, Z as ZoneConfig } from './types-
|
|
1
|
+
import { C as CDPAdapter, A as AmplifyUpConfig, E as EventProperties, I as IdentifyTraits, a as AmplifyUpTarget, b as EventTrackingConfig$1 } from './types-Xv9P55Dj.js';
|
|
2
|
+
export { P as PageConfig, Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, c as resolveAmplifyUpUrls } from './types-Xv9P55Dj.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AmplifyUp Tracking SDK
|
|
@@ -24,7 +24,12 @@ declare class AmplifyUpSDK {
|
|
|
24
24
|
private apiGatewayUrl;
|
|
25
25
|
private orchestratorUrl;
|
|
26
26
|
private decisionApiUrl;
|
|
27
|
+
private target;
|
|
27
28
|
private initialized;
|
|
29
|
+
/** Prevents overlapping init() from React Strict Mode double-mount */
|
|
30
|
+
private initPromise;
|
|
31
|
+
/** Ensures auto page() on init fires once per page load */
|
|
32
|
+
private initialPageSent;
|
|
28
33
|
private highlightingEnabled;
|
|
29
34
|
private componentRegistry;
|
|
30
35
|
private messageListener;
|
|
@@ -49,22 +54,12 @@ declare class AmplifyUpSDK {
|
|
|
49
54
|
* Check if we're in preview/composer mode (should disable tracking)
|
|
50
55
|
*/
|
|
51
56
|
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
57
|
/**
|
|
64
58
|
* Initialize the SDK
|
|
65
|
-
*
|
|
59
|
+
* Resolves local | dev | production targets for ingestion + personalization URLs.
|
|
66
60
|
*/
|
|
67
61
|
init(config: AmplifyUpConfig): Promise<void>;
|
|
62
|
+
private performInit;
|
|
68
63
|
/**
|
|
69
64
|
* Check if SDK is initialized
|
|
70
65
|
*/
|
|
@@ -130,6 +125,7 @@ declare class AmplifyUpSDK {
|
|
|
130
125
|
instanceId: string;
|
|
131
126
|
userId: string | null;
|
|
132
127
|
trackingId: string | undefined;
|
|
128
|
+
target: AmplifyUpTarget;
|
|
133
129
|
config: {
|
|
134
130
|
apiGatewayUrl?: string;
|
|
135
131
|
decisionApiUrl?: string;
|
|
@@ -137,6 +133,7 @@ declare class AmplifyUpSDK {
|
|
|
137
133
|
debug?: boolean;
|
|
138
134
|
};
|
|
139
135
|
};
|
|
136
|
+
getTarget(): AmplifyUpTarget;
|
|
140
137
|
/**
|
|
141
138
|
* Test tracking by sending a test event
|
|
142
139
|
*/
|
|
@@ -266,6 +263,7 @@ declare const reset: () => void;
|
|
|
266
263
|
declare const getInstanceId: () => string;
|
|
267
264
|
declare const getUserId: () => string | null;
|
|
268
265
|
declare const getTrackingId: () => string | undefined;
|
|
266
|
+
declare const getTarget: () => AmplifyUpTarget;
|
|
269
267
|
declare const getOrchestratorUrl: () => string | undefined;
|
|
270
268
|
declare const buildLayoutProviderUrl: (route: string, preview?: boolean) => string;
|
|
271
269
|
declare const buildPageRenderUrl: (route: string, preview?: boolean) => string;
|
|
@@ -278,6 +276,7 @@ declare const getDiagnostics: () => {
|
|
|
278
276
|
instanceId: string;
|
|
279
277
|
userId: string | null;
|
|
280
278
|
trackingId: string | undefined;
|
|
279
|
+
target: AmplifyUpTarget;
|
|
281
280
|
config: {
|
|
282
281
|
apiGatewayUrl?: string;
|
|
283
282
|
decisionApiUrl?: string;
|
|
@@ -290,6 +289,7 @@ declare const getStatus: () => {
|
|
|
290
289
|
instanceId: string;
|
|
291
290
|
userId: string | null;
|
|
292
291
|
trackingId: string | undefined;
|
|
292
|
+
target: AmplifyUpTarget;
|
|
293
293
|
config: {
|
|
294
294
|
apiGatewayUrl?: string;
|
|
295
295
|
decisionApiUrl?: string;
|
|
@@ -306,4 +306,4 @@ declare const verifyAWSConnection: () => {
|
|
|
306
306
|
|
|
307
307
|
declare const _default: AmplifyUpSDK;
|
|
308
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 };
|
|
309
|
+
export { AmplifyUpConfig, AmplifyUpSDK, AmplifyUpTarget, CDPAdapter, EventProperties, EventTrackingConfig$1 as EventTrackingConfig, IdentifyTraits, buildLayoutProviderUrl, buildPageRenderUrl, cleanupEventTracking, _default as default, fetchPageConfig, getDiagnostics, getInstanceId, getOrchestratorUrl, getSDK, getStatus, getTarget, getTrackingId, getUserId, identify, init, page, refreshEventTracking, reset, setupEventTracking, testTracking, track, trackClick, trackContentEngagement, trackContentView, trackFormFieldInteraction, trackFormSubmit, verifyAWSConnection };
|
package/dist/index.js
CHANGED
|
@@ -213,9 +213,69 @@ function clearIds() {
|
|
|
213
213
|
localStorage.removeItem(USER_ID_KEY);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
// src/targets.ts
|
|
217
|
+
var AWS_DEV_API = "https://api-dev.amplifyup.ai";
|
|
218
|
+
var AWS_PROD_API = "https://api.amplifyup.ai";
|
|
219
|
+
var PROD_ORCHESTRATOR = "https://amplifyup.ai";
|
|
220
|
+
function isAmplifyUpTarget(value) {
|
|
221
|
+
return value === "local" || value === "dev" || value === "production";
|
|
222
|
+
}
|
|
223
|
+
function normalizeAmplifyUpTarget(value) {
|
|
224
|
+
return value === "dev" ? "local" : value;
|
|
225
|
+
}
|
|
226
|
+
function resolveAmplifyUpTarget(options) {
|
|
227
|
+
if (options?.configTarget && isAmplifyUpTarget(options.configTarget)) {
|
|
228
|
+
return normalizeAmplifyUpTarget(options.configTarget);
|
|
229
|
+
}
|
|
230
|
+
if (options?.configDev === true) {
|
|
231
|
+
return "local";
|
|
232
|
+
}
|
|
233
|
+
const envTarget = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_AMPLIFYUP_TARGET : void 0;
|
|
234
|
+
if (isAmplifyUpTarget(envTarget)) {
|
|
235
|
+
return normalizeAmplifyUpTarget(envTarget);
|
|
236
|
+
}
|
|
237
|
+
if (typeof window !== "undefined") {
|
|
238
|
+
const host = window.location.hostname;
|
|
239
|
+
if (host === "localhost" || host === "127.0.0.1") {
|
|
240
|
+
return "local";
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return "production";
|
|
244
|
+
}
|
|
245
|
+
function localOrchestratorUrl() {
|
|
246
|
+
const fromEnv = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_ORCHESTRATOR_URL : void 0;
|
|
247
|
+
return (fromEnv || "http://localhost:5001").replace(/\/$/, "");
|
|
248
|
+
}
|
|
249
|
+
function localAwsApiUrl() {
|
|
250
|
+
const fromEnv = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_AMPLIFYUP_API_URL : void 0;
|
|
251
|
+
return (fromEnv || AWS_DEV_API).replace(/\/$/, "");
|
|
252
|
+
}
|
|
253
|
+
function resolveAmplifyUpUrls(target) {
|
|
254
|
+
if (target === "local") {
|
|
255
|
+
const orchestratorUrl2 = localOrchestratorUrl();
|
|
256
|
+
const apiGatewayUrl = localAwsApiUrl();
|
|
257
|
+
return {
|
|
258
|
+
target: "local",
|
|
259
|
+
// Layouts / site config / composer APIs → local orchestrator + Neon
|
|
260
|
+
orchestratorUrl: orchestratorUrl2,
|
|
261
|
+
// Events + personalize → AWS development stack
|
|
262
|
+
apiGatewayUrl,
|
|
263
|
+
decisionApiUrl: `${apiGatewayUrl}/v1/personalize`
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
const resolvedApi = typeof process !== "undefined" && process.env.NEXT_PUBLIC_AMPLIFYUP_API_URL?.replace(/\/$/, "") || AWS_PROD_API;
|
|
267
|
+
const orchestratorFromEnv = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_ORCHESTRATOR_URL : void 0;
|
|
268
|
+
const isLocalOrchestrator = !!orchestratorFromEnv && (orchestratorFromEnv.includes("localhost") || orchestratorFromEnv.includes("127.0.0.1"));
|
|
269
|
+
const orchestratorUrl = isLocalOrchestrator || !orchestratorFromEnv ? PROD_ORCHESTRATOR : orchestratorFromEnv.replace(/\/$/, "");
|
|
270
|
+
return {
|
|
271
|
+
target: "production",
|
|
272
|
+
apiGatewayUrl: resolvedApi,
|
|
273
|
+
orchestratorUrl,
|
|
274
|
+
decisionApiUrl: `${resolvedApi}/v1/personalize`
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
216
278
|
// src/index.ts
|
|
217
|
-
var PROD_API_URL = "https://api.amplifyup.ai" ;
|
|
218
|
-
var PROD_ORCHESTRATOR_URL = "https://amplifyup.ai" ;
|
|
219
279
|
var AmplifyUpSDK = class {
|
|
220
280
|
constructor(adapter) {
|
|
221
281
|
this.config = null;
|
|
@@ -223,7 +283,12 @@ var AmplifyUpSDK = class {
|
|
|
223
283
|
this.apiGatewayUrl = "";
|
|
224
284
|
this.orchestratorUrl = "";
|
|
225
285
|
this.decisionApiUrl = "";
|
|
286
|
+
this.target = "local";
|
|
226
287
|
this.initialized = false;
|
|
288
|
+
/** Prevents overlapping init() from React Strict Mode double-mount */
|
|
289
|
+
this.initPromise = null;
|
|
290
|
+
/** Ensures auto page() on init fires once per page load */
|
|
291
|
+
this.initialPageSent = false;
|
|
227
292
|
this.highlightingEnabled = false;
|
|
228
293
|
this.componentRegistry = [];
|
|
229
294
|
this.messageListener = null;
|
|
@@ -306,46 +371,41 @@ var AmplifyUpSDK = class {
|
|
|
306
371
|
}
|
|
307
372
|
return false;
|
|
308
373
|
}
|
|
309
|
-
/**
|
|
310
|
-
* Get production URLs
|
|
311
|
-
*
|
|
312
|
-
* URLs are baked in at build time via tsup.config.ts
|
|
313
|
-
*
|
|
314
|
-
* API Gateway endpoints:
|
|
315
|
-
* - /v1/track - Event tracking (ingestion)
|
|
316
|
-
* - /v1/page - Page view tracking (ingestion)
|
|
317
|
-
* - /v1/personalize - Decision engine (personalization)
|
|
318
|
-
*/
|
|
319
|
-
getProductionUrls() {
|
|
320
|
-
return {
|
|
321
|
-
apiGatewayUrl: PROD_API_URL,
|
|
322
|
-
orchestratorUrl: PROD_ORCHESTRATOR_URL,
|
|
323
|
-
decisionApiUrl: `${PROD_API_URL}/v1/personalize`
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
374
|
/**
|
|
327
375
|
* Initialize the SDK
|
|
328
|
-
*
|
|
376
|
+
* Resolves local | dev | production targets for ingestion + personalization URLs.
|
|
329
377
|
*/
|
|
330
378
|
async init(config) {
|
|
379
|
+
if (this.initialized && this.adapter?.isInitialized()) {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (this.initPromise) {
|
|
383
|
+
return this.initPromise;
|
|
384
|
+
}
|
|
385
|
+
this.initPromise = this.performInit(config);
|
|
386
|
+
try {
|
|
387
|
+
await this.initPromise;
|
|
388
|
+
} finally {
|
|
389
|
+
this.initPromise = null;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
async performInit(config) {
|
|
331
393
|
if (!this.adapter) {
|
|
332
394
|
this.adapter = new AWSAdapter();
|
|
333
395
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
this.orchestratorUrl = urls.orchestratorUrl;
|
|
343
|
-
this.decisionApiUrl = urls.decisionApiUrl;
|
|
344
|
-
}
|
|
396
|
+
this.target = resolveAmplifyUpTarget({
|
|
397
|
+
configTarget: config.target,
|
|
398
|
+
configDev: config.dev
|
|
399
|
+
});
|
|
400
|
+
const urls = resolveAmplifyUpUrls(this.target);
|
|
401
|
+
this.apiGatewayUrl = urls.apiGatewayUrl;
|
|
402
|
+
this.orchestratorUrl = urls.orchestratorUrl;
|
|
403
|
+
this.decisionApiUrl = urls.decisionApiUrl;
|
|
345
404
|
this.config = {
|
|
346
405
|
trackingId: config.trackingId,
|
|
347
406
|
debug: config.debug ?? true,
|
|
348
407
|
// Enable debug by default
|
|
408
|
+
target: this.target,
|
|
349
409
|
dev: config.dev
|
|
350
410
|
};
|
|
351
411
|
try {
|
|
@@ -362,6 +422,7 @@ var AmplifyUpSDK = class {
|
|
|
362
422
|
getInstanceId: () => this.getInstanceId(),
|
|
363
423
|
getUserId: () => this.getUserId(),
|
|
364
424
|
getTrackingId: () => this.getTrackingId(),
|
|
425
|
+
getTarget: () => this.getTarget(),
|
|
365
426
|
getDiagnostics: () => this.getDiagnostics(),
|
|
366
427
|
getStatus: () => {
|
|
367
428
|
console.log(this.getStatus());
|
|
@@ -382,7 +443,7 @@ var AmplifyUpSDK = class {
|
|
|
382
443
|
};
|
|
383
444
|
if (this.config?.debug) {
|
|
384
445
|
console.log("AmplifyUp SDK: Diagnostic methods available on window.AmplifyUp");
|
|
385
|
-
console.log("Try: AmplifyUp.getStatus() or AmplifyUp.
|
|
446
|
+
console.log("Try: AmplifyUp.getStatus() or AmplifyUp.testTracking()");
|
|
386
447
|
}
|
|
387
448
|
}
|
|
388
449
|
this.clearTrackingIntervals();
|
|
@@ -394,11 +455,20 @@ var AmplifyUpSDK = class {
|
|
|
394
455
|
if (this.isPreviewMode()) {
|
|
395
456
|
return;
|
|
396
457
|
}
|
|
397
|
-
|
|
398
|
-
|
|
458
|
+
if (!this.initialPageSent) {
|
|
459
|
+
this.initialPageSent = true;
|
|
460
|
+
const url = window.location.pathname;
|
|
461
|
+
this.page(url);
|
|
462
|
+
}
|
|
399
463
|
}
|
|
400
464
|
if (this.config?.debug && this.initialized) {
|
|
401
|
-
console.log("AmplifyUp SDK: Initialized successfully", {
|
|
465
|
+
console.log("AmplifyUp SDK: Initialized successfully", {
|
|
466
|
+
trackingId: config.trackingId,
|
|
467
|
+
target: this.target,
|
|
468
|
+
apiGatewayUrl: this.apiGatewayUrl,
|
|
469
|
+
orchestratorUrl: this.orchestratorUrl,
|
|
470
|
+
decisionApiUrl: this.decisionApiUrl || "(orchestrator fallback)"
|
|
471
|
+
});
|
|
402
472
|
}
|
|
403
473
|
} catch (error) {
|
|
404
474
|
console.error("AmplifyUp SDK: Initialization failed", error);
|
|
@@ -599,6 +669,7 @@ var AmplifyUpSDK = class {
|
|
|
599
669
|
instanceId,
|
|
600
670
|
userId,
|
|
601
671
|
trackingId: this.config?.trackingId,
|
|
672
|
+
target: this.target,
|
|
602
673
|
config: {
|
|
603
674
|
apiGatewayUrl: this.apiGatewayUrl,
|
|
604
675
|
decisionApiUrl: this.decisionApiUrl,
|
|
@@ -607,6 +678,9 @@ var AmplifyUpSDK = class {
|
|
|
607
678
|
}
|
|
608
679
|
};
|
|
609
680
|
}
|
|
681
|
+
getTarget() {
|
|
682
|
+
return this.target;
|
|
683
|
+
}
|
|
610
684
|
/**
|
|
611
685
|
* Test tracking by sending a test event
|
|
612
686
|
*/
|
|
@@ -664,6 +738,7 @@ var AmplifyUpSDK = class {
|
|
|
664
738
|
AmplifyUp SDK Status:
|
|
665
739
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
666
740
|
Initialized: ${diag.initialized ? "\u2705 Yes" : "\u274C No"}
|
|
741
|
+
Target: ${diag.target}
|
|
667
742
|
Instance ID: ${diag.instanceId}
|
|
668
743
|
User ID: ${diag.userId || "Not identified"}
|
|
669
744
|
Tracking ID: ${diag.trackingId || "Not set"}
|
|
@@ -675,11 +750,11 @@ Config:
|
|
|
675
750
|
API Gateway: ${this.apiGatewayUrl || "Not set (required)"}
|
|
676
751
|
Decision API: ${this.decisionApiUrl || "Not set (using Orchestrator fallback)"}
|
|
677
752
|
Orchestrator: ${this.orchestratorUrl || "Not set"}
|
|
678
|
-
Debug: ${diag.config.debug ? "Enabled" : "Disabled"}
|
|
679
753
|
|
|
680
754
|
Available Console Commands:
|
|
681
755
|
AmplifyUp.getStatus() - Show this status
|
|
682
756
|
AmplifyUp.getDiagnostics() - Get full diagnostic object
|
|
757
|
+
AmplifyUp.getTarget() - Current environment target
|
|
683
758
|
AmplifyUp.getInstanceId() - Get instance ID (browser/session ID)
|
|
684
759
|
AmplifyUp.getUserId() - Get user ID if identified
|
|
685
760
|
AmplifyUp.testTracking() - Send a test event
|
|
@@ -1402,6 +1477,7 @@ var reset = () => getSDK().reset();
|
|
|
1402
1477
|
var getInstanceId2 = () => getSDK().getInstanceId();
|
|
1403
1478
|
var getUserId2 = () => getSDK().getUserId();
|
|
1404
1479
|
var getTrackingId = () => getSDK().getTrackingId();
|
|
1480
|
+
var getTarget = () => getSDK().getTarget();
|
|
1405
1481
|
var getOrchestratorUrl = () => getSDK().getOrchestratorUrl();
|
|
1406
1482
|
var buildLayoutProviderUrl = (route, preview) => getSDK().buildLayoutProviderUrl(route, preview);
|
|
1407
1483
|
var buildPageRenderUrl = (route, preview) => getSDK().buildLayoutProviderUrl(route, preview);
|
|
@@ -1435,13 +1511,18 @@ exports.getInstanceId = getInstanceId2;
|
|
|
1435
1511
|
exports.getOrchestratorUrl = getOrchestratorUrl;
|
|
1436
1512
|
exports.getSDK = getSDK;
|
|
1437
1513
|
exports.getStatus = getStatus;
|
|
1514
|
+
exports.getTarget = getTarget;
|
|
1438
1515
|
exports.getTrackingId = getTrackingId;
|
|
1439
1516
|
exports.getUserId = getUserId2;
|
|
1440
1517
|
exports.identify = identify;
|
|
1441
1518
|
exports.init = init;
|
|
1519
|
+
exports.isAmplifyUpTarget = isAmplifyUpTarget;
|
|
1520
|
+
exports.normalizeAmplifyUpTarget = normalizeAmplifyUpTarget;
|
|
1442
1521
|
exports.page = page;
|
|
1443
1522
|
exports.refreshEventTracking = refreshEventTracking;
|
|
1444
1523
|
exports.reset = reset;
|
|
1524
|
+
exports.resolveAmplifyUpTarget = resolveAmplifyUpTarget;
|
|
1525
|
+
exports.resolveAmplifyUpUrls = resolveAmplifyUpUrls;
|
|
1445
1526
|
exports.setupEventTracking = setupEventTracking;
|
|
1446
1527
|
exports.testTracking = testTracking;
|
|
1447
1528
|
exports.track = track;
|