@frontegg/js 7.129.0-alpha.0 → 7.129.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.
@@ -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.129.0-alpha.0'
1937
+ cdnVersion: '7.129.0'
1938
1938
  });
1939
1939
 
1940
1940
  /***/ }),
@@ -5520,15 +5520,13 @@ __webpack_require__.r(__webpack_exports__);
5520
5520
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
5521
5521
  /* harmony export */ });
5522
5522
  /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
5523
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/feature-flags/index.js");
5524
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
5525
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers.js");
5526
- /* harmony import */ var _helpers_tenantSelect__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../helpers/tenantSelect */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers/tenantSelect.js");
5527
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../constants */ "../../dist/@frontegg/redux-store/constants.js");
5528
- /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../interfaces */ "../../dist/@frontegg/redux-store/auth/LoginState/interfaces.js");
5529
- /* harmony import */ var _StepUpState_consts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../StepUpState/consts */ "../../dist/@frontegg/redux-store/auth/StepUpState/consts.js");
5530
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
5531
- /* harmony import */ var _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../StepUpState/helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
5523
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers.js");
5524
+ /* harmony import */ var _helpers_tenantSelect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../helpers/tenantSelect */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers/tenantSelect.js");
5525
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../constants */ "../../dist/@frontegg/redux-store/constants.js");
5526
+ /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../interfaces */ "../../dist/@frontegg/redux-store/auth/LoginState/interfaces.js");
5527
+ /* harmony import */ var _StepUpState_consts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../StepUpState/consts */ "../../dist/@frontegg/redux-store/auth/StepUpState/consts.js");
5528
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
5529
+ /* harmony import */ var _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../StepUpState/helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
5532
5530
  /* harmony import */ var _oauthStorage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../oauthStorage */ "../../dist/@frontegg/redux-store/auth/LoginState/oauthStorage.js");
5533
5531
 
5534
5532
 
@@ -5539,7 +5537,6 @@ __webpack_require__.r(__webpack_exports__);
5539
5537
 
5540
5538
 
5541
5539
 
5542
-
5543
5540
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((store, api, sharedActions) => {
5544
5541
  const actions = sharedActions;
5545
5542
 
@@ -5589,33 +5586,6 @@ __webpack_require__.r(__webpack_exports__);
5589
5586
  }, additionalUpdate));
5590
5587
  }
5591
5588
 
5592
- /**
5593
- * A switch that needed SSO saved its target tenant (in this tab) before sending the user to SSO.
5594
- * Once logged in again, switch to it once if the login landed in another tenant.
5595
- * @returns true when the switch left the user without a session (MFA step for the target tenant, or logout)
5596
- */
5597
- async function switchToPendingSsoTenant() {
5598
- var _store$auth$user, _store$auth$user2;
5599
- const [isEnforceSsoOnTenantAccessEnabled] = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.FeatureFlags.getFeatureFlags([_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__.ENFORCE_SSO_ON_TENANT_ACCESS_FF], store.root.appName);
5600
- const pendingTenantId = window.sessionStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_PENDING_SWITCH_TENANT);
5601
- if (!isEnforceSsoOnTenantAccessEnabled || !pendingTenantId || !((_store$auth$user = store.auth.user) != null && _store$auth$user.accessToken)) {
5602
- return false;
5603
- }
5604
- if (store.auth.user.tenantId === pendingTenantId) {
5605
- window.sessionStorage.removeItem(_constants__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_PENDING_SWITCH_TENANT);
5606
- return false;
5607
- }
5608
- // silentReload keeps switchingTenant set, so the switch's own refresh doesn't re-run this navigation
5609
- await actions.switchTenant({
5610
- tenantId: pendingTenantId,
5611
- silentReload: true,
5612
- keepLoginState: true
5613
- });
5614
- // removed only after the switch: a refused re-run must not send the user to SSO again
5615
- window.sessionStorage.removeItem(_constants__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_PENDING_SWITCH_TENANT);
5616
- return !((_store$auth$user2 = store.auth.user) != null && _store$auth$user2.accessToken);
5617
- }
5618
-
5619
5589
  /**
5620
5590
  * @param customLoginAuthenticatedUrl custom login authenticated url if exists
5621
5591
  * @returns the authenticated url to redirect to after auth navigation
@@ -5630,9 +5600,9 @@ __webpack_require__.r(__webpack_exports__);
5630
5600
  enforceRedirectToSameSite = false,
5631
5601
  allowedRedirectOrigins = []
5632
5602
  } = store.auth;
5633
- const urlFromLocalStorage = window.localStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_AFTER_AUTH_REDIRECT_URL);
5603
+ const urlFromLocalStorage = window.localStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_2__.FRONTEGG_AFTER_AUTH_REDIRECT_URL);
5634
5604
  if (customLoginAuthenticatedUrl && !urlFromLocalStorage) {
5635
- return (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.getPathAndSearchParamsFromUrl)(customLoginAuthenticatedUrl, preventRedirectUrlOriginCleaning);
5605
+ return (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getPathAndSearchParamsFromUrl)(customLoginAuthenticatedUrl, preventRedirectUrlOriginCleaning);
5636
5606
  }
5637
5607
  const {
5638
5608
  authenticatedUrl,
@@ -5640,15 +5610,19 @@ __webpack_require__.r(__webpack_exports__);
5640
5610
  logoutUrl,
5641
5611
  socialLoginCallbackUrl,
5642
5612
  activateUrl,
5643
- activateWithOTCUrl
5613
+ activateWithOTCUrl,
5614
+ oidcRedirectUrl
5644
5615
  } = routes;
5645
5616
  let finalUrl = urlFromLocalStorage;
5646
5617
  if (!finalUrl || [loginUrl, logoutUrl, socialLoginCallbackUrl, activateUrl, activateWithOTCUrl].includes(finalUrl)) {
5647
5618
  finalUrl = authenticatedUrl;
5648
5619
  }
5649
- const redirectUrl = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.getRedirectUrl)({
5620
+
5621
+ // The OIDC callback's query is the IdP's code and state; the user's own query was saved with the URL.
5622
+ const isOidcCallback = !!oidcRedirectUrl && window.location.pathname.endsWith(oidcRedirectUrl);
5623
+ const redirectUrl = (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getRedirectUrl)({
5650
5624
  authenticatedUrl: finalUrl,
5651
- includeQueryParam,
5625
+ includeQueryParam: includeQueryParam && !isOidcCallback,
5652
5626
  enforceRedirectToSameSite,
5653
5627
  allowedRedirectOrigins
5654
5628
  });
@@ -5685,8 +5659,8 @@ __webpack_require__.r(__webpack_exports__);
5685
5659
  if (shouldStepUpDuringLogin) {
5686
5660
  // getUrlForAfterAuthNavigation give priority to the redirectUrl
5687
5661
  // avoiding use of getUrlForAfterAuthNavigation because we don't want to use the redirectUrl for magic link for example
5688
- const localStorageRedirectUrl = window.localStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_AFTER_AUTH_REDIRECT_URL);
5689
- if (localStorageRedirectUrl && !(0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isAbsoluteUrl)(localStorageRedirectUrl)) {
5662
+ const localStorageRedirectUrl = window.localStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_2__.FRONTEGG_AFTER_AUTH_REDIRECT_URL);
5663
+ if (localStorageRedirectUrl && !(0,_helpers__WEBPACK_IMPORTED_MODULE_3__.isAbsoluteUrl)(localStorageRedirectUrl)) {
5690
5664
  redirectUrl = localStorageRedirectUrl;
5691
5665
  }
5692
5666
  }
@@ -5696,9 +5670,9 @@ __webpack_require__.r(__webpack_exports__);
5696
5670
  preventRedirectUrlOriginCleaning
5697
5671
  });
5698
5672
  }
5699
- (_window3 = window) == null ? void 0 : _window3.localStorage.removeItem(_constants__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_AFTER_AUTH_REDIRECT_URL);
5673
+ (_window3 = window) == null ? void 0 : _window3.localStorage.removeItem(_constants__WEBPACK_IMPORTED_MODULE_2__.FRONTEGG_AFTER_AUTH_REDIRECT_URL);
5700
5674
  }
5701
- await (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.delay)(200);
5675
+ await (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.delay)(200);
5702
5676
  await resetStateAction();
5703
5677
  if (redirectUrl.startsWith('http')) {
5704
5678
  (0,_oauthStorage__WEBPACK_IMPORTED_MODULE_1__.clearHostedOAuthState)();
@@ -5719,7 +5693,7 @@ __webpack_require__.r(__webpack_exports__);
5719
5693
  * until the resolved-guard, the LD flag, and the option all pass.
5720
5694
  */
5721
5695
  const shouldRouteToChooseTenant = async () => {
5722
- var _store$auth$tenantSel, _store$auth$user3, _store$auth$user3$act, _store$auth$tenantsSt;
5696
+ var _store$auth$tenantSel, _store$auth$user, _store$auth$user$act, _store$auth$tenantsSt;
5723
5697
  const loginState = store.auth.loginState;
5724
5698
  // Guard first so re-entry after the choice is resolved finalizes without re-reading the flag.
5725
5699
  if (loginState.tenantChoiceResolved) {
@@ -5735,7 +5709,7 @@ __webpack_require__.r(__webpack_exports__);
5735
5709
  return false; // feature off — never read tenant data
5736
5710
  }
5737
5711
 
5738
- const isImpersonation = !!((_store$auth$user3 = store.auth.user) != null && (_store$auth$user3$act = _store$auth$user3.act) != null && _store$auth$user3$act.sub);
5712
+ const isImpersonation = !!((_store$auth$user = store.auth.user) != null && (_store$auth$user$act = _store$auth$user.act) != null && _store$auth$user$act.sub);
5739
5713
  if (isImpersonation) {
5740
5714
  return false;
5741
5715
  }
@@ -5757,7 +5731,7 @@ __webpack_require__.r(__webpack_exports__);
5757
5731
  const {
5758
5732
  tenants
5759
5733
  } = store.auth.tenantsState;
5760
- return (0,_helpers_tenantSelect__WEBPACK_IMPORTED_MODULE_7__.shouldPromptChooseTenant)({
5734
+ return (0,_helpers_tenantSelect__WEBPACK_IMPORTED_MODULE_5__.shouldPromptChooseTenant)({
5761
5735
  ldEnabled,
5762
5736
  enabledByOption,
5763
5737
  tenants,
@@ -5813,14 +5787,6 @@ __webpack_require__.r(__webpack_exports__);
5813
5787
  }
5814
5788
  try {
5815
5789
  var _window4, _payload$preventRedir;
5816
- const isSessionLostInPendingSwitch = await switchToPendingSsoTenant();
5817
- if (isSessionLostInPendingSwitch) {
5818
- // MFA for the target tenant or a failed refresh: continue on the login page
5819
- store.auth.onRedirectTo(store.auth.routes.loginUrl, {
5820
- preserveQueryParams: true
5821
- });
5822
- return;
5823
- }
5824
5790
  const {
5825
5791
  customLoginAuthenticatedUrl,
5826
5792
  stepUpUrl
@@ -5831,20 +5797,20 @@ __webpack_require__.r(__webpack_exports__);
5831
5797
  // org requires on its own, and the isSteppedUp guard below means an already-stepped-up user is
5832
5798
  // never re-prompted.
5833
5799
  // 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
5834
- const shouldStepUp = (_window4 = window) == null ? void 0 : _window4.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_8__.SHOULD_STEP_UP_KEY);
5800
+ const shouldStepUp = (_window4 = window) == null ? void 0 : _window4.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_6__.SHOULD_STEP_UP_KEY);
5835
5801
  const user = store.auth.user;
5836
5802
  if (shouldStepUp) {
5837
5803
  var _window5;
5838
- (_window5 = window) == null ? void 0 : _window5.localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_8__.SHOULD_STEP_UP_KEY);
5804
+ (_window5 = window) == null ? void 0 : _window5.localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_6__.SHOULD_STEP_UP_KEY);
5839
5805
  }
5840
- if (stepUpUrl && shouldStepUp && !(0,_StepUpState_helpers__WEBPACK_IMPORTED_MODULE_9__.isSteppedUp)(user)) {
5806
+ if (stepUpUrl && shouldStepUp && !(0,_StepUpState_helpers__WEBPACK_IMPORTED_MODULE_7__.isSteppedUp)(user)) {
5841
5807
  return await afterAuthNavigationUtil(actions.resetLoginState, {
5842
5808
  forceStepUpUrl: stepUpUrl
5843
5809
  });
5844
5810
  }
5845
5811
  if (await shouldRouteToChooseTenant()) {
5846
5812
  actions.setLoginState({
5847
- step: _interfaces__WEBPACK_IMPORTED_MODULE_10__.LoginStep.chooseTenant,
5813
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_8__.LoginStep.chooseTenant,
5848
5814
  loading: false
5849
5815
  });
5850
5816
  // Mirror the other post-auth interstitials (e.g. promptPasskeys): navigate to the login URL
@@ -6047,14 +6013,12 @@ __webpack_require__.r(__webpack_exports__);
6047
6013
  /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
6048
6014
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/refreshTokenRetry.js");
6049
6015
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/random.js");
6050
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/gtm.js");
6016
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/gtm.js");
6051
6017
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../constants */ "../../dist/@frontegg/redux-store/constants.js");
6052
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/feature-flags/index.js");
6053
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
6054
6018
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers.js");
6055
6019
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/helpers.js");
6056
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
6057
- /* harmony import */ var _StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../StepUpState/consts */ "../../dist/@frontegg/redux-store/auth/StepUpState/consts.js");
6020
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
6021
+ /* harmony import */ var _StepUpState_consts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../StepUpState/consts */ "../../dist/@frontegg/redux-store/auth/StepUpState/consts.js");
6058
6022
  /* harmony import */ var _toolkit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../toolkit */ "../../dist/@frontegg/redux-store/toolkit/FronteggNativeModule.js");
6059
6023
 
6060
6024
 
