@frontegg/js 7.134.0 → 7.135.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.134.0
1
+ /** @license Frontegg v7.135.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.134.0
1
+ /** @license Frontegg v7.135.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/node/version.js CHANGED
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
- cdnVersion: '7.134.0'
8
+ cdnVersion: '7.135.0'
9
9
  };
10
10
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@frontegg/js",
3
- "version": "7.134.0",
3
+ "version": "7.135.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
- "@frontegg/types": "7.134.0"
9
+ "@frontegg/types": "7.135.0"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1965,7 +1965,7 @@ __webpack_require__.r(__webpack_exports__);
1965
1965
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1966
1966
  /* harmony export */ });
1967
1967
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1968
- cdnVersion: '7.134.0'
1968
+ cdnVersion: '7.135.0'
1969
1969
  });
1970
1970
 
1971
1971
  /***/ }),
@@ -2808,19 +2808,21 @@ const initialState = {
2808
2808
  "use strict";
2809
2809
  __webpack_require__.r(__webpack_exports__);
2810
2810
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2811
+ /* harmony export */ KEEP_AUTH_FLOWS_REDIRECT_ON_ACTIVATION_FF: () => (/* binding */ KEEP_AUTH_FLOWS_REDIRECT_ON_ACTIVATION_FF),
2811
2812
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
2812
2813
  /* harmony export */ });
2813
2814
  /* 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");
2814
2815
  /* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
2815
2816
  /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./state */ "../../dist/@frontegg/redux-store/auth/ActivateAccountState/state.js");
2816
- /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
2817
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
2817
2818
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
2818
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
2819
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
2819
2820
  /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interfaces */ "../../dist/@frontegg/redux-store/auth/ActivateAccountState/interfaces.js");
2820
- /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../interfaces */ "../../dist/@frontegg/redux-store/auth/interfaces.js");
2821
- /* harmony import */ var _helpers_gtm__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../helpers/gtm */ "../../dist/@frontegg/redux-store/helpers/gtm.js");
2822
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/helpers.js");
2823
- /* harmony import */ var _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../TeamState/interfaces */ "../../dist/@frontegg/redux-store/auth/TeamState/interfaces.js");
2821
+ /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../interfaces */ "../../dist/@frontegg/redux-store/auth/interfaces.js");
2822
+ /* harmony import */ var _helpers_gtm__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../helpers/gtm */ "../../dist/@frontegg/redux-store/helpers/gtm.js");
2823
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/helpers.js");
2824
+ /* harmony import */ var _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../TeamState/interfaces */ "../../dist/@frontegg/redux-store/auth/TeamState/interfaces.js");
2825
+ /* harmony import */ var _LoginState_oauthStorage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../LoginState/oauthStorage */ "../../dist/@frontegg/redux-store/auth/LoginState/oauthStorage.js");
2824
2826
 
2825
2827
 
2826
2828
  const _excluded = ["user"],
@@ -2838,6 +2840,8 @@ const _excluded = ["user"],
2838
2840
 
2839
2841
 
2840
2842
 
2843
+
2844
+ const KEEP_AUTH_FLOWS_REDIRECT_ON_ACTIVATION_FF = 'login-box-keep-auth-flows-redirect-on-activation';
2841
2845
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((store, api, sharedActions) => {
2842
2846
  const actions = sharedActions;
2843
2847
  const setActivateState = state => {
@@ -2861,7 +2865,11 @@ const _excluded = ["user"],
2861
2865
  try {
2862
2866
  const isAuthenticated = store.auth.isAuthenticated;
2863
2867
  if (isAuthenticated) {
2864
- await actions.silentLogout();
2868
+ const [keepAuthFlowsRedirect] = await actions.getFeatureFlags([KEEP_AUTH_FLOWS_REDIRECT_ON_ACTIVATION_FF]);
2869
+ const hostedOAuthKeysToKeep = keepAuthFlowsRedirect ? [_LoginState_oauthStorage__WEBPACK_IMPORTED_MODULE_5__.FRONTEGG_AUTHENTICATION_FLOWS_REDIRECT_AFTER_LOGIN] : [];
2870
+ await actions.silentLogout({
2871
+ hostedOAuthKeysToKeep
2872
+ });
2865
2873
  }
2866
2874
  const strategy = await api.auth.getActivateAccountStrategy({
2867
2875
  userId,
@@ -2881,7 +2889,7 @@ const _excluded = ["user"],
2881
2889
  } catch (e) {
2882
2890
  setActivateState({
2883
2891
  loading: false,
2884
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.errorHandler)(e)
2892
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
2885
2893
  });
2886
2894
  }
2887
2895
  };
@@ -2899,7 +2907,7 @@ const _excluded = ["user"],
2899
2907
  window.location.href = user.redirectLocation;
2900
2908
  return;
2901
2909
  }
2902
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
2910
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_7__.isMfaRequired)(user, store.root.appName)) {
2903
2911
  setActivateState({
2904
2912
  step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.ActivateAccountStep.success
2905
2913
  });
@@ -2916,14 +2924,14 @@ const _excluded = ["user"],
2916
2924
  });
