@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/react.d.mts CHANGED
@@ -97,7 +97,7 @@ declare function Field(props: {
97
97
  fallback?: ReactNode;
98
98
  className?: string;
99
99
  render?: (value: any) => ReactNode;
100
- }): string | number | true | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
100
+ }): string | number | true | react_jsx_runtime.JSX.Element | Iterable<React.ReactNode> | null;
101
101
  /**
102
102
  * RichText - Renders a markdown (or HTML string) value as formatted HTML.
103
103
  *
package/dist/react.d.ts CHANGED
@@ -97,7 +97,7 @@ declare function Field(props: {
97
97
  fallback?: ReactNode;
98
98
  className?: string;
99
99
  render?: (value: any) => ReactNode;
100
- }): string | number | true | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
100
+ }): string | number | true | react_jsx_runtime.JSX.Element | Iterable<React.ReactNode> | null;
101
101
  /**
102
102
  * RichText - Renders a markdown (or HTML string) value as formatted HTML.
103
103
  *
package/dist/react.js CHANGED
@@ -1227,7 +1227,9 @@ var AmplifyUpSDK = class {
1227
1227
  this.page(url);
1228
1228
  this.lastTrackedPath = url;
1229
1229
  this.setupPageEngagement();
1230
- this.installHistoryHooks();
1230
+ if (!this.isNextJsApp()) {
1231
+ this.installHistoryHooks();
1232
+ }
1231
1233
  }
1232
1234
  }
1233
1235
  if (this.config?.debug && this.initialized) {
@@ -1480,9 +1482,21 @@ var AmplifyUpSDK = class {
1480
1482
  console.log("[AmplifyUp SDK] Route change page view", path);
1481
1483
  }
1482
1484
  }
1485
+ /** True on Next.js (App or Pages). Do not patch history on these apps. */
1486
+ isNextJsApp() {
1487
+ if (typeof window === "undefined" || typeof document === "undefined") {
1488
+ return false;
1489
+ }
1490
+ const win = window;
1491
+ if (win.next) return true;
1492
+ if (document.getElementById("__next")) return true;
1493
+ if (document.querySelector('script[src*="/_next/"]')) return true;
1494
+ return false;
1495
+ }
1483
1496
  /**
1484
1497
  * Patch history.pushState / replaceState + popstate for non-React SPAs.
1485
- * React/Next apps should also call routeChange from the provider.
1498
+ * Next.js apps use AmplifyUpProvider.routeChange via usePathname instead —
1499
+ * wrapping history breaks App Router <Link> (no RSC request).
1486
1500
  */
1487
1501
  installHistoryHooks() {
1488
1502
  if (typeof window === "undefined" || this.historyHooksInstalled) return;