@frontegg/js 6.186.0-alpha.2 → 6.186.0-alpha.4

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 v6.186.0-alpha.2
1
+ /** @license Frontegg v6.186.0-alpha.4
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 v6.186.0-alpha.2
1
+ /** @license Frontegg v6.186.0-alpha.4
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: '6.186.0-alpha.2'
8
+ cdnVersion: '6.186.0-alpha.4'
9
9
  };
10
10
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@frontegg/js",
3
- "version": "6.186.0-alpha.2",
3
+ "version": "6.186.0-alpha.4",
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": "6.186.0-alpha.2"
9
+ "@frontegg/types": "6.186.0-alpha.4"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1452,7 +1452,7 @@ __webpack_require__.r(__webpack_exports__);
1452
1452
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1453
1453
  /* harmony export */ });
1454
1454
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1455
- cdnVersion: '6.186.0-alpha.2'
1455
+ cdnVersion: '6.186.0-alpha.4'
1456
1456
  });
1457
1457
 
1458
1458
  /***/ }),
@@ -5900,7 +5900,9 @@ function* impersonate(_ref) {
5900
5900
  console.log('after setImpersonateState');
5901
5901
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_1__.delay)(1000);
5902
5902
  console.log('after delay');
5903
- yield (0,_LoginState_saga__WEBPACK_IMPORTED_MODULE_5__.afterAuthNavigation)();
5903
+ yield (0,_LoginState_saga__WEBPACK_IMPORTED_MODULE_5__.afterAuthNavigation)({
5904
+ forceRefresh: true
5905
+ });
5904
5906
  console.log('after afterAuthNavigation');
5905
5907
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_1__.put)(_reducer__WEBPACK_IMPORTED_MODULE_2__.actions.resetImpersonateState());
5906
5908
  console.log('after resetImpersonateState');
@@ -7992,11 +7994,12 @@ __webpack_require__.r(__webpack_exports__);
7992
7994
  * @returns url without the origin if it's the same origin as the current window origin
7993
7995
  */
7994
7996
  function cleanUrlIfSameOrigin(url) {
7995
- var _window, _window2;
7997
+ var _window, _window2, _window3;
7996
7998
  if (!url.startsWith((_window = window) == null ? void 0 : _window.location.origin)) {
7997
7999
  return url;
7998
8000
  }
7999
- return url.replace((_window2 = window) == null ? void 0 : _window2.location.origin, '');
8001
+ console.log('url.replace(window?.location.origin, )', url.replace((_window2 = window) == null ? void 0 : _window2.location.origin, ''));
8002
+ return url.replace((_window3 = window) == null ? void 0 : _window3.location.origin, '') || '/';
8000
8003
  }
8001
8004
 
8002
8005
  /**
@@ -8043,7 +8046,8 @@ function* getUrlForAfterAuthNavigation(customLoginAuthenticatedUrl) {
8043
8046
  function* afterAuthNavigationUtil(resetStateAction, {
8044
8047
  customLoginAuthenticatedUrl,
8045
8048
  forceStepUpUrl,
8046
- shouldStepUpDuringLogin
8049
+ shouldStepUpDuringLogin,
8050
+ forceRefresh = false
8047
8051
  } = {}) {
8048
8052
  const onRedirectTo = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.onRedirectTo;
8049
8053
  let redirectUrl = undefined;
@@ -8052,7 +8056,7 @@ function* afterAuthNavigationUtil(resetStateAction, {
8052
8056
  // we don't want to remove the FRONTEGG_AFTER_AUTH_REDIRECT_URL when we are in the step up flow
8053
8057
  redirectUrl = forceStepUpUrl;
8054
8058
  } else {
8055
- var _window3;
8059
+ var _window4;
8056
8060
  if (shouldStepUpDuringLogin) {
8057
8061
  // getUrlForAfterAuthNavigation give priority to the redirectUrl
8058
8062
  // avoiding use of getUrlForAfterAuthNavigation because we don't want to use the redirectUrl for magic link for example
@@ -8064,16 +8068,16 @@ function* afterAuthNavigationUtil(resetStateAction, {
8064
8068
  if (!redirectUrl) {
8065
8069
  redirectUrl = yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_0__.call)(getUrlForAfterAuthNavigation, customLoginAuthenticatedUrl);
8066
8070
  }
8067
- (_window3 = window) == null ? void 0 : _window3.localStorage.removeItem(_constants__WEBPACK_IMPORTED_MODULE_2__.FRONTEGG_AFTER_AUTH_REDIRECT_URL);
8071
+ (_window4 = window) == null ? void 0 : _window4.localStorage.removeItem(_constants__WEBPACK_IMPORTED_MODULE_2__.FRONTEGG_AFTER_AUTH_REDIRECT_URL);
8068
8072
  }
8069
8073
  console.log('afterAuthNavigationUtil redirectUrl', redirectUrl);
8070
8074
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_0__.delay)(200);
8071
8075
  (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_0__.put)(resetStateAction());
8072
8076
  console.log('afterAuthNavigationUtil onRedirectTo', {
8073
- refresh: redirectUrl.startsWith('http')
8077
+ refresh: redirectUrl.startsWith('http') || forceRefresh
8074
8078
  });
8075
8079
  onRedirectTo(redirectUrl, {
8076
- refresh: redirectUrl.startsWith('http')
8080
+ refresh: redirectUrl.startsWith('http') || forceRefresh
8077
8081
  });
8078
8082
  }
8079
8083
 
@@ -8081,8 +8085,8 @@ function* afterAuthNavigationUtil(resetStateAction, {
8081
8085
  * After auth navigation for login flow
8082
8086
  * Handling also step up scenario when user silently logout to continue to step up
8083
8087
  */
