@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/AmplifyRenderer.js
CHANGED
|
@@ -829,7 +829,9 @@ var AmplifyUpSDK = class {
|
|
|
829
829
|
this.page(url);
|
|
830
830
|
this.lastTrackedPath = url;
|
|
831
831
|
this.setupPageEngagement();
|
|
832
|
-
this.
|
|
832
|
+
if (!this.isNextJsApp()) {
|
|
833
|
+
this.installHistoryHooks();
|
|
834
|
+
}
|
|
833
835
|
}
|
|
834
836
|
}
|
|
835
837
|
if (this.config?.debug && this.initialized) {
|
|
@@ -1082,9 +1084,21 @@ var AmplifyUpSDK = class {
|
|
|
1082
1084
|
console.log("[AmplifyUp SDK] Route change page view", path);
|
|
1083
1085
|
}
|
|
1084
1086
|
}
|
|
1087
|
+
/** True on Next.js (App or Pages). Do not patch history on these apps. */
|
|
1088
|
+
isNextJsApp() {
|
|
1089
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
1090
|
+
return false;
|
|
1091
|
+
}
|
|
1092
|
+
const win = window;
|
|
1093
|
+
if (win.next) return true;
|
|
1094
|
+
if (document.getElementById("__next")) return true;
|
|
1095
|
+
if (document.querySelector('script[src*="/_next/"]')) return true;
|
|
1096
|
+
return false;
|
|
1097
|
+
}
|
|
1085
1098
|
/**
|
|
1086
1099
|
* Patch history.pushState / replaceState + popstate for non-React SPAs.
|
|
1087
|
-
*
|
|
1100
|
+
* Next.js apps use AmplifyUpProvider.routeChange via usePathname instead —
|
|
1101
|
+
* wrapping history breaks App Router <Link> (no RSC request).
|
|
1088
1102
|
*/
|
|
1089
1103
|
installHistoryHooks() {
|
|
1090
1104
|
if (typeof window === "undefined" || this.historyHooksInstalled) return;
|