@frontegg/js 7.76.0-alpha.2 → 7.77.0-alpha.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.76.0-alpha.2
1
+ /** @license Frontegg v7.77.0-alpha.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.76.0-alpha.2
1
+ /** @license Frontegg v7.77.0-alpha.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.76.0-alpha.2'
8
+ cdnVersion: '7.77.0-alpha.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.76.0-alpha.2",
3
+ "version": "7.77.0-alpha.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.76.0-alpha.2"
9
+ "@frontegg/types": "7.77.0-alpha.0"
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.2'
1810
+ cdnVersion: '7.77.0-alpha.0'
1811
1811
  });
1812
1812
 
1813
1813
  /***/ }),
@@ -4084,11 +4084,100 @@ const _excluded = ["callback"];
4084
4084
  (_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, false, e);
4085
4085
  }
4086
4086
  };
4087
+ const sendPasswordRecoveryEmail = async () => {
4088
+ const {
4089
+ identifier,
4090
+ identifierType
4091
+ } = store.auth.forgotPasswordState;
4092
+ setForgotPasswordState({
4093
+ loading: true
4094
+ });
4095
+ try {
4096
+ await api.auth.resetPasswordViaEmail({
4097
+ identifier,
4098
+ identifierType
4099
+ });
4100
+ setForgotPasswordState({
4101
+ loading: false,
4102
+ error: undefined,
4103
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_3__.ForgotPasswordStep.success
4104
+ });
4105
+ } catch (e) {
4106
+ setForgotPasswordState({
4107
+ loading: false,
4108
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e, 'An error occurred while sending recovery email')
4109
+ });
4110
+ }
4111
+ };
4112
+ const sendPasswordRecoverySms = async () => {
4113
+ const {
4114
+ identifier,
4115
+ identifierType
4116
+ } = store.auth.forgotPasswordState;
4117
+ setForgotPasswordState({
4118
+ loading: true
4119
+ });
4120
+ try {
4121
+ const response = await api.auth.resetPasswordViaSms({
4122
+ identifier,
4123
+ identifierType
4124
+ });
4125
+ setForgotPasswordState({
4126
+ loading: false,
4127
+ error: undefined,
4128
+ sessionId: response.sessionId
4129
+ });
4130
+ } catch (e) {
4131
+ setForgotPasswordState({
4132
+ loading: false,
4133
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e, 'An error occurred while sending recovery sms')
4134
+ });
4135
+ }
4136
+ };
4137
+ const verifyPasswordViaSms = async payload => {
4138
+ const {
4139
+ sessionId
4140
+ } = store.auth.forgotPasswordState;
4141
+ if (!sessionId) {
4142
+ const error = 'Session ID not found in state for verifying password via sms.';
4143
+ setForgotPasswordState({
4144
+ loading: false,
4145
+ error
4146
+ });
4147
+ return;
4148
+ }
4149
+ setForgotPasswordState({
4150
+ loading: true
4151
+ });
4152
+ try {
4153
+ const response = await api.auth.verifyPasswordViaSms({
4154
+ otcToken: payload.otcToken,
4155
+ sessionId
4156
+ });
4157
+ if (!response.userId || !response.token) {
4158
+ const error = 'Invalid response from server: missing userId or token';
4159
+ throw new Error(error);
4160
+ }
4161
+ setForgotPasswordState({
4162
+ loading: false,
4163
+ error: undefined,
4164
+ userId: response.userId,
4165
+ token: response.token,
4166
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_3__.ForgotPasswordStep.resetPasswordPage
4167
+ });
4168
+ } catch (e) {
4169
+ setForgotPasswordState({
4170
+ loading: false,
4171
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e, 'An error occurred while verifying password via sms')
4172
+ });
4173
+ }
4174
+ };
4087
4175
  const determinePasswordRecoveryStrategy = async payload => {
4088
4176
  setForgotPasswordState({
4089
4177
  loading: true,
4090
4178
  error: undefined,
4091
- identifier: payload.identifier
4179
+ identifier: payload.identifier,
4180
+ identifierType: payload.identifierType
4092
4181
  });
4093
4182
  try {
4094
4183
  const strategies = await api.auth.getPasswordRecoveryStrategies();
@@ -4097,23 +4186,23 @@ const _excluded = ["callback"];
4097
4186
  if (isEmailActive && isSmsActive) {
4098
4187
  setForgotPasswordState({
4099
4188
  loading: false,
4100
- step: _interfaces__WEBPACK_IMPORTED_MODULE_3__.ForgotPasswordStep.passwordRecoverySelector
4189
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_3__.ForgotPasswordStep.passwordRecoverySelector,
4190
+ activeStrategies: strategies
4101
4191
  });
4102
4192
  } else if (isEmailActive) {
4103
- await forgotPassword({
4104
- email: payload.identifier,
4105
- recaptchaToken: payload.recaptchaToken
4106
- });
4193
+ await sendPasswordRecoveryEmail();
4107
4194
  } else if (isSmsActive) {
4108
4195
  setForgotPasswordState({
4109
4196
  loading: false,
4110
- step: _interfaces__WEBPACK_IMPORTED_MODULE_3__.ForgotPasswordStep.resetPasswordViaSms
4197
+ step: _interfaces__WEBPACK_IMPORTED_MODULE_3__.ForgotPasswordStep.resetPasswordViaSms,
4198
+ activeStrategies: strategies
4111
4199
  });
4112
4200
  } else {
4113
4201
  const error = 'No active password recovery methods found.';
4114
4202
  setForgotPasswordState({
4115
4203
  loading: false,
4116
- error
4204
+ error,
4205
+ activeStrategies: strategies
4117
4206
  });
4118
4207
  }
4119
4208
  } catch (e) {
@@ -4170,7 +4259,10 @@ const _excluded = ["callback"];
4170
4259
  forgotPassword,
4171
4260
  resetPassword,
4172
4261
  loadPasswordConfig,
4173
- determinePasswordRecoveryStrategy
4262
+ determinePasswordRecoveryStrategy,
4263
+ sendPasswordRecoveryEmail,
4264
+ sendPasswordRecoverySms,
4265
+ verifyPasswordViaSms
4174
4266
  };
4175
4267
  });
