@frontegg/js 7.131.0-alpha.1 → 7.131.0-alpha.2

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.131.0-alpha.1
1
+ /** @license Frontegg v7.131.0-alpha.2
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.131.0-alpha.1
1
+ /** @license Frontegg v7.131.0-alpha.2
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.131.0-alpha.1'
8
+ cdnVersion: '7.131.0-alpha.2'
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.131.0-alpha.1",
3
+ "version": "7.131.0-alpha.2",
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.131.0-alpha.1"
9
+ "@frontegg/types": "7.131.0-alpha.2"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1934,7 +1934,7 @@ __webpack_require__.r(__webpack_exports__);
1934
1934
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1935
1935
  /* harmony export */ });
1936
1936
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1937
- cdnVersion: '7.131.0-alpha.1'
1937
+ cdnVersion: '7.131.0-alpha.2'
1938
1938
  });
1939
1939
 
1940
1940
  /***/ }),
@@ -6057,6 +6057,10 @@ __webpack_require__.r(__webpack_exports__);
6057
6057
  response = await api.auth.silentOAuthRefreshTokenV2();
6058
6058
  } catch (error) {
6059
6059
  var _store$auth$user, _error$errorContext;
6060
+ // on the hosted login callback the page finishes the login with its code: fail as with the flag off
6061
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_1__.isOnLoginCodeCallbackRoute)(store)) {
6062
+ throw error;
6063
+ }
6060
6064
  // the tenant requires SSO: hosted login for that tenant, not the plain one the caller falls back to
6061
6065
  if (await actions.__redirectToSsoIfRequired(error)) {
6062
6066
  return;
@@ -6483,7 +6487,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
6483
6487
  */
6484
6488
  const __handleSsoEnforcementRefreshError = async (e, isSsoEnforcementRetry, refreshForTenant) => {
6485
6489
  var _store$auth$user;
6486
- if (!(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName) || !(0,_helpers__WEBPACK_IMPORTED_MODULE_9__.isSsoEnforcementError)(e)) {
6490
+ // on a login callback the page finishes the login with its code: log out as with the flag off, no new SSO trip
6491
+ if (!(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName) || !(0,_helpers__WEBPACK_IMPORTED_MODULE_9__.isSsoEnforcementError)(e) || (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isOnLoginCodeCallbackRoute)(store)) {
6487
6492
  return false;
6488
6493
  }
6489
6494
  if (await __redirectToSsoIfRequired(e)) {
@@ -6600,8 +6605,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
6600
6605
  }
6601
6606
  } catch (e) {
6602
6607
  // a refused identity refresh has already used up the refresh token: no retry, only the SSO redirect, except on
6603
- // the OIDC callback, where the page itself completes the OIDC login
6604
- if ((0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName) && !(0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isOnOidcCallbackRoute)(store) && (await __redirectToSsoIfRequired(e))) {
6608
+ // a login callback, where the page itself completes the login
6609
+ if ((0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName) && !(0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isOnLoginCodeCallbackRoute)(store) && (await __redirectToSsoIfRequired(e))) {
6605
6610
  return;
6606
6611
  }
6607
6612
  contextHolder.setAccessToken(null);
@@ -16470,12 +16475,11 @@ const isMfaIsNotEnrolledError = error => (error == null ? void 0 : error['messag
16470
16475
  }
16471
16476
  callback == null ? void 0 : callback(true);
16472
16477
  } catch (e) {
16473
- callback == null ? void 0 : callback(false);
16474
-
16475
16478
  // the session's tenant requires SSO: its SSO login steps the user up, instead of logging them out
16476
16479
  if (await actions.__redirectToSsoIfRequired(e)) {
16477
16480
  return;
16478
16481
  }
16482
+ callback == null ? void 0 : callback(false);
16479
16483
  await __handleStepUpError(e);
16480
16484
  }
16481
16485
  };
@@ -18989,7 +18993,7 @@ __webpack_require__.r(__webpack_exports__);
18989
18993
  /* harmony export */ isMfaRequired: () => (/* binding */ isMfaRequired),
18990
18994
  /* harmony export */ isOauthCallbackRoute: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.isOauthCallbackRoute),
18991
18995
  /* harmony export */ isOnAuthPageRoute: () => (/* binding */ isOnAuthPageRoute),
18992
- /* harmony export */ isOnOidcCallbackRoute: () => (/* binding */ isOnOidcCallbackRoute),
18996
+ /* harmony export */ isOnLoginCodeCallbackRoute: () => (/* binding */ isOnLoginCodeCallbackRoute),
18993
18997
  /* harmony export */ isResetPasswordRequired: () => (/* binding */ isResetPasswordRequired),
18994
18998
  /* harmony export */ isSteppedUp: () => (/* reexport safe */ _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__.isSteppedUp),
18995
18999
  /* harmony export */ isUsernamePayload: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.isUsernamePayload),
@@ -19077,15 +19081,18 @@ const getCurrentRoutes = urlStrategy => {
19077
19081
  };
19078
19082
 
19079
19083
  /**
19080
- * On the OIDC callback the page still has to finish the OIDC login with its code: a refresh refused before that is not
19081
- * a reason to go back to the IdP, which would send the user straight back here, forever.
19084
+ * On the OIDC or hosted login callback the page still has to finish the login with its code: a refresh refused before
19085
+ * that is not a reason to go to SSO again. On the OIDC callback the IdP would send the user straight back here, forever;
19086
+ * on the hosted callback a new hosted login would replace the PKCE verifier the code exchange needs.
19082
19087
  */
19083
- const isOnOidcCallbackRoute = store => {
19088
+ const isOnLoginCodeCallbackRoute = store => {
19084
19089
  var _store$root$urlStrate;
19085
19090
  const {
19086
- oidcRedirectUrl
19091
+ oidcRedirectUrl,
19092
+ hostedLoginRedirectUrl
19087
19093
  } = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, _LoginState_consts__WEBPACK_IMPORTED_MODULE_6__.defaultFronteggRoutes, store.auth.routes);
19088
- return !!oidcRedirectUrl && getCurrentRoutes((_store$root$urlStrate = store.root.urlStrategy) != null ? _store$root$urlStrate : 'path').some(currentRoute => currentRoute.endsWith(oidcRedirectUrl));
19094
+ const currentRoutes = getCurrentRoutes((_store$root$urlStrate = store.root.urlStrategy) != null ? _store$root$urlStrate : 'path');
19095
+ return [oidcRedirectUrl, hostedLoginRedirectUrl].some(route => !!route && currentRoutes.some(currentRoute => currentRoute.endsWith(route)));
19089
19096
  };
19090
19097
 
19091
19098
  /**
@@ -19094,7 +19101,9 @@ const isOnOidcCallbackRoute = store => {
19094
19101
  */
19095
19102
  const restoreTabTenantUnlessSsoCallback = store => {
19096
19103
  var _store$root$urlStrate2;
19097
- if (!(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_7__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName) || !_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.ContextHolder.for(store.root.appName).isSessionPerTenantEnabled()) {
19104
+ // Flags load in parallel with the first refresh. Recover an existing marker
19105
+ // before choosing that refresh's tenant, even if flags are not available yet.
19106
+ if (!_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.ContextHolder.for(store.root.appName).isSessionPerTenantEnabled()) {
19098
19107
  return;
19099
19108
  }
19100
19109
  const {
@@ -21439,7 +21448,7 @@ __webpack_require__.r(__webpack_exports__);
21439
21448
  /* harmony export */ isMfaRequired: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isMfaRequired),
21440
21449
  /* harmony export */ isOauthCallbackRoute: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isOauthCallbackRoute),
21441
21450
  /* harmony export */ isOnAuthPageRoute: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isOnAuthPageRoute),
21442
- /* harmony export */ isOnOidcCallbackRoute: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isOnOidcCallbackRoute),
21451
+ /* harmony export */ isOnLoginCodeCallbackRoute: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isOnLoginCodeCallbackRoute),
21443
21452
  /* harmony export */ isPreferredMfaMethod: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.isPreferredMfaMethod),