@@ -6063,7 +6027,6 @@ __webpack_require__.r(__webpack_exports__);
6063
6027
 
6064
6028
 
6065
6029
 
6066
-
6067
6030
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((store, api, sharedActions) => {
6068
6031
  const actions = sharedActions;
6069
6032
 
@@ -6138,10 +6101,7 @@ __webpack_require__.r(__webpack_exports__);
6138
6101
  code_challenge_method: 'S256',
6139
6102
  nonce
6140
6103
  }, additionalParams);
6141
- const [isEnforceSsoOnTenantAccessEnabled] = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_7__.FeatureFlags.getFeatureFlags([_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.ENFORCE_SSO_ON_TENANT_ACCESS_FF], store.root.appName);
6142
- // the tenant asked for (SSO for a refused switch or refresh) wins over the resolved and the page's tenant
6143
- const isTenantRequested = isEnforceSsoOnTenantAccessEnabled && !!(additionalParams != null && additionalParams.tenantId);
6144
- if (context.tenantResolver && !isTenantRequested) {
6104
+ if (context.tenantResolver) {
6145
6105
  var _context$tenantResolv;
6146
6106
  const resolvedTenantResult = await ((_context$tenantResolv = context.tenantResolver) == null ? void 0 : _context$tenantResolv.call(context));
6147
6107
  if (resolvedTenantResult != null && resolvedTenantResult.tenant) {
@@ -6149,7 +6109,7 @@ __webpack_require__.r(__webpack_exports__);
6149
6109
  }
6150
6110
  }
6151
6111
  const tenantId = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.getSearchParam)(_helpers__WEBPACK_IMPORTED_MODULE_6__.TENANT_ID_PARAM_KEY);
6152
- if (tenantId && !isTenantRequested) {
6112
+ if (tenantId) {
6153
6113
  params['tenantId'] = tenantId;
6154
6114
  }
6155
6115
  if (_toolkit__WEBPACK_IMPORTED_MODULE_1__["default"].isAvailable('closeWindow')) {
@@ -6164,7 +6124,7 @@ __webpack_require__.r(__webpack_exports__);
6164
6124
  const refreshOrRequestHostedLoginAuthorize = async additionalParams => {
6165
6125
  var _localStorage;
6166
6126
  // when the user pause the step up flow we may still have the key in the local storage in hosted - Remove it
6167
- (_localStorage = localStorage) == null ? void 0 : _localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY);
6127
+ (_localStorage = localStorage) == null ? void 0 : _localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_7__.SHOULD_STEP_UP_KEY);
6168
6128
  const disableSilentRefresh = store.auth.disableSilentRefresh;
6169
6129
  if ((additionalParams == null ? void 0 : additionalParams['prompt']) === 'login') {
6170
6130
  return await requestHostedLoginAuthorize(additionalParams);
@@ -6188,11 +6148,11 @@ __webpack_require__.r(__webpack_exports__);
6188
6148
  let {
6189
6149
  additionalParams
6190
6150
  } = payload != null ? payload : {};
6191
- const urlDerivedStepUp = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.getUrlDerivedStepUp)();
6151
+ const urlDerivedStepUp = (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.getUrlDerivedStepUp)();
6192
6152
  const isNativeStepUp = _toolkit__WEBPACK_IMPORTED_MODULE_1__["default"].isGetTokensAvailable() && urlDerivedStepUp.isStepUpRequested;
6193
6153
  if (!isNativeStepUp) {
6194
6154
  var _localStorage2;
6195
- (_localStorage2 = localStorage) == null ? void 0 : _localStorage2.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY);
6155
+ (_localStorage2 = localStorage) == null ? void 0 : _localStorage2.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_7__.SHOULD_STEP_UP_KEY);
6196
6156
  }
6197
6157
  if (firstTime) {
6198
6158
  const urlStrategy = store.root.urlStrategy;
@@ -6215,7 +6175,7 @@ __webpack_require__.r(__webpack_exports__);
6215
6175
  if (((_additionalParams = additionalParams) == null ? void 0 : _additionalParams['prompt']) === 'login') {
6216
6176
  return await requestHostedLoginAuthorize(additionalParams);
6217
6177
  }
6218
- if (isNativeStepUp && !(0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isSteppedUp)(store.auth.user, {
6178
+ if (isNativeStepUp && !(0,_helpers__WEBPACK_IMPORTED_MODULE_8__.isSteppedUp)(store.auth.user, {
6219
6179
  maxAge: urlDerivedStepUp.maxAge
6220
6180
  })) {
6221
6181
  const {
@@ -6223,11 +6183,11 @@ __webpack_require__.r(__webpack_exports__);
6223
6183
  onRedirectTo
6224
6184
  } = store.auth;
6225
6185
  if (routes.stepUpUrl && !window.location.href.includes(routes.stepUpUrl)) {
6226
- window.localStorage.setItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY, 'true');
6186
+ window.localStorage.setItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_7__.SHOULD_STEP_UP_KEY, 'true');
6227
6187
  actions.setAuthState({
6228
6188
  isLoading: true
6229
6189
  });
6230
- (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.redirectByStepUpUrl)(routes.stepUpUrl, onRedirectTo, urlDerivedStepUp.maxAge);
6190
+ (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.redirectByStepUpUrl)(routes.stepUpUrl, onRedirectTo, urlDerivedStepUp.maxAge);
6231
6191
  return;
6232
6192
  }
6233
6193
  }
@@ -6268,7 +6228,7 @@ __webpack_require__.r(__webpack_exports__);
6268
6228
  code_verifier,
6269
6229
  grant_type: 'authorization_code'
6270
6230
  };
6271
- const isStepUpFlow = window.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY);
6231
+ const isStepUpFlow = window.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_7__.SHOULD_STEP_UP_KEY);
6272
6232
  try {
6273
6233
  const response = await api.auth.exchangeOAuthTokensV2(body);
6274
6234
  const user = response.user;
@@ -6285,7 +6245,7 @@ __webpack_require__.r(__webpack_exports__);
6285
6245
  email: user == null ? void 0 : user.email,
6286
6246
  name: user == null ? void 0 : user.name
6287
6247
  };
6288
- (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.reportGTMEvent)(_helpers__WEBPACK_IMPORTED_MODULE_11__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
6248
+ (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.reportGTMEvent)(_helpers__WEBPACK_IMPORTED_MODULE_9__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
6289
6249
  }
6290
6250
  } catch (e) {
6291
6251
  actions.setAuthState({
@@ -6294,10 +6254,10 @@ __webpack_require__.r(__webpack_exports__);
6294
6254
  console.error('Failed to exchangeOAuthTokens', e);
6295
6255
  } finally {
6296
6256
  const user = store.auth.user;
6297
- window.localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY);
6257
+ window.localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_7__.SHOULD_STEP_UP_KEY);
6298
6258
 
6299
6259
  // when the user pause the step up flow we may still have the key in the local storage in hosted. Ignore it.
6300
- if (isStepUpFlow && (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isSteppedUp)(user)) {
6260
+ if (isStepUpFlow && (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.isSteppedUp)(user)) {
6301
6261
  await actions.afterStepUpAuthNavigation();
6302
6262
  } else {
6303
6263
  await actions.afterAuthNavigation();
@@ -6328,39 +6288,38 @@ __webpack_require__.r(__webpack_exports__);
6328
6288
  /* harmony export */ });
6329
6289
  /* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
6330
6290
  /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
6331
- /* harmony import */ var _afterAuthNavigation_actions__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./afterAuthNavigation.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/afterAuthNavigation.actions.js");
6332
- /* harmony import */ var _handleVerifyMFAResponse_actions__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./handleVerifyMFAResponse.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/handleVerifyMFAResponse.actions.js");
6333
- /* harmony import */ var _mfaRequiredState_actions__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./mfaRequiredState.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaRequiredState.actions.js");
6334
- /* harmony import */ var _mfaWithAuthenticator_actions__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./mfaWithAuthenticator.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithAuthenticator.actions.js");
6335
- /* harmony import */ var _mfaWithEmailCode_actions__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./mfaWithEmailCode.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithEmailCode.actions.js");
6336
- /* harmony import */ var _mfaWithSMS_actions__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./mfaWithSMS.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithSMS.actions.js");
6337
- /* harmony import */ var _mfaWithWebAuthn_actions__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./mfaWithWebAuthn.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithWebAuthn.actions.js");
6338
- /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../interfaces */ "../../dist/@frontegg/redux-store/auth/LoginState/interfaces.js");
6339
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
6340
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/refreshTokenRetry.js");
6341
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
6291
+ /* harmony import */ var _afterAuthNavigation_actions__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./afterAuthNavigation.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/afterAuthNavigation.actions.js");
6292
+ /* harmony import */ var _handleVerifyMFAResponse_actions__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./handleVerifyMFAResponse.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/handleVerifyMFAResponse.actions.js");
6293
+ /* harmony import */ var _mfaRequiredState_actions__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./mfaRequiredState.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaRequiredState.actions.js");
6294
+ /* harmony import */ var _mfaWithAuthenticator_actions__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./mfaWithAuthenticator.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithAuthenticator.actions.js");
6295
+ /* harmony import */ var _mfaWithEmailCode_actions__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./mfaWithEmailCode.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithEmailCode.actions.js");
6296
+ /* harmony import */ var _mfaWithSMS_actions__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./mfaWithSMS.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithSMS.actions.js");
6297
+ /* harmony import */ var _mfaWithWebAuthn_actions__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./mfaWithWebAuthn.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithWebAuthn.actions.js");
6298
+ /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../interfaces */ "../../dist/@frontegg/redux-store/auth/LoginState/interfaces.js");
6299
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/refreshTokenRetry.js");
6300
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
6301
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
6342
6302
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/gtm.js");
6343
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/encoders.js");
6344
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/converters.js");
6345
- /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../state */ "../../dist/@frontegg/redux-store/auth/LoginState/state.js");
6346
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers.js");
6347
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
6348
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/feature-flags/index.js");
6349
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
6350
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/utils.js");
6351
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/enums.js");
6352
- /* harmony import */ var _hostedLoginAuthorize_actions__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./hostedLoginAuthorize.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/hostedLoginAuthorize.actions.js");
6303
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/encoders.js");
6304
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/converters.js");
6305
+ /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../state */ "../../dist/@frontegg/redux-store/auth/LoginState/state.js");
6306
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers.js");
6307
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
6308
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/utils.js");
6309
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/feature-flags/index.js");
6310
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/enums.js");
6311
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
6312
+ /* harmony import */ var _hostedLoginAuthorize_actions__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./hostedLoginAuthorize.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/hostedLoginAuthorize.actions.js");
6353
6313
  /* harmony import */ var _oauthStorage__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../oauthStorage */ "../../dist/@frontegg/redux-store/auth/LoginState/oauthStorage.js");
6354
6314
  /* harmony import */ var _StepUpState_consts__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../StepUpState/consts */ "../../dist/@frontegg/redux-store/auth/StepUpState/consts.js");
6355
- /* harmony import */ var _toolkit__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../toolkit */ "../../dist/@frontegg/redux-store/toolkit/FronteggNativeModule.js");
6356
- /* harmony import */ var _toolkit__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../toolkit */ "../../dist/@frontegg/redux-store/auth/Entitlements/helpers.js");
6357
- /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../interfaces */ "../../dist/@frontegg/redux-store/auth/interfaces.js");
6358
- /* harmony import */ var _consts__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../consts */ "../../dist/@frontegg/redux-store/auth/LoginState/consts.js");
6359
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
6360
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/helpers.js");
6361
- /* harmony import */ var _MfaState_interfaces__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../../MfaState/interfaces */ "../../dist/@frontegg/redux-store/auth/MfaState/interfaces.js");
6315
+ /* harmony import */ var _toolkit__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../toolkit */ "../../dist/@frontegg/redux-store/toolkit/FronteggNativeModule.js");
6316
+ /* harmony import */ var _toolkit__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../toolkit */ "../../dist/@frontegg/redux-store/auth/Entitlements/helpers.js");
6317
+ /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../interfaces */ "../../dist/@frontegg/redux-store/auth/interfaces.js");
6318
+ /* harmony import */ var _consts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../consts */ "../../dist/@frontegg/redux-store/auth/LoginState/consts.js");
6319
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/helpers.js");
6320
+ /* harmony import */ var _MfaState_interfaces__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../../MfaState/interfaces */ "../../dist/@frontegg/redux-store/auth/MfaState/interfaces.js");
6362
6321
  /* harmony import */ var _SSOState_interfaces__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../SSOState/interfaces */ "../../dist/@frontegg/redux-store/auth/SSOState/interfaces.js");
6363
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../constants */ "../../dist/@frontegg/redux-store/constants.js");
6322
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../constants */ "../../dist/@frontegg/redux-store/constants.js");
6364
6323
 
6365
6324
 
6366
6325
  const _excluded = ["callback", "error"],
@@ -6400,71 +6359,14 @@ const _excluded = ["callback", "error"],
6400
6359
 
6401
6360
 
6402
6361
 
