@frontegg/js 7.101.0-alpha.2 → 7.102.0-alpha.0

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.101.0-alpha.2
1
+ /** @license Frontegg v7.102.0-alpha.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.101.0-alpha.2
1
+ /** @license Frontegg v7.102.0-alpha.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/node/version.js CHANGED
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
- cdnVersion: '7.101.0-alpha.2'
8
+ cdnVersion: '7.102.0-alpha.0'
9
9
  };
10
10
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@frontegg/js",
3
- "version": "7.101.0-alpha.2",
3
+ "version": "7.102.0-alpha.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
- "@frontegg/types": "7.101.0-alpha.2"
9
+ "@frontegg/types": "7.102.0-alpha.0"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1923,7 +1923,7 @@ __webpack_require__.r(__webpack_exports__);
1923
1923
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1924
1924
  /* harmony export */ });
1925
1925
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1926
- cdnVersion: '7.101.0-alpha.2'
1926
+ cdnVersion: '7.102.0-alpha.0'
1927
1927
  });
1928
1928
 
1929
1929
  /***/ }),
@@ -19895,7 +19895,7 @@ __webpack_require__.r(__webpack_exports__);
19895
19895
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
19896
19896
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
19897
19897
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
19898
- /** @license Frontegg v7.101.0-alpha.2
19898
+ /** @license Frontegg v7.102.0-alpha.0
19899
19899
  *
19900
19900
  * This source code is licensed under the MIT license found in the
19901
19901
  * LICENSE file in the root directory of this source tree.
@@ -28227,14 +28227,12 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
28227
28227
  const [me, currentUserTenants] = await Promise.all([this.getMeAndEntitlements(), (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getCurrentUserTenantsFunction)(this.appName)()]);
28228
28228
  const decodedContent = accessToken ? (0,_jwt__WEBPACK_IMPORTED_MODULE_10__.jwtDecode)(accessToken) : {};
28229
28229
  const user = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, loginResponse, decodedContent, me);
28230
- if (contextHolder.isSessionPerTenantEnabled()) {
28231
- (0,_utils__WEBPACK_IMPORTED_MODULE_5__.setTabTenantInSessionStorage)(user.tenantId);
28232
- }
28230
+ const activeTenant = this.resolveSessionTenant(contextHolder, user, decodedContent, currentUserTenants);
28233
28231
  contextHolder.setUser(user);
28234
28232
  return {
28235
28233
  user,
28236
28234
  tenants: currentUserTenants.tenants,
28237
- activeTenant: currentUserTenants.activeTenant
28235
+ activeTenant
28238
28236
  };
28239
28237
  };
28240
28238
  this.generateLoginResponseFromOAuthResponse = async oauthResponse => {
@@ -28264,14 +28262,12 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
28264
28262
  }, decodedContent, me, {
28265
28263
  expiresIn: oauthResponse.expires_in || 300
28266
28264
  });
28267
- if (contextHolder.isSessionPerTenantEnabled()) {
28268
- (0,_utils__WEBPACK_IMPORTED_MODULE_5__.setTabTenantInSessionStorage)(user.tenantId);
28269
- }
28265
+ const activeTenant = this.resolveSessionTenant(contextHolder, user, decodedContent, currentUserTenants);
28270
28266
  contextHolder.setUser(user);
28271
28267
  return {
28272
28268
  user,
28273
28269
  tenants: currentUserTenants.tenants,
28274
- activeTenant: currentUserTenants.activeTenant
28270
+ activeTenant
28275
28271
  };
28276
28272
  };
28277
28273
  this.preLogin = async body => {
@@ -28984,6 +28980,26 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
28984
28980
  const [shouldLoadAuthorization] = _feature_flags__WEBPACK_IMPORTED_MODULE_12__.FeatureFlags.getFeatureFlags([_interfaces__WEBPACK_IMPORTED_MODULE_13__.LOAD_AUTHORIZATION_FF], this.appName);
28985
28981
  return shouldLoadAuthorization;
28986
28982
  }
28983
+ resolveSessionTenant(contextHolder, user, decodedContent, currentUserTenants) {
28984
+ let {
28985
+ activeTenant
28986
+ } = currentUserTenants;
28987
+ if (contextHolder.isSessionPerTenantEnabled()) {
28988
+ if (decodedContent.tenantId) {
28989
+ user.tenantId = decodedContent.tenantId;
28990
+ }
28991
+ if (user.tenantId) {
28992
+ (0,_utils__WEBPACK_IMPORTED_MODULE_5__.setTabTenantInSessionStorage)(user.tenantId);
28993
+ // The server's activeTenant may reflect a different tab's tenant switch.
28994
+ // Correct it to match the JWT's tenant for this tab.
28995
+ const matchingTenant = currentUserTenants.tenants.find(t => t.tenantId === user.tenantId);
28996
+ if (matchingTenant) {
28997
+ activeTenant = matchingTenant;
28998
+ }
28999
+ }
29000
+ }
29001
+ return activeTenant;
29002
+ }
28987
29003
  }
28988
29004
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (new AuthenticationApi('default'));
28989
29005
 
@@ -30222,7 +30238,7 @@ __webpack_require__.r(__webpack_exports__);
30222
30238
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
30223
30239
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
30224
30240
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
30225
- /** @license Frontegg v7.101.0-alpha.2
30241
+ /** @license Frontegg v7.102.0-alpha.0
30226
30242
  *
30227
30243
  * This source code is licensed under the MIT license found in the
30228
30244
  * LICENSE file in the root directory of this source tree.
@@ -33017,7 +33033,7 @@ __webpack_require__.r(__webpack_exports__);
33017
33033
  /* harmony export */ });
33018
33034
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
33019
33035
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
33020
- /** @license Frontegg v7.101.0-alpha.2
33036
+ /** @license Frontegg v7.102.0-alpha.0
33021
33037
  *
33022
33038
  * This source code is licensed under the MIT license found in the
33023
33039
  * LICENSE file in the root directory of this source tree.