@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.d.mts
CHANGED
|
@@ -246,9 +246,12 @@ declare class AmplifyUpSDK {
|
|
|
246
246
|
* No-op when the path has not changed. Safe for React Strict Mode remounts.
|
|
247
247
|
*/
|
|
248
248
|
routeChange(url?: string, properties?: EventProperties): void;
|
|
249
|
+
/** True on Next.js (App or Pages). Do not patch history on these apps. */
|
|
250
|
+
private isNextJsApp;
|
|
249
251
|
/**
|
|
250
252
|
* Patch history.pushState / replaceState + popstate for non-React SPAs.
|
|
251
|
-
*
|
|
253
|
+
* Next.js apps use AmplifyUpProvider.routeChange via usePathname instead —
|
|
254
|
+
* wrapping history breaks App Router <Link> (no RSC request).
|
|
252
255
|
*/
|
|
253
256
|
private installHistoryHooks;
|
|
254
257
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -246,9 +246,12 @@ declare class AmplifyUpSDK {
|
|
|
246
246
|
* No-op when the path has not changed. Safe for React Strict Mode remounts.
|
|
247
247
|
*/
|
|
248
248
|
routeChange(url?: string, properties?: EventProperties): void;
|
|
249
|
+
/** True on Next.js (App or Pages). Do not patch history on these apps. */
|
|
250
|
+
private isNextJsApp;
|
|
249
251
|
/**
|
|
250
252
|
* Patch history.pushState / replaceState + popstate for non-React SPAs.
|
|
251
|
-
*
|
|
253
|
+
* Next.js apps use AmplifyUpProvider.routeChange via usePathname instead —
|
|
254
|
+
* wrapping history breaks App Router <Link> (no RSC request).
|
|
252
255
|
*/
|
|
253
256
|
private installHistoryHooks;
|
|
254
257
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1168,7 +1168,9 @@ var AmplifyUpSDK = class {
|
|
|
1168
1168
|
this.page(url);
|
|
1169
1169
|
this.lastTrackedPath = url;
|
|
1170
1170
|
this.setupPageEngagement();
|
|
1171
|
-
this.
|
|
1171
|
+
if (!this.isNextJsApp()) {
|
|
1172
|
+
this.installHistoryHooks();
|
|
1173
|
+
}
|
|
1172
1174
|
}
|
|
1173
1175
|
}
|
|
1174
1176
|
if (this.config?.debug && this.initialized) {
|
|
@@ -1421,9 +1423,21 @@ var AmplifyUpSDK = class {
|
|
|
1421
1423
|
console.log("[AmplifyUp SDK] Route change page view", path);
|
|
1422
1424
|
}
|
|
1423
1425
|
}
|
|
1426
|
+
/** True on Next.js (App or Pages). Do not patch history on these apps. */
|
|
1427
|
+
isNextJsApp() {
|
|
1428
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
1429
|
+
return false;
|
|
1430
|
+
}
|
|
1431
|
+
const win = window;
|
|
1432
|
+
if (win.next) return true;
|
|
1433
|
+
if (document.getElementById("__next")) return true;
|
|
1434
|
+
if (document.querySelector('script[src*="/_next/"]')) return true;
|
|
1435
|
+
return false;
|
|
1436
|
+
}
|
|
1424
1437
|
/**
|
|
1425
1438
|
* Patch history.pushState / replaceState + popstate for non-React SPAs.
|
|
1426
|
-
*
|
|
1439
|
+
* Next.js apps use AmplifyUpProvider.routeChange via usePathname instead —
|
|
1440
|
+
* wrapping history breaks App Router <Link> (no RSC request).
|
|
1427
1441
|
*/
|
|
1428
1442
|
installHistoryHooks() {
|
|
1429
1443
|
if (typeof window === "undefined" || this.historyHooksInstalled) return;
|