6362
+ const SSO_REDIRECT_DELAY_MS = 2000;
6363
+ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && onRedirectTo !== _consts__WEBPACK_IMPORTED_MODULE_2__.defaultOnRedirectTo;
6403
6364
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((store, api, sharedActions) => {
6404
6365
  const actions = sharedActions;
6405
- const contextHolder = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.ContextHolder.for(store.root.appName);
6406
-
6407
- /**
6408
- * Sends the user to log in through the tenant's SSO and back to the current page afterwards.
6409
- * @protected
6410
- */
6411
- const __redirectToSsoForTenant = async ({
6412
- tenantId,
6413
- address
6414
- }) => {
6415
- // on the login page (tenant chooser) keep the destination the login already saved
6416
- if (!window.location.pathname.endsWith(store.auth.routes.loginUrl)) {
6417
- (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.setAfterAuthRedirectUrlForStepUp)();
6418
- }
6419
- if (store.auth.hostedLoginBox) {
6420
- await actions.requestHostedLoginAuthorize({
6421
- prompt: 'login',
6422
- tenantId
6423
- });
6424
- return;
6425
- }
6426
- store.auth.onRedirectTo(address, {
6427
- refresh: true
6428
- });
6429
- };
6430
- /**
6431
- * Handles a token refresh refused because the tenant requires SSO.
6432
- * ssoRequired: true sends the user to SSO. ssoRequired: false renews once more for the tenant of the
6433
- * current token, which keeps the session.
6434
- * @returns true when handled, false when the caller should log out
6435
- * @private
6436
- */
6437
- const __handleSsoEnforcementRefreshError = async (e, isSsoEnforcementRetry, refreshForTenant) => {
6438
- var _store$auth$user;
6439
- const [isEnforceSsoOnTenantAccessEnabled] = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.FeatureFlags.getFeatureFlags([_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.ENFORCE_SSO_ON_TENANT_ACCESS_FF], store.root.appName);
6440
- if (!isEnforceSsoOnTenantAccessEnabled || !(0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isSsoEnforcementError)(e)) {
6441
- return false;
6442
- }
6443
- const {
6444
- errorContext
6445
- } = e;
6446
- // the switch re-run after coming back from SSO keeps the session instead of sending the user to SSO again
6447
- const isPendingSwitchRerun = !!window.sessionStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_7__.FRONTEGG_PENDING_SWITCH_TENANT);
6448
- if (errorContext.ssoRequired && !isPendingSwitchRerun) {
6449
- await __redirectToSsoForTenant(errorContext);
6450
- return true;
6451
- }
6452
- if (isSsoEnforcementRetry) {
6453
- return false;
6454
- }
6455
- const currentTenantId = (_store$auth$user = store.auth.user) == null ? void 0 : _store$auth$user.tenantId;
6456
- if (currentTenantId && contextHolder.isSessionPerTenantEnabled()) {
6457
- (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.setTabTenantInSessionStorage)(currentTenantId);
6458
- }
6459
- await refreshForTenant(currentTenantId);
6460
- return true;
6461
- };
6366
+ const contextHolder = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.for(store.root.appName);
6462
6367
 
6463
6368
  /** @private */
6464
- const __refreshTokenHosted = async ({
6465
- tenantId,
6466
- isSsoEnforcementRetry = false
6467
- } = {}) => {
6369
+ const __refreshTokenHosted = async () => {
6468
6370
  const user = store.auth.user;
6469
6371
  if (!(user != null && user.refreshToken)) {
6470
6372
  contextHolder.setAccessToken(null);
@@ -6476,7 +6378,7 @@ const _excluded = ["callback", "error"],
6476
6378
  return;
6477
6379
  }
6478
6380
  try {
6479
- const tabTenantId = tenantId != null ? tenantId : (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.getTabTenantFromSessionStorage)(store.root.appName);
6381
+ const tabTenantId = (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.getTabTenantFromSessionStorage)(store.root.appName);
6480
6382
  const body = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({
6481
6383
  grant_type: 'refresh_token',
6482
6384
  refresh_token: user == null ? void 0 : user.refreshToken
@@ -6491,13 +6393,6 @@ const _excluded = ["callback", "error"],
6491
6393
  isAuthenticated: true
6492
6394
  });
6493
6395
  } catch (e) {
6494
- const retry = tenantId => __refreshTokenHosted({
6495
- tenantId,
6496
- isSsoEnforcementRetry: true
6497
- });
6498
- if (await __handleSsoEnforcementRefreshError(e, isSsoEnforcementRetry, retry)) {
6499
- return;
6500
- }
6501
6396
  contextHolder.setAccessToken(null);
6502
6397
  contextHolder.setUser(null);
6503
6398
  actions.setAuthState({
@@ -6517,10 +6412,7 @@ const _excluded = ["callback", "error"],
6517
6412
  };
6518
6413
 
6519
6414
  /** @private */
6520
- const __refreshTokenEmbedded = async ({
6521
- tenantId,
6522
- isSsoEnforcementRetry = false
6523
- } = {}) => {
6415
+ const __refreshTokenEmbedded = async () => {
6524
6416
  try {
6525
6417
  const {
6526
6418
  routes,
@@ -6531,8 +6423,8 @@ const _excluded = ["callback", "error"],
6531
6423
  user,
6532
6424
  tenants = [],
6533
6425
  activeTenant
6534
- } = await (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.refreshTokenWithRetry)(() => api.auth.refreshTokenV3(tenantId));
6535
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isMfaRequired)(user, store.root.appName)) {
6426
+ } = await (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.refreshTokenWithRetry)(() => api.auth.refreshTokenV3());
6427
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
6536
6428
  const mfaRequiredState = await actions.getMfaRequiredState(user);
6537
6429
  actions.setAuthState(mfaRequiredState);
6538
6430
  onRedirectTo(routes.loginUrl, {
@@ -6553,7 +6445,7 @@ const _excluded = ["callback", "error"],
6553
6445
  }, {
6554
6446
  loginState: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, loginState, {
6555
6447
  quickLoginToRegister,
6556
- flow: shouldNavigateToRegisterQuickLogin ? _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginFlow.RegisterQuickLogin : _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginFlow.Login
6448
+ flow: shouldNavigateToRegisterQuickLogin ? _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.RegisterQuickLogin : _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.Login
6557
6449
  }),
6558
6450
  isAuthenticated: true
6559
6451
  });
@@ -6562,13 +6454,6 @@ const _excluded = ["callback", "error"],
6562
6454
  });
6563
6455
  }
6564
6456
  } catch (e) {
6565
- const retry = tenantId => __refreshTokenEmbedded({
6566
- tenantId,
6567
- isSsoEnforcementRetry: true
6568
- });
6569
- if (await __handleSsoEnforcementRefreshError(e, isSsoEnforcementRetry, retry)) {
6570
- return;
6571
- }
6572
6457
  contextHolder.setAccessToken(null);
6573
6458
  contextHolder.setUser(null);
6574
6459
  actions.setAuthState({
@@ -6579,13 +6464,11 @@ const _excluded = ["callback", "error"],
6579
6464
  };
6580
6465
 
6581
6466
  /** @private */
6582
- const __refreshTokenWithNativeTokens = async ({
6583
- isSsoEnforcementRetry = false
6584
- } = {}) => {
6467
+ const __refreshTokenWithNativeTokens = async () => {
6585
6468
  try {
6586
6469
  const authApi = api.auth;
6587
- const response = await (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.refreshTokenWithRetry)(async () => {
6588
- const tokens = await _toolkit__WEBPACK_IMPORTED_MODULE_12__["default"].getTokens();
6470
+ const response = await (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.refreshTokenWithRetry)(async () => {
6471
+ const tokens = await _toolkit__WEBPACK_IMPORTED_MODULE_8__["default"].getTokens();
6589
6472
  return await authApi.silentOAuthRefreshTokenV3(tokens);
6590
6473
  });
6591
6474
  const updatedUser = await __handleUnnecessaryEntitlementsUpdate(response.user);
@@ -6595,13 +6478,6 @@ const _excluded = ["callback", "error"],
6595
6478
  isAuthenticated: true
6596
6479
  });
6597
6480
  } catch (e) {
6598
- // native tokens can't name a tenant: the retry relies on the tab tenant only
6599
- const retry = () => __refreshTokenWithNativeTokens({
6600
- isSsoEnforcementRetry: true
6601
- });
6602
- if (await __handleSsoEnforcementRefreshError(e, isSsoEnforcementRetry, retry)) {
6603
- return;
6604
- }
6605
6481
  contextHolder.setAccessToken(null);
6606
6482
  contextHolder.setUser(null);
6607
6483
  actions.setAuthState({
@@ -6613,7 +6489,7 @@ const _excluded = ["callback", "error"],
6613
6489
 
6614
6490
  /** @protected */
6615
6491
  const __refreshToken = async () => {
6616
- if (_toolkit__WEBPACK_IMPORTED_MODULE_12__["default"].isGetTokensAvailable()) {
6492
+ if (_toolkit__WEBPACK_IMPORTED_MODULE_8__["default"].isGetTokensAvailable()) {
6617
6493
  await __refreshTokenWithNativeTokens();
6618
6494
  return;
6619
6495
  }
@@ -6635,10 +6511,10 @@ const _excluded = ["callback", "error"],
6635
6511
  * @private
6636
6512
  */
6637
6513
  const __handleUnnecessaryEntitlementsUpdate = async updatedUser => {
6638
- var _store$auth$user2;
6514
+ var _store$auth$user;
6639
6515
  // @ts-ignore TODO: fix entitlements state type
6640
- const oldEntitlements = (_store$auth$user2 = store.auth.user) == null ? void 0 : _store$auth$user2.entitlements;
6641
- if ((0,_toolkit__WEBPACK_IMPORTED_MODULE_13__.isEntitlementsDeeplyEqual)(oldEntitlements, updatedUser == null ? void 0 : updatedUser.entitlements)) {
6516
+ const oldEntitlements = (_store$auth$user = store.auth.user) == null ? void 0 : _store$auth$user.entitlements;
6517
+ if ((0,_toolkit__WEBPACK_IMPORTED_MODULE_9__.isEntitlementsDeeplyEqual)(oldEntitlements, updatedUser == null ? void 0 : updatedUser.entitlements)) {
6642
6518
  // set the previous entitlements object
6643
6519
  return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, updatedUser, {
6644
6520
  entitlements: oldEntitlements
@@ -6658,7 +6534,7 @@ const _excluded = ["callback", "error"],
6658
6534
  loginState,
6659
6535
  onRedirectTo
6660
6536
  } = store.auth;
6661
- const [preventAuthRedirectOnSocialLogin] = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.FeatureFlags.getFeatureFlags(['prevent-auth-redirect-on-social-login'], store.root.appName);
6537
+ const [preventAuthRedirectOnSocialLogin] = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_10__.FeatureFlags.getFeatureFlags(['prevent-auth-redirect-on-social-login'], store.root.appName);
6662
6538
  const invitationToken = url.searchParams.get('invitationToken');
6663
6539
  const redirectRoutes = [routes.socialLoginCallbackUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl, routes.magicLinkCallbackUrl];
6664
6540
  if (!invitationToken) {
@@ -6687,7 +6563,7 @@ const _excluded = ["callback", "error"],
6687
6563
  var _payload$callback;
6688
6564
  const {
6689
6565
  isActive
6690
- } = await (0,_helpers__WEBPACK_IMPORTED_MODULE_14__.retryIfNeeded)(api.auth.getSSOPublicConfiguration, payload == null ? void 0 : payload.retryConfig);
6566
+ } = await (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.retryIfNeeded)(api.auth.getSSOPublicConfiguration, payload == null ? void 0 : payload.retryConfig);
6691
6567
  actions.setAuthState({
6692
6568
  isSSOAuth: isActive
6693
6569
  });
@@ -6706,7 +6582,7 @@ const _excluded = ["callback", "error"],
6706
6582
  let ssoACS;
6707
6583
  try {
6708
6584
  var _metadata$configurati;
6709
- const metadata = await (0,_helpers__WEBPACK_IMPORTED_MODULE_14__.retryIfNeeded)(api.metadata.getSamlMetadata, payload == null ? void 0 : payload.retryConfig);
6585
+ const metadata = await (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.retryIfNeeded)(api.metadata.getSamlMetadata, payload == null ? void 0 : payload.retryConfig);
6710
6586
  ssoACS = metadata == null ? void 0 : (_metadata$configurati = metadata.configuration) == null ? void 0 : _metadata$configurati.acsUrl;
6711
6587
  } catch (e) {
6712
6588
  console.error(e);
@@ -6732,8 +6608,8 @@ const _excluded = ["callback", "error"],
6732
6608
  onRedirectTo,
6733
6609
  routes
6734
6610
  } = store.auth;
6735
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isMfaRequired)(user, store.root.appName)) {
6736
- const mfaRequiredState = await actions.getMfaRequiredState(user, _constants__WEBPACK_IMPORTED_MODULE_7__.DEFAULT_RETRY_CONFIG, true);
6611
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
6612
+ const mfaRequiredState = await actions.getMfaRequiredState(user, _constants__WEBPACK_IMPORTED_MODULE_12__.DEFAULT_RETRY_CONFIG, true);
6737
6613
  actions.setAuthState(mfaRequiredState);
6738
6614
  onRedirectTo(routes.loginUrl, {
6739
6615
  preserveQueryParams: true
@@ -6744,17 +6620,17 @@ const _excluded = ["callback", "error"],
6744
6620
  Object.assign(store.auth.loginState, state);
6745
6621
  };
6746
6622
  const resetLoginState = () => {
6747
- (0,_helpers__WEBPACK_IMPORTED_MODULE_14__.deepResetState)(store, ['auth', 'loginState'], _state__WEBPACK_IMPORTED_MODULE_15__.initialState);
6623
+ (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.deepResetState)(store, ['auth', 'loginState'], _state__WEBPACK_IMPORTED_MODULE_13__.initialState);
6748
6624
  };
6749
6625
  const getRetryWithBlockingCallbackPayload = requestName => {
6750
6626
  const callback = (_, error) => {
6751
6627
  if (!error || error.statusCode < 500) return;
6752
6628
  actions.setErrorByRequestName({
6753
6629
  requestName,
6754
- traceId: (0,_helpers__WEBPACK_IMPORTED_MODULE_14__.errorTraceId)(error)
6630
+ traceId: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorTraceId)(error)
6755
6631
  });
6756
6632
  };
6757
- return (0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)({
6633
+ return (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.withRetryConfig)({
6758
6634
  callback
6759
6635
  });
6760
6636
  };
@@ -6766,19 +6642,19 @@ const _excluded = ["callback", "error"],
6766
6642
  actions.setAuthState({
6767
6643
  isLoading: true
6768
6644
  });
6769
- calls.push(actions.loadSocialLoginsConfigurationV2((0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)()));
6770
- calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_16__.REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
6771
- calls.push(actions.loadPublicAuthStrategiesPolicy(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_16__.REQUEST_NAME.LOAD_PUBLIC_AUTH_STRATEGIES_POLICY)));
6645
+ calls.push(actions.loadSocialLoginsConfigurationV2((0,_helpers__WEBPACK_IMPORTED_MODULE_11__.withRetryConfig)()));
6646
+ calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_14__.REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
6647
+ calls.push(actions.loadPublicAuthStrategiesPolicy(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_14__.REQUEST_NAME.LOAD_PUBLIC_AUTH_STRATEGIES_POLICY)));
6772
6648
  calls.push(actions.loadSignUpStrategies());
6773
- calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_16__.REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
6774
- calls.push(actions.loadVendorPublicInfo((0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)()));
6775
- calls.push(__refreshMetadata((0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)()));
6649
+ calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_14__.REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
6650
+ calls.push(actions.loadVendorPublicInfo((0,_helpers__WEBPACK_IMPORTED_MODULE_11__.withRetryConfig)()));
6651
+ calls.push(__refreshMetadata((0,_helpers__WEBPACK_IMPORTED_MODULE_11__.withRetryConfig)()));
6776
6652
  /*
6777
6653
  We will load custom login routes only if custom login is enabled
6778
6654
  to check if custom login is enabled without the tenant alias (search-param/subdomain)
6779
6655
  we have to wait for the user state (refreshToken request)
6780
6656
  */
6781
- callsAfterRefresh.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_16__.REQUEST_NAME.LOAD_CUSTOM_LOGIN_ROUTES)));
6657
+ callsAfterRefresh.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_14__.REQUEST_NAME.LOAD_CUSTOM_LOGIN_ROUTES)));
6782
6658
  }
6783
6659
  await Promise.all(calls);
6784
6660
  if (callsAfterRefresh.length > 0) {
@@ -6790,14 +6666,14 @@ const _excluded = ["callback", "error"],
6790
6666
  };
6791
6667
  const requestAuthorizeSSR = async payload => {
6792
6668
  const calls = [];
6793
- calls.push(actions.loadSocialLoginsConfigurationV2((0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)()));
6794
- calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_16__.REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
6795
- calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_16__.REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
6669
+ calls.push(actions.loadSocialLoginsConfigurationV2((0,_helpers__WEBPACK_IMPORTED_MODULE_11__.withRetryConfig)()));
6670
+ calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_14__.REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
6671
+ calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_14__.REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
6796
6672
  calls.push(actions.loadSignUpStrategies());
6797
- calls.push(actions.loadVendorPublicInfo((0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)()));
6673
+ calls.push(actions.loadVendorPublicInfo((0,_helpers__WEBPACK_IMPORTED_MODULE_11__.withRetryConfig)()));
6798
6674
  calls.push(__refreshMetadata());
6799
6675
  calls.push(__isMFARequiredSSR(payload));
6800
- calls.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_16__.REQUEST_NAME.LOAD_CUSTOM_LOGIN_ROUTES)));
6676
+ calls.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_14__.REQUEST_NAME.LOAD_CUSTOM_LOGIN_ROUTES)));
6801
6677
  await Promise.all(calls);
