@amplifyup/sdk 0.1.52 → 0.1.54
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 +22 -10
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +22 -10
- 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.js +24 -11
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +24 -11
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1164,7 +1164,9 @@ var AmplifyUpSDK = class {
|
|
|
1164
1164
|
this.page(url);
|
|
1165
1165
|
this.lastTrackedPath = url;
|
|
1166
1166
|
this.setupPageEngagement();
|
|
1167
|
-
this.
|
|
1167
|
+
if (!this.isNextJsApp()) {
|
|
1168
|
+
this.installHistoryHooks();
|
|
1169
|
+
}
|
|
1168
1170
|
}
|
|
1169
1171
|
}
|
|
1170
1172
|
if (this.config?.debug && this.initialized) {
|
|
@@ -1417,9 +1419,21 @@ var AmplifyUpSDK = class {
|
|
|
1417
1419
|
console.log("[AmplifyUp SDK] Route change page view", path);
|
|
1418
1420
|
}
|
|
1419
1421
|
}
|
|
1422
|
+
/** True on Next.js (App or Pages). Do not patch history on these apps. */
|
|
1423
|
+
isNextJsApp() {
|
|
1424
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
1425
|
+
return false;
|
|
1426
|
+
}
|
|
1427
|
+
const win = window;
|
|
1428
|
+
if (win.next) return true;
|
|
1429
|
+
if (document.getElementById("__next")) return true;
|
|
1430
|
+
if (document.querySelector('script[src*="/_next/"]')) return true;
|
|
1431
|
+
return false;
|
|
1432
|
+
}
|
|
1420
1433
|
/**
|
|
1421
1434
|
* Patch history.pushState / replaceState + popstate for non-React SPAs.
|
|
1422
|
-
*
|
|
1435
|
+
* Next.js apps use AmplifyUpProvider.routeChange via usePathname instead —
|
|
1436
|
+
* wrapping history breaks App Router <Link> (no RSC request).
|
|
1423
1437
|
*/
|
|
1424
1438
|
installHistoryHooks() {
|
|
1425
1439
|
if (typeof window === "undefined" || this.historyHooksInstalled) return;
|