@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.d.ts
CHANGED
|
@@ -1557,7 +1557,7 @@ type Props$2 = {
|
|
|
1557
1557
|
* 4. Handles redirects to auth SPA when needed
|
|
1558
1558
|
* 5. Manages public route access state
|
|
1559
1559
|
*/
|
|
1560
|
-
declare function AuthProvider({ children, fallback, middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, skipAuthCheck, storageService, token, enableStorageSync, skip, }: Props$2): string | number | bigint | boolean |
|
|
1560
|
+
declare function AuthProvider({ children, fallback, middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, skipAuthCheck, storageService, token, enableStorageSync, skip, }: Props$2): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
1561
1561
|
|
|
1562
1562
|
/**
|
|
1563
1563
|
* Props for the MentorProvider component
|
|
@@ -1590,7 +1590,7 @@ type Props$1 = {
|
|
|
1590
1590
|
* 3. Manages redirection based on mentor availability
|
|
1591
1591
|
* 4. Integrates with tenant context for access control
|
|
1592
1592
|
*/
|
|
1593
|
-
declare function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redirectToAuthSpa, redirectToMentor, onLoadMentorsPermissions, redirectToNoMentorsPage, redirectToCreateMentor, username, isAdmin, mainTenantKey, requestedMentorId, handleMentorNotFound, forceDetermineMentor, onComplete, skip, }: Props$1): string | number | bigint | boolean |
|
|
1593
|
+
declare function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redirectToAuthSpa, redirectToMentor, onLoadMentorsPermissions, redirectToNoMentorsPage, redirectToCreateMentor, username, isAdmin, mainTenantKey, requestedMentorId, handleMentorNotFound, forceDetermineMentor, onComplete, skip, }: Props$1): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
1594
1594
|
|
|
1595
1595
|
/**
|
|
1596
1596
|
* Type definition for the tenant context
|
|
@@ -1654,7 +1654,7 @@ type Props = {
|
|
|
1654
1654
|
* 4. Handles tenant-specific domain redirects
|
|
1655
1655
|
* 5. Maintains tenant access state
|
|
1656
1656
|
*/
|
|
1657
|
-
declare function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, saveVisitingTenant, removeVisitingTenant, saveUserTokens, saveTenant, onAutoJoinUserToTenant, redirectToAuthSpa, username, isIframed, setUseMentorProvider, skip, onLoadPlatformPermissions, skipCustomDomainCheck, onTenantMismatch, }: Props): string | number | bigint | boolean |
|
|
1657
|
+
declare function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, saveVisitingTenant, removeVisitingTenant, saveUserTokens, saveTenant, onAutoJoinUserToTenant, redirectToAuthSpa, username, isIframed, setUseMentorProvider, skip, onLoadPlatformPermissions, skipCustomDomainCheck, onTenantMismatch, }: Props): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
1658
1658
|
|
|
1659
1659
|
/**
|
|
1660
1660
|
* Chat area size constants
|
package/dist/index.esm.js
CHANGED
|
@@ -2507,6 +2507,7 @@ const COOKIE_KEYS = {
|
|
|
2507
2507
|
USER_DATA: "ibl_user_data",
|
|
2508
2508
|
TENANT: "ibl_tenant",
|
|
2509
2509
|
LOGOUT_TIMESTAMP: "ibl_logout_timestamp",
|
|
2510
|
+
LOGIN_TIMESTAMP: "ibl_login_timestamp",
|
|
2510
2511
|
};
|
|
2511
2512
|
/**
|
|
2512
2513
|
* Get the base domain for cookie sharing
|
|
@@ -2818,6 +2819,7 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
|
|
|
2818
2819
|
const [initialSyncComplete, setInitialSyncComplete] = useState(false);
|
|
2819
2820
|
const cookieCheckIntervalRef = useRef(null);
|
|
2820
2821
|
const lastLogoutTimestampRef = useRef(null);
|
|
2822
|
+
const lastLoginTimestampRef = useRef(null);
|
|
2821
2823
|
// Guard to prevent poll from firing after a redirect has been initiated.
|
|
2822
2824
|
// Once set, no further redirects or cookie syncs will happen.
|
|
2823
2825
|
const isRedirectingRef = useRef(false);
|
|
@@ -2832,11 +2834,6 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
|
|
|
2832
2834
|
console.log("[AuthProvider] Redirect already in progress, skipping");
|
|
2833
2835
|
return;
|
|
2834
2836
|
}
|
|
2835
|
-
// Skip if a tenant switch is already in progress
|
|
2836
|
-
if (isWeb$1() && document.cookie.includes("ibl_tenant_switching")) {
|
|
2837
|
-
console.log("[AuthProvider] Tenant switch in progress, skipping redirect");
|
|
2838
|
-
return;
|
|
2839
|
-
}
|
|
2840
2837
|
isRedirectingRef.current = true;
|
|
2841
2838
|
// NOTE: we intentionally do NOT clear the interval here.
|
|
2842
2839
|
// The isRedirectingRef guard prevents redundant redirects while navigation
|
|
@@ -2878,8 +2875,9 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
|
|
|
2878
2875
|
async function initialSync() {
|
|
2879
2876
|
console.log("[AuthProvider] initialSync starting");
|
|
2880
2877
|
try {
|
|
2881
|
-
// Initialize last known logout
|
|
2878
|
+
// Initialize last known logout and login timestamps
|
|
2882
2879
|
lastLogoutTimestampRef.current = CookieUtils.get(COOKIE_KEYS.LOGOUT_TIMESTAMP);
|
|
2880
|
+
lastLoginTimestampRef.current = CookieUtils.get(COOKIE_KEYS.LOGIN_TIMESTAMP);
|
|
2883
2881
|
const { needsRefresh, userDataOutOfSync } = await syncCookiesToLocalStorage(storageService);
|
|
2884
2882
|
console.log("[AuthProvider] initialSync result", {
|
|
2885
2883
|
needsRefresh,
|