6802
6678
  };
6803
6679
  const ssoPreloginFailed = async _ref3 => {
@@ -6809,32 +6685,55 @@ const _excluded = ["callback", "error"],
6809
6685
  const publicPolicy = store.auth.securityPolicyState.publicPolicy.policy;
6810
6686
  if (!(publicPolicy != null && publicPolicy.authStrategy)) {
6811
6687
  actions.setLoginState({
6812
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.loginWithPassword,
6688
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithPassword,
6813
6689
  loading: false
6814
6690
  });
6815
6691
  callback == null ? void 0 : callback();
6816
6692
  return;
6817
6693
  }
6818
- if ((publicPolicy == null ? void 0 : publicPolicy.authStrategy) === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_17__.AuthStrategyEnum.EmailAndPassword) {
6694
+ if ((publicPolicy == null ? void 0 : publicPolicy.authStrategy) === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_15__.AuthStrategyEnum.EmailAndPassword) {
6819
6695
  actions.setLoginState({
6820
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.loginWithPassword,
6696
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithPassword,
6821
6697
  loading: false
6822
6698
  });
6823
6699
  callback == null ? void 0 : callback();
6824
- } else if ([_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_17__.AuthStrategyEnum.MagicLink, _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_17__.AuthStrategyEnum.Code, _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_17__.AuthStrategyEnum.SmsCode].includes(publicPolicy == null ? void 0 : publicPolicy.authStrategy)) {
6700
+ } else if ([_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_15__.AuthStrategyEnum.MagicLink, _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_15__.AuthStrategyEnum.Code, _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_15__.AuthStrategyEnum.SmsCode].includes(publicPolicy == null ? void 0 : publicPolicy.authStrategy)) {
6825
6701
  await actions.passwordlessPreLogin((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, body, {
6826
6702
  type: publicPolicy == null ? void 0 : publicPolicy.authStrategy,
6827
6703
  callback
6828
6704
  }));
6829
6705
  } else {
6830
6706
  actions.setLoginState({
6831
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.loginWithPassword,
6707
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithPassword,
6832
6708
  loading: false,
6833
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(error)
6709
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(error)
6834
6710
  });
6835
6711
  callback == null ? void 0 : callback();
6836
6712
  }
6837
6713
  };
6714
+
6715
+ // v6 parity (takeLeading): a preLogin called while another is in flight is dropped.
6716
+ let preLoginInFlight = false;
6717
+ let latestPreLoginAttempt = 0;
6718
+
6719
+ // Read on use: the login box installs onRedirectTo lazily, logout() clears it and the store default is a no-op.
6720
+ const redirectToFullPage = url => {
6721
+ const onRedirectTo = [store.auth.onRedirectTo, contextHolder.onRedirectTo].find(isUsableRedirect);
6722
+ if (onRedirectTo) {
6723
+ onRedirectTo(url, {
6724
+ refresh: true
6725
+ });
6726
+ } else {
6727
+ window.location.href = url;
6728
+ }
6729
+ };
6730
+ const scheduleSsoRedirect = (ssoRedirectUrl, attempt) => {
6731
+ setTimeout(() => {
6732
+ if (attempt === latestPreLoginAttempt && store.auth.loginState.step === _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.redirectToSSO) {
6733
+ redirectToFullPage(ssoRedirectUrl);
6734
+ }
6735
+ }, SSO_REDIRECT_DELAY_MS);
6736
+ };
6838
6737
  const preLogin = async payload => {
6839
6738
  const {
6840
6739
  email,
@@ -6843,12 +6742,18 @@ const _excluded = ["callback", "error"],
6843
6742
  invitationToken,
6844
6743
  callback
6845
6744
  } = payload;
6745
+ if (preLoginInFlight) {
6746
+ callback == null ? void 0 : callback();
6747
+ return;
6748
+ }
6749
+ preLoginInFlight = true;
6750
+ latestPreLoginAttempt += 1;
6751
+ const attempt = latestPreLoginAttempt;
6846
6752
  setLoginState({
6847
6753
  loading: true
6848
6754
  });
6849
6755
  try {
6850
- const onRedirectTo = store.auth.onRedirectTo;
6851
- const tenantId = (0,_helpers__WEBPACK_IMPORTED_MODULE_18__.getSearchParam)(_helpers__WEBPACK_IMPORTED_MODULE_18__.TENANT_ID_PARAM_KEY);
6756
+ const tenantId = (0,_helpers__WEBPACK_IMPORTED_MODULE_17__.getSearchParam)(_helpers__WEBPACK_IMPORTED_MODULE_17__.TENANT_ID_PARAM_KEY);
6852
6757
  const preLoginResult = await api.auth.preLoginV2((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, email ? {
6853
6758
  email
6854
6759
  } : {}, username ? {
@@ -6862,15 +6767,13 @@ const _excluded = ["callback", "error"],
6862
6767
  addressType
6863
6768
  } = preLoginResult != null ? preLoginResult : {};
6864
6769
  if (address) {
6865
- if (addressType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.PreLoginAddressType.External) {
6770
+ if (addressType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__.PreLoginAddressType.External) {
6866
6771
  // Domain-based routing: navigate to the vendor legacy login URL immediately,
6867
6772
  // skipping the SSO interstitial and the SSO/OIDC-specific handling.
6868
6773
  setLoginState({
6869
6774
  loading: false
6870
6775
  });
6871
- onRedirectTo(address, {
6872
- refresh: true
6873
- });
6776
+ redirectToFullPage(address);
6874
6777
  return;
6875
6778
  }
6876
6779
  let ssoRedirectUrl = address;
@@ -6880,24 +6783,20 @@ const _excluded = ["callback", "error"],
6880
6783
  } = store.auth.routes;
6881
6784
  ssoRedirectUrl += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
6882
6785
  }
6883
- if (_toolkit__WEBPACK_IMPORTED_MODULE_12__["default"].isLoginWithSSOAvailable()) {
6786
+ if (_toolkit__WEBPACK_IMPORTED_MODULE_8__["default"].isLoginWithSSOAvailable()) {
6884
6787
  var _ref4;
6885
- _toolkit__WEBPACK_IMPORTED_MODULE_12__["default"].loginWithSSO((_ref4 = email != null ? email : username) != null ? _ref4 : '');
6788
+ _toolkit__WEBPACK_IMPORTED_MODULE_8__["default"].loginWithSSO((_ref4 = email != null ? email : username) != null ? _ref4 : '');
6886
6789
  setLoginState({
6887
6790
  loading: false
6888
6791
  });
6889
6792
  callback == null ? void 0 : callback();
6890
6793
  } else {
6891
6794
  setLoginState({
6892
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.redirectToSSO,
6795
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.redirectToSSO,
6893
6796
  loading: false,
6894
6797
  ssoRedirectUrl
6895
6798
  });
6896
- setTimeout(() => {
6897
- onRedirectTo(ssoRedirectUrl, {
6898
- refresh: true
6899
- });
6900
- }, 2000);
6799
+ scheduleSsoRedirect(ssoRedirectUrl, attempt);
6901
6800
  }
6902
6801
  } else {
6903
6802
  await ssoPreloginFailed((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, username ? {
@@ -6921,6 +6820,8 @@ const _excluded = ["callback", "error"],
6921
6820
  invitationToken,
6922
6821
  error: e
6923
6822
  }));
6823
+ } finally {
6824
+ preLoginInFlight = false;
6924
6825
  }
6925
6826
  };
6926
6827
  const postLogin = async payload => {
@@ -6956,7 +6857,7 @@ const _excluded = ["callback", "error"],
6956
6857
  onRedirectTo(routes.authenticatedUrl);
6957
6858
  }, 1000);
6958
6859
  setLoginState({
6959
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.loginWithSSOFailed,
6860
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithSSOFailed,
6960
6861
  loading: false
6961
6862
  });
6962
6863
  }
@@ -6991,17 +6892,17 @@ const _excluded = ["callback", "error"],
6991
6892
  onRedirectTo,
6992
6893
  routes
6993
6894
  } = store.auth;
6994
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isMfaRequired)(user, store.root.appName)) {
6995
- const mfaRequiredState = await actions.getMfaRequiredState(user, _constants__WEBPACK_IMPORTED_MODULE_7__.DEFAULT_RETRY_CONFIG, true, email);
6895
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
6896
+ const mfaRequiredState = await actions.getMfaRequiredState(user, _constants__WEBPACK_IMPORTED_MODULE_12__.DEFAULT_RETRY_CONFIG, true, email);
6996
6897
  actions.setAuthState(mfaRequiredState);
6997
6898
  onRedirectTo(routes.loginUrl, {
6998
6899
  preserveQueryParams: true
6999
6900
  });
7000
6901
  } else {
7001
6902
  const [securityCenterLoginFlows] = await actions.getFeatureFlags(['security-center-show-login-flows']);
7002
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isResetPasswordRequired)(user, store.root.appName)) {
6903
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isResetPasswordRequired)(user, store.root.appName)) {
7003
6904
  setLoginState({
7004
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.passwordRotationExpired,
6905
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.passwordRotationExpired,
7005
6906
  loading: false,
7006
6907
  resetPasswordToken: user.resetPasswordToken,
7007
6908
  userId: user.userId
@@ -7024,7 +6925,7 @@ const _excluded = ["callback", "error"],
7024
6925
  loading: false,
7025
6926
  error: undefined,
7026
6927
  mfaToken: user.mfaToken,
7027
- step: loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginFlow.Login ? _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.success : loginState.step,
6928
+ step: loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.Login ? _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.success : loginState.step,
7028
6929
  tenants,
7029
6930
  tenantsLoading: true,
7030
6931
  isBreachedPassword: user.isBreachedPassword,
@@ -7046,25 +6947,25 @@ const _excluded = ["callback", "error"],
7046
6947
  };
7047
6948
  (0,_helpers__WEBPACK_IMPORTED_MODULE_20__.reportGTMEvent)(_helpers__WEBPACK_IMPORTED_MODULE_20__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
7048
6949
  }
7049
- if (loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginFlow.Login) {
6950
+ if (loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.Login) {
7050
6951
  if (securityCenterLoginFlows && user.isBreachedPassword && !isAuthenticated) {
7051
6952
  setLoginState({
7052
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.breachedPassword,
6953
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.breachedPassword,
7053
6954
  loading: false
7054
6955
  });
7055
6956
  } else {
7056
6957
  if (isAuthenticated) {
7057
- const shouldShowPasswordRotationPrompt = (0,_helpers__WEBPACK_IMPORTED_MODULE_18__.shouldShowPasswordRotationPromptFunc)(user);
6958
+ const shouldShowPasswordRotationPrompt = (0,_helpers__WEBPACK_IMPORTED_MODULE_17__.shouldShowPasswordRotationPromptFunc)(user);
7058
6959
  if (shouldShowPasswordRotationPrompt) {
7059
6960
  setLoginState({
7060
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.passwordRotationNotification,
6961
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.passwordRotationNotification,
7061
6962
  loading: false
7062
6963
  });
7063
6964
  } else {
7064
6965
  const shouldShowPromptPasskeys = await actions.__shouldShowPromptPasskeys();
7065
6966
  if (shouldShowPromptPasskeys) {
7066
6967
  setLoginState({
7067
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.promptPasskeys,
6968
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.promptPasskeys,
7068
6969
  loading: false
7069
6970
  });
7070
6971
  onRedirectTo(routes.loginUrl, {
@@ -7079,8 +6980,8 @@ const _excluded = ["callback", "error"],
7079
6980
  }
7080
6981
  }
7081
6982
  }
7082
- if (_toolkit__WEBPACK_IMPORTED_MODULE_12__["default"].isSuggestSavePasswordAvailable()) {
7083
- _toolkit__WEBPACK_IMPORTED_MODULE_12__["default"].suggestSavePassword(email, password);
6983
+ if (_toolkit__WEBPACK_IMPORTED_MODULE_8__["default"].isSuggestSavePasswordAvailable()) {
6984
+ _toolkit__WEBPACK_IMPORTED_MODULE_8__["default"].suggestSavePassword(email, password);
7084
6985
  }
7085
6986
 
7086
6987
  // TODO: extract item name to constants
@@ -7092,7 +6993,7 @@ const _excluded = ["callback", "error"],
7092
6993
  callback == null ? void 0 : callback(false, e);
7093
6994
  setLoginState({
7094
6995
  email,
7095
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e),
6996
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e),
7096
6997
  loading: false
7097
6998
  });
7098
6999
  }
@@ -7101,13 +7002,12 @@ const _excluded = ["callback", "error"],
7101
7002
  keepHostedOAuthState = false
7102
7003
  } = {}) => {
7103
7004
  if (contextHolder.isSessionPerTenantEnabled()) {
7104
- (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.removeTabTenantFromSessionStorage)();
7005
+ (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.removeTabTenantFromSessionStorage)();
7105
7006
  }
7106
7007
  // Step-up re-login goes through silentLogout but still needs the hosted OAuth state to finish the client flow.
7107
7008
  if (!keepHostedOAuthState) {
7108
7009
  (0,_oauthStorage__WEBPACK_IMPORTED_MODULE_21__.clearHostedOAuthState)();
7109
7010
  }
7110
- window.sessionStorage.removeItem(_constants__WEBPACK_IMPORTED_MODULE_7__.FRONTEGG_PENDING_SWITCH_TENANT);
7111
7011
  };
7112
7012
  const logout = async payload => {
7113
7013
  const hostedLoginBox = store.auth.hostedLoginBox;
@@ -7154,7 +7054,7 @@ const _excluded = ["callback", "error"],
7154
7054
  setLoginState({
7155
7055
  loading: false,
7156
7056
  error: undefined,
7157
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.preLogin
7057
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.preLogin
7158
7058
  });
7159
7059
  actions.setAuthState({
7160
7060
  user: undefined,
@@ -7164,7 +7064,7 @@ const _excluded = ["callback", "error"],
7164
7064
  } catch (e) {
7165
7065
  var _payload$callback5;
7166
7066
  setLoginState({
7167
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e),
7067
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e),
7168
7068
  loading: false
7169
7069
  });
7170
7070
  (_payload$callback5 = payload.callback) == null ? void 0 : _payload$callback5.call(payload, false, e);
@@ -7183,10 +7083,10 @@ const _excluded = ["callback", "error"],
7183
7083
  // TODO: fix @frontegg/rest-api return value
7184
7084
  // @ts-ignore
7185
7085
  const preloginRes = await api.auth.passwordlessPreLogin((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, payload, {
7186
- type: _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_17__.AuthStrategyEnum.SmsCode
7086
+ type: _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_15__.AuthStrategyEnum.SmsCode
7187
7087
  }));
7188
7088
  setLoginState({
7189
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.loginWithQuickSmsOtc,
7089
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithQuickSmsOtc,
7190
7090
  loading: false,
7191
7091
  phoneNumber: preloginRes == null ? void 0 : preloginRes.phoneNumber,
7192
7092
  error: undefined
@@ -7194,7 +7094,7 @@ const _excluded = ["callback", "error"],
7194
7094
  callback == null ? void 0 : callback(true);
7195
7095
  } catch (e) {
7196
7096
  setLoginState({
7197
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e),
7097
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e),
7198
7098
  loading: false
7199
7099
  });
7200
7100
  callback == null ? void 0 : callback(false, e);
@@ -7214,13 +7114,13 @@ const _excluded = ["callback", "error"],
7214
7114
  phoneNumber: payload.phoneNumber,
7215
7115
  loading: false,
7216
7116
  changePhoneId: changePhoneRes.changePhoneId,
7217
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.loginWithQuickSmsOtc,
7117
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithQuickSmsOtc,
7218
7118
  error: undefined
7219
7119
  });
7220
7120
  callback == null ? void 0 : callback(true);
7221
7121
  } catch (e) {
7222
7122
  setLoginState({
7223
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e),
7123
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e),
7224
7124
  loading: false
7225
7125
  });
