@frontegg/js 7.103.0 → 7.104.0-alpha.1

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