@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.js
CHANGED
|
@@ -9740,6 +9740,7 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
|
|
|
9740
9740
|
return true;
|
|
9741
9741
|
}
|
|
9742
9742
|
catch (e) {
|
|
9743
|
+
console.error("[joinAndActivateTenant] error", e);
|
|
9743
9744
|
if (handleVisitingTenant) {
|
|
9744
9745
|
saveVisitingTenant === null || saveVisitingTenant === void 0 ? void 0 : saveVisitingTenant(newCurrentTenant);
|
|
9745
9746
|
}
|
|
@@ -9801,29 +9802,30 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
|
|
|
9801
9802
|
return;
|
|
9802
9803
|
}
|
|
9803
9804
|
}
|
|
9804
|
-
// If there is a
|
|
9805
|
+
// If there is a effectiveRequestedTenant and user doesn't belong to that tenant,
|
|
9805
9806
|
// redirect to auth to re-authenticate. Use a sessionStorage guard to prevent
|
|
9806
9807
|
// an infinite loop: if we already tried once this session and the user still
|
|
9807
9808
|
// doesn't belong after re-auth, surface the failure instead of looping.
|
|
9808
|
-
if (
|
|
9809
|
-
if (!(enhancedTenants === null || enhancedTenants === void 0 ? void 0 : enhancedTenants.find((tenant) => tenant.key ===
|
|
9810
|
-
const guardKey = `tenant_access_attempt_${
|
|
9809
|
+
if (effectiveRequestedTenant) {
|
|
9810
|
+
if (!(enhancedTenants === null || enhancedTenants === void 0 ? void 0 : enhancedTenants.find((tenant) => tenant.key === effectiveRequestedTenant))) {
|
|
9811
|
+
const guardKey = `tenant_access_attempt_${effectiveRequestedTenant}`;
|
|
9811
9812
|
if (isWeb() && sessionStorage.getItem(guardKey)) {
|
|
9812
9813
|
sessionStorage.removeItem(guardKey);
|
|
9813
|
-
console.warn(`[TenantProvider] User still does not belong to
|
|
9814
|
-
onAuthFailure === null || onAuthFailure === void 0 ? void 0 : onAuthFailure(`You do not have access to this platform (${
|
|
9814
|
+
console.warn(`[TenantProvider] User still does not belong to tenant after re-auth: ${effectiveRequestedTenant}`);
|
|
9815
|
+
onAuthFailure === null || onAuthFailure === void 0 ? void 0 : onAuthFailure(`You do not have access to this platform (${effectiveRequestedTenant}). Please contact your administrator.`);
|
|
9815
9816
|
return;
|
|
9816
9817
|
}
|
|
9817
9818
|
let joined = false;
|
|
9818
|
-
joined = await joinAndActivateTenant(
|
|
9819
|
-
platform_key:
|
|
9820
|
-
platform_name:
|
|
9819
|
+
joined = await joinAndActivateTenant(effectiveRequestedTenant, {
|
|
9820
|
+
platform_key: effectiveRequestedTenant,
|
|
9821
|
+
platform_name: effectiveRequestedTenant,
|
|
9821
9822
|
}, {
|
|
9822
|
-
key:
|
|
9823
|
+
key: effectiveRequestedTenant,
|
|
9823
9824
|
is_admin: false,
|
|
9824
|
-
org:
|
|
9825
|
-
platform_name:
|
|
9825
|
+
org: effectiveRequestedTenant,
|
|
9826
|
+
platform_name: effectiveRequestedTenant,
|
|
9826
9827
|
}, { handleVisitingTenant: false });
|
|
9828
|
+
console.log("[determineWhichTenantToUse] joined", joined);
|
|
9827
9829
|
if (isWeb()) {
|
|
9828
9830
|
if (!joined) {
|
|
9829
9831
|
sessionStorage.setItem(guardKey, "1");
|