8084
- function* afterAuthNavigation() {
8085
- var _window4;
8088
+ function* afterAuthNavigation(payload) {
8089
+ var _window5, _payload$forceRefresh;
8086
8090
  const {
8087
8091
  routes: {
8088
8092
  customLoginAuthenticatedUrl,
@@ -8091,13 +8095,13 @@ function* afterAuthNavigation() {
8091
8095
  } = yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_0__.select)(state => state.auth);
8092
8096
 
8093
8097
  // 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
8094
- const shouldStepUp = (_window4 = window) == null ? void 0 : _window4.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_4__.SHOULD_STEP_UP_KEY);
8098
+ const shouldStepUp = (_window5 = window) == null ? void 0 : _window5.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_4__.SHOULD_STEP_UP_KEY);
8095
8099
  const user = yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_0__.select)(({
8096
8100
  auth
8097
8101
  }) => auth.user);
8098
8102
  if (shouldStepUp) {
8099
- var _window5;
8100
- (_window5 = window) == null ? void 0 : _window5.localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_4__.SHOULD_STEP_UP_KEY);
8103
+ var _window6;
8104
+ (_window6 = window) == null ? void 0 : _window6.localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_4__.SHOULD_STEP_UP_KEY);
8101
8105
  }
8102
8106
  if (stepUpUrl && shouldStepUp && !(0,_StepUpState__WEBPACK_IMPORTED_MODULE_5__.isSteppedUp)(user)) {
8103
8107
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_0__.call)(afterAuthNavigationUtil, _reducer__WEBPACK_IMPORTED_MODULE_6__.actions.resetLoginState, {
@@ -8116,7 +8120,8 @@ function* afterAuthNavigation() {
8116
8120
  console.log('call afterAuthNavigationUtil');
8117
8121
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_0__.call)(afterAuthNavigationUtil, _reducer__WEBPACK_IMPORTED_MODULE_6__.actions.resetLoginState, {
8118
8122
  customLoginAuthenticatedUrl: customLoginURL,
8119
- shouldStepUpDuringLogin: !!shouldStepUp
8123
+ shouldStepUpDuringLogin: !!shouldStepUp,
8124
+ forceRefresh: (_payload$forceRefresh = payload == null ? void 0 : payload.forceRefresh) != null ? _payload$forceRefresh : false
8120
8125
  });
8121
8126
  }
8122
8127
 
@@ -25569,7 +25574,7 @@ __webpack_require__.r(__webpack_exports__);
25569
25574
  /* harmony export */ });
25570
25575
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
25571
25576
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
25572
- /** @license Frontegg v6.186.0-alpha.2
25577
+ /** @license Frontegg v6.186.0-alpha.4
25573
25578
  *
25574
25579
  * This source code is licensed under the MIT license found in the
25575
25580
  * LICENSE file in the root directory of this source tree.