@frontegg/js 7.76.0-alpha.0 → 7.76.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.76.0-alpha.0
1
+ /** @license Frontegg v7.76.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.76.0-alpha.0
1
+ /** @license Frontegg v7.76.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.76.0-alpha.0'
8
+ cdnVersion: '7.76.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.76.0-alpha.0",
3
+ "version": "7.76.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.76.0-alpha.0"
9
+ "@frontegg/types": "7.76.0-alpha.1"
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.1'
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));
@@ -18925,7 +18970,7 @@ __webpack_require__.r(__webpack_exports__);
18925
18970
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
18926
18971
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
18927
18972
  /* 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
18973
+ /** @license Frontegg v7.76.0-alpha.1
18929
18974
  *
18930
18975
  * This source code is licensed under the MIT license found in the
18931
18976
  * LICENSE file in the root directory of this source tree.
@@ -27041,7 +27086,9 @@ const USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF = 'admin_portal_use_current_user_t
27041
27086
  __webpack_require__.r(__webpack_exports__);
27042
27087
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27043
27088
  /* harmony export */ AuthStrategyEnum: () => (/* binding */ AuthStrategyEnum),
27089
+ /* harmony export */ EIdentifierType: () => (/* binding */ EIdentifierType),
27044
27090
  /* harmony export */ MachineToMachineAuthStrategy: () => (/* binding */ MachineToMachineAuthStrategy),
27091
+ /* harmony export */ PasswordRecoveryStrategyEnum: () => (/* binding */ PasswordRecoveryStrategyEnum),
27045
27092
  /* harmony export */ SignUpStrategyEnum: () => (/* binding */ SignUpStrategyEnum),
27046
27093
  /* harmony export */ SocialLoginProviders: () => (/* binding */ SocialLoginProviders)
27047
27094
  /* harmony export */ });
@@ -27078,6 +27125,17 @@ let SignUpStrategyEnum;
27078
27125
  SignUpStrategyEnum["Email"] = "email";
27079
27126
  SignUpStrategyEnum["PhoneNumber"] = "phoneNumber";
27080
27127
  })(SignUpStrategyEnum || (SignUpStrategyEnum = {}));
27128
+ let EIdentifierType;
27129
+ (function (EIdentifierType) {
27130
+ EIdentifierType["email"] = "email";
27131
+ EIdentifierType["phoneNumber"] = "phoneNumber";
27132
+ EIdentifierType["username"] = "username";
27133
+ })(EIdentifierType || (EIdentifierType = {}));
27134
+ let PasswordRecoveryStrategyEnum;
27135
+ (function (PasswordRecoveryStrategyEnum) {
27136
+ PasswordRecoveryStrategyEnum["Email"] = "email";
27137
+ PasswordRecoveryStrategyEnum["Sms"] = "sms";
27138
+ })(PasswordRecoveryStrategyEnum || (PasswordRecoveryStrategyEnum = {}));
27081
27139
 
27082
27140
  /***/ }),
27083
27141
 
@@ -27092,8 +27150,10 @@ __webpack_require__.r(__webpack_exports__);
27092
27150
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27093
27151
  /* harmony export */ AuthStrategyEnum: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.AuthStrategyEnum),
27094
27152
  /* harmony export */ AuthenticationApi: () => (/* binding */ AuthenticationApi),
27153
+ /* harmony export */ EIdentifierType: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.EIdentifierType),
27095
27154
  /* harmony export */ FRONTEGG_SEPARATE_TABS_BY_TENANT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_SEPARATE_TABS_BY_TENANT),
27096
27155
  /* harmony export */ MachineToMachineAuthStrategy: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.MachineToMachineAuthStrategy),
27156
+ /* harmony export */ PasswordRecoveryStrategyEnum: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.PasswordRecoveryStrategyEnum),
27097
27157
  /* harmony export */ SecurityPolicyApi: () => (/* reexport safe */ _secutiry_poilicy__WEBPACK_IMPORTED_MODULE_2__.SecurityPolicyApi),
27098
27158
  /* harmony export */ SignUpStrategyEnum: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.SignUpStrategyEnum),
27099
27159
  /* harmony export */ SocialLoginProviders: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.SocialLoginProviders),
