@iblai/web-utils 1.10.3 → 1.10.5
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.esm.js +14 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -12
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -9720,6 +9720,7 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
|
|
|
9720
9720
|
return true;
|
|
9721
9721
|
}
|
|
9722
9722
|
catch (e) {
|
|
9723
|
+
console.error("[joinAndActivateTenant] error", e);
|
|
9723
9724
|
if (handleVisitingTenant) {
|
|
9724
9725
|
saveVisitingTenant === null || saveVisitingTenant === void 0 ? void 0 : saveVisitingTenant(newCurrentTenant);
|
|
9725
9726
|
}
|
|
@@ -9781,29 +9782,30 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
|
|
|
9781
9782
|
return;
|
|
9782
9783
|
}
|
|
9783
9784
|
}
|
|
9784
|
-
// If there is a
|
|
9785
|
+
// If there is a effectiveRequestedTenant and user doesn't belong to that tenant,
|
|
9785
9786
|
// redirect to auth to re-authenticate. Use a sessionStorage guard to prevent
|
|
9786
9787
|
// an infinite loop: if we already tried once this session and the user still
|
|
9787
9788
|
// doesn't belong after re-auth, surface the failure instead of looping.
|
|
9788
|
-
if (
|
|
9789
|
-
if (!(enhancedTenants === null || enhancedTenants === void 0 ? void 0 : enhancedTenants.find((tenant) => tenant.key ===
|
|
9790
|
-
const guardKey = `tenant_access_attempt_${
|
|
9789
|
+
if (effectiveRequestedTenant) {
|
|
9790
|
+
if (!(enhancedTenants === null || enhancedTenants === void 0 ? void 0 : enhancedTenants.find((tenant) => tenant.key === effectiveRequestedTenant))) {
|
|
9791
|
+
const guardKey = `tenant_access_attempt_${effectiveRequestedTenant}`;
|
|
9791
9792
|
if (isWeb() && sessionStorage.getItem(guardKey)) {
|
|
9792
9793
|
sessionStorage.removeItem(guardKey);
|
|
9793
|
-
console.warn(`[TenantProvider] User still does not belong to
|
|
9794
|
-
onAuthFailure === null || onAuthFailure === void 0 ? void 0 : onAuthFailure(`You do not have access to this platform (${
|
|
9794
|
+
console.warn(`[TenantProvider] User still does not belong to tenant after re-auth: ${effectiveRequestedTenant}`);
|
|
9795
|
+
onAuthFailure === null || onAuthFailure === void 0 ? void 0 : onAuthFailure(`You do not have access to this platform (${effectiveRequestedTenant}). Please contact your administrator.`);
|
|
9795
9796
|
return;
|
|
9796
9797
|
}
|
|
9797
9798
|
let joined = false;
|
|
9798
|
-
joined = await joinAndActivateTenant(
|
|
9799
|
-
platform_key:
|
|
9800
|
-
platform_name:
|
|
9799
|
+
joined = await joinAndActivateTenant(effectiveRequestedTenant, {
|
|
9800
|
+
platform_key: effectiveRequestedTenant,
|
|
9801
|
+
platform_name: effectiveRequestedTenant,
|
|
9801
9802
|
}, {
|
|
9802
|
-
key:
|
|
9803
|
+
key: effectiveRequestedTenant,
|
|
9803
9804
|
is_admin: false,
|
|
9804
|
-
org:
|
|
9805
|
-
platform_name:
|
|
9805
|
+
org: effectiveRequestedTenant,
|
|
9806
|
+
platform_name: effectiveRequestedTenant,
|
|
9806
9807
|
}, { handleVisitingTenant: false });
|
|
9808
|
+
console.log("[determineWhichTenantToUse] joined", joined);
|
|
9807
9809
|
if (isWeb()) {
|
|
9808
9810
|
if (!joined) {
|
|
9809
9811
|
sessionStorage.setItem(guardKey, "1");
|