@iblai/web-utils 1.5.0 → 1.6.0
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.d.ts +3 -3
- package/dist/index.esm.js +4 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2527,6 +2527,7 @@ const COOKIE_KEYS = {
|
|
|
2527
2527
|
USER_DATA: "ibl_user_data",
|
|
2528
2528
|
TENANT: "ibl_tenant",
|
|
2529
2529
|
LOGOUT_TIMESTAMP: "ibl_logout_timestamp",
|
|
2530
|
+
LOGIN_TIMESTAMP: "ibl_login_timestamp",
|
|
2530
2531
|
};
|
|
2531
2532
|
/**
|
|
2532
2533
|
* Get the base domain for cookie sharing
|
|
@@ -2838,6 +2839,7 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
|
|
|
2838
2839
|
const [initialSyncComplete, setInitialSyncComplete] = React.useState(false);
|
|
2839
2840
|
const cookieCheckIntervalRef = React.useRef(null);
|
|
2840
2841
|
const lastLogoutTimestampRef = React.useRef(null);
|
|
2842
|
+
const lastLoginTimestampRef = React.useRef(null);
|
|
2841
2843
|
// Guard to prevent poll from firing after a redirect has been initiated.
|
|
2842
2844
|
// Once set, no further redirects or cookie syncs will happen.
|
|
2843
2845
|
const isRedirectingRef = React.useRef(false);
|
|
@@ -2852,11 +2854,6 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
|
|
|
2852
2854
|
console.log("[AuthProvider] Redirect already in progress, skipping");
|
|
2853
2855
|
return;
|
|
2854
2856
|
}
|
|
2855
|
-
// Skip if a tenant switch is already in progress
|
|
2856
|
-
if (isWeb$1() && document.cookie.includes("ibl_tenant_switching")) {
|
|
2857
|
-
console.log("[AuthProvider] Tenant switch in progress, skipping redirect");
|
|
2858
|
-
return;
|
|
2859
|
-
}
|
|
2860
2857
|
isRedirectingRef.current = true;
|
|
2861
2858
|
// NOTE: we intentionally do NOT clear the interval here.
|
|
2862
2859
|
// The isRedirectingRef guard prevents redundant redirects while navigation
|
|
@@ -2898,8 +2895,9 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
|
|
|
2898
2895
|
async function initialSync() {
|
|
2899
2896
|
console.log("[AuthProvider] initialSync starting");
|
|
2900
2897
|
try {
|
|
2901
|
-
// Initialize last known logout
|
|
2898
|
+
// Initialize last known logout and login timestamps
|
|
2902
2899
|
lastLogoutTimestampRef.current = CookieUtils.get(COOKIE_KEYS.LOGOUT_TIMESTAMP);
|
|
2900
|
+
lastLoginTimestampRef.current = CookieUtils.get(COOKIE_KEYS.LOGIN_TIMESTAMP);
|
|
2903
2901
|
const { needsRefresh, userDataOutOfSync } = await syncCookiesToLocalStorage(storageService);
|
|
2904
2902
|
console.log("[AuthProvider] initialSync result", {
|
|
2905
2903
|
needsRefresh,
|