2917
2925
  const userVerifiedPayload = {
2918
2926
  email: user.email,
2919
- origin: _interfaces__WEBPACK_IMPORTED_MODULE_7__.UserVerifiedOriginTypes.ACTIVATION_LINK,
2927
+ origin: _interfaces__WEBPACK_IMPORTED_MODULE_8__.UserVerifiedOriginTypes.ACTIVATION_LINK,
2920
2928
  id: user.id,
2921
2929
  tenantId: user.tenantId,
2922
2930
  name: user.name,
2923
2931
  createdAt: (_user$createdAt = user == null ? void 0 : user.createdAt) != null ? _user$createdAt : new Date()
2924
2932
  };
2925
2933
  events == null ? void 0 : (_events$userVerified = events.userVerified) == null ? void 0 : _events$userVerified.call(events, userVerifiedPayload);
2926
- (0,_helpers_gtm__WEBPACK_IMPORTED_MODULE_8__.reportGTMEvent)(_helpers_gtm__WEBPACK_IMPORTED_MODULE_8__.GTMEventAction.USER_VERIFIED, userVerifiedPayload);
2934
+ (0,_helpers_gtm__WEBPACK_IMPORTED_MODULE_9__.reportGTMEvent)(_helpers_gtm__WEBPACK_IMPORTED_MODULE_9__.GTMEventAction.USER_VERIFIED, userVerifiedPayload);
2927
2935
  const loginCompletedPayload = {
2928
2936
  tenantId: user.tenantId,
2929
2937
  userId: user.id,
@@ -2932,7 +2940,7 @@ const _excluded = ["user"],
2932
2940
  email: user.email,
2933
2941
  name: user.name
2934
2942
  };
2935
- (0,_helpers_gtm__WEBPACK_IMPORTED_MODULE_8__.reportGTMEvent)(_helpers_gtm__WEBPACK_IMPORTED_MODULE_8__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
2943
+ (0,_helpers_gtm__WEBPACK_IMPORTED_MODULE_9__.reportGTMEvent)(_helpers_gtm__WEBPACK_IMPORTED_MODULE_9__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
2936
2944
  actions.afterAuthenticationStateUpdate((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({
2937
2945
  user
2938
2946
  }, rest), {
@@ -2954,7 +2962,7 @@ const _excluded = ["user"],
2954
2962
  submitting: true
2955
2963
  });
2956
2964
  try {
2957
- const onRedirectTo = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_9__.ContextHolder.for(store.root.appName).onRedirectTo;
2965
+ const onRedirectTo = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_10__.ContextHolder.for(store.root.appName).onRedirectTo;
2958
2966
  const routes = store.auth.routes;
2959
2967
  const _await$api$auth$activ = await api.auth.activateAccountV2(payload),
2960
2968
  {
@@ -2979,7 +2987,7 @@ const _excluded = ["user"],
2979
2987
  }
2980
2988
  setActivateState({
2981
2989
  loading: false,
2982
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.errorHandler)(e)
2990
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
2983
2991
  });
2984
2992
  }
2985
2993
  };
@@ -2994,7 +3002,7 @@ const _excluded = ["user"],
2994
3002
  submitting: true
2995
3003
  });
2996
3004
  try {
2997
- const onRedirectTo = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_9__.ContextHolder.for(store.root.appName).onRedirectTo;
3005
+ const onRedirectTo = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_10__.ContextHolder.for(store.root.appName).onRedirectTo;
2998
3006
  const routes = store.auth.routes;
2999
3007
  const _await$api$auth$activ2 = await api.auth.activateAccountWithOTC(payload),
3000
3008
  {
@@ -3020,7 +3028,7 @@ const _excluded = ["user"],
3020
3028
  setActivateState({
3021
3029
  submitting: false,
3022
3030
  loading: false,
3023
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.errorHandler)(e),
3031
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e),
3024
3032
  step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.ActivateAccountStep.activating
3025
3033
  });
3026
3034
  }
@@ -3044,7 +3052,7 @@ const _excluded = ["user"],
3044
3052
  } catch (e) {
3045
3053
  setActivateStrategyState({
3046
3054
  loading: false,
3047
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.errorHandler)(e)
3055
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
3048
3056
  });
3049
3057
  }
3050
3058
  };
@@ -3054,7 +3062,7 @@ const _excluded = ["user"],
3054
3062
  } = payload,
3055
3063
  body = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(payload, _excluded7);
