@frontegg/js 7.104.0-alpha.0 → 7.104.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.104.0-alpha.0
1
+ /** @license Frontegg v7.104.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.104.0-alpha.0
1
+ /** @license Frontegg v7.104.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.104.0-alpha.0'
8
+ cdnVersion: '7.104.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.104.0-alpha.0",
3
+ "version": "7.104.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.104.0-alpha.0"
9
+ "@frontegg/types": "7.104.0"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1923,7 +1923,7 @@ __webpack_require__.r(__webpack_exports__);
1923
1923
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1924
1924
  /* harmony export */ });
1925
1925
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1926
- cdnVersion: '7.104.0-alpha.0'
1926
+ cdnVersion: '7.104.0'
1927
1927
  });
1928
1928
 
1929
1929
  /***/ }),
@@ -4507,7 +4507,8 @@ const _excluded = ["callback"];
4507
4507
  error: undefined,
4508
4508
  userId: response.userId,
4509
4509
  token: response.token,
4510
- step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.ForgotPasswordStep.resetPasswordPage
4510
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.ForgotPasswordStep.resetPasswordPage,
4511
+ resetTokenValidationStatus: 'valid'
4511
4512
  });
4512
4513
  } catch (e) {
4513
4514
  setForgotPasswordState({
@@ -4584,18 +4585,81 @@ const _excluded = ["callback"];
4584
4585
  loading: true
4585
4586
  });
4586
4587
  try {
4587
- const passwordConfig = await api.auth.loadPasswordConfig(payload);
4588
+ var _payload$signal;
4589
+ const passwordConfig = await api.auth.loadPasswordConfig(payload ? {
4590
+ userId: payload.userId
4591
+ } : undefined);
4592
+ if (payload != null && (_payload$signal = payload.signal) != null && _payload$signal.aborted) return;
4588
4593
  setForgotPasswordState({
4589
4594
  loading: false,
4590
4595
  passwordConfig
4591
4596
  });
4592
4597
  } catch (e) {
4598
+ var _payload$signal2;
4599
+ if (payload != null && (_payload$signal2 = payload.signal) != null && _payload$signal2.aborted) return;
4593
4600
  setForgotPasswordState({
4594
4601
  loading: false,
4595
4602
  error: (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.errorHandler)(e)
4596
4603
  });
4597
4604
  }
4598
4605
  };
