@iblai/iblai-js 1.7.0 → 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.
|
@@ -126,7 +126,7 @@ const initializeLocalStorageWithObject = async (data, localStorageKeys) => {
|
|
|
126
126
|
* 3. Syncs critical auth data to cookies for cross-SPA synchronization
|
|
127
127
|
* 4. Redirects to the appropriate path after login
|
|
128
128
|
*/
|
|
129
|
-
function SsoLogin({ localStorageKeys, redirectPathKey = 'redirect-to', defaultRedirectPath = '/', onLoginSuccess, }) {
|
|
129
|
+
function SsoLogin({ localStorageKeys, redirectPathKey = 'redirect-to', defaultRedirectPath = '/', onLoginSuccess, resolveRedirectPath, }) {
|
|
130
130
|
const searchParams = useSearchParams();
|
|
131
131
|
React__default.useEffect(() => {
|
|
132
132
|
const queryParamData = searchParams.get('data');
|
|
@@ -138,21 +138,17 @@ function SsoLogin({ localStorageKeys, redirectPathKey = 'redirect-to', defaultRe
|
|
|
138
138
|
onLoginSuccess === null || onLoginSuccess === void 0 ? void 0 : onLoginSuccess(parsedData);
|
|
139
139
|
// Determine redirect path
|
|
140
140
|
let redirectPath = localStorage.getItem(redirectPathKey) || incomingRedirectPath || defaultRedirectPath;
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const pathPlatformKey = platformKeyMatch[1];
|
|
145
|
-
const authenticatedTenant = parsedData.tenant;
|
|
146
|
-
if (authenticatedTenant && pathPlatformKey !== authenticatedTenant) {
|
|
147
|
-
// Platform key in path doesn't match authenticated tenant, reset to default
|
|
148
|
-
redirectPath = '/';
|
|
149
|
-
}
|
|
141
|
+
// Allow the calling component to resolve/override the redirect path
|
|
142
|
+
if (resolveRedirectPath) {
|
|
143
|
+
redirectPath = resolveRedirectPath(redirectPath, parsedData);
|
|
150
144
|
}
|
|
151
145
|
// Clean up redirect path from storage
|
|
152
146
|
localStorage.removeItem(redirectPathKey);
|
|
153
147
|
// Debug: log localStorage right before redirect
|
|
154
|
-
console.log('
|
|
155
|
-
console.log('
|
|
148
|
+
console.log('[sso-login] localStorage.tenant:', localStorage.getItem('tenant'));
|
|
149
|
+
console.log('[sso-login] redirectPath:', redirectPath);
|
|
150
|
+
// Set login timestamp so auth provider won't redirect during an active login
|
|
151
|
+
setCookie('ibl_login_timestamp', String(Date.now()));
|
|
156
152
|
// Clear tenant switching cookie before redirect
|
|
157
153
|
deleteCookie('ibl_tenant_switching');
|
|
158
154
|
// Redirect to the target path
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iblai/iblai-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Unified JavaScript SDK for IBL.ai — re-exports data-layer, web-containers, and web-utils under a single package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"winston": "3.19.0",
|
|
64
64
|
"@iblai/data-layer": "1.4.0",
|
|
65
65
|
"@iblai/mcp": "1.4.2",
|
|
66
|
-
"@iblai/web-containers": "1.
|
|
67
|
-
"@iblai/web-utils": "1.
|
|
66
|
+
"@iblai/web-containers": "1.6.0",
|
|
67
|
+
"@iblai/web-utils": "1.6.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@iblai/iblai-api": "4.166.0-ai",
|