4176
4268
 
@@ -4211,16 +4303,22 @@ __webpack_require__.r(__webpack_exports__);
4211
4303
  /* harmony export */ initialState: () => (/* binding */ initialState)
4212
4304
  /* harmony export */ });
4213
4305
  /* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interfaces */ "../../dist/@frontegg/redux-store/auth/ForgotPasswordState/interfaces.js");
4214
- /* harmony import */ var _toolkit_proxy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../toolkit/proxy */ "../../dist/@frontegg/redux-store/toolkit/proxy.js");
4306
+ /* harmony import */ var _toolkit_proxy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../toolkit/proxy */ "../../dist/@frontegg/redux-store/toolkit/proxy.js");
4307
+ /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/enums.js");
4308
+
4215
4309
 
4216
4310
 
4217
4311
  const initialState = {
4218
4312
  step: _interfaces__WEBPACK_IMPORTED_MODULE_0__.ForgotPasswordStep.forgotPassword,
4219
4313
  loading: false,
4220
4314
  identifier: '',
4315
+ identifierType: _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__.EIdentifierType.email,
4316
+ sessionId: '',
4317
+ userId: '',
4318
+ token: '',
4221
4319
  passwordConfig: null
4222
4320
  };
4223
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (overrideState => (0,_toolkit_proxy__WEBPACK_IMPORTED_MODULE_1__.createProxy)(initialState, overrideState));
4321
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (overrideState => (0,_toolkit_proxy__WEBPACK_IMPORTED_MODULE_2__.createProxy)(initialState, overrideState));
4224
4322
 
4225
4323
  /***/ }),
4226
4324
 
@@ -18971,7 +19069,7 @@ __webpack_require__.r(__webpack_exports__);
18971
19069
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
18972
19070
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
18973
19071
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
18974
- /** @license Frontegg v7.76.0-alpha.2
19072
+ /** @license Frontegg v7.77.0-alpha.0
18975
19073
  *
18976
19074
  * This source code is licensed under the MIT license found in the
18977
19075
  * LICENSE file in the root directory of this source tree.
@@ -22222,7 +22320,7 @@ __webpack_require__.r(__webpack_exports__);
22222
22320
 
22223
22321
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((store, api, sharedActions) => {
22224
22322
  const originalActions = (0,_auth_UsersEmailsPolicyState__WEBPACK_IMPORTED_MODULE_0__["default"])(store, api, sharedActions);
22225
- return (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.mockActionsExpect)(originalActions, ['loadUserEmailPolicyState']);
22323
+ return (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.mockActionsExpect)(originalActions, ['setUserEmailPolicyState']);
22226
22324
  });
22227
22325
 
22228
22326
  /***/ }),
@@ -25243,8 +25341,10 @@ __webpack_require__.r(__webpack_exports__);
25243
25341
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25244
25342
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
25245
25343
  /* harmony export */ });
