@iblai/web-utils 1.10.4 → 1.10.6

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.js CHANGED
@@ -9721,25 +9721,13 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
9721
9721
  var _a;
9722
9722
  try {
9723
9723
  await joinTenant({ platform_key: tenantKey }).unwrap();
9724
- const formData = new FormData();
9725
- formData.append("platform_key", tenantKey);
9726
- const { data: newTenants } = await fetchUserTenants();
9727
- const enhancedNewTenants = await enhanceTenants(newTenants, tenantMetadata);
9728
- const { data: tokenResponse } = await getAppToken(formData).unwrap();
9729
- saveUserTokens === null || saveUserTokens === void 0 ? void 0 : saveUserTokens(tokenResponse);
9730
- saveCurrentTenant(newCurrentTenant);
9731
- if (enhancedNewTenants && enhancedNewTenants.length) {
9732
- saveUserTenants(enhancedNewTenants);
9733
- }
9734
- const rbacPermissions = await loadPlatformPermissions(tenantMetadata.platform_key);
9735
- onLoadPlatformPermissions === null || onLoadPlatformPermissions === void 0 ? void 0 : onLoadPlatformPermissions(rbacPermissions);
9736
9724
  onAutoJoinUserToTenant === null || onAutoJoinUserToTenant === void 0 ? void 0 : onAutoJoinUserToTenant((_a = tenantMetadata.platform_name) !== null && _a !== void 0 ? _a : tenantMetadata === null || tenantMetadata === void 0 ? void 0 : tenantMetadata.platform_key.toUpperCase());
9737
- saveTenant === null || saveTenant === void 0 ? void 0 : saveTenant(tenantKey);
9738
9725
  setUserIsAccessingPublicRoute(false);
9739
9726
  removeVisitingTenant === null || removeVisitingTenant === void 0 ? void 0 : removeVisitingTenant();
9740
9727
  return true;
9741
9728
  }
9742
9729
  catch (e) {
9730
+ console.error("[joinAndActivateTenant] error", e);
9743
9731
  if (handleVisitingTenant) {
9744
9732
  saveVisitingTenant === null || saveVisitingTenant === void 0 ? void 0 : saveVisitingTenant(newCurrentTenant);
9745
9733
  }
@@ -9824,6 +9812,7 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
9824
9812
  org: effectiveRequestedTenant,
9825
9813
  platform_name: effectiveRequestedTenant,
9826
9814
  }, { handleVisitingTenant: false });
9815
+ console.log("[determineWhichTenantToUse] joined", joined);
9827
9816
  if (isWeb()) {
9828
9817
  if (!joined) {
9829
9818
  sessionStorage.setItem(guardKey, "1");
@@ -9965,7 +9954,10 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
9965
9954
  setIsLoading(false);
9966
9955
  return;
9967
9956
  }
9968
- await joinAndActivateTenant(tenantKey, data, newCurrentTenant);
9957
+ const joined = await joinAndActivateTenant(tenantKey, data, newCurrentTenant);
9958
+ if (joined) {
9959
+ handleTenantSwitch(tenantKey, true);
9960
+ }
9969
9961
  }
9970
9962
  else {
9971
9963
  if (!currentTenant) {