@iblai/web-utils 1.2.2 → 1.2.4
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 +1 -1
- package/dist/index.esm.js +24 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -15
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -811,7 +811,7 @@ declare const isWeb: () => boolean;
|
|
|
811
811
|
declare const isNode: () => string | false;
|
|
812
812
|
declare const isExpo: () => any;
|
|
813
813
|
declare const isTauri: () => boolean;
|
|
814
|
-
declare const getPlatform: () => "
|
|
814
|
+
declare const getPlatform: () => "web" | "react-native" | "node" | "unknown";
|
|
815
815
|
declare const safeRequire: (moduleName: string) => any;
|
|
816
816
|
declare const getNextNavigation: () => any;
|
|
817
817
|
|
package/dist/index.esm.js
CHANGED
|
@@ -3350,25 +3350,34 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
|
|
|
3350
3350
|
if (isWeb() && sessionStorage.getItem(guardKey)) {
|
|
3351
3351
|
sessionStorage.removeItem(guardKey);
|
|
3352
3352
|
console.warn(`[TenantProvider] User still does not belong to custom domain tenant after re-auth: ${customDomainPlatformKey}`);
|
|
3353
|
-
|
|
3354
|
-
platform_key: customDomainPlatformKey,
|
|
3355
|
-
platform_name: customDomainPlatformKey,
|
|
3356
|
-
}, {
|
|
3357
|
-
key: customDomainPlatformKey,
|
|
3358
|
-
is_admin: false,
|
|
3359
|
-
org: customDomainPlatformKey,
|
|
3360
|
-
platform_name: customDomainPlatformKey,
|
|
3361
|
-
}, { handleVisitingTenant: false });
|
|
3362
|
-
if (!joined) {
|
|
3363
|
-
onAuthFailure === null || onAuthFailure === void 0 ? void 0 : onAuthFailure(`You do not have access to this platform (${customDomainPlatformKey}). Please contact your administrator.`);
|
|
3364
|
-
}
|
|
3353
|
+
onAuthFailure === null || onAuthFailure === void 0 ? void 0 : onAuthFailure(`You do not have access to this platform (${customDomainPlatformKey}). Please contact your administrator.`);
|
|
3365
3354
|
return;
|
|
3366
3355
|
}
|
|
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 });
|
|
3367
3366
|
if (isWeb()) {
|
|
3368
|
-
|
|
3367
|
+
if (!joined) {
|
|
3368
|
+
sessionStorage.setItem(guardKey, "1");
|
|
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
|
+
}
|
|
3376
|
+
}
|
|
3377
|
+
if (!joined) {
|
|
3378
|
+
redirectToAuthSpa === null || redirectToAuthSpa === void 0 ? void 0 : redirectToAuthSpa(undefined, undefined, true);
|
|
3379
|
+
return;
|
|
3369
3380
|
}
|
|
3370
|
-
redirectToAuthSpa === null || redirectToAuthSpa === void 0 ? void 0 : redirectToAuthSpa(undefined, undefined, true);
|
|
3371
|
-
return;
|
|
3372
3381
|
}
|
|
3373
3382
|
}
|
|
3374
3383
|
saveUserTenants(enhancedTenants);
|