@frontegg/js 6.129.0-alpha.0 → 6.129.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,7 +30,7 @@ export declare class FronteggApp {
30
30
  constructor(_options: FronteggAppOptions, name: string, iframeRendering?: boolean, allowMultipleRenderers?: boolean);
31
31
  /**
32
32
  * Set entitlements related options in context holder according to frontegg options
33
- * @param fronteggAppOptions
33
+ * @param entitlementsOptions - entitlements options from frontegg options
34
34
  */
35
35
  private setEntitlementsOptions;
36
36
  loadAdminBoxMetadata: () => Promise<void>;
@@ -74,11 +74,21 @@ export var FronteggApp = /*#__PURE__*/function () {
74
74
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
75
75
  while (1) switch (_context2.prev = _context2.next) {
76
76
  case 0:
77
- if (!_this.options.hostedLoginBox && !_this.options.builderMode && _this.options.framework !== 'nextjs') {
78
- _this.store.dispatch({
79
- type: 'auth/requestAuthorize',
80
- payload: true
81
- });
77
+ if (!_this.options.builderMode && _this.options.framework !== 'nextjs') {
78
+ if (_this.options.hostedLoginBox && !_this.options.customLoginBox) {
79
+ _this.store.dispatch({
80
+ type: 'auth/requestHostedLoginAuthorizeV2',
81
+ payload: {
82
+ shouldRedirectToLogin: false,
83
+ firstTime: true
84
+ }
85
+ });
86
+ } else {
87
+ _this.store.dispatch({
88
+ type: 'auth/requestAuthorize',
89
+ payload: true
90
+ });
91
+ }
82
92
  }
83
93
  case 1:
84
94
  case "end":
@@ -170,7 +180,7 @@ export var FronteggApp = /*#__PURE__*/function () {
170
180
 
171
181
  /**
172
182
  * Set entitlements related options in context holder according to frontegg options
173
- * @param fronteggAppOptions
183
+ * @param entitlementsOptions - entitlements options from frontegg options
174
184
  */
175
185
  _createClass(FronteggApp, [{
176
186
  key: "setEntitlementsOptions",
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.129.0-alpha.0
1
+ /** @license Frontegg v6.129.0-alpha.2
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -81,11 +81,21 @@ var FronteggApp = /*#__PURE__*/function () {
81
81
  return _regenerator["default"].wrap(function _callee2$(_context2) {
82
82
  while (1) switch (_context2.prev = _context2.next) {
83
83
  case 0:
84
- if (!_this.options.hostedLoginBox && !_this.options.builderMode && _this.options.framework !== 'nextjs') {
85
- _this.store.dispatch({
86
- type: 'auth/requestAuthorize',
87
- payload: true
88
- });
84
+ if (!_this.options.builderMode && _this.options.framework !== 'nextjs') {
85
+ if (_this.options.hostedLoginBox && !_this.options.customLoginBox) {
86
+ _this.store.dispatch({
87
+ type: 'auth/requestHostedLoginAuthorizeV2',
88
+ payload: {
89
+ shouldRedirectToLogin: false,
90
+ firstTime: true
91
+ }
92
+ });
93
+ } else {
94
+ _this.store.dispatch({
95
+ type: 'auth/requestAuthorize',
96
+ payload: true
97
+ });
98
+ }
89
99
  }
90
100
  case 1:
91
101
  case "end":
@@ -177,7 +187,7 @@ var FronteggApp = /*#__PURE__*/function () {
177
187
 
178
188
  /**
179
189
  * Set entitlements related options in context holder according to frontegg options
180
- * @param fronteggAppOptions
190
+ * @param entitlementsOptions - entitlements options from frontegg options
181
191
  */
182
192
  (0, _createClass2["default"])(FronteggApp, [{
183
193
  key: "setEntitlementsOptions",
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.129.0-alpha.0
1
+ /** @license Frontegg v6.129.0-alpha.2
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/node/version.js CHANGED
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
- cdnVersion: '6.129.0-alpha.0'
8
+ cdnVersion: '6.129.0-alpha.2'
9
9
  };
10
10
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@frontegg/js",
3
- "version": "6.129.0-alpha.0",
3
+ "version": "6.129.0-alpha.2",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
- "@frontegg/types": "6.129.0-alpha.0"
9
+ "@frontegg/types": "6.129.0-alpha.2"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -389,11 +389,21 @@ var FronteggApp = /*#__PURE__*/function () {
389
389
  return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default().wrap(function _callee2$(_context2) {
390
390
  while (1) switch (_context2.prev = _context2.next) {
391
391
  case 0:
392
- if (!_this.options.hostedLoginBox && !_this.options.builderMode && _this.options.framework !== 'nextjs') {
393
- _this.store.dispatch({
394
- type: 'auth/requestAuthorize',
395
- payload: true
396
- });
392
+ if (!_this.options.builderMode && _this.options.framework !== 'nextjs') {
393
+ if (_this.options.hostedLoginBox && !_this.options.customLoginBox) {
394
+ _this.store.dispatch({
395
+ type: 'auth/requestHostedLoginAuthorizeV2',
396
+ payload: {
397
+ shouldRedirectToLogin: false,
398
+ firstTime: true
399
+ }
400
+ });
401
+ } else {
402
+ _this.store.dispatch({
403
+ type: 'auth/requestAuthorize',
404
+ payload: true
405
+ });
406
+ }
397
407
  }
398
408
  case 1:
399
409
  case "end":
@@ -485,7 +495,7 @@ var FronteggApp = /*#__PURE__*/function () {
485
495
 
486
496
  /**
487
497
  * Set entitlements related options in context holder according to frontegg options
488
- * @param fronteggAppOptions
498
+ * @param entitlementsOptions - entitlements options from frontegg options
489
499
  */
490
500
  (0,_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_3__["default"])(FronteggApp, [{
491
501
  key: "setEntitlementsOptions",
@@ -1304,7 +1314,7 @@ __webpack_require__.r(__webpack_exports__);
1304
1314
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1305
1315
  /* harmony export */ });
1306
1316
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1307
- cdnVersion: '6.129.0-alpha.0'
1317
+ cdnVersion: '6.129.0-alpha.2'
1308
1318
  });
1309
1319
 
1310
1320
  /***/ }),
@@ -5481,6 +5491,9 @@ const actions = {
5481
5491
  requestHostedLoginAuthorize: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_2__.createAction)(`${_constants__WEBPACK_IMPORTED_MODULE_3__.authStoreName}/requestHostedLoginAuthorize`, payload => ({
5482
5492
  payload
5483
5493
  })),
5494
+ requestHostedLoginAuthorizeV2: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_2__.createAction)(`${_constants__WEBPACK_IMPORTED_MODULE_3__.authStoreName}/requestHostedLoginAuthorizeV2`, payload => ({
5495
+ payload
5496
+ })),
5484
5497
  handleHostedLoginCallback: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_2__.createAction)(`${_constants__WEBPACK_IMPORTED_MODULE_3__.authStoreName}/handleHostedLoginCallback`, payload => ({
5485
5498
  payload
5486
5499
  })),
@@ -6259,6 +6272,47 @@ function* refreshOrRequestHostedLoginAuthorize({
6259
6272
  yield requestHostedLoginAuthorize(additionalParams);
6260
6273
  }
6261
6274
  }
6275
+ function* refreshOrRequestHostedLoginAuthorizeV2({
6276
+ payload: {
6277
+ additionalParams,
6278
+ shouldRedirectToLogin,
6279
+ firstTime
6280
+ }
6281
+ }) {
6282
+ if (firstTime) {
6283
+ const {
6284
+ urlStrategy
6285
+ } = yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.select)(state => ({
6286
+ urlStrategy: state.root.urlStrategy
6287
+ }));
6288
+ const activeUri = getUri(urlStrategy);
6289
+ yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.put)(_reducer__WEBPACK_IMPORTED_MODULE_4__.actions.setState({
6290
+ isLoading: true
6291
+ }));
6292
+ if ((0,_utils__WEBPACK_IMPORTED_MODULE_9__.isOauthCallbackRoute)(activeUri)) {
6293
+ return;
6294
+ }
6295
+ }
6296
+ const {
6297
+ disableSilentRefresh
6298
+ } = yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.select)(state => ({
6299
+ disableSilentRefresh: state.auth.disableSilentRefresh
6300
+ }));
6301
+ try {
6302
+ if (disableSilentRefresh) {
6303
+ throw new Error('silent refresh is disabled');
6304
+ }
6305
+ yield requestHostedLoginSilentAuthorize();
6306
+ } catch (e) {
6307
+ if (!shouldRedirectToLogin) {
6308
+ yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.put)(_reducer__WEBPACK_IMPORTED_MODULE_4__.actions.setState({
6309
+ isLoading: false
6310
+ }));
6311
+ return;
6312
+ }
6313
+ yield requestHostedLoginAuthorize(additionalParams);
6314
+ }
6315
+ }
6262
6316
  function* requestHostedLoginAuthorize(additionalParams) {
6263
6317
  const {
6264
6318
  routes,
@@ -6360,9 +6414,13 @@ function* handleHostedLoginCallback({
6360
6414
  try {
6361
6415
  const response = yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.call)(_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_10__.api.auth.exchangeOAuthTokensV2, body);
6362
6416
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.call)(afterAuthenticationStateUpdate, response, {
6363
- isAuthenticated: true
6417
+ isAuthenticated: true,
6418
+ isLoading: false
6364
6419
  });
6365
6420
  } catch (e) {
6421
+ yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.put)(_reducer__WEBPACK_IMPORTED_MODULE_4__.actions.setState({
6422
+ isLoading: false
6423
+ }));
6366
6424
  console.error('Failed to exchangeOAuthTokens', e);
6367
6425
  } finally {
6368
6426
  yield afterAuthNavigation();
@@ -7589,6 +7647,7 @@ function* loginSagas() {
7589
7647
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.takeLeading)(_reducer__WEBPACK_IMPORTED_MODULE_4__.actions.requestAuthorize, requestAuthorize);
7590
7648
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.takeLeading)(_reducer__WEBPACK_IMPORTED_MODULE_4__.actions.requestAuthorizeSSR, requestAuthorizeSSR);
7591
7649
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.takeLeading)(_reducer__WEBPACK_IMPORTED_MODULE_4__.actions.requestHostedLoginAuthorize, refreshOrRequestHostedLoginAuthorize);
7650
+ yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.takeLeading)(_reducer__WEBPACK_IMPORTED_MODULE_4__.actions.requestHostedLoginAuthorizeV2, refreshOrRequestHostedLoginAuthorizeV2);
7592
7651
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.takeLeading)(_reducer__WEBPACK_IMPORTED_MODULE_4__.actions.handleHostedLoginCallback, handleHostedLoginCallback);
7593
7652
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.takeLeading)(_reducer__WEBPACK_IMPORTED_MODULE_4__.actions.preLogin, preLogin);
7594
7653
  yield (0,redux_saga_effects__WEBPACK_IMPORTED_MODULE_2__.takeLeading)(_reducer__WEBPACK_IMPORTED_MODULE_4__.actions.postLogin, postLogin);
@@ -7685,7 +7744,8 @@ __webpack_require__.r(__webpack_exports__);
7685
7744
  /* harmony export */ "getRedirectUrl": () => (/* binding */ getRedirectUrl),
7686
7745
  /* harmony export */ "getSearchParam": () => (/* binding */ getSearchParam),
7687
7746
  /* harmony export */ "getSearchParamsFromUrl": () => (/* binding */ getSearchParamsFromUrl),
7688
- /* harmony export */ "isMfaRequired": () => (/* binding */ isMfaRequired)
7747
+ /* harmony export */ "isMfaRequired": () => (/* binding */ isMfaRequired),
7748
+ /* harmony export */ "isOauthCallbackRoute": () => (/* binding */ isOauthCallbackRoute)
7689
7749
  /* harmony export */ });
7690
7750
  /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/ContextHolder/index.js");
7691
7751
  /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/auth/interfaces.js");
@@ -7813,6 +7873,9 @@ const getMfaStepForNotEnrolledUsers = mfaStrategies => {
7813
7873
  }
7814
7874
  return _MfaState_interfaces__WEBPACK_IMPORTED_MODULE_1__.MFAStep.verify;
7815
7875
  };
7876
+ const isOauthCallbackRoute = activeUri => {
7877
+ return activeUri === '/oauth/callback';
7878
+ };
7816
7879
 
7817
7880
  /***/ }),
7818
7881
 
@@ -22233,7 +22296,7 @@ __webpack_require__.r(__webpack_exports__);
22233
22296
  /* harmony export */ });
22234
22297
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
22235
22298
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
22236
- /** @license Frontegg v6.129.0-alpha.0
22299
+ /** @license Frontegg v6.129.0-alpha.2
22237
22300
  *
22238
22301
  * This source code is licensed under the MIT license found in the
22239
22302
  * LICENSE file in the root directory of this source tree.