@frontegg/js 7.123.0-alpha.2 → 7.123.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.123.0-alpha.2
1
+ /** @license Frontegg v7.123.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.123.0-alpha.2
1
+ /** @license Frontegg v7.123.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.123.0-alpha.2'
8
+ cdnVersion: '7.123.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.123.0-alpha.2",
3
+ "version": "7.123.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.123.0-alpha.2"
9
+ "@frontegg/types": "7.123.0"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1924,7 +1924,7 @@ __webpack_require__.r(__webpack_exports__);
1924
1924
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1925
1925
  /* harmony export */ });
1926
1926
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1927
- cdnVersion: '7.123.0-alpha.2'
1927
+ cdnVersion: '7.123.0'
1928
1928
  });
1929
1929
 
1930
1930
  /***/ }),
@@ -5729,7 +5729,7 @@ __webpack_require__.r(__webpack_exports__);
5729
5729
  */
5730
5730
 
5731
5731
  const afterAuthNavigation = async payload => {
5732
- var _window4, _payload$preventRedir;
5732
+ var _store$auth$tenantSel2;
5733
5733
  // Once the choose-tenant step starts a switch the chooser owns navigation. Every re-entry here
5734
5734
  // (the switch's token refresh, and — critically — a late or timed-out switch completing AFTER the
5735
5735
  // user hit the escape hatch) must be a no-op, so navigation can't run twice or jump into the wrong
@@ -5756,52 +5756,73 @@ __webpack_require__.r(__webpack_exports__);
5756
5756
  }); // consume: later re-entries stay suppressed
5757
5757
  }
5758
5758
 
5759
- const {
5760
- customLoginAuthenticatedUrl,
5761
- stepUpUrl
5762
- } = store.auth.routes;
5763
-
5764
- // Step-up on the CURRENT tenant resolves before the org chooser: a user who needs both
5765
- // authenticates + steps up first, then picks an org. switchTenant handles any MFA the chosen
5766
- // org requires on its own, and the isSteppedUp guard below means an already-stepped-up user is
5767
- // never re-prompted.
5768
- // login with magic code, try to step up, no other mfa, invalid max age, force_enroll -> logout, login with first factor, not-stepped up jwt -> navigate to step up
5769
- const shouldStepUp = (_window4 = window) == null ? void 0 : _window4.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_6__.SHOULD_STEP_UP_KEY);
5770
- const user = store.auth.user;
5771
- if (shouldStepUp) {
5772
- var _window5;
5773
- (_window5 = window) == null ? void 0 : _window5.localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_6__.SHOULD_STEP_UP_KEY);
5774
- }
5775
- if (stepUpUrl && shouldStepUp && !(0,_StepUpState_helpers__WEBPACK_IMPORTED_MODULE_7__.isSteppedUp)(user)) {
5776
- return afterAuthNavigationUtil(actions.resetLoginState, {
5777
- forceStepUpUrl: stepUpUrl
5778
- });
5779
- }
5780
- if (await shouldRouteToChooseTenant()) {
5759
+ // Callers expose the authenticated user in the store BEFORE this function's async gates resolve,
5760
+ // so a host app that redirects on `user != null` (e.g. the hosted-login postlogin) would complete
5761
+ // the flow before the choose-organization step can render. Raise `tenantChoicePending` in the same
5762
+ // synchronous block (same store batch as the user set) so such hosts can hold, and always lower it
5763
+ // once the gate has decided: by then either `step` is chooseTenant (the chooser now covers the
5764
+ // hold) or the flow finalized. Written only when the integrator opted into tenant selection.
5765
+ const tenantSelectionEnabled = ((_store$auth$tenantSel2 = store.auth.tenantSelection) == null ? void 0 : _store$auth$tenantSel2.enabled) === true;
5766
+ if (tenantSelectionEnabled) {
5781
5767
  actions.setLoginState({
5782
- step: _interfaces__WEBPACK_IMPORTED_MODULE_8__.LoginStep.chooseTenant,
5783
- loading: false
5768
+ tenantChoicePending: true
5784
5769
  });
5785
- // Mirror the other post-auth interstitials (e.g. promptPasskeys): navigate to the login URL
5786
- // so the ChooseTenant step actually renders even when afterAuthNavigation is invoked from an
5787
- // OAuth/social callback route.
5788
- store.auth.onRedirectTo(store.auth.routes.loginUrl, {
5789
- preserveQueryParams: true
5790
- });
5791
- return; // do NOT finalize; ChooseTenant confirm re-enters afterAuthNavigation
5792
5770
  }
5771
+ try {
5772
+ var _window4, _payload$preventRedir;
5773
+ const {
5774
+ customLoginAuthenticatedUrl,
5775
+ stepUpUrl
5776
+ } = store.auth.routes;
5777
+
5778
+ // Step-up on the CURRENT tenant resolves before the org chooser: a user who needs both
5779
+ // authenticates + steps up first, then picks an org. switchTenant handles any MFA the chosen
5780
+ // org requires on its own, and the isSteppedUp guard below means an already-stepped-up user is
5781
+ // never re-prompted.
5782
+ // login with magic code, try to step up, no other mfa, invalid max age, force_enroll -> logout, login with first factor, not-stepped up jwt -> navigate to step up
5783
+ const shouldStepUp = (_window4 = window) == null ? void 0 : _window4.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_6__.SHOULD_STEP_UP_KEY);
5784
+ const user = store.auth.user;
5785
+ if (shouldStepUp) {
5786
+ var _window5;
5787
+ (_window5 = window) == null ? void 0 : _window5.localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_6__.SHOULD_STEP_UP_KEY);
5788
+ }
5789
+ if (stepUpUrl && shouldStepUp && !(0,_StepUpState_helpers__WEBPACK_IMPORTED_MODULE_7__.isSteppedUp)(user)) {
5790
+ return await afterAuthNavigationUtil(actions.resetLoginState, {
5791
+ forceStepUpUrl: stepUpUrl
5792
+ });
5793
+ }
5794
+ if (await shouldRouteToChooseTenant()) {
5795
+ actions.setLoginState({
5796
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_8__.LoginStep.chooseTenant,
5797
+ loading: false
5798
+ });
5799
+ // Mirror the other post-auth interstitials (e.g. promptPasskeys): navigate to the login URL
5800
+ // so the ChooseTenant step actually renders even when afterAuthNavigation is invoked from an
5801
+ // OAuth/social callback route.
5802
+ store.auth.onRedirectTo(store.auth.routes.loginUrl, {
5803
+ preserveQueryParams: true
5804
+ });
5805
+ return; // do NOT finalize; ChooseTenant confirm re-enters afterAuthNavigation
5806
+ }
5793
5807
 
