@iblai/web-utils 1.7.3 → 1.8.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 +1 -0
- package/dist/index.esm.js +8 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/web-utils/src/utils/auth.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -916,6 +916,7 @@ interface RedirectToAuthSpaOptions {
|
|
|
916
916
|
authRedirectProxy?: string;
|
|
917
917
|
/** Function to check if the app is running as a native app (e.g., Tauri). Affects redirect behavior. */
|
|
918
918
|
isNativeApp?: () => boolean;
|
|
919
|
+
forceRedirect?: boolean;
|
|
919
920
|
}
|
|
920
921
|
/**
|
|
921
922
|
* Redirect to authentication SPA for login/logout
|
package/dist/index.esm.js
CHANGED
|
@@ -1161,17 +1161,19 @@ async function redirectToAuthSpa(options) {
|
|
|
1161
1161
|
logoutTimestamp: "ibl_logout_timestamp",
|
|
1162
1162
|
loginTimestamp: "ibl_login_timestamp",
|
|
1163
1163
|
tenantSwitching: "ibl_tenant_switching",
|
|
1164
|
-
}, hasNonExpiredAuthToken, isOffline, preserveTokenKey, authRedirectProxy, isNativeApp, } = options;
|
|
1165
|
-
console.log("[redirectToAuthSpa] starting redirect to auth spa", redirectTo, platformKey, logout, saveRedirect);
|
|
1164
|
+
}, hasNonExpiredAuthToken, isOffline, preserveTokenKey, authRedirectProxy, isNativeApp, forceRedirect = false, } = options;
|
|
1165
|
+
console.log("[redirectToAuthSpa] starting redirect to auth spa", redirectTo, platformKey, logout, saveRedirect, forceRedirect);
|
|
1166
1166
|
// Skip if a tenant switch is already in progress
|
|
1167
|
-
if (
|
|
1167
|
+
if (!forceRedirect &&
|
|
1168
|
+
cookieNames.tenantSwitching &&
|
|
1168
1169
|
document.cookie.includes(cookieNames.tenantSwitching)) {
|
|
1169
1170
|
console.log("[redirectToAuthSpa] Tenant switch in progress, skipping redirect");
|
|
1170
1171
|
return;
|
|
1171
1172
|
}
|
|
1172
1173
|
// Skip if a login occurred after the last logout (login takes precedence)
|
|
1173
1174
|
// but only if this app actually has a valid auth token
|
|
1174
|
-
if (
|
|
1175
|
+
if (!forceRedirect &&
|
|
1176
|
+
hasNonExpiredAuthToken &&
|
|
1175
1177
|
cookieNames.loginTimestamp &&
|
|
1176
1178
|
cookieNames.logoutTimestamp) {
|
|
1177
1179
|
const loginTs = getCookieValue(cookieNames.loginTimestamp);
|
|
@@ -1183,7 +1185,8 @@ async function redirectToAuthSpa(options) {
|
|
|
1183
1185
|
hasValidToken,
|
|
1184
1186
|
loginAhead: loginTs && logoutTs ? Number(loginTs) > Number(logoutTs) : false,
|
|
1185
1187
|
});
|
|
1186
|
-
if (
|
|
1188
|
+
if (!forceRedirect &&
|
|
1189
|
+
hasValidToken &&
|
|
1187
1190
|
loginTs &&
|
|
1188
1191
|
logoutTs &&
|
|
1189
1192
|
Number(loginTs) > Number(logoutTs)) {
|