@amplifyup/sdk 0.1.52 → 0.1.53
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/dist/AmplifyRenderer.js +16 -2
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +16 -2
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -2
- package/dist/index.mjs.map +1 -1
- package/dist/middleware.d.mts +10 -12
- package/dist/middleware.d.ts +10 -12
- package/dist/middleware.js +15 -157
- package/dist/middleware.js.map +1 -1
- package/dist/middleware.mjs +15 -157
- package/dist/middleware.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +16 -2
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +16 -2
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -1221,7 +1221,9 @@ var AmplifyUpSDK = class {
|
|
|
1221
1221
|
this.page(url);
|
|
1222
1222
|
this.lastTrackedPath = url;
|
|
1223
1223
|
this.setupPageEngagement();
|
|
1224
|
-
this.
|
|
1224
|
+
if (!this.isNextJsApp()) {
|
|
1225
|
+
this.installHistoryHooks();
|
|
1226
|
+
}
|
|
1225
1227
|
}
|
|
1226
1228
|
}
|
|
1227
1229
|
if (this.config?.debug && this.initialized) {
|
|
@@ -1474,9 +1476,21 @@ var AmplifyUpSDK = class {
|
|
|
1474
1476
|
console.log("[AmplifyUp SDK] Route change page view", path);
|
|
1475
1477
|
}
|
|
1476
1478
|
}
|
|
1479
|
+
/** True on Next.js (App or Pages). Do not patch history on these apps. */
|
|
1480
|
+
isNextJsApp() {
|
|
1481
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
1482
|
+
return false;
|
|
1483
|
+
}
|
|
1484
|
+
const win = window;
|
|
1485
|
+
if (win.next) return true;
|
|
1486
|
+
if (document.getElementById("__next")) return true;
|
|
1487
|
+
if (document.querySelector('script[src*="/_next/"]')) return true;
|
|
1488
|
+
return false;
|
|
1489
|
+
}
|
|
1477
1490
|
/**
|
|
1478
1491
|
* Patch history.pushState / replaceState + popstate for non-React SPAs.
|
|
1479
|
-
*
|
|
1492
|
+
* Next.js apps use AmplifyUpProvider.routeChange via usePathname instead —
|
|
1493
|
+
* wrapping history breaks App Router <Link> (no RSC request).
|
|
1480
1494
|
*/
|
|
1481
1495
|
installHistoryHooks() {
|
|
1482
1496
|
if (typeof window === "undefined" || this.historyHooksInstalled) return;
|