@frontegg/js 7.87.0 → 7.88.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.87.0
1
+ /** @license Frontegg v7.88.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.87.0
1
+ /** @license Frontegg v7.88.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.87.0'
8
+ cdnVersion: '7.88.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.87.0",
3
+ "version": "7.88.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.87.0"
9
+ "@frontegg/types": "7.88.0"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1839,7 +1839,7 @@ __webpack_require__.r(__webpack_exports__);
1839
1839
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1840
1840
  /* harmony export */ });
1841
1841
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1842
- cdnVersion: '7.87.0'
1842
+ cdnVersion: '7.88.0'
1843
1843
  });
1844
1844
 
1845
1845
  /***/ }),
@@ -13909,7 +13909,8 @@ __webpack_require__.r(__webpack_exports__);
13909
13909
 
13910
13910
 
13911
13911
  const _excluded = ["events", "url"],
13912
- _excluded2 = ["events", "url"];
13912
+ _excluded2 = ["events", "url"],
13913
+ _excluded3 = ["events", "url"];
13913
13914
 
13914
13915
 
13915
13916
 
@@ -14022,7 +14023,7 @@ const _excluded = ["events", "url"],
14022
14023
  });
14023
14024
  }
14024
14025
  };
14025
- const signUpUser = async _payload => {
14026
+ const signUpUserWithUsername = async _payload => {
14026
14027
  const {
14027
14028
  events
14028
14029
  } = _payload,
@@ -14030,10 +14031,86 @@ const _excluded = ["events", "url"],
14030
14031
  setSignUpState({
14031
14032
  loading: true
14032
14033
  });
14034
+ if (!payload.username) {
14035
+ throw new Error('Username is required for username signup');
14036
+ }
14037
+ try {
14038
+ const {
14039
+ routes,
14040
+ onRedirectTo
14041
+ } = store.auth;
14042
+ const {
14043
+ shouldActivate,
14044
+ user,
14045
+ tenantId,
14046
+ userId,
14047
+ tenants = [],
14048
+ activeTenant,
14049
+ activationToken
14050
+ } = await api.auth.signUpUserWithUsername((0,_helpers__WEBPACK_IMPORTED_MODULE_7__.prepareIdentifiersForSignup)(payload));
14051
+ if (!payload.invitationToken) {
14052
+ reportSignupCompletion(payload, userId, tenantId, activationToken, events, _interfaces__WEBPACK_IMPORTED_MODULE_5__.AuthenticationTypes.USERNAME);
14053
+ }
14054
+ if (!shouldActivate && user && (0,_helpers__WEBPACK_IMPORTED_MODULE_7__.isMfaRequired)(user, store.root.appName)) {
14055
+ const mfaRequiredState = await actions.getMfaRequiredState(user, _constants__WEBPACK_IMPORTED_MODULE_11__.DEFAULT_RETRY_CONFIG, true, payload.email);
14056
+ actions.setAuthState(mfaRequiredState);
14057
+ onRedirectTo(routes.loginUrl);
14058
+ } else if (shouldActivate && activationToken) {
14059
+ const searchParams = new URLSearchParams({
14060
+ userId: userId || '',
14061
+ token: activationToken || ''
14062
+ });
14063
+ const url = `${routes.activateWithOTCUrl}?${searchParams.toString()}`;
14064
+ setSignUpState({
14065
+ loading: false,
14066
+ shouldActivate,
14067
+ stage: _interfaces__WEBPACK_IMPORTED_MODULE_12__.SignUpStage.SignUpSuccess
14068
+ });
14069
+ onRedirectTo(url);
14070
+ } else {
14071
+ const tenantsState = store.auth.tenantsState;
14072
+ setSignUpState({
14073
+ loading: false,
14074
+ shouldActivate,
14075
+ stage: _interfaces__WEBPACK_IMPORTED_MODULE_12__.SignUpStage.SignUpSuccess
14076
+ });
14077
+ actions.setAuthState({
14078
+ user,
14079
+ isAuthenticated: !!(user != null && user.accessToken),
14080
+ tenantsState: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, tenantsState, {
14081
+ tenants,
14082
+ activeTenant
14083
+ })
14084
+ });
14085
+ }
14086
+ } catch (e) {
14087
+ contextHolder.setAccessToken(null);
14088
+ contextHolder.setUser(null);
14089
+ setSignUpState({
14090
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.errorHandler)(e)
14091
+ });
14092
+ } finally {
14093
+ setSignUpState({
14094
+ loading: false
14095
+ });
14096
+ }
14097
+ };
14098
+ const signUpUser = async _payload => {
14099
+ const {
14100
+ events
14101
+ } = _payload,
14102
+ payload = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(_payload, _excluded3);
14103
+ setSignUpState({
14104
+ loading: true
14105
+ });
14033
14106
  const phoneNumberStrategy = store.auth.signUpState.strategies.phoneNumber;
14034
14107
  if (phoneNumberStrategy != null && phoneNumberStrategy.required && phoneNumberStrategy != null && phoneNumberStrategy.enabled && payload.phoneNumber) {
14035
14108
  return signUpUserWithPhoneNumber(_payload);
14036
14109
  }
14110
+ const usernameStrategy = store.auth.signUpState.strategies.username;
14111
+ if (usernameStrategy != null && usernameStrategy.required && usernameStrategy != null && usernameStrategy.enabled && payload.username) {
14112
+ return signUpUserWithUsername(_payload);
14113
+ }
14037
14114
  try {
14038
14115
  const {
14039
14116
  routes,
@@ -14151,7 +14228,6 @@ const _excluded = ["events", "url"],
14151
14228
  resetSignUpState,
14152
14229
  resetSignUpStateSoft,
14153
14230
  signUpUser,
14154
- signUpUserWithPhoneNumber,
14155
14231
  loadAllowSignUps,
14156
14232
  loadSignUpStrategies
14157
14233
  };
@@ -14211,6 +14287,10 @@ const initialState = {
14211
14287
  [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__.SignUpStrategyEnum.PhoneNumber]: {
14212
14288
  enabled: false,
14213
14289
  required: false
14290
+ },
14291
+ [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__.SignUpStrategyEnum.Username]: {
14292
+ enabled: false,
14293
+ required: false
14214
14294
  }
14215
14295
  }
14216
14296
  };
@@ -17060,7 +17140,7 @@ __webpack_require__.r(__webpack_exports__);
17060
17140
  /* harmony import */ var _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./StepUpState/helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
17061
17141
 
17062
17142
 
17063
- const _excluded = ["phoneNumber", "email"],
17143
+ const _excluded = ["phoneNumber", "email", "username"],
17064
17144
  _excluded2 = ["authenticatedUrl"];
17065
17145
 
17066
17146
 
@@ -17116,7 +17196,8 @@ const getUri = urlStrategy => {
17116
17196
  const prepareIdentifiersForSignup = payload => {
17117
17197
  const {
17118
17198
  phoneNumber,
17119
- email
17199
+ email,
17200
+ username
17120
17201
  } = payload,
17121
17202
  finalDto = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(payload, _excluded);
17122
17203
  if (email != null && email.length) {
@@ -17129,6 +17210,11 @@ const prepareIdentifiersForSignup = payload => {
17129
17210
  phoneNumber
17130
17211
  });
17131
17212
  }
17213
+ if (username != null && username.length) {
17214
+ Object.assign(finalDto, {
17215
+ username
17216
+ });
17217
+ }
17132
17218
  return finalDto;
17133
17219
  };
17134
17220
  const isAuthRoute = (path, routes) => {
@@ -17568,6 +17654,7 @@ let AuthenticationTypes;
17568
17654
  AuthenticationTypes["SOCIAL_LOGIN"] = "SOCIAL_LOGIN";
17569
17655
  AuthenticationTypes["PASSWORD"] = "PASSWORD";
17570
17656
  AuthenticationTypes["PHONE_NUMBER"] = "PHONE_NUMBER";
17657
+ AuthenticationTypes["USERNAME"] = "USERNAME";
17571
17658
  })(AuthenticationTypes || (AuthenticationTypes = {}));
