@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 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 customDomainPlatformKey and user doesn't belong to that tenant,
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 (customDomainPlatformKey) {
9789
- if (!(enhancedTenants === null || enhancedTenants === void 0 ? void 0 : enhancedTenants.find((tenant) => tenant.key === customDomainPlatformKey))) {
9790
- const guardKey = `tenant_access_attempt_${customDomainPlatformKey}`;
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 custom domain tenant after re-auth: ${customDomainPlatformKey}`);
9794
- onAuthFailure === null || onAuthFailure === void 0 ? void 0 : onAuthFailure(`You do not have access to this platform (${customDomainPlatformKey}). Please contact your administrator.`);
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(customDomainPlatformKey, {
9799
- platform_key: customDomainPlatformKey,
9800
- platform_name: customDomainPlatformKey,
9799
+ joined = await joinAndActivateTenant(effectiveRequestedTenant, {
9800
+ platform_key: effectiveRequestedTenant,
9801
+ platform_name: effectiveRequestedTenant,
9801
9802
  }, {
9802
- key: customDomainPlatformKey,
9803
+ key: effectiveRequestedTenant,
9803
9804
  is_admin: false,
9804
- org: customDomainPlatformKey,
9805
- platform_name: customDomainPlatformKey,
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");