7226
7126
  }
@@ -7241,7 +7141,7 @@ const _excluded = ["callback", "error"],
7241
7141
  callback == null ? void 0 : callback(true);
7242
7142
  } catch (e) {
7243
7143
  setLoginState({
7244
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e),
7144
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e),
7245
7145
  loading: false
7246
7146
  });
7247
7147
  }
@@ -7257,11 +7157,11 @@ const _excluded = ["callback", "error"],
7257
7157
  loading: true
7258
7158
  });
7259
7159
  let email;
7260
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_18__.isEmailPayload)(payload)) {
7160
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_17__.isEmailPayload)(payload)) {
7261
7161
  email = payload.email;
7262
7162
  }
7263
7163
  let username;
7264
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_18__.isUsernamePayload)(payload)) {
7164
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_17__.isUsernamePayload)(payload)) {
7265
7165
  username = payload.username;
7266
7166
  }
7267
7167
  // TODO: [Typescript 4.8] fix @frontegg/rest-api return value
@@ -7271,7 +7171,7 @@ const _excluded = ["callback", "error"],
7271
7171
  username: (_username = username) != null ? _username : ''
7272
7172
  }));
7273
7173
  // @ts-ignore
7274
- const step = _consts__WEBPACK_IMPORTED_MODULE_23__.authStrategyLoginStepMap[payload.type];
7174
+ const step = _consts__WEBPACK_IMPORTED_MODULE_2__.authStrategyLoginStepMap[payload.type];
7275
7175
  setLoginState({
7276
7176
  step,
7277
7177
  loading: false,
@@ -7283,7 +7183,7 @@ const _excluded = ["callback", "error"],
7283
7183
  callback == null ? void 0 : callback();
7284
7184
  } catch (e) {
7285
7185
  setLoginState({
7286
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e),
7186
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e),
7287
7187
  loading: false
7288
7188
  });
7289
7189
  callback == null ? void 0 : callback(null, e);
@@ -7308,7 +7208,7 @@ const _excluded = ["callback", "error"],
7308
7208
  routes,
7309
7209
  onRedirectTo
7310
7210
  } = store.auth;
