@frontegg/js 7.82.0-alpha.2 → 7.83.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.82.0-alpha.2
1
+ /** @license Frontegg v7.83.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.82.0-alpha.2
1
+ /** @license Frontegg v7.83.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.82.0-alpha.2'
8
+ cdnVersion: '7.83.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.82.0-alpha.2",
3
+ "version": "7.83.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.82.0-alpha.2"
9
+ "@frontegg/types": "7.83.0-alpha.0"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1788,7 +1788,7 @@ __webpack_require__.r(__webpack_exports__);
1788
1788
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1789
1789
  /* harmony export */ });
1790
1790
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1791
- cdnVersion: '7.82.0-alpha.2'
1791
+ cdnVersion: '7.83.0-alpha.0'
1792
1792
  });
1793
1793
 
1794
1794
  /***/ }),
@@ -13857,7 +13857,8 @@ __webpack_require__.r(__webpack_exports__);
13857
13857
 
13858
13858
 
13859
13859
  const _excluded = ["events", "url"],
13860
- _excluded2 = ["events", "url"];
13860
+ _excluded2 = ["events", "url"],
13861
+ _excluded3 = ["events", "url"];
13861
13862
 
13862
13863
 
13863
13864
 
@@ -13970,7 +13971,7 @@ const _excluded = ["events", "url"],
13970
13971
  });
13971
13972
  }
13972
13973
  };
