@iblai/web-utils 1.2.3 → 1.2.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.d.ts CHANGED
@@ -1510,7 +1510,7 @@ type Props$2 = {
1510
1510
  * 4. Handles redirects to auth SPA when needed
1511
1511
  * 5. Manages public route access state
1512
1512
  */
1513
- declare function AuthProvider({ children, fallback, middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, skipAuthCheck, storageService, token, enableStorageSync, skip, }: Props$2): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
1513
+ declare function AuthProvider({ children, fallback, middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, skipAuthCheck, storageService, token, enableStorageSync, skip, }: Props$2): string | number | bigint | boolean | react_jsx_runtime.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
1514
1514
 
1515
1515
  /**
1516
1516
  * Props for the MentorProvider component
@@ -1543,7 +1543,7 @@ type Props$1 = {
1543
1543
  * 3. Manages redirection based on mentor availability
1544
1544
  * 4. Integrates with tenant context for access control
1545
1545
  */
1546
- declare function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redirectToAuthSpa, redirectToMentor, onLoadMentorsPermissions, redirectToNoMentorsPage, redirectToCreateMentor, username, isAdmin, mainTenantKey, requestedMentorId, handleMentorNotFound, forceDetermineMentor, onComplete, skip, }: Props$1): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
1546
+ declare function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redirectToAuthSpa, redirectToMentor, onLoadMentorsPermissions, redirectToNoMentorsPage, redirectToCreateMentor, username, isAdmin, mainTenantKey, requestedMentorId, handleMentorNotFound, forceDetermineMentor, onComplete, skip, }: Props$1): string | number | bigint | boolean | react_jsx_runtime.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
1547
1547
 
1548
1548
  /**
1549
1549
  * Type definition for the tenant context
@@ -1606,7 +1606,7 @@ type Props = {
1606
1606
  * 4. Handles tenant-specific domain redirects
1607
1607
  * 5. Maintains tenant access state
1608
1608
  */
1609
- declare function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, saveVisitingTenant, removeVisitingTenant, saveUserTokens, saveTenant, onAutoJoinUserToTenant, redirectToAuthSpa, username, isIframed, setUseMentorProvider, skip, onLoadPlatformPermissions, skipCustomDomainCheck, }: Props): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
1609
+ declare function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, saveVisitingTenant, removeVisitingTenant, saveUserTokens, saveTenant, onAutoJoinUserToTenant, redirectToAuthSpa, username, isIframed, setUseMentorProvider, skip, onLoadPlatformPermissions, skipCustomDomainCheck, }: Props): string | number | bigint | boolean | react_jsx_runtime.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
1610
1610
 
1611
1611
  /**
1612
1612
  * Chat area size constants
package/dist/index.esm.js CHANGED
@@ -3354,24 +3354,30 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
3354
3354
  return;
3355
3355
  }
3356
3356
  let joined = false;
3357
+ joined = await joinAndActivateTenant(customDomainPlatformKey, {
3358
+ platform_key: customDomainPlatformKey,
3359
+ platform_name: customDomainPlatformKey,
3360
+ }, {
3361
+ key: customDomainPlatformKey,
3362
+ is_admin: false,
3363
+ org: customDomainPlatformKey,
3364
+ platform_name: customDomainPlatformKey,
3365
+ }, { handleVisitingTenant: false });
3357
3366
  if (isWeb()) {
3358
- joined = await joinAndActivateTenant(customDomainPlatformKey, {
3359
- platform_key: customDomainPlatformKey,
3360
- platform_name: customDomainPlatformKey,
3361
- }, {
3362
- key: customDomainPlatformKey,
3363
- is_admin: false,
3364
- org: customDomainPlatformKey,
3365
- platform_name: customDomainPlatformKey,
3366
- }, { handleVisitingTenant: false });
3367
3367
  if (!joined) {
3368
3368
  sessionStorage.setItem(guardKey, "1");
3369
3369
  }
3370
+ else {
3371
+ const { data: tenants } = await fetchUserTenants();
3372
+ console.log("[determineWhichTenantToUse] tenants after joining are ", tenants);
3373
+ // Enhance tenants with platform metadata
3374
+ enhancedTenants = await enhanceTenants(tenants);
3375
+ }
3370
3376
  }
3371
3377
  if (!joined) {
3372
3378
  redirectToAuthSpa === null || redirectToAuthSpa === void 0 ? void 0 : redirectToAuthSpa(undefined, undefined, true);
3379
+ return;
3373
3380
  }
3374
- return;
3375
3381
  }
3376
3382
  }
3377
3383
  saveUserTenants(enhancedTenants);
@@ -3506,7 +3512,6 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
3506
3512
  saveUserTokens === null || saveUserTokens === void 0 ? void 0 : saveUserTokens(tokenResponse);
3507
3513
  saveCurrentTenant(userAlreadyInTenant);
3508
3514
  setUserIsAccessingPublicRoute(false);
3509
- saveTenant === null || saveTenant === void 0 ? void 0 : saveTenant(userAlreadyInTenant.key);
3510
3515
  setIsLoading(false);
3511
3516
  return;
3512
3517
  }