@iblai/web-utils 1.2.7 → 1.2.8

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/index.js CHANGED
@@ -2842,12 +2842,22 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
2842
2842
  return;
2843
2843
  }
2844
2844
  isRedirectingRef.current = true;
2845
- // Stop polling immediately to prevent stale callbacks
2846
- if (cookieCheckIntervalRef.current) {
2847
- clearInterval(cookieCheckIntervalRef.current);
2848
- cookieCheckIntervalRef.current = null;
2849
- }
2845
+ // NOTE: we intentionally do NOT clear the interval here.
2846
+ // The isRedirectingRef guard prevents redundant redirects while navigation
2847
+ // is in progress. Clearing the interval preemptively can permanently stop
2848
+ // cross-SPA sync if the consuming app suppresses the redirect (e.g. during
2849
+ // its own concurrent tenant switch), leaving the page with no active poller.
2850
2850
  redirectToAuthSpa(...args);
2851
+ // Safety recovery: if navigation was suppressed by the consuming app
2852
+ // (e.g. _suppressAuthRedirect was true), reset the guard after a short delay
2853
+ // so the interval can resume cross-SPA sync on its next tick.
2854
+ // If navigation did occur, the page will have unloaded before this fires.
2855
+ setTimeout(() => {
2856
+ if (isRedirectingRef.current) {
2857
+ console.log("[AuthProvider] safeRedirectToAuthSpa: navigation did not occur, resetting redirect guard");
2858
+ isRedirectingRef.current = false;
2859
+ }
2860
+ }, 3000);
2851
2861
  };
2852
2862
  /**
2853
2863
  * Sync cookies to localStorage on mount and periodically (web only)
@@ -5924,6 +5934,7 @@ const initialState$3 = {
5924
5934
  href: "",
5925
5935
  },
5926
5936
  pageContent: "",
5937
+ metadata: null,
5927
5938
  },
5928
5939
  documentFilter: null,
5929
5940
  token: null,
@@ -8067,6 +8078,7 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
8067
8078
  messageData = {
8068
8079
  ...messageData,
8069
8080
  page_content: iframeContext.pageContent,
8081
+ metadata: iframeContext.metadata,
8070
8082
  };
8071
8083
  }
8072
8084
  if (documentFilter) {