@@ -27329,6 +27389,9 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
27329
27389
  this.resetPassword = async body => {
27330
27390
  return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/passwords/reset/verify`, body);
27331
27391
  };
27392
+ this.getPasswordRecoveryStrategies = async () => {
27393
+ return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.configurations.v1}/password-recovery/strategies`);
27394
+ };
27332
27395
  this.loadPasswordConfig = async params => {
27333
27396
  return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/passwords/config`, params);
27334
27397
  };
@@ -29061,6 +29124,7 @@ __webpack_require__.r(__webpack_exports__);
29061
29124
  /* harmony export */ AuthStrategyEnum: () => (/* reexport safe */ _auth_enums__WEBPACK_IMPORTED_MODULE_2__.AuthStrategyEnum),
29062
29125
  /* harmony export */ ContextHolder: () => (/* reexport safe */ _ContextHolder__WEBPACK_IMPORTED_MODULE_44__.ContextHolder),
29063
29126
  /* harmony export */ DirectoryApi: () => (/* reexport safe */ _directory_index__WEBPACK_IMPORTED_MODULE_11__.DirectoryApi),
29127
+ /* harmony export */ EIdentifierType: () => (/* reexport safe */ _auth_enums__WEBPACK_IMPORTED_MODULE_2__.EIdentifierType),
29064
29128
  /* harmony export */ FRONTEGG_SEPARATE_TABS_BY_TENANT: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_SEPARATE_TABS_BY_TENANT),
29065
29129
  /* harmony export */ FeatureFlags: () => (/* reexport safe */ _feature_flags_index__WEBPACK_IMPORTED_MODULE_10__.FeatureFlags),
29066
29130
  /* harmony export */ FeatureFlagsApi: () => (/* reexport safe */ _feature_flags_index__WEBPACK_IMPORTED_MODULE_10__.FeatureFlagsApi),
@@ -29081,6 +29145,7 @@ __webpack_require__.r(__webpack_exports__);
29081
29145
  /* harmony export */ MachineToMachineAuthStrategy: () => (/* reexport safe */ _auth_enums__WEBPACK_IMPORTED_MODULE_2__.MachineToMachineAuthStrategy),
29082
29146
  /* harmony export */ NotEntitledJustification: () => (/* reexport safe */ _entitlements_interfaces__WEBPACK_IMPORTED_MODULE_15__.NotEntitledJustification),
29083
29147
  /* harmony export */ PaginationOrderEnum: () => (/* reexport safe */ _interfaces__WEBPACK_IMPORTED_MODULE_0__.PaginationOrderEnum),
29148
+ /* harmony export */ PasswordRecoveryStrategyEnum: () => (/* reexport safe */ _auth_enums__WEBPACK_IMPORTED_MODULE_2__.PasswordRecoveryStrategyEnum),
29084
29149
  /* harmony export */ PaymentMethodType: () => (/* reexport safe */ _subscriptions__WEBPACK_IMPORTED_MODULE_46__.PaymentMethodType),
29085
29150
  /* harmony export */ PermissionAssignmentTypeEnum: () => (/* reexport safe */ _roles_interfaces__WEBPACK_IMPORTED_MODULE_7__.PermissionAssignmentTypeEnum),
29086
29151
  /* harmony export */ ProviderType: () => (/* reexport safe */ _subscriptions__WEBPACK_IMPORTED_MODULE_46__.ProviderType),
@@ -29165,7 +29230,7 @@ __webpack_require__.r(__webpack_exports__);
29165
29230
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
29166
29231
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
29167
29232
  /* 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
29233
+ /** @license Frontegg v7.76.0-alpha.1
29169
29234
  *
29170
29235
  * This source code is licensed under the MIT license found in the
29171
29236
  * LICENSE file in the root directory of this source tree.
@@ -29309,7 +29374,8 @@ const createApiClient = appName => ({
29309
29374
  ISubscriptionCancellationPolicy: _subscriptions__WEBPACK_IMPORTED_MODULE_46__.ISubscriptionCancellationPolicy,
29310
29375
  ISubscriptionStatus: _subscriptions__WEBPACK_IMPORTED_MODULE_46__.ISubscriptionStatus,
29311
29376
  PaymentMethodType: _subscriptions__WEBPACK_IMPORTED_MODULE_46__.PaymentMethodType,
29312
- ProviderType: _subscriptions__WEBPACK_IMPORTED_MODULE_46__.ProviderType
29377
+ ProviderType: _subscriptions__WEBPACK_IMPORTED_MODULE_46__.ProviderType,
29378
+ EIdentifierType: _auth_enums__WEBPACK_IMPORTED_MODULE_2__.EIdentifierType
29313
29379
  });
29314
29380
 
29315
29381
  /***/ }),
@@ -31901,7 +31967,7 @@ __webpack_require__.r(__webpack_exports__);
31901
31967
  /* harmony export */ });
31902
31968
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
31903
31969
  /* 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
31970
+ /** @license Frontegg v7.76.0-alpha.1
31905
31971
  *
31906
31972
  * This source code is licensed under the MIT license found in the
31907
31973
  * LICENSE file in the root directory of this source tree.