@frontegg/js 7.76.0-alpha.0 → 7.76.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.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.76.0-alpha.0
1
+ /** @license Frontegg v7.76.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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.76.0-alpha.0
1
+ /** @license Frontegg v7.76.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: '7.76.0-alpha.0'
8
+ cdnVersion: '7.76.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": "7.76.0-alpha.0",
3
+ "version": "7.76.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": "7.76.0-alpha.0"
9
+ "@frontegg/types": "7.76.0-alpha.2"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1807,7 +1807,7 @@ __webpack_require__.r(__webpack_exports__);
1807
1807
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1808
1808
  /* harmony export */ });
1809
1809
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1810
- cdnVersion: '7.76.0-alpha.0'
1810
+ cdnVersion: '7.76.0-alpha.2'
1811
1811
  });
1812
1812
 
1813
1813
  /***/ }),
@@ -4043,6 +4043,7 @@ __webpack_require__.r(__webpack_exports__);
4043
4043
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
4044
4044
  /* harmony export */ });
4045
4045
  /* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
4046
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/enums.js");
4046
4047
  /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./interfaces */ "../../dist/@frontegg/redux-store/auth/ForgotPasswordState/interfaces.js");
4047
4048
  /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./state */ "../../dist/@frontegg/redux-store/auth/ForgotPasswordState/state.js");
4048
4049
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
@@ -4052,6 +4053,7 @@ const _excluded = ["callback"];
4052
4053
 
4053
4054
 
4054
4055
 
4056
+
4055
4057
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((store, api, sharedActions) => {
4056
4058
  const actions = sharedActions;
4057
4059
  const setForgotPasswordState = payload => {
@@ -4082,6 +4084,45 @@ const _excluded = ["callback"];
4082
4084
  (_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, false, e);
4083
4085
  }
4084
4086
  };
4087
+ const determinePasswordRecoveryStrategy = async payload => {
4088
+ setForgotPasswordState({
4089
+ loading: true,
4090
+ error: undefined,
4091
+ identifier: payload.identifier
4092
+ });
4093
+ try {
4094
+ const strategies = await api.auth.getPasswordRecoveryStrategies();
4095
+ const isEmailActive = strategies.some(s => s.strategy === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.PasswordRecoveryStrategyEnum.Email && s.isActive);
4096
+ const isSmsActive = strategies.some(s => s.strategy === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.PasswordRecoveryStrategyEnum.Sms && s.isActive);
4097
+ if (isEmailActive && isSmsActive) {
4098
+ setForgotPasswordState({
4099
+ loading: false,
4100
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_3__.ForgotPasswordStep.passwordRecoverySelector
4101
+ });
4102
+ } else if (isEmailActive) {
4103
+ await forgotPassword({
4104
+ email: payload.identifier,
4105
+ recaptchaToken: payload.recaptchaToken
4106
+ });
4107
+ } else if (isSmsActive) {
4108
+ setForgotPasswordState({
4109
+ loading: false,
4110
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_3__.ForgotPasswordStep.resetPasswordViaSms
4111
+ });
4112
+ } else {
4113
+ const error = 'No active password recovery methods found.';
4114
+ setForgotPasswordState({
4115
+ loading: false,
4116
+ error
4117
+ });
4118
+ }
4119
+ } catch (e) {
4120
+ setForgotPasswordState({
4121
+ loading: false,
4122
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e, 'An error occurred while determining recovery strategy')
4123
+ });
4124
+ }
4125
+ };
4085
4126
  const resetPassword = async payload => {
4086
4127
  const {
4087
4128
  callback
@@ -4128,7 +4169,8 @@ const _excluded = ["callback"];
4128
4169
  resetForgotPasswordState,
4129
4170
  forgotPassword,
4130
4171
  resetPassword,
4131
- loadPasswordConfig
4172
+ loadPasswordConfig,
4173
+ determinePasswordRecoveryStrategy
4132
4174
  };
4133
4175
  });
4134
4176
 
@@ -4148,6 +4190,9 @@ __webpack_require__.r(__webpack_exports__);
4148
4190
  let ForgotPasswordStep;
4149
4191
  (function (ForgotPasswordStep) {
4150
4192
  ForgotPasswordStep["forgotPassword"] = "forgotPassword";
4193
+ ForgotPasswordStep["resetPasswordViaSms"] = "resetPasswordViaSms";
4194
+ ForgotPasswordStep["passwordRecoverySelector"] = "passwordRecoverySelector";
4195
+ ForgotPasswordStep["resetPasswordPage"] = "resetPasswordPage";
4151
4196
  ForgotPasswordStep["success"] = "success";
4152
4197
  })(ForgotPasswordStep || (ForgotPasswordStep = {}));
4153
4198
 