17572
17659
  let AdminPortalPagesForEvents;
17573
17660
 
@@ -19313,7 +19400,7 @@ __webpack_require__.r(__webpack_exports__);
19313
19400
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
19314
19401
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
19315
19402
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
19316
- /** @license Frontegg v7.87.0
19403
+ /** @license Frontegg v7.88.0
19317
19404
  *
19318
19405
  * This source code is licensed under the MIT license found in the
19319
19406
  * LICENSE file in the root directory of this source tree.
@@ -27491,6 +27578,7 @@ let SignUpStrategyEnum;
27491
27578
  (function (SignUpStrategyEnum) {
27492
27579
  SignUpStrategyEnum["Email"] = "email";
27493
27580
  SignUpStrategyEnum["PhoneNumber"] = "phoneNumber";
27581
+ SignUpStrategyEnum["Username"] = "username";
27494
27582
  })(SignUpStrategyEnum || (SignUpStrategyEnum = {}));
27495
27583
  let EIdentifierType;
27496
27584
  (function (EIdentifierType) {
@@ -27985,14 +28073,14 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
27985
28073
  this.getVendorConfig = async () => {
27986
28074
  return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.configurations.v1}/public`);
27987
28075
  };
27988
- this.signUpUser = async body => {
28076
+ this.signUp = async (signUpUrl, body) => {
27989
28077
  const {
27990
28078
  shouldActivate,
27991
28079
  authResponse,
27992
28080
  userId,
27993
28081
  tenantId,
27994
28082
  activationToken
27995
- } = await this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp`, body);
28083
+ } = await this.post(signUpUrl, body);
27996
28084
  const response = {
27997
28085
  shouldActivate,
27998
28086
  userId,
@@ -28014,34 +28102,14 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
28014
28102
  activationToken
28015
28103
  });
28016
28104
  };
28105
+ this.signUpUser = async body => {
28106
+ return this.signUp(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp`, body);
28107
+ };
28017
28108
  this.signUpUserWithPhoneNumber = async body => {
28018
- const {
28019
- shouldActivate,
28020
- authResponse,
28021
- userId,
28022
- tenantId,
28023
- activationToken
28024
- } = await this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp/phoneNumber`, body);
28025
- const response = {
28026
- shouldActivate,
28027
- userId,
28028
- tenantId
28029
- };
28030
- if (!shouldActivate && authResponse) {
28031
- const {
28032
- user,
28033
- tenants,
28034
- activeTenant
28035
- } = await this.generateLoginResponseV3(authResponse);
28036
- return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, response, {
28037
- user,
28038
- tenants,
28039
- activeTenant
28040
- });
28041
- }
28042
- return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, response, {
28043
- activationToken
28044
- });
28109
+ return this.signUp(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp/phoneNumber`, body);
28110
+ };
28111
+ this.signUpUserWithUsername = async body => {
28112
+ return this.signUp(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp/username`, body);
28045
28113
  };
28046
28114
  this.getCurrentUserSessions = async () => {
28047
28115
  return this.get(_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.sessions.currentUser.v1);
@@ -29611,7 +29679,7 @@ __webpack_require__.r(__webpack_exports__);
29611
29679
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
29612
29680
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
29613
29681
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
29614
- /** @license Frontegg v7.87.0
29682
+ /** @license Frontegg v7.88.0
29615
29683
  *
29616
29684
  * This source code is licensed under the MIT license found in the
29617
29685
  * LICENSE file in the root directory of this source tree.
@@ -32142,6 +32210,7 @@ __webpack_require__.r(__webpack_exports__);
32142
32210
  let SignupFields;
32143
32211
  (function (SignupFields) {
32144
32212
  SignupFields["phoneNumber"] = "phoneNumber";
32213
+ SignupFields["username"] = "username";
32145
32214
  })(SignupFields || (SignupFields = {}));
32146
32215
  let COUNTRY_FILTER_TYPE;
32147
32216
 
@@ -32358,7 +32427,7 @@ __webpack_require__.r(__webpack_exports__);
32358
32427
  /* harmony export */ });
32359
32428
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
32360
32429
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
32361
- /** @license Frontegg v7.87.0
32430
+ /** @license Frontegg v7.88.0
32362
32431
  *
32363
32432
  * This source code is licensed under the MIT license found in the
32364
32433
  * LICENSE file in the root directory of this source tree.