7311
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isMfaRequired)(user, store.root.appName)) {
7211
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
7312
7212
  const mfaRequiredState = await actions.getMfaRequiredState(user);
7313
7213
  actions.setAuthState(mfaRequiredState);
7314
7214
  onRedirectTo(routes.loginUrl, {
@@ -7321,7 +7221,7 @@ const _excluded = ["callback", "error"],
7321
7221
  var _events$userVerified;
7322
7222
  const userVerifiedPayload = {
7323
7223
  email: user.email,
7324
- origin: _interfaces__WEBPACK_IMPORTED_MODULE_16__.UserVerifiedOriginTypes.PASSWORDLESS,
7224
+ origin: _interfaces__WEBPACK_IMPORTED_MODULE_14__.UserVerifiedOriginTypes.PASSWORDLESS,
7325
7225
  id: user.id,
7326
7226
  tenantId: user.tenantId,
7327
7227
  createdAt: new Date(),
@@ -7353,11 +7253,11 @@ const _excluded = ["callback", "error"],
7353
7253
  actions.setAuthState({
7354
7254
  isLoading: false
7355
7255
  });
7356
- if (loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginFlow.Login) {
7256
+ if (loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.Login) {
7357
7257
  const shouldShowPrompt = await actions.__shouldShowPromptPasskeys();
7358
7258
  if (shouldShowPrompt) {
7359
7259
  actions.setLoginState({
7360
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.promptPasskeys,
7260
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.promptPasskeys,
7361
7261
  loading: false
7362
7262
  });
7363
7263
  onRedirectTo(routes.loginUrl, {
@@ -7367,12 +7267,12 @@ const _excluded = ["callback", "error"],
7367
7267
  actions.setAuthState({
7368
7268
  isAuthenticated: true
7369
7269
  });
7370
- if (_payload.type === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_17__.AuthStrategyEnum.MagicLink) {
7270
+ if (_payload.type === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_15__.AuthStrategyEnum.MagicLink) {
7371
7271
  actions.setLoginState({
7372
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.magicLinkPostLoginSuccess,
7272
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.magicLinkPostLoginSuccess,
7373
7273
  loading: false
7374
7274
  });
7375
- await (0,_helpers__WEBPACK_IMPORTED_MODULE_14__.delay)(5000);
7275
+ await (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.delay)(5000);
7376
7276
  }
7377
7277
  await actions.afterAuthNavigation();
7378
7278
  }
@@ -7386,7 +7286,7 @@ const _excluded = ["callback", "error"],
7386
7286
  }
7387
7287
  } catch (e) {
7388
7288
  setLoginState({
7389
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e, 'Failed to authenticate')
7289
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e, 'Failed to authenticate')
7390
7290
  });
7391
7291
  callback == null ? void 0 : callback(null, e);
7392
7292
  } finally {
@@ -7410,7 +7310,7 @@ const _excluded = ["callback", "error"],
7410
7310
  });
7411
7311
  } catch (e) {
7412
7312
  setLoginState({
7413
- inviteTokenError: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e, `We couldn't verify your invitation`)
7313
+ inviteTokenError: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e, `We couldn't verify your invitation`)
7414
7314
  });
7415
7315
  } finally {
7416
7316
  setLoginState({
@@ -7436,9 +7336,9 @@ const _excluded = ["callback", "error"],
7436
7336
  const {
7437
7337
  options
7438
7338
  } = await api.auth.webAuthnPreLogin(body);
7439
- options.challenge = (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(options.challenge);
7339
+ options.challenge = (0,_helpers__WEBPACK_IMPORTED_MODULE_23__.base64urlDecode)(options.challenge);
7440
7340
  options.allowCredentials = (_options$allowCredent = options.allowCredentials) == null ? void 0 : _options$allowCredent.map(credentials => (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, credentials, {
7441
- id: (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(credentials.id)
7341
+ id: (0,_helpers__WEBPACK_IMPORTED_MODULE_23__.base64urlDecode)(credentials.id)
7442
7342
  }));
7443
7343
  setLoginState({
7444
7344
  error: undefined
@@ -7446,7 +7346,7 @@ const _excluded = ["callback", "error"],
7446
7346
  callback == null ? void 0 : callback(options);
7447
7347
  } catch (e) {
7448
7348
  setLoginState({
7449
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
7349
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e)
7450
7350
  });
7451
7351
  callback == null ? void 0 : callback(null);
7452
7352
  } finally {
@@ -7471,7 +7371,7 @@ const _excluded = ["callback", "error"],
7471
7371
  setLoginState({
7472
7372
  loading: true
7473
7373
  });
7474
- const publicKey = (0,_helpers__WEBPACK_IMPORTED_MODULE_25__.publicKeyCredentialToJSON)(body.publicKey);
7374
+ const publicKey = (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.publicKeyCredentialToJSON)(body.publicKey);
7475
7375
  const _await$api$auth$webAu = await api.auth.webAuthnPostLoginV2((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, publicKey, {
7476
7376
  response: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, publicKey.response, {
7477
7377
  userHandle: (_publicKey$response$u = publicKey.response.userHandle) != null ? _publicKey$response$u : undefined
@@ -7483,7 +7383,7 @@ const _excluded = ["callback", "error"],
7483
7383
  user
7484
7384
  } = _await$api$auth$webAu,
7485
7385
  rest = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(_await$api$auth$webAu, _excluded9);
7486
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isMfaRequired)(user, store.root.appName)) {
7386
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
7487
7387
  const {
7488
7388
  routes,
7489
7389
  onRedirectTo
@@ -7522,7 +7422,7 @@ const _excluded = ["callback", "error"],
7522
7422
  // callback?.(true);
7523
7423
  } catch (e) {
7524
7424
  setLoginState({
7525
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
7425
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e)
7526
7426
  });
7527
7427
  callback == null ? void 0 : callback(null);
7528
7428
  } finally {
@@ -7547,13 +7447,13 @@ const _excluded = ["callback", "error"],
7547
7447
  const {
7548
7448
  options
7549
7449
  } = await api.auth.webAuthnCreateNewDeviceSession();
7550
- options.user.id = (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(options.user.id);
7551
- options.challenge = (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(options.challenge);
7450
+ options.user.id = (0,_helpers__WEBPACK_IMPORTED_MODULE_23__.base64urlDecode)(options.user.id);
7451
+ options.challenge = (0,_helpers__WEBPACK_IMPORTED_MODULE_23__.base64urlDecode)(options.challenge);
7552
7452
  options.excludeCredentials = [];
7553
7453
  callback == null ? void 0 : callback(options);
7554
7454
  } catch (e) {
7555
7455
  setLoginState({
7556
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
7456
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e)
7557
7457
  });
7558
7458
  callback == null ? void 0 : callback(null);
7559
7459
  } finally {
@@ -7571,8 +7471,8 @@ const _excluded = ["callback", "error"],
7571
7471
  setLoginState({
7572
7472
  loading: true
7573
7473
  });
7574
- const publicKey = (0,_helpers__WEBPACK_IMPORTED_MODULE_25__.publicKeyCredentialToJSON)(body.publicKey);
7575
- const deviceType = (publicKey == null ? void 0 : publicKey.authenticatorAttachment) === 'platform' ? _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.WebAuthnDeviceType.Platform : _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.WebAuthnDeviceType.CrossPlatform;
7474
+ const publicKey = (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.publicKeyCredentialToJSON)(body.publicKey);
7475
+ const deviceType = (publicKey == null ? void 0 : publicKey.authenticatorAttachment) === 'platform' ? _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__.WebAuthnDeviceType.Platform : _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__.WebAuthnDeviceType.CrossPlatform;
7576
7476
  await api.auth.verifyNewDeviceSession({
7577
7477
  id: publicKey.id,
7578
7478
  response: publicKey.response,
@@ -7581,7 +7481,7 @@ const _excluded = ["callback", "error"],
7581
7481
  callback == null ? void 0 : callback(true);
7582
7482
  } catch (e) {
7583
7483
  setLoginState({
7584
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
7484
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e)
7585
7485
  });
7586
7486
  callback == null ? void 0 : callback(null);
7587
7487
  } finally {
@@ -7639,12 +7539,12 @@ const _excluded = ["callback", "error"],
7639
7539
  var _data$options$exclude;
7640
7540
  const data = await api.auth.preEnrollMFAWebAuthnForLogin(payload);
7641
7541
  const options = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, data.options, {
7642
- challenge: (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(data.options.challenge),
7542
+ challenge: (0,_helpers__WEBPACK_IMPORTED_MODULE_23__.base64urlDecode)(data.options.challenge),
7643
7543
  user: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, data.options.user, {
7644
- id: (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(data.options.user.id)
7544
+ id: (0,_helpers__WEBPACK_IMPORTED_MODULE_23__.base64urlDecode)(data.options.user.id)
7645
7545
  }),
7646
7546
  excludeCredentials: (_data$options$exclude = data.options.excludeCredentials) == null ? void 0 : _data$options$exclude.map(credentials => (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, credentials, {
7647
- id: (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(credentials.id)
7547
+ id: (0,_helpers__WEBPACK_IMPORTED_MODULE_23__.base64urlDecode)(credentials.id)
7648
7548
  }))
7649
7549
  });
7650
7550
  setLoginState({
@@ -7657,7 +7557,7 @@ const _excluded = ["callback", "error"],
7657
7557
  } catch (e) {
7658
7558
  setLoginState({
7659
7559
  loading: false,
7660
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
7560
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e)
7661
7561
  });
7662
7562
  callback == null ? void 0 : callback(null);
7663
7563
  }
@@ -7671,7 +7571,7 @@ const _excluded = ["callback", "error"],
7671
7571
  loading: true
7672
7572
  });
7673
7573
  try {
7674
- const publicKey = (0,_helpers__WEBPACK_IMPORTED_MODULE_25__.publicKeyCredentialToJSON)(payload.publicKey);
7574
+ const publicKey = (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.publicKeyCredentialToJSON)(payload.publicKey);
7675
7575
  const data = await api.auth.enrollMFAWebAuthnForLoginV2((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, payload, {
7676
7576
  options: publicKey
7677
7577
  }));
@@ -7683,7 +7583,7 @@ const _excluded = ["callback", "error"],
7683
7583
  } catch (e) {
7684
7584
  setLoginState({
7685
7585
  loading: false,
7686
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
7586
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e)
7687
7587
  });
7688
7588
  callback == null ? void 0 : callback(null);
7689
7589
  }
@@ -7706,7 +7606,7 @@ const _excluded = ["callback", "error"],
7706
7606
  } catch (e) {
7707
7607
  setLoginState({
7708
7608
  loading: false,
7709
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
7609
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e)
7710
7610
  });
7711
7611
  callback == null ? void 0 : callback(null);
7712
7612
  }
@@ -7723,7 +7623,7 @@ const _excluded = ["callback", "error"],
7723
7623
  const data = await api.auth.preEnrollMFASMSForLogin(payload);
7724
7624
  actions.setMfaState({
7725
7625
  otcToken: data.otcToken,
7726
- step: _MfaState_interfaces__WEBPACK_IMPORTED_MODULE_26__.MFAStep.smsVerifyCode,
7626
+ step: _MfaState_interfaces__WEBPACK_IMPORTED_MODULE_25__.MFAStep.smsVerifyCode,
7727
7627
  phoneNumber: data.phoneNumber
7728
7628
  });
7729
7629
  setLoginState({
@@ -7733,7 +7633,7 @@ const _excluded = ["callback", "error"],
7733
7633
  } catch (e) {
7734
7634
  setLoginState({
7735
7635
  loading: false,
7736
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
7636
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e)
7737
7637
  });
7738
7638
  callback == null ? void 0 : callback(null);
7739
7639
  }
@@ -7756,7 +7656,7 @@ const _excluded = ["callback", "error"],
7756
7656
  } catch (e) {
7757
7657
  setLoginState({
7758
7658
  loading: false,
7759
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
7659
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e)
7760
7660
  });
7761
7661
  callback == null ? void 0 : callback(null);
7762
7662
  }
@@ -7768,7 +7668,7 @@ const _excluded = ["callback", "error"],
7768
7668
  activeTenant
7769
7669
  } = payload;
7770
7670
  const mfaState = {
7771
- step: _MfaState_interfaces__WEBPACK_IMPORTED_MODULE_26__.MFAStep.recoveryCode,
7671
+ step: _MfaState_interfaces__WEBPACK_IMPORTED_MODULE_25__.MFAStep.recoveryCode,
7772
7672
  loading: false,
7773
7673
  error: undefined,
7774
7674
  saving: false
@@ -7796,7 +7696,7 @@ const _excluded = ["callback", "error"],
7796
7696
  setLoginState({
7797
7697
  loading: false,
7798
7698
  error: undefined,
7799
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.breachedPasswordSuccess
7699
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.breachedPasswordSuccess
7800
7700
  });
7801
7701
  actions.setAuthState({
7802
7702
  isAuthenticated: false
@@ -7804,16 +7704,13 @@ const _excluded = ["callback", "error"],
7804
7704
  } catch (e) {
7805
7705
  setLoginState({
7806
7706
  loading: false,
7807
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
7707
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorHandler)(e)
7808
7708
  });
7809
7709
  }
7810
7710
  };
7811
7711
 
7812
7712
  /** @private */
7813
- const __refreshTokenHostedSocialLogins = async ({
7814
- tenantId,
7815
- isSsoEnforcementRetry = false
7816
- } = {}) => {
7713
+ const __refreshTokenHostedSocialLogins = async () => {
7817
7714
  const {
7818
7715
  user: currentUser
7819
7716
  } = store.auth;
@@ -7827,7 +7724,7 @@ const _excluded = ["callback", "error"],
7827
7724
  return;
7828
7725
  }
7829
7726
  try {
7830
- const tabTenantId = tenantId != null ? tenantId : (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.getTabTenantFromSessionStorage)(store.root.appName);
7727
+ const tabTenantId = (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.getTabTenantFromSessionStorage)(store.root.appName);
7831
7728
  const body = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({
7832
7729
  grant_type: 'refresh_token',
7833
7730
  refresh_token: currentUser == null ? void 0 : currentUser.refreshToken
@@ -7842,13 +7739,6 @@ const _excluded = ["callback", "error"],
7842
7739
  isAuthenticated: true
7843
7740
  });
7844
7741
  } catch (e) {
7845
- const retry = tenantId => __refreshTokenHostedSocialLogins({
7846
- tenantId,
7847
- isSsoEnforcementRetry: true
7848
- });
7849
- if (await __handleSsoEnforcementRefreshError(e, isSsoEnforcementRetry, retry)) {
7850
- return;
7851
- }
7852
7742
  contextHolder.setAccessToken(null);
7853
7743
  contextHolder.setUser(null);
7854
7744
  actions.setAuthState({
@@ -7858,10 +7748,7 @@ const _excluded = ["callback", "error"],
7858
7748
  }
7859
7749
  };
7860
7750
  /** @private */
7861
- const __refreshTokenEmbeddedSocialLogins = async ({
7862
- tenantId,
7863
- isSsoEnforcementRetry = false
7864
- } = {}) => {
7751
+ const __refreshTokenEmbeddedSocialLogins = async () => {
7865
7752
  try {
7866
7753
  const {
7867
7754
  routes,
@@ -7872,8 +7759,8 @@ const _excluded = ["callback", "error"],
7872
7759
  user,
7873
7760
  tenants = [],
7874
7761
  activeTenant
7875
- } = await (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.refreshTokenWithRetry)(() => api.auth.refreshTokenV3(tenantId));
7876
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isMfaRequired)(user, store.root.appName)) {
7762
+ } = await (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.refreshTokenWithRetry)(() => api.auth.refreshTokenV3());
7763
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
7877
7764
  const mfaRequiredState = await actions.getMfaRequiredState(user);
7878
7765
  actions.setAuthState(mfaRequiredState);
7879
7766
  onRedirectTo(routes.loginUrl, {
@@ -7884,7 +7771,7 @@ const _excluded = ["callback", "error"],
7884
7771
  const shouldShowPrompt = await actions.__shouldShowPromptPasskeys();
7885
7772
  if (shouldShowPrompt) {
7886
7773
  actions.setLoginState({
7887
- step: _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginStep.promptPasskeys,
7774
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.promptPasskeys,
7888
7775
  loading: false
7889
7776
  });
7890
7777
  actions.afterAuthenticationStateUpdate({
@@ -7911,7 +7798,7 @@ const _excluded = ["callback", "error"],
7911
7798
  }, {
7912
7799
  loginState: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, loginState, {
7913
7800
  quickLoginToRegister,
7914
- flow: shouldNavigateToRegisterQuickLogin ? _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginFlow.RegisterQuickLogin : _interfaces__WEBPACK_IMPORTED_MODULE_11__.LoginFlow.Login
7801
+ flow: shouldNavigateToRegisterQuickLogin ? _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.RegisterQuickLogin : _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.Login
7915
7802
  }),
7916
7803
  isAuthenticated: true
7917
7804
  });
@@ -7922,13 +7809,6 @@ const _excluded = ["callback", "error"],
7922
7809
  }
7923
7810
  }
7924
7811
  } catch (e) {
7925
- const retry = tenantId => __refreshTokenEmbeddedSocialLogins({
7926
- tenantId,
7927
- isSsoEnforcementRetry: true
7928
- });
7929
- if (await __handleSsoEnforcementRefreshError(e, isSsoEnforcementRetry, retry)) {
7930
- return;
7931
- }
7932
7812
  contextHolder.setAccessToken(null);
7933
7813
  contextHolder.setUser(null);
7934
7814
  actions.setAuthState({
@@ -7975,9 +7855,8 @@ const _excluded = ["callback", "error"],
7975
7855
  resetBreachedPassword,
7976
7856
  refreshTokenForSocialLogins,
7977
7857
  // protected
7978
- __refreshToken,
7979
- __redirectToSsoForTenant
7980
- }, (0,_hostedLoginAuthorize_actions__WEBPACK_IMPORTED_MODULE_27__["default"])(store, api, sharedActions), (0,_afterAuthNavigation_actions__WEBPACK_IMPORTED_MODULE_28__["default"])(store, api, sharedActions), (0,_handleVerifyMFAResponse_actions__WEBPACK_IMPORTED_MODULE_29__["default"])(store, api, sharedActions), (0,_mfaRequiredState_actions__WEBPACK_IMPORTED_MODULE_30__["default"])(store, api, sharedActions), (0,_mfaWithAuthenticator_actions__WEBPACK_IMPORTED_MODULE_31__["default"])(store, api, sharedActions), (0,_mfaWithEmailCode_actions__WEBPACK_IMPORTED_MODULE_32__["default"])(store, api, sharedActions), (0,_mfaWithSMS_actions__WEBPACK_IMPORTED_MODULE_33__["default"])(store, api, sharedActions), (0,_mfaWithWebAuthn_actions__WEBPACK_IMPORTED_MODULE_34__["default"])(store, api, sharedActions));
7858
+ __refreshToken
7859
+ }, (0,_hostedLoginAuthorize_actions__WEBPACK_IMPORTED_MODULE_26__["default"])(store, api, sharedActions), (0,_afterAuthNavigation_actions__WEBPACK_IMPORTED_MODULE_27__["default"])(store, api, sharedActions), (0,_handleVerifyMFAResponse_actions__WEBPACK_IMPORTED_MODULE_28__["default"])(store, api, sharedActions), (0,_mfaRequiredState_actions__WEBPACK_IMPORTED_MODULE_29__["default"])(store, api, sharedActions), (0,_mfaWithAuthenticator_actions__WEBPACK_IMPORTED_MODULE_30__["default"])(store, api, sharedActions), (0,_mfaWithEmailCode_actions__WEBPACK_IMPORTED_MODULE_31__["default"])(store, api, sharedActions), (0,_mfaWithSMS_actions__WEBPACK_IMPORTED_MODULE_32__["default"])(store, api, sharedActions), (0,_mfaWithWebAuthn_actions__WEBPACK_IMPORTED_MODULE_33__["default"])(store, api, sharedActions));
7981
7860
  });
7982
7861
 
7983
7862
  /***/ }),
@@ -8676,7 +8555,8 @@ const _excluded = ["callback", "deviceId"],
8676
8555
  __webpack_require__.r(__webpack_exports__);
8677
8556
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8678
8557
  /* harmony export */ authStrategyLoginStepMap: () => (/* binding */ authStrategyLoginStepMap),
8679
- /* harmony export */ defaultFronteggRoutes: () => (/* binding */ defaultFronteggRoutes)
8558
+ /* harmony export */ defaultFronteggRoutes: () => (/* binding */ defaultFronteggRoutes),
8559
+ /* harmony export */ defaultOnRedirectTo: () => (/* binding */ defaultOnRedirectTo)
8680
8560
  /* harmony export */ });
