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