@amplifyup/sdk 0.1.5 → 0.1.7
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 +57 -98
- package/dist/AmplifyRenderer.js +38 -28
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +38 -28
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +66 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -29
- package/dist/index.mjs.map +1 -1
- package/dist/preview-BMrIgUvp.d.mts +13 -0
- package/dist/preview-BMrIgUvp.d.ts +13 -0
- package/dist/react.d.mts +28 -2
- package/dist/react.d.ts +28 -2
- package/dist/react.js +125 -47
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +123 -48
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/AmplifyRenderer.mjs
CHANGED
|
@@ -405,6 +405,7 @@ var AmplifyUpSDK = class {
|
|
|
405
405
|
*/
|
|
406
406
|
async init(config) {
|
|
407
407
|
if (this.initialized && this.adapter?.isInitialized()) {
|
|
408
|
+
this.ensureWindowBridge();
|
|
408
409
|
return;
|
|
409
410
|
}
|
|
410
411
|
if (this.initPromise) {
|
|
@@ -417,6 +418,32 @@ var AmplifyUpSDK = class {
|
|
|
417
418
|
this.initPromise = null;
|
|
418
419
|
}
|
|
419
420
|
}
|
|
421
|
+
/** Attach console helpers to window (idempotent; survives Fast Refresh). */
|
|
422
|
+
ensureWindowBridge() {
|
|
423
|
+
if (typeof window === "undefined") return;
|
|
424
|
+
window.AmplifyUp = {
|
|
425
|
+
getInstanceId: () => this.getInstanceId(),
|
|
426
|
+
getUserId: () => this.getUserId(),
|
|
427
|
+
getTrackingId: () => this.getTrackingId(),
|
|
428
|
+
getTarget: () => this.getTarget(),
|
|
429
|
+
getDiagnostics: () => this.getDiagnostics(),
|
|
430
|
+
getStatus: () => {
|
|
431
|
+
console.log(this.getStatus());
|
|
432
|
+
return this.getDiagnostics();
|
|
433
|
+
},
|
|
434
|
+
testTracking: () => this.testTracking(),
|
|
435
|
+
verifyAWSConnection: () => {
|
|
436
|
+
const result = this.verifyAWSConnection();
|
|
437
|
+
console.log("AWS Connection Verification:", result.message);
|
|
438
|
+
console.log("Full details:", result);
|
|
439
|
+
return result;
|
|
440
|
+
},
|
|
441
|
+
isInitialized: () => this.isInitialized(),
|
|
442
|
+
page: (url, properties) => this.page(url, properties),
|
|
443
|
+
track: (eventName, properties) => this.track(eventName, properties),
|
|
444
|
+
identify: (userId, traits) => this.identify(userId, traits)
|
|
445
|
+
};
|
|
446
|
+
}
|
|
420
447
|
async performInit(config) {
|
|
421
448
|
if (!this.adapter) {
|
|
422
449
|
this.adapter = new AWSAdapter();
|
|
@@ -455,34 +482,10 @@ var AmplifyUpSDK = class {
|
|
|
455
482
|
};
|
|
456
483
|
await this.adapter.init(adapterConfig);
|
|
457
484
|
this.initialized = this.adapter.isInitialized();
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
getTrackingId: () => this.getTrackingId(),
|
|
463
|
-
getTarget: () => this.getTarget(),
|
|
464
|
-
getDiagnostics: () => this.getDiagnostics(),
|
|
465
|
-
getStatus: () => {
|
|
466
|
-
console.log(this.getStatus());
|
|
467
|
-
return this.getDiagnostics();
|
|
468
|
-
},
|
|
469
|
-
testTracking: () => this.testTracking(),
|
|
470
|
-
verifyAWSConnection: () => {
|
|
471
|
-
const result = this.verifyAWSConnection();
|
|
472
|
-
console.log("AWS Connection Verification:", result.message);
|
|
473
|
-
console.log("Full details:", result);
|
|
474
|
-
return result;
|
|
475
|
-
},
|
|
476
|
-
isInitialized: () => this.isInitialized(),
|
|
477
|
-
// Re-export main tracking methods for convenience
|
|
478
|
-
page: (url, properties) => this.page(url, properties),
|
|
479
|
-
track: (eventName, properties) => this.track(eventName, properties),
|
|
480
|
-
identify: (userId, traits) => this.identify(userId, traits)
|
|
481
|
-
};
|
|
482
|
-
if (this.config?.debug) {
|
|
483
|
-
console.log("AmplifyUp SDK: Diagnostic methods available on window.AmplifyUp");
|
|
484
|
-
console.log("Try: AmplifyUp.getStatus() or AmplifyUp.testTracking()");
|
|
485
|
-
}
|
|
485
|
+
this.ensureWindowBridge();
|
|
486
|
+
if (this.config?.debug) {
|
|
487
|
+
console.log("AmplifyUp SDK: Diagnostic methods available on window.AmplifyUp");
|
|
488
|
+
console.log("Try: AmplifyUp.getStatus() or AmplifyUp.testTracking()");
|
|
486
489
|
}
|
|
487
490
|
this.clearTrackingIntervals();
|
|
488
491
|
if (this.isPreviewMode()) {
|
|
@@ -1493,10 +1496,17 @@ Available Console Commands:
|
|
|
1493
1496
|
}
|
|
1494
1497
|
};
|
|
1495
1498
|
var sdkInstance = null;
|
|
1499
|
+
if (typeof window !== "undefined" && window.__AMPLIFYUP_SDK__) {
|
|
1500
|
+
sdkInstance = window.__AMPLIFYUP_SDK__;
|
|
1501
|
+
}
|
|
1496
1502
|
function getSDK(adapter) {
|
|
1497
1503
|
if (!sdkInstance) {
|
|
1498
1504
|
sdkInstance = new AmplifyUpSDK(adapter);
|
|
1505
|
+
if (typeof window !== "undefined") {
|
|
1506
|
+
window.__AMPLIFYUP_SDK__ = sdkInstance;
|
|
1507
|
+
}
|
|
1499
1508
|
}
|
|
1509
|
+
sdkInstance.ensureWindowBridge();
|
|
1500
1510
|
return sdkInstance;
|
|
1501
1511
|
}
|
|
1502
1512
|
var trackContentView = (contentId, contentType, properties) => getSDK().trackContentView(contentId, contentType, properties);
|