21444
21453
  /* harmony export */ isProxy: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.isProxy),
21445
21454
  /* harmony export */ isResetPasswordRequired: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isResetPasswordRequired),
@@ -21479,7 +21488,7 @@ __webpack_require__.r(__webpack_exports__);
21479
21488
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
21480
21489
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
21481
21490
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
21482
- /** @license Frontegg v7.131.0-alpha.1
21491
+ /** @license Frontegg v7.131.0-alpha.2
21483
21492
  *
21484
21493
  * This source code is licensed under the MIT license found in the
21485
21494
  * LICENSE file in the root directory of this source tree.
@@ -30899,9 +30908,9 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
30899
30908
  }
30900
30909
  if (user.tenantId) {
30901
30910
  (0,_utils__WEBPACK_IMPORTED_MODULE_5__.setTabTenantInSessionStorage)(user.tenantId);
30902
- if ((0,_utils__WEBPACK_IMPORTED_MODULE_5__.isEnforceSsoOnTenantAccessEnabled)(this.appName)) {
30903
- (0,_utils__WEBPACK_IMPORTED_MODULE_5__.clearTabTenantBeforeSsoSwitch)();
30904
- }
30911
+ // A confirmed session consumes any pending switch, including when the
30912
+ // callback finishes before feature flags have loaded.
30913
+ (0,_utils__WEBPACK_IMPORTED_MODULE_5__.clearTabTenantBeforeSsoSwitch)();
30905
30914
  // The server's activeTenant may reflect a different tab's tenant switch.
30906
30915
  // Correct it to match the JWT's tenant for this tab.
30907
30916
  const matchingTenant = currentUserTenants.tenants.find(t => t.tenantId === user.tenantId);
@@ -32264,7 +32273,7 @@ __webpack_require__.r(__webpack_exports__);
32264
32273
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
32265
32274
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
32266
32275
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
32267
- /** @license Frontegg v7.131.0-alpha.1
32276
+ /** @license Frontegg v7.131.0-alpha.2
32268
32277
  *
32269
32278
  * This source code is licensed under the MIT license found in the
32270
32279
  * LICENSE file in the root directory of this source tree.
@@ -35119,7 +35128,7 @@ __webpack_require__.r(__webpack_exports__);
35119
35128
  /* harmony export */ });
35120
35129
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
35121
35130
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
35122
- /** @license Frontegg v7.131.0-alpha.1
35131
+ /** @license Frontegg v7.131.0-alpha.2
35123
35132
  *
35124
35133
  * This source code is licensed under the MIT license found in the
35125
35134
  * LICENSE file in the root directory of this source tree.