13973
- const signUpUser = async _payload => {
13974
+ const signUpUserWithUsername = async _payload => {
13974
13975
  const {
13975
13976
  events
13976
13977
  } = _payload,
@@ -13978,10 +13979,86 @@ const _excluded = ["events", "url"],
13978
13979
  setSignUpState({
13979
13980
  loading: true
13980
13981
  });
13982
+ if (!payload.username) {
13983
+ throw new Error('Username is required for username signup');
13984
+ }
13985
+ try {
13986
+ const {
13987
+ routes,
13988
+ onRedirectTo
13989
+ } = store.auth;
13990
+ const {
13991
+ shouldActivate,
13992
+ user,
13993
+ tenantId,
13994
+ userId,
13995
+ tenants = [],
13996
+ activeTenant,
13997
+ activationToken
13998
+ } = await api.auth.signUpUserWithUsername((0,_helpers__WEBPACK_IMPORTED_MODULE_7__.prepareIdentifiersForSignup)(payload));
13999
+ if (!payload.invitationToken) {
14000
+ reportSignupCompletion(payload, userId, tenantId, activationToken, events, _interfaces__WEBPACK_IMPORTED_MODULE_5__.AuthenticationTypes.USERNAME);
14001
+ }
14002
+ if (!shouldActivate && user && (0,_helpers__WEBPACK_IMPORTED_MODULE_7__.isMfaRequired)(user, store.root.appName)) {
14003
+ const mfaRequiredState = await actions.getMfaRequiredState(user, _constants__WEBPACK_IMPORTED_MODULE_11__.DEFAULT_RETRY_CONFIG, true, payload.email);
14004
+ actions.setAuthState(mfaRequiredState);
14005
+ onRedirectTo(routes.loginUrl);
14006
+ } else if (shouldActivate && activationToken) {
14007
+ const searchParams = new URLSearchParams({
14008
+ userId: userId || '',
14009
+ token: activationToken || ''
14010
+ });
14011
+ const url = `${routes.activateWithOTCUrl}?${searchParams.toString()}`;
14012
+ setSignUpState({
14013
+ loading: false,
14014
+ shouldActivate,
14015
+ stage: _interfaces__WEBPACK_IMPORTED_MODULE_12__.SignUpStage.SignUpSuccess
14016
+ });
14017
+ onRedirectTo(url);
14018
+ } else {
14019
+ const tenantsState = store.auth.tenantsState;
14020
+ setSignUpState({
14021
+ loading: false,
14022
+ shouldActivate,
14023
+ stage: _interfaces__WEBPACK_IMPORTED_MODULE_12__.SignUpStage.SignUpSuccess
14024
+ });
14025
+ actions.setAuthState({
14026
+ user,
14027
+ isAuthenticated: !!(user != null && user.accessToken),
14028
+ tenantsState: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, tenantsState, {
14029
+ tenants,
14030
+ activeTenant
14031
+ })
14032
+ });
14033
+ }
14034
+ } catch (e) {
14035
+ contextHolder.setAccessToken(null);
14036
+ contextHolder.setUser(null);
14037
+ setSignUpState({
14038
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.errorHandler)(e)
14039
+ });
14040
+ } finally {
14041
+ setSignUpState({
14042
+ loading: false
14043
+ });
14044
+ }
14045
+ };
14046
+ const signUpUser = async _payload => {
14047
+ const {
14048
+ events
14049
+ } = _payload,
14050
+ payload = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(_payload, _excluded3);
14051
+ setSignUpState({
14052
+ loading: true
14053
+ });
13981
14054
  const phoneNumberStrategy = store.auth.signUpState.strategies.phoneNumber;
13982
14055
  if (phoneNumberStrategy != null && phoneNumberStrategy.required && phoneNumberStrategy != null && phoneNumberStrategy.enabled && payload.phoneNumber) {
13983
14056
  return signUpUserWithPhoneNumber(_payload);
13984
14057
  }
14058
+ const usernameStrategy = store.auth.signUpState.strategies.username;
14059
+ if (usernameStrategy != null && usernameStrategy.required && usernameStrategy != null && usernameStrategy.enabled && payload.username) {
14060
+ return signUpUserWithUsername(_payload);
14061
+ }
13985
14062
  try {
13986
14063
  const {
13987
14064
  routes,
@@ -14099,7 +14176,6 @@ const _excluded = ["events", "url"],
14099
14176
  resetSignUpState,
14100
14177
  resetSignUpStateSoft,
14101
14178
  signUpUser,
14102
- signUpUserWithPhoneNumber,
14103
14179
  loadAllowSignUps,
14104
14180
  loadSignUpStrategies
14105
14181
  };
@@ -14159,6 +14235,10 @@ const initialState = {
14159
14235
  [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__.SignUpStrategyEnum.PhoneNumber]: {
14160
14236
  enabled: false,
14161
14237
  required: false
14238
+ },
14239
+ [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__.SignUpStrategyEnum.Username]: {
14240
+ enabled: false,
14241
+ required: false
14162
14242
  }
14163
14243
  }
14164
14244
  };
@@ -16986,7 +17066,7 @@ __webpack_require__.r(__webpack_exports__);
16986
17066
  /* harmony import */ var _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./StepUpState/helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
16987
17067
 
16988
17068
 
16989
- const _excluded = ["phoneNumber", "email"],
17069
+ const _excluded = ["phoneNumber", "email", "username"],
16990
17070
  _excluded2 = ["authenticatedUrl"];
16991
17071
 
16992
17072
 
@@ -17042,7 +17122,8 @@ const getUri = urlStrategy => {
17042
17122
  const prepareIdentifiersForSignup = payload => {
17043
17123
  const {
17044
17124
  phoneNumber,
17045
- email
17125
+ email,
17126
+ username
17046
17127
  } = payload,
17047
17128
  finalDto = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(payload, _excluded);
17048
17129
  if (email != null && email.length) {
@@ -17055,6 +17136,11 @@ const prepareIdentifiersForSignup = payload => {
17055
17136
  phoneNumber
17056
17137
  });
17057
17138
  }
17139
+ if (username != null && username.length) {
17140
+ Object.assign(finalDto, {
17141
+ username
17142
+ });
17143
+ }
17058
17144
  return finalDto;
17059
17145
  };
17060
17146
  const isAuthRoute = (path, routes) => {
@@ -17494,6 +17580,7 @@ let AuthenticationTypes;
17494
17580
  AuthenticationTypes["SOCIAL_LOGIN"] = "SOCIAL_LOGIN";
17495
17581
  AuthenticationTypes["PASSWORD"] = "PASSWORD";
17496
17582
  AuthenticationTypes["PHONE_NUMBER"] = "PHONE_NUMBER";
17583
+ AuthenticationTypes["USERNAME"] = "USERNAME";
17497
17584
  })(AuthenticationTypes || (AuthenticationTypes = {}));
17498
17585
  let AdminPortalPagesForEvents;
17499
17586
 