@@ -4172,7 +4217,7 @@ __webpack_require__.r(__webpack_exports__);
4172
4217
  const initialState = {
4173
4218
  step: _interfaces__WEBPACK_IMPORTED_MODULE_0__.ForgotPasswordStep.forgotPassword,
4174
4219
  loading: false,
4175
- email: '',
4220
+ identifier: '',
4176
4221
  passwordConfig: null
4177
4222
  };
4178
4223
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (overrideState => (0,_toolkit_proxy__WEBPACK_IMPORTED_MODULE_1__.createProxy)(initialState, overrideState));
@@ -16579,7 +16624,8 @@ __webpack_require__.r(__webpack_exports__);
16579
16624
  }
16580
16625
  };
16581
16626
  return {
16582
- loadUserEmailPolicyState
16627
+ loadUserEmailPolicyState,
16628
+ setUserEmailPolicyState
16583
16629
  };
16584
16630
  });
16585
16631
 
@@ -18925,7 +18971,7 @@ __webpack_require__.r(__webpack_exports__);
18925
18971
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
18926
18972
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
18927
18973
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
18928
- /** @license Frontegg v7.76.0-alpha.0
18974
+ /** @license Frontegg v7.76.0-alpha.2
18929
18975
  *
18930
18976
  * This source code is licensed under the MIT license found in the
18931
18977
  * LICENSE file in the root directory of this source tree.
@@ -27041,7 +27087,9 @@ const USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF = 'admin_portal_use_current_user_t
27041
27087
  __webpack_require__.r(__webpack_exports__);
27042
27088
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27043
27089
  /* harmony export */ AuthStrategyEnum: () => (/* binding */ AuthStrategyEnum),
27090
+ /* harmony export */ EIdentifierType: () => (/* binding */ EIdentifierType),
27044
27091
  /* harmony export */ MachineToMachineAuthStrategy: () => (/* binding */ MachineToMachineAuthStrategy),
27092
+ /* harmony export */ PasswordRecoveryStrategyEnum: () => (/* binding */ PasswordRecoveryStrategyEnum),
27045
27093
  /* harmony export */ SignUpStrategyEnum: () => (/* binding */ SignUpStrategyEnum),
27046
27094
  /* harmony export */ SocialLoginProviders: () => (/* binding */ SocialLoginProviders)
27047
27095
  /* harmony export */ });
@@ -27078,6 +27126,17 @@ let SignUpStrategyEnum;
27078
27126
  SignUpStrategyEnum["Email"] = "email";
27079
27127
  SignUpStrategyEnum["PhoneNumber"] = "phoneNumber";
27080
27128
  })(SignUpStrategyEnum || (SignUpStrategyEnum = {}));
27129
+ let EIdentifierType;
27130
+ (function (EIdentifierType) {
27131
+ EIdentifierType["email"] = "email";
27132
+ EIdentifierType["phoneNumber"] = "phoneNumber";
27133
+ EIdentifierType["username"] = "username";
27134
+ })(EIdentifierType || (EIdentifierType = {}));
27135
+ let PasswordRecoveryStrategyEnum;
27136
+ (function (PasswordRecoveryStrategyEnum) {
27137
+ PasswordRecoveryStrategyEnum["Email"] = "email";
27138
+ PasswordRecoveryStrategyEnum["Sms"] = "sms";
27139
+ })(PasswordRecoveryStrategyEnum || (PasswordRecoveryStrategyEnum = {}));
27081
27140
 
27082
27141
  /***/ }),
27083
27142
 
@@ -27092,8 +27151,10 @@ __webpack_require__.r(__webpack_exports__);
27092
27151
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27093
27152
  /* harmony export */ AuthStrategyEnum: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.AuthStrategyEnum),
27094
27153
  /* harmony export */ AuthenticationApi: () => (/* binding */ AuthenticationApi),
27154
+ /* harmony export */ EIdentifierType: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.EIdentifierType),
27095
27155
  /* harmony export */ FRONTEGG_SEPARATE_TABS_BY_TENANT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_SEPARATE_TABS_BY_TENANT),
27096
27156
  /* harmony export */ MachineToMachineAuthStrategy: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.MachineToMachineAuthStrategy),
27157
+ /* harmony export */ PasswordRecoveryStrategyEnum: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.PasswordRecoveryStrategyEnum),
27097
27158
  /* harmony export */ SecurityPolicyApi: () => (/* reexport safe */ _secutiry_poilicy__WEBPACK_IMPORTED_MODULE_2__.SecurityPolicyApi),
27098
27159
  /* harmony export */ SignUpStrategyEnum: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.SignUpStrategyEnum),
27099
27160
  /* harmony export */ SocialLoginProviders: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.SocialLoginProviders),