5794
- let customLoginURL = customLoginAuthenticatedUrl;
5795
- if (!customLoginAuthenticatedUrl) {
5796
- var _store$auth$routes;
5797
- await actions.loadCustomLoginRoutes();
5798
- customLoginURL = (_store$auth$routes = store.auth.routes) == null ? void 0 : _store$auth$routes.customLoginAuthenticatedUrl;
5808
+ let customLoginURL = customLoginAuthenticatedUrl;
5809
+ if (!customLoginAuthenticatedUrl) {
5810
+ var _store$auth$routes;
5811
+ await actions.loadCustomLoginRoutes();
5812
+ customLoginURL = (_store$auth$routes = store.auth.routes) == null ? void 0 : _store$auth$routes.customLoginAuthenticatedUrl;
5813
+ }
5814
+ return await afterAuthNavigationUtil(actions.resetLoginState, {
5815
+ customLoginAuthenticatedUrl: customLoginURL,
5816
+ shouldStepUpDuringLogin: !!shouldStepUp,
5817
+ preventRedirectUrlOriginCleaning: (_payload$preventRedir = payload == null ? void 0 : payload.preventRedirectUrlOriginCleaning) != null ? _payload$preventRedir : false
5818
+ });
5819
+ } finally {
5820
+ if (tenantSelectionEnabled) {
5821
+ actions.setLoginState({
5822
+ tenantChoicePending: false
5823
+ });
5824
+ }
5799
5825
  }
5800
- return afterAuthNavigationUtil(actions.resetLoginState, {
5801
- customLoginAuthenticatedUrl: customLoginURL,
5802
- shouldStepUpDuringLogin: !!shouldStepUp,
5803
- preventRedirectUrlOriginCleaning: (_payload$preventRedir = payload == null ? void 0 : payload.preventRedirectUrlOriginCleaning) != null ? _payload$preventRedir : false
5804
- });
5805
5826
  };
5806
5827
 
5807
5828
  /**
@@ -9183,6 +9204,7 @@ const initialState = {
9183
9204
  email: '',
9184
9205
  tenants: [],
9185
9206
  tenantChoiceResolved: false,
9207
+ tenantChoicePending: false,
9186
9208
  chooseTenantSwitching: false,
9187
9209
  chooseTenantFinalizing: false
9188
9210
  };
@@ -21067,7 +21089,7 @@ __webpack_require__.r(__webpack_exports__);
21067
21089
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
21068
21090
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
21069
21091
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
21070
- /** @license Frontegg v7.123.0-alpha.2
21092
+ /** @license Frontegg v7.123.0
21071
21093
  *
21072
21094
  * This source code is licensed under the MIT license found in the
21073
21095
  * LICENSE file in the root directory of this source tree.
@@ -31753,7 +31775,7 @@ __webpack_require__.r(__webpack_exports__);
31753
31775
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
31754
31776
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
31755
31777
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
31756
- /** @license Frontegg v7.123.0-alpha.2
31778
+ /** @license Frontegg v7.123.0
31757
31779
  *
31758
31780
  * This source code is licensed under the MIT license found in the
31759
31781
  * LICENSE file in the root directory of this source tree.
@@ -34595,7 +34617,7 @@ __webpack_require__.r(__webpack_exports__);
34595
34617
  /* harmony export */ });
34596
34618
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
34597
34619
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
34598
- /** @license Frontegg v7.123.0-alpha.2
34620
+ /** @license Frontegg v7.123.0
34599
34621
  *
34600
34622
  * This source code is licensed under the MIT license found in the
34601
34623
  * LICENSE file in the root directory of this source tree.