8681
8561
  /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/enums.js");
8682
8562
  /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./interfaces */ "../../dist/@frontegg/redux-store/auth/LoginState/interfaces.js");
@@ -8687,6 +8567,7 @@ __webpack_require__.r(__webpack_exports__);
8687
8567
  */
8688
8568
 
8689
8569
 
8570
+ const defaultOnRedirectTo = () => void 0;
8690
8571
  const authStrategyLoginStepMap = {
8691
8572
  [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.AuthStrategyEnum.Code]: _interfaces__WEBPACK_IMPORTED_MODULE_1__.LoginStep.loginWithOtc,
8692
8573
  [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.AuthStrategyEnum.EmailAndPassword]: _interfaces__WEBPACK_IMPORTED_MODULE_1__.LoginStep.loginWithPassword,
@@ -18385,12 +18266,7 @@ __webpack_require__.r(__webpack_exports__);
18385
18266
  /* harmony export */ });
18386
18267
  /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "../../dist/@frontegg/redux-store/auth/TenantsState/state.js");
18387
18268
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
18388
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
18389
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/feature-flags/index.js");
18390
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
18391
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/utils.js");
18392
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../constants */ "../../dist/@frontegg/redux-store/constants.js");
18393
-
18269
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/utils.js");
18394
18270
 
18395
18271
 
18396
18272
 
@@ -18444,15 +18320,6 @@ __webpack_require__.r(__webpack_exports__);
18444
18320
  }) : actions.setAuthState({
18445
18321
  isLoading: false
18446
18322
  });
18447
- const [isEnforceSsoOnTenantAccessEnabled] = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.FeatureFlags.getFeatureFlags([_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__.ENFORCE_SSO_ON_TENANT_ACCESS_FF], store.root.appName);
18448
- // a switch re-run after coming back from SSO doesn't send the user to SSO again
18449
- const isPendingSwitchRerun = window.sessionStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_PENDING_SWITCH_TENANT) === tenantId;
18450
- if (isEnforceSsoOnTenantAccessEnabled && (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isSsoEnforcementError)(e) && e.errorContext.ssoRequired && !isPendingSwitchRerun) {
18451
- // saved to finish the switch after the SSO login, which may land in another tenant
18452
- window.sessionStorage.setItem(_constants__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_PENDING_SWITCH_TENANT, tenantId);
18453
- await actions.__redirectToSsoForTenant(e.errorContext);
18454
- return;
18455
- }
18456
18323
  callback == null ? void 0 : callback(false, e);
18457
18324
  }
18458
18325
  };
@@ -18462,7 +18329,7 @@ __webpack_require__.r(__webpack_exports__);
18462
18329
  });
18463
18330
  try {
18464
18331
  var _payload$callback;
18465
- const userTenantsResponseFunc = (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_6__.getCurrentUserTenantsFunction)(store.root.appName);
18332
+ const userTenantsResponseFunc = (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.getCurrentUserTenantsFunction)(store.root.appName);
18466
18333
  const userTenantsResponse = await userTenantsResponseFunc();
18467
18334
  setTenantsState({
18468
18335
  tenants: userTenantsResponse.tenants,
@@ -19270,7 +19137,7 @@ const createAuthState = _overrideState => {
19270
19137
  overrideState = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(_ref, _excluded);
19271
19138
  return (0,_toolkit_proxy__WEBPACK_IMPORTED_MODULE_26__.createProxy)((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({
19272
19139
  routes: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, _LoginState_consts__WEBPACK_IMPORTED_MODULE_27__.defaultFronteggRoutes, routes),
19273
- onRedirectTo: () => void 0,
19140
+ onRedirectTo: _LoginState_consts__WEBPACK_IMPORTED_MODULE_27__.defaultOnRedirectTo,
19274
19141
  isAuthenticated: false,
19275
19142
  isLoading: true,
19276
19143
  isSSOAuth: false,
@@ -20194,17 +20061,16 @@ __webpack_require__.r(__webpack_exports__);
20194
20061
  /* harmony export */ AMR_MFA_VALUE: () => (/* reexport safe */ _auth_StepUpState_consts__WEBPACK_IMPORTED_MODULE_0__.AMR_MFA_VALUE),
20195
20062
  /* harmony export */ DEFAULT_RETRY_CONFIG: () => (/* binding */ DEFAULT_RETRY_CONFIG),
20196
20063
  /* harmony export */ FRONTEGG_AFTER_AUTH_REDIRECT_URL: () => (/* binding */ FRONTEGG_AFTER_AUTH_REDIRECT_URL),
20197
- /* harmony export */ FRONTEGG_PENDING_SWITCH_TENANT: () => (/* binding */ FRONTEGG_PENDING_SWITCH_TENANT),
20198
20064
  /* harmony export */ HOSTED_LOGIN_VERIFIER_KEY: () => (/* binding */ HOSTED_LOGIN_VERIFIER_KEY),
20199
20065
  /* harmony export */ SHOULD_STEP_UP_KEY: () => (/* reexport safe */ _auth_StepUpState_consts__WEBPACK_IMPORTED_MODULE_0__.SHOULD_STEP_UP_KEY),
20200
20066
  /* harmony export */ STEP_UP_MAX_AGE_PARAM_NAME: () => (/* reexport safe */ _auth_StepUpState_consts__WEBPACK_IMPORTED_MODULE_0__.STEP_UP_MAX_AGE_PARAM_NAME),
20201
20067
  /* harmony export */ authStrategyLoginStepMap: () => (/* reexport safe */ _auth_LoginState_consts__WEBPACK_IMPORTED_MODULE_1__.authStrategyLoginStepMap),
20202
- /* harmony export */ defaultFronteggRoutes: () => (/* reexport safe */ _auth_LoginState_consts__WEBPACK_IMPORTED_MODULE_1__.defaultFronteggRoutes)
20068
+ /* harmony export */ defaultFronteggRoutes: () => (/* reexport safe */ _auth_LoginState_consts__WEBPACK_IMPORTED_MODULE_1__.defaultFronteggRoutes),
20069
+ /* harmony export */ defaultOnRedirectTo: () => (/* reexport safe */ _auth_LoginState_consts__WEBPACK_IMPORTED_MODULE_1__.defaultOnRedirectTo)
20203
20070
  /* harmony export */ });
20204
20071
  /* harmony import */ var _auth_StepUpState_consts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./auth/StepUpState/consts */ "../../dist/@frontegg/redux-store/auth/StepUpState/consts.js");
20205
20072
  /* harmony import */ var _auth_LoginState_consts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./auth/LoginState/consts */ "../../dist/@frontegg/redux-store/auth/LoginState/consts.js");
20206
20073
  const FRONTEGG_AFTER_AUTH_REDIRECT_URL = 'FRONTEGG_AFTER_AUTH_REDIRECT_URL';
20207
- const FRONTEGG_PENDING_SWITCH_TENANT = 'FRONTEGG_PENDING_SWITCH_TENANT';
20208
20074
  const HOSTED_LOGIN_VERIFIER_KEY = 'HOSTED_LOGIN_VERIFIER_KEY';
20209
20075
  const DEFAULT_RETRY_CONFIG = {
20210
20076
  retryCount: 3
@@ -20526,16 +20392,12 @@ __webpack_require__.r(__webpack_exports__);
20526
20392
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
20527
20393
  /* harmony export */ errorHandler: () => (/* binding */ errorHandler),
20528
20394
  /* harmony export */ isError: () => (/* binding */ isError),
20529
- /* harmony export */ isFronteggApiError: () => (/* binding */ isFronteggApiError),
20530
- /* harmony export */ isSsoEnforcementError: () => (/* binding */ isSsoEnforcementError)
20395
+ /* harmony export */ isFronteggApiError: () => (/* binding */ isFronteggApiError)
20531
20396
  /* harmony export */ });
20532
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/constants.js");
20533
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/error.js");
20397
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/error.js");
20398
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/constants.js");
20534
20399
 
20535
20400
  const isFronteggApiError = error => Boolean(error == null ? void 0 : error.statusCode);
20536
-
20537
- // ER-01079 (disabled user / expired tenant) is not this: it still logs out
20538
- const isSsoEnforcementError = error => isFronteggApiError(error) && error.errorCode === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.SSO_REQUIRED_FOR_TENANT_ERROR_CODE;
20539
20401
  const isError = error => {
20540
20402
  if (error instanceof Error) {
20541
20403
  return true;
@@ -20557,7 +20419,7 @@ const errorHandler = (error, fallback) => {
20557
20419
  } else if (typeof error === 'string') {
20558
20420
  console.error(error);
20559
20421
  }
20560
- return fallback != null ? fallback : new _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__.FronteggApiError(_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.GENERIC_ERROR_MESSAGE, 500, null, _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.GENERIC_ERROR_CODE);
20422
+ return fallback != null ? fallback : new _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.FronteggApiError(_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__.GENERIC_ERROR_MESSAGE, 500, null, _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__.GENERIC_ERROR_CODE);
20561
20423
  };
20562
20424
 
20563
20425
  /***/ }),
@@ -20588,7 +20450,6 @@ __webpack_require__.r(__webpack_exports__);
20588
20450
  /* harmony export */ isError: () => (/* reexport safe */ _handlers__WEBPACK_IMPORTED_MODULE_1__.isError),
20589
20451
  /* harmony export */ isFronteggApiError: () => (/* reexport safe */ _handlers__WEBPACK_IMPORTED_MODULE_1__.isFronteggApiError),
20590
20452
  /* harmony export */ isProxy: () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.isProxy),
20591
- /* harmony export */ isSsoEnforcementError: () => (/* reexport safe */ _handlers__WEBPACK_IMPORTED_MODULE_1__.isSsoEnforcementError),
20592
20453
  /* harmony export */ omitProps: () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.omitProps),
20593
20454
  /* harmony export */ publicKeyCredentialToJSON: () => (/* reexport safe */ _converters__WEBPACK_IMPORTED_MODULE_2__.publicKeyCredentialToJSON),
20594
20455
  /* harmony export */ readFileAsText: () => (/* reexport safe */ _converters__WEBPACK_IMPORTED_MODULE_2__.readFileAsText),
@@ -21194,7 +21055,6 @@ __webpack_require__.r(__webpack_exports__);
21194
21055
  /* harmony export */ FRONTEGG_OAUTH_STEP_UP_ACR_VALUES: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_OAUTH_STEP_UP_ACR_VALUES),
21195
21056
  /* harmony export */ FRONTEGG_OAUTH_STEP_UP_MAX_AGE: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_OAUTH_STEP_UP_MAX_AGE),
21196
21057
  /* harmony export */ FRONTEGG_OAUTH_TENANT_ID: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_OAUTH_TENANT_ID),
21197
- /* harmony export */ FRONTEGG_PENDING_SWITCH_TENANT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.FRONTEGG_PENDING_SWITCH_TENANT),
21198
21058
  /* harmony export */ ForgotPasswordStep: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.ForgotPasswordStep),
21199
21059
  /* harmony export */ FronteggNativeModule: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.FronteggNativeModule),
21200
21060
  /* harmony export */ GTMEventAction: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.GTMEventAction),
@@ -21250,6 +21110,7 @@ __webpack_require__.r(__webpack_exports__);
21250
21110
  /* harmony export */ deepClone: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.deepClone),
21251
21111
  /* harmony export */ deepResetState: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.deepResetState),
21252
21112
  /* harmony export */ defaultFronteggRoutes: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.defaultFronteggRoutes),
21113
+ /* harmony export */ defaultOnRedirectTo: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.defaultOnRedirectTo),
21253
21114
  /* harmony export */ delay: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.delay),
21254
21115
  /* harmony export */ errorHandler: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.errorHandler),
21255
21116
  /* harmony export */ errorTraceId: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.errorTraceId),
@@ -21288,7 +21149,6 @@ __webpack_require__.r(__webpack_exports__);
21288
21149
  /* harmony export */ isPreferredMfaMethod: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.isPreferredMfaMethod),
21289
21150
  /* harmony export */ isProxy: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.isProxy),
21290
21151
  /* harmony export */ isResetPasswordRequired: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isResetPasswordRequired),
21291
- /* harmony export */ isSsoEnforcementError: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.isSsoEnforcementError),
21292
21152
  /* harmony export */ isSteppedUp: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isSteppedUp),
21293
21153
  /* harmony export */ isUsernamePayload: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isUsernamePayload),
21294
21154
  /* harmony export */ mapMetaDataObjectToActions: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.mapMetaDataObjectToActions),
@@ -21323,7 +21183,7 @@ __webpack_require__.r(__webpack_exports__);
21323
21183
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
21324
21184
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
21325
21185
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
21326
- /** @license Frontegg v7.129.0-alpha.0
21186
+ /** @license Frontegg v7.129.0
21327
21187
  *
21328
21188
  * This source code is licensed under the MIT license found in the
21329
21189
  * LICENSE file in the root directory of this source tree.
@@ -30083,10 +29943,10 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
30083
29943
  });
30084
29944
  return this.generateLoginResponseV2(data);
30085
29945
  };
30086
- this.refreshTokenV3 = async tenantId => {
29946
+ this.refreshTokenV3 = async () => {
30087
29947
  const tabTenantId = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getTabTenantFromSessionStorage)(this.appName);
30088
29948
  const data = await this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.auth.v1}/user/token/refresh`, {
30089
- tenantId: tenantId != null ? tenantId : tabTenantId
29949
+ tenantId: tabTenantId
30090
29950
  });
30091
29951
  return this.generateLoginResponseV3(data);
30092
29952
  };
@@ -30762,7 +30622,6 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
30762
30622
  "use strict";
30763
30623
  __webpack_require__.r(__webpack_exports__);
30764
30624
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
30765
- /* harmony export */ ENFORCE_SSO_ON_TENANT_ACCESS_FF: () => (/* binding */ ENFORCE_SSO_ON_TENANT_ACCESS_FF),
30766
30625
  /* harmony export */ LOAD_AUTHORIZATION_FF: () => (/* binding */ LOAD_AUTHORIZATION_FF),