4606
+ const validateResetPasswordToken = async payload => {
4607
+ if (payload.skipValidation || store.auth.forgotPasswordState.resetTokenValidationStatus === 'valid') {
4608
+ var _payload$signal3;
4609
+ if (!((_payload$signal3 = payload.signal) != null && _payload$signal3.aborted)) {
4610
+ setForgotPasswordState({
4611
+ resetTokenValidationStatus: 'valid',
4612
+ error: undefined
4613
+ });
4614
+ }
4615
+ return;
4616
+ }
4617
+ setForgotPasswordState({
4618
+ resetTokenValidationStatus: 'pending',
4619
+ error: undefined
4620
+ });
4621
+ try {
4622
+ var _payload$signal4;
4623
+ await api.auth.validateResetPasswordToken({
4624
+ userId: payload.userId,
4625
+ token: payload.token
4626
+ });
4627
+ if ((_payload$signal4 = payload.signal) != null && _payload$signal4.aborted) return;
4628
+ setForgotPasswordState({
4629
+ resetTokenValidationStatus: 'valid',
4630
+ error: undefined
4631
+ });
4632
+ } catch (e) {
4633
+ var _payload$signal5;
4634
+ if ((_payload$signal5 = payload.signal) != null && _payload$signal5.aborted) return;
4635
+ const handled = (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.errorHandler)(e);
4636
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_1__.isFronteggApiError)(handled)) {
4637
+ const status = handled.statusCode;
4638
+ // Identity: 400 = bad request / missing input; 410 = expired or consumed. Both use the same link-expired screen (invalid).
4639
+ // 403/422 included if the API or gateway uses them for invalid tokens.
4640
+ const tokenInvalid = status === 400 || status === 403 || status === 410 || status === 422;
4641
+ const degradeToLegacyFlow = status === 401 || status === 404 || status >= 500;
4642
+ if (tokenInvalid) {
4643
+ setForgotPasswordState({
4644
+ resetTokenValidationStatus: 'invalid',
4645
+ error: undefined
4646
+ });
4647
+ return;
4648
+ }
4649
+ if (degradeToLegacyFlow) {
4650
+ setForgotPasswordState({
4651
+ resetTokenValidationStatus: 'valid',
4652
+ error: undefined
4653
+ });
4654
+ return;
4655
+ }
4656
+ }
4657
+ setForgotPasswordState({
4658
+ resetTokenValidationStatus: 'valid',
4659
+ error: undefined
4660
+ });
4661
+ }
4662
+ };
4599
4663
  return {
4600
4664
  loadPasswordRecoveryStrategies,
4601
4665
  setForgotPasswordState,
@@ -4603,6 +4667,7 @@ const _excluded = ["callback"];
4603
4667
  forgotPassword,
4604
4668
  resetPassword,
4605
4669
  loadPasswordConfig,
4670
+ validateResetPasswordToken,
4606
4671
  determinePasswordRecoveryStrategy,
4607
4672
  sendPasswordRecoveryEmail,
4608
4673
  sendPasswordRecoverySms,
@@ -4686,7 +4751,8 @@ const initialState = {
4686
4751
  sessionId: '',
4687
4752
  userId: '',
4688
4753
  token: '',
4689
- passwordConfig: null
4754
+ passwordConfig: null,
4755
+ resetTokenValidationStatus: 'idle'
4690
4756
  };
4691
4757
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (overrideState => (0,_toolkit_proxy__WEBPACK_IMPORTED_MODULE_2__.createProxy)(initialState, overrideState));
4692
4758
 
@@ -20014,7 +20080,7 @@ __webpack_require__.r(__webpack_exports__);
20014
20080
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
20015
20081
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
20016
20082
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
20017
- /** @license Frontegg v7.104.0-alpha.0
20083
+ /** @license Frontegg v7.104.0
20018
20084
  *
20019
20085
  * This source code is licensed under the MIT license found in the
20020
20086
  * LICENSE file in the root directory of this source tree.
@@ -20816,6 +20882,20 @@ __webpack_require__.r(__webpack_exports__);
20816
20882
  });
20817
20883
  }
20818
20884
  };
20885
+ mockedActions.validateResetPasswordToken = async payload => {
20886
+ if (payload.skipValidation) {
20887
+ mockedActions.setForgotPasswordState({
20888
+ resetTokenValidationStatus: 'valid'
20889
+ });
20890
+ return;
20891
+ }
20892
+ mockedActions.setForgotPasswordState({
20893
+ resetTokenValidationStatus: 'pending'
20894
+ });
20895
+ mockedActions.setForgotPasswordState({
20896
+ resetTokenValidationStatus: 'valid'
20897
+ });
20898
+ };
20819
20899
  return mockedActions;
20820
20900
  });
20821
20901
 
@@ -28514,6 +28594,9 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
28514
28594
  this.loadPasswordConfig = async params => {
28515
28595
  return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/passwords/config`, params);
28516
28596
  };
28597
+ this.validateResetPasswordToken = async params => {
28598
+ return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/passwords/reset/validate`, params);
28599
+ };
28517
28600
  this.getSignUpStrategies = async () => {
28518
28601
  return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.signup.v1.strategies}`);
28519
28602
  };
@@ -30375,7 +30458,7 @@ __webpack_require__.r(__webpack_exports__);
30375
30458
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
30376
30459
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
30377
30460
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
30378
- /** @license Frontegg v7.104.0-alpha.0
30461
+ /** @license Frontegg v7.104.0
30379
30462
  *
30380
30463
  * This source code is licensed under the MIT license found in the
30381
30464
  * LICENSE file in the root directory of this source tree.
@@ -33170,7 +33253,7 @@ __webpack_require__.r(__webpack_exports__);
33170
33253
  /* harmony export */ });
33171
33254
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
33172
33255
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
33173
- /** @license Frontegg v7.104.0-alpha.0
33256
+ /** @license Frontegg v7.104.0
33174
33257
  *
33175
33258
  * This source code is licensed under the MIT license found in the
33176
33259
  * LICENSE file in the root directory of this source tree.