@@ -27329,6 +27390,9 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
27329
27390
  this.resetPassword = async body => {
27330
27391
  return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/passwords/reset/verify`, body);
27331
27392
  };
27393
+ this.getPasswordRecoveryStrategies = async () => {
27394
+ return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.configurations.v1}/password-recovery/strategies`);
27395
+ };
27332
27396
  this.loadPasswordConfig = async params => {
27333
27397
  return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/passwords/config`, params);
27334
27398
  };
@@ -29061,6 +29125,7 @@ __webpack_require__.r(__webpack_exports__);
29061
29125
  /* harmony export */ AuthStrategyEnum: () => (/* reexport safe */ _auth_enums__WEBPACK_IMPORTED_MODULE_2__.AuthStrategyEnum),
29062
29126
  /* harmony export */ ContextHolder: () => (/* reexport safe */ _ContextHolder__WEBPACK_IMPORTED_MODULE_44__.ContextHolder),
29063
29127
  /* harmony export */ DirectoryApi: () => (/* reexport safe */ _directory_index__WEBPACK_IMPORTED_MODULE_11__.DirectoryApi),
29128
+ /* harmony export */ EIdentifierType: () => (/* reexport safe */ _auth_enums__WEBPACK_IMPORTED_MODULE_2__.EIdentifierType),
29064
29129
  /* harmony export */ FRONTEGG_SEPARATE_TABS_BY_TENANT: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_SEPARATE_TABS_BY_TENANT),
29065
29130
  /* harmony export */ FeatureFlags: () => (/* reexport safe */ _feature_flags_index__WEBPACK_IMPORTED_MODULE_10__.FeatureFlags),
29066
29131
  /* harmony export */ FeatureFlagsApi: () => (/* reexport safe */ _feature_flags_index__WEBPACK_IMPORTED_MODULE_10__.FeatureFlagsApi),
@@ -29081,6 +29146,7 @@ __webpack_require__.r(__webpack_exports__);
29081
29146
  /* harmony export */ MachineToMachineAuthStrategy: () => (/* reexport safe */ _auth_enums__WEBPACK_IMPORTED_MODULE_2__.MachineToMachineAuthStrategy),
29082
29147
  /* harmony export */ NotEntitledJustification: () => (/* reexport safe */ _entitlements_interfaces__WEBPACK_IMPORTED_MODULE_15__.NotEntitledJustification),
29083
29148
  /* harmony export */ PaginationOrderEnum: () => (/* reexport safe */ _interfaces__WEBPACK_IMPORTED_MODULE_0__.PaginationOrderEnum),
29149
+ /* harmony export */ PasswordRecoveryStrategyEnum: () => (/* reexport safe */ _auth_enums__WEBPACK_IMPORTED_MODULE_2__.PasswordRecoveryStrategyEnum),
29084
29150
  /* harmony export */ PaymentMethodType: () => (/* reexport safe */ _subscriptions__WEBPACK_IMPORTED_MODULE_46__.PaymentMethodType),
29085
29151
  /* harmony export */ PermissionAssignmentTypeEnum: () => (/* reexport safe */ _roles_interfaces__WEBPACK_IMPORTED_MODULE_7__.PermissionAssignmentTypeEnum),
29086
29152
  /* harmony export */ ProviderType: () => (/* reexport safe */ _subscriptions__WEBPACK_IMPORTED_MODULE_46__.ProviderType),
@@ -29165,7 +29231,7 @@ __webpack_require__.r(__webpack_exports__);
29165
29231
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
29166
29232
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
29167
29233
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
29168
- /** @license Frontegg v7.76.0-alpha.0
29234
+ /** @license Frontegg v7.76.0-alpha.2
29169
29235
  *
29170
29236
  * This source code is licensed under the MIT license found in the
29171
29237
  * LICENSE file in the root directory of this source tree.
@@ -29309,7 +29375,8 @@ const createApiClient = appName => ({
29309
29375
  ISubscriptionCancellationPolicy: _subscriptions__WEBPACK_IMPORTED_MODULE_46__.ISubscriptionCancellationPolicy,
29310
29376
  ISubscriptionStatus: _subscriptions__WEBPACK_IMPORTED_MODULE_46__.ISubscriptionStatus,
29311
29377
  PaymentMethodType: _subscriptions__WEBPACK_IMPORTED_MODULE_46__.PaymentMethodType,
29312
- ProviderType: _subscriptions__WEBPACK_IMPORTED_MODULE_46__.ProviderType
29378
+ ProviderType: _subscriptions__WEBPACK_IMPORTED_MODULE_46__.ProviderType,
29379
+ EIdentifierType: _auth_enums__WEBPACK_IMPORTED_MODULE_2__.EIdentifierType
29313
29380
  });
29314
29381
 
29315
29382
  /***/ }),
@@ -31901,7 +31968,7 @@ __webpack_require__.r(__webpack_exports__);
31901
31968
  /* harmony export */ });
31902
31969
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
31903
31970
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
31904
- /** @license Frontegg v7.76.0-alpha.0
31971
+ /** @license Frontegg v7.76.0-alpha.2
31905
31972
  *
31906
31973
  * This source code is licensed under the MIT license found in the
31907
31974
  * LICENSE file in the root directory of this source tree.