3056
3064
  actions.setTeamLoader({
3057
- key: _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_10__.TeamStateKeys.RESEND_ACTIVATE_LINK,
3065
+ key: _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_11__.TeamStateKeys.RESEND_ACTIVATE_LINK,
3058
3066
  value: body.email
3059
3067
  });
3060
3068
  setActivateState({
@@ -3071,12 +3079,12 @@ const _excluded = ["user"],
3071
3079
  } catch (e) {
3072
3080
  setActivateState({
3073
3081
  loading: false,
3074
- error: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.errorHandler)(e)
3082
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.errorHandler)(e)
3075
3083
  });
3076
3084
  callback == null ? void 0 : callback(null, e);
3077
3085
  } finally {
3078
3086
  actions.setTeamLoader({
3079
- key: _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_10__.TeamStateKeys.RESEND_ACTIVATE_LINK,
3087
+ key: _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_11__.TeamStateKeys.RESEND_ACTIVATE_LINK,
3080
3088
  value: false
3081
3089
  });
3082
3090
  }
@@ -7201,7 +7209,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
7201
7209
  }
7202
7210
  };
7203
7211
  const clearLogoutLocalState = async ({
7204
- keepHostedOAuthState = false
7212
+ keepHostedOAuthState = false,
7213
+ hostedOAuthKeysToKeep = []
7205
7214
  } = {}) => {
7206
7215
  if (contextHolder.isSessionPerTenantEnabled()) {
7207
7216
  (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__.removeTabTenantFromSessionStorage)();
@@ -7210,7 +7219,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
7210
7219
  }
7211
7220
  // Step-up re-login goes through silentLogout but still needs the hosted OAuth state to finish the client flow.
7212
7221
  if (!keepHostedOAuthState) {
7213
- (0,_oauthStorage__WEBPACK_IMPORTED_MODULE_23__.clearHostedOAuthState)();
7222
+ (0,_oauthStorage__WEBPACK_IMPORTED_MODULE_23__.clearHostedOAuthState)(hostedOAuthKeysToKeep);
7214
7223
  }
7215
7224
  };
7216
7225
  const logout = async payload => {
@@ -7241,7 +7250,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
7241
7250
  }
7242
7251
  const isStepUpInProgress = !!((_window2 = window) != null && _window2.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY));
7243
7252
  await clearLogoutLocalState({
7244
- keepHostedOAuthState: isStepUpInProgress
7253
+ keepHostedOAuthState: isStepUpInProgress,
7254
+ hostedOAuthKeysToKeep: payload == null ? void 0 : payload.hostedOAuthKeysToKeep
7245
7255
  });
7246
7256
  setTimeout(() => {
7247
7257
  var _payload$callback3;
@@ -9263,11 +9273,12 @@ function getStoredHostedOAuthValue(key) {
9263
9273
  }
9264
9274
  return null;
9265
9275
  }
9266
- function clearHostedOAuthState() {
9276
+ function clearHostedOAuthState(keysToKeep = []) {
9267
9277
  if (typeof window === 'undefined') {
9268
9278
  return;
9269
9279
  }
9270
- HOSTED_OAUTH_STORAGE_KEYS.forEach(key => {
9280
+ const keysToClear = HOSTED_OAUTH_STORAGE_KEYS.filter(key => !keysToKeep.includes(key));
9281
+ keysToClear.forEach(key => {
9271
9282
  window.localStorage.removeItem(key);
9272
9283
  window.sessionStorage.removeItem(key);
9273
9284
  removeHostedOAuthCookie(key);
@@ -21666,7 +21677,7 @@ __webpack_require__.r(__webpack_exports__);
21666
21677
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
21667
21678
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
21668
21679
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
21669
- /** @license Frontegg v7.134.0
21680
+ /** @license Frontegg v7.135.0
21670
21681
  *
21671
21682
  * This source code is licensed under the MIT license found in the
21672
21683
  * LICENSE file in the root directory of this source tree.
@@ -32509,7 +32520,7 @@ __webpack_require__.r(__webpack_exports__);
32509
32520
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
32510
32521
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
32511
32522
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
32512
- /** @license Frontegg v7.134.0
32523
+ /** @license Frontegg v7.135.0
32513
32524
  *
32514
32525
  * This source code is licensed under the MIT license found in the
32515
32526
  * LICENSE file in the root directory of this source tree.
@@ -35366,7 +35377,7 @@ __webpack_require__.r(__webpack_exports__);
35366
35377
  /* harmony export */ });
35367
35378
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
35368
35379
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
35369
- /** @license Frontegg v7.134.0
35380
+ /** @license Frontegg v7.135.0
35370
35381
  *
35371
35382
  * This source code is licensed under the MIT license found in the
35372
35383
  * LICENSE file in the root directory of this source tree.