30767
30626
  /* harmony export */ MFAStrategyEnum: () => (/* binding */ MFAStrategyEnum),
30768
30627
  /* harmony export */ PreLoginAddressType: () => (/* binding */ PreLoginAddressType),
@@ -30804,13 +30663,6 @@ let MFAStrategyEnum;
30804
30663
  MFAStrategyEnum["EmailCode"] = "EmailCode";
30805
30664
  })(MFAStrategyEnum || (MFAStrategyEnum = {}));
30806
30665
  const LOAD_AUTHORIZATION_FF = 'admin_portal_should_load_authorization';
30807
- const ENFORCE_SSO_ON_TENANT_ACCESS_FF = 'enforce-sso-on-tenant-access';
30808
-
30809
- /**
30810
- * errorContext of a refused tenant switch or token refresh when the tenant requires SSO.
30811
- * ssoRequired: true - the user must log in through the tenant's SSO at `address`.
30812
- * ssoRequired: false - the user may stay in the current tenant, still logged in.
30813
- */
30814
30666
 
30815
30667
  /***/ }),
30816
30668
 
@@ -31205,7 +31057,6 @@ __webpack_require__.r(__webpack_exports__);
31205
31057
  /* harmony export */ INVITATION_LINK_CREATION_TENANT_LOCKED_ERROR_CODE: () => (/* binding */ INVITATION_LINK_CREATION_TENANT_LOCKED_ERROR_CODE),
31206
31058
  /* harmony export */ INVITATION_TENANT_LOCKED_ERROR_CODE: () => (/* binding */ INVITATION_TENANT_LOCKED_ERROR_CODE),
31207
31059
  /* harmony export */ SSO_EMAIL_MISMATCH_ERROR_CODE: () => (/* binding */ SSO_EMAIL_MISMATCH_ERROR_CODE),
31208
- /* harmony export */ SSO_REQUIRED_FOR_TENANT_ERROR_CODE: () => (/* binding */ SSO_REQUIRED_FOR_TENANT_ERROR_CODE),
31209
31060
  /* harmony export */ urls: () => (/* binding */ urls)
31210
31061
  /* harmony export */ });
31211
31062
  const urls = {
@@ -31537,10 +31388,6 @@ const INVALID_SSO_EMAIL_DOMAIN_ERROR_CODE = 'ER-01248';
31537
31388
  // Returned on the SAML callback when the email returned by the IdP differs from the one that started the login.
31538
31389
  const SSO_EMAIL_MISMATCH_ERROR_CODE = 'ER-01249';
31539
31390
 
31540
- // Returned by identity-service when a login, tenant switch or token refresh is refused because the target tenant
31541
- // requires SSO (HTTP 400 Bad Request, IdentityErrorCodes.SsoRequiredForTenantException with an errorContext).
31542
- const SSO_REQUIRED_FOR_TENANT_ERROR_CODE = 'ER-01253';
31543
-
31544
31391
  /***/ }),
31545
31392
 
31546
31393
  /***/ "../../dist/@frontegg/rest-api/directory/index.js":
@@ -31943,7 +31790,6 @@ __webpack_require__.r(__webpack_exports__);
31943
31790
  /* harmony export */ ContextHolder: () => (/* reexport safe */ _ContextHolder__WEBPACK_IMPORTED_MODULE_46__.ContextHolder),
31944
31791
  /* harmony export */ DirectoryApi: () => (/* reexport safe */ _directory_index__WEBPACK_IMPORTED_MODULE_11__.DirectoryApi),
31945
31792
  /* harmony export */ EIdentifierType: () => (/* reexport safe */ _auth_enums__WEBPACK_IMPORTED_MODULE_2__.EIdentifierType),
31946
- /* harmony export */ ENFORCE_SSO_ON_TENANT_ACCESS_FF: () => (/* reexport safe */ _auth_interfaces__WEBPACK_IMPORTED_MODULE_1__.ENFORCE_SSO_ON_TENANT_ACCESS_FF),
31947
31793
  /* harmony export */ FRONTEGG_SEPARATE_TABS_BY_TENANT: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_SEPARATE_TABS_BY_TENANT),
31948
31794
  /* harmony export */ FeatureFlags: () => (/* reexport safe */ _feature_flags_index__WEBPACK_IMPORTED_MODULE_10__.FeatureFlags),
31949
31795
  /* harmony export */ FeatureFlagsApi: () => (/* reexport safe */ _feature_flags_index__WEBPACK_IMPORTED_MODULE_10__.FeatureFlagsApi),
@@ -31978,7 +31824,6 @@ __webpack_require__.r(__webpack_exports__);
31978
31824
  /* harmony export */ RequestSource: () => (/* reexport safe */ _interfaces__WEBPACK_IMPORTED_MODULE_0__.RequestSource),
31979
31825
  /* harmony export */ RestrictionType: () => (/* reexport safe */ _auth_interfaces__WEBPACK_IMPORTED_MODULE_1__.RestrictionType),
31980
31826
  /* harmony export */ SSO_EMAIL_MISMATCH_ERROR_CODE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_18__.SSO_EMAIL_MISMATCH_ERROR_CODE),
31981
- /* harmony export */ SSO_REQUIRED_FOR_TENANT_ERROR_CODE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_18__.SSO_REQUIRED_FOR_TENANT_ERROR_CODE),
31982
31827
  /* harmony export */ ScimConnectionSource: () => (/* reexport safe */ _directory_interfaces__WEBPACK_IMPORTED_MODULE_12__.ScimConnectionSource),
31983
31828
  /* harmony export */ SecondaryAuthStrategy: () => (/* reexport safe */ _auth_interfaces__WEBPACK_IMPORTED_MODULE_1__.SecondaryAuthStrategy),
31984
31829
  /* harmony export */ SecurityCategory: () => (/* reexport safe */ _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__.SecurityCategory),
@@ -32057,7 +31902,7 @@ __webpack_require__.r(__webpack_exports__);
32057
31902
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
32058
31903
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
32059
31904
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
32060
- /** @license Frontegg v7.129.0-alpha.0
31905
+ /** @license Frontegg v7.129.0
32061
31906
  *
32062
31907
  * This source code is licensed under the MIT license found in the
32063
31908
  * LICENSE file in the root directory of this source tree.
@@ -33636,14 +33481,10 @@ __webpack_require__.r(__webpack_exports__);
33636
33481
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
33637
33482
  /* harmony export */ });
33638
33483
  /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
33639
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../constants */ "../../dist/@frontegg/rest-api/constants.js");
33640
- /* harmony import */ var _auth_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../auth/utils */ "../../dist/@frontegg/rest-api/auth/utils.js");
33641
- /* harmony import */ var _auth_interfaces__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../auth/interfaces */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
33642
- /* harmony import */ var _ContextHolder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../ContextHolder */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
33484
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constants */ "../../dist/@frontegg/rest-api/constants.js");
33485
+ /* harmony import */ var _auth_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../auth/utils */ "../../dist/@frontegg/rest-api/auth/utils.js");
33486
+ /* harmony import */ var _ContextHolder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ContextHolder */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
33643
33487
  /* harmony import */ var _BaseApiClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../BaseApiClient */ "../../dist/@frontegg/rest-api/BaseApiClient.js");
33644
- /* harmony import */ var _feature_flags__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../feature-flags */ "../../dist/@frontegg/rest-api/feature-flags/index.js");
33645
-
33646
-
33647
33488
 
33648
33489
 
33649
33490
 
@@ -33653,60 +33494,46 @@ class TenantsApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_1__.BaseApiClie
33653
33494
  constructor(appName) {
33654
33495
  super(appName);
33655
33496
  this.switchTenant = async body => {
33656
- const [isEnforceSsoOnTenantAccessEnabled] = _feature_flags__WEBPACK_IMPORTED_MODULE_2__.FeatureFlags.getFeatureFlags([_auth_interfaces__WEBPACK_IMPORTED_MODULE_3__.ENFORCE_SSO_ON_TENANT_ACCESS_FF], this.appName);
33657
- if (isEnforceSsoOnTenantAccessEnabled && _ContextHolder__WEBPACK_IMPORTED_MODULE_4__.ContextHolder.for(this.appName).isSessionPerTenantEnabled()) {
33658
- return this.switchTabTenantKeepingItOnRefusal(body);
33659
- }
33660
- if (_ContextHolder__WEBPACK_IMPORTED_MODULE_4__.ContextHolder.for(this.appName).isSessionPerTenantEnabled()) {
33661
- (0,_auth_utils__WEBPACK_IMPORTED_MODULE_5__.setTabTenantInSessionStorage)(body.tenantId);
33662
- }
33663
- return this.put(`${_constants__WEBPACK_IMPORTED_MODULE_6__.urls.identity.users.v1}/tenant`, body);
33664
- };
33665
- this.switchTabTenantKeepingItOnRefusal = async body => {
33666
- const previousTabTenantId = (0,_auth_utils__WEBPACK_IMPORTED_MODULE_5__.getTabTenantFromSessionStorage)(this.appName);
33667
- (0,_auth_utils__WEBPACK_IMPORTED_MODULE_5__.setTabTenantInSessionStorage)(body.tenantId);
33668
- try {
33669
- return await this.put(`${_constants__WEBPACK_IMPORTED_MODULE_6__.urls.identity.users.v1}/tenant`, body);
33670
- } catch (e) {
33671
- previousTabTenantId ? (0,_auth_utils__WEBPACK_IMPORTED_MODULE_5__.setTabTenantInSessionStorage)(previousTabTenantId) : (0,_auth_utils__WEBPACK_IMPORTED_MODULE_5__.removeTabTenantFromSessionStorage)();
33672
- throw e;
33497
+ if (_ContextHolder__WEBPACK_IMPORTED_MODULE_2__.ContextHolder.for(this.appName).isSessionPerTenantEnabled()) {
33498
+ (0,_auth_utils__WEBPACK_IMPORTED_MODULE_3__.setTabTenantInSessionStorage)(body.tenantId);
33673
33499
  }
33500
+ return this.put(`${_constants__WEBPACK_IMPORTED_MODULE_4__.urls.identity.users.v1}/tenant`, body);
33674
33501
  };
33675
33502
  this.getTenants = async () => {
33676
- return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_6__.urls.identity.users.v2}/me/tenants`);
33503
+ return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_4__.urls.identity.users.v2}/me/tenants`);
33677
33504
  };
33678
33505
  this.getSubTenants = async options => {
33679
- return this.get(_constants__WEBPACK_IMPORTED_MODULE_6__.urls.tenants.hierarchy.v1, undefined, {
33506
+ return this.get(_constants__WEBPACK_IMPORTED_MODULE_4__.urls.tenants.hierarchy.v1, undefined, {
33680
33507
  headers: this.extractHeadersFromOptions(options)
33681
33508
  });
33682
33509
  };
33683
33510
  this.getSubTenantsAsTree = async options => {
33684
- return this.get(_constants__WEBPACK_IMPORTED_MODULE_6__.urls.tenants.hierarchy.tree.v1, undefined, {
33511
+ return this.get(_constants__WEBPACK_IMPORTED_MODULE_4__.urls.tenants.hierarchy.tree.v1, undefined, {
33685
33512
  headers: this.extractHeadersFromOptions(options)
33686
33513
  });
33687
33514
  };
33688
33515
  this.getParentTenants = async options => {
33689
- return this.get(_constants__WEBPACK_IMPORTED_MODULE_6__.urls.tenants.hierarchy.parents.v1, undefined, {
33516
+ return this.get(_constants__WEBPACK_IMPORTED_MODULE_4__.urls.tenants.hierarchy.parents.v1, undefined, {
33690
33517
  headers: this.extractHeadersFromOptions(options)
33691
33518
  });
33692
33519
  };
33693
33520
  this.getParentTenantsById = async (tenantId, options) => {
33694
- return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_6__.urls.tenants.hierarchy.parents.v1}/${tenantId}`, undefined, {
33521
+ return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_4__.urls.tenants.hierarchy.parents.v1}/${tenantId}`, undefined, {
33695
33522
  headers: this.extractHeadersFromOptions(options)
33696
33523
  });
33697
33524
  };
33698
33525
  this.getTenantsUsersCount = async (body, options) => {
33699
- return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_6__.urls.identity.tenants.users.v1}/count`, body, {
33526
+ return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_4__.urls.identity.tenants.users.v1}/count`, body, {
33700
33527
  headers: this.extractHeadersFromOptions(options)
33701
33528
  });
33702
33529
  };
33703
33530
  this.searchSubTenants = async (params, options) => {
33704
- return this.get(_constants__WEBPACK_IMPORTED_MODULE_6__.urls.tenants.hierarchy.v2, params, {
33531
+ return this.get(_constants__WEBPACK_IMPORTED_MODULE_4__.urls.tenants.hierarchy.v2, params, {
33705
33532
  headers: this.extractHeadersFromOptions(options)
33706
33533
  });
33707
33534
  };
33708
33535
  this.getHierarchyMetadata = async (params, options) => {
33709
- return this.get(_constants__WEBPACK_IMPORTED_MODULE_6__.urls.tenants.hierarchy.metadata.v2, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, params, {
33536
+ return this.get(_constants__WEBPACK_IMPORTED_MODULE_4__.urls.tenants.hierarchy.metadata.v2, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, params, {
33710
33537
  _tenantIds: params._tenantIds.join(',')
33711
33538
  }), {
33712
33539
  headers: this.extractHeadersFromOptions(options)
@@ -34917,7 +34744,7 @@ __webpack_require__.r(__webpack_exports__);
34917
34744
  /* harmony export */ });
34918
34745
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
34919
34746
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
34920
- /** @license Frontegg v7.129.0-alpha.0
34747
+ /** @license Frontegg v7.129.0
34921
34748
  *
34922
34749
  * This source code is licensed under the MIT license found in the
34923
34750
  * LICENSE file in the root directory of this source tree.