@@ -19238,7 +19325,7 @@ __webpack_require__.r(__webpack_exports__);
19238
19325
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
19239
19326
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
19240
19327
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
19241
- /** @license Frontegg v7.82.0-alpha.2
19328
+ /** @license Frontegg v7.83.0-alpha.0
19242
19329
  *
19243
19330
  * This source code is licensed under the MIT license found in the
19244
19331
  * LICENSE file in the root directory of this source tree.
@@ -27415,6 +27502,7 @@ let SignUpStrategyEnum;
27415
27502
  (function (SignUpStrategyEnum) {
27416
27503
  SignUpStrategyEnum["Email"] = "email";
27417
27504
  SignUpStrategyEnum["PhoneNumber"] = "phoneNumber";
27505
+ SignUpStrategyEnum["Username"] = "username";
27418
27506
  })(SignUpStrategyEnum || (SignUpStrategyEnum = {}));
27419
27507
  let EIdentifierType;
27420
27508
  (function (EIdentifierType) {
@@ -27909,14 +27997,14 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
27909
27997
  this.getVendorConfig = async () => {
27910
27998
  return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.configurations.v1}/public`);
27911
27999
  };
27912
- this.signUpUser = async body => {
28000
+ this.signUp = async (signUpUrl, body) => {
27913
28001
  const {
27914
28002
  shouldActivate,
27915
28003
  authResponse,
27916
28004
  userId,
27917
28005
  tenantId,
27918
28006
  activationToken
27919
- } = await this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp`, body);
28007
+ } = await this.post(signUpUrl, body);
27920
28008
  const response = {
27921
28009
  shouldActivate,
27922
28010
  userId,
@@ -27938,34 +28026,14 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
27938
28026
  activationToken
27939
28027
  });
27940
28028
  };
28029
+ this.signUpUser = async body => {
28030
+ return this.signUp(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp`, body);
28031
+ };
27941
28032
  this.signUpUserWithPhoneNumber = async body => {
27942
- const {
27943
- shouldActivate,
27944
- authResponse,
27945
- userId,
27946
- tenantId,
27947
- activationToken
27948
- } = await this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp/phoneNumber`, body);
27949
- const response = {
27950
- shouldActivate,
27951
- userId,
27952
- tenantId
27953
- };
27954
- if (!shouldActivate && authResponse) {
27955
- const {
27956
- user,
27957
- tenants,
27958
- activeTenant
27959
- } = await this.generateLoginResponseV3(authResponse);
27960
- return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, response, {
27961
- user,
27962
- tenants,
27963
- activeTenant
27964
- });
27965
- }
27966
- return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, response, {
27967
- activationToken
27968
- });
28033
+ return this.signUp(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp/phoneNumber`, body);
28034
+ };
28035
+ this.signUpUserWithUsername = async body => {
28036
+ return this.signUp(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp/username`, body);
27969
28037
  };
27970
28038
  this.getCurrentUserSessions = async () => {
27971
28039
  return this.get(_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.sessions.currentUser.v1);
@@ -29534,7 +29602,7 @@ __webpack_require__.r(__webpack_exports__);
29534
29602
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
29535
29603
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
29536
29604
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
29537
- /** @license Frontegg v7.82.0-alpha.2
29605
+ /** @license Frontegg v7.83.0-alpha.0
29538
29606
  *
29539
29607
  * This source code is licensed under the MIT license found in the
29540
29608
  * LICENSE file in the root directory of this source tree.
@@ -32057,6 +32125,7 @@ __webpack_require__.r(__webpack_exports__);
32057
32125
  let SignupFields;
32058
32126
  (function (SignupFields) {
32059
32127
  SignupFields["phoneNumber"] = "phoneNumber";
32128
+ SignupFields["username"] = "username";
32060
32129
  })(SignupFields || (SignupFields = {}));
32061
32130
  let COUNTRY_FILTER_TYPE;
32062
32131
 
@@ -32272,7 +32341,7 @@ __webpack_require__.r(__webpack_exports__);
32272
32341
  /* harmony export */ });
32273
32342
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
32274
32343
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
32275
- /** @license Frontegg v7.82.0-alpha.2
32344
+ /** @license Frontegg v7.83.0-alpha.0
32276
32345
  *
32277
32346
  * This source code is licensed under the MIT license found in the
32278
32347
  * LICENSE file in the root directory of this source tree.