25344
+ const FRONTEGG_EXTERNAL_MOBILE_BROWSER_KEY = 'frontegg_external_mobile_browser';
25246
25345
  class FronteggNativeModule {
25247
25346
  constructor() {
25347
+ this.backToLoginImpl = undefined;
25248
25348
  this.loginWithSSO = identifier => {
25249
25349
  if (this.isIOSNativeBridgeAvailable()) {
25250
25350
  var _window$webkit, _window$webkit$messag, _window$webkit$messag2;
@@ -25331,6 +25431,24 @@ class FronteggNativeModule {
25331
25431
  return window.FronteggNativeBridge != null;
25332
25432
  }
25333
25433
 
25434
+ /**
25435
+ * Check if the current browser is an external mobile browser
25436
+ * That being used by the Frontegg Mobile SDK to authenticate with social providers
25437
+ * Back to login button should close and navigate back to the app
25438
+ */
25439
+ isExternalMobileBrowser() {
25440
+ return sessionStorage.getItem(FRONTEGG_EXTERNAL_MOBILE_BROWSER_KEY) !== null && this.backToLoginImpl != undefined;
25441
+ }
25442
+ setBackToLogin(impl) {
25443
+ this.backToLoginImpl = impl;
25444
+ }
25445
+ backToLogin() {
25446
+ if (this.backToLoginImpl) {
25447
+ this.backToLoginImpl();
25448
+ return;
25449
+ }
25450
+ }
25451
+
25334
25452
  /**
25335
25453
  * @deprecated use isSocialLoginProviderAvailable instead for pkce flow in mobile
25336
25454
  */
@@ -27390,6 +27508,15 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
27390
27508
  this.resetPassword = async body => {
27391
27509
  return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/passwords/reset/verify`, body);
27392
27510
  };
27511
+ this.resetPasswordViaEmail = async body => {
27512
+ return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v2}/passwords/reset/email`, body);
27513
+ };
27514
+ this.resetPasswordViaSms = async body => {
27515
+ return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v2}/passwords/reset/sms`, body);
27516
+ };
27517
+ this.verifyPasswordViaSms = async body => {
27518
+ return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v2}/passwords/reset/sms/verify`, body);
27519
+ };
27393
27520
  this.getPasswordRecoveryStrategies = async () => {
27394
27521
  return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.configurations.v1}/password-recovery/strategies`);
27395
27522
  };
@@ -28025,11 +28152,14 @@ __webpack_require__.r(__webpack_exports__);
28025
28152
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
28026
28153
  /* harmony export */ LOAD_AUTHORIZATION_FF: () => (/* binding */ LOAD_AUTHORIZATION_FF),
28027
28154
  /* harmony export */ MFAStrategyEnum: () => (/* binding */ MFAStrategyEnum),
28028
- /* harmony export */ RestrictionType: () => (/* reexport safe */ _secutiry_poilicy_interfaces__WEBPACK_IMPORTED_MODULE_0__.RestrictionType),
28155
+ /* harmony export */ RestrictionType: () => (/* reexport safe */ _secutiry_poilicy_interfaces__WEBPACK_IMPORTED_MODULE_1__.RestrictionType),
28029
28156
  /* harmony export */ SecondaryAuthStrategy: () => (/* binding */ SecondaryAuthStrategy),
28030
28157
  /* harmony export */ WebAuthnDeviceType: () => (/* binding */ WebAuthnDeviceType)
28031
28158
  /* harmony export */ });
28032
- /* harmony import */ var _secutiry_poilicy_interfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./secutiry-poilicy/interfaces */ "../../dist/@frontegg/rest-api/auth/secutiry-poilicy/interfaces.js");
28159
+ /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./enums */ "../../dist/@frontegg/rest-api/auth/enums.js");
28160
+ /* harmony import */ var _secutiry_poilicy_interfaces__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./secutiry-poilicy/interfaces */ "../../dist/@frontegg/rest-api/auth/secutiry-poilicy/interfaces.js");
28161
+ _enums__WEBPACK_IMPORTED_MODULE_0__.EIdentifierType;
28162
+
28033
28163
 
28034
28164
  // SmsCode is for speedy login, SmsCodeV2 is for login with SMS
28035
28165
  let SecondaryAuthStrategy;
@@ -29231,7 +29361,7 @@ __webpack_require__.r(__webpack_exports__);
29231
29361
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
29232
29362
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
29233
29363
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
29234
- /** @license Frontegg v7.76.0-alpha.2
29364
+ /** @license Frontegg v7.77.0-alpha.0
29235
29365
  *
29236
29366
  * This source code is licensed under the MIT license found in the
29237
29367
  * LICENSE file in the root directory of this source tree.
@@ -31968,7 +32098,7 @@ __webpack_require__.r(__webpack_exports__);
31968
32098
  /* harmony export */ });
31969
32099
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
31970
32100
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
31971
- /** @license Frontegg v7.76.0-alpha.2
32101
+ /** @license Frontegg v7.77.0-alpha.0
31972
32102
  *
31973
32103
  * This source code is licensed under the MIT license found in the
31974
32104
  * LICENSE file in the root directory of this source tree.