@frontegg/js 7.83.0 → 7.84.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.83.0
1
+ /** @license Frontegg v7.84.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.83.0
1
+ /** @license Frontegg v7.84.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.83.0'
8
+ cdnVersion: '7.84.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.83.0",
3
+ "version": "7.84.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.83.0"
9
+ "@frontegg/types": "7.84.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.83.0'
1791
+ cdnVersion: '7.84.0-alpha.0'
1792
1792
  });
1793
1793
 
1794
1794
  /***/ }),
@@ -13858,7 +13858,8 @@ __webpack_require__.r(__webpack_exports__);
13858
13858
 
13859
13859
 
13860
13860
  const _excluded = ["events", "url"],
13861
- _excluded2 = ["events", "url"];
13861
+ _excluded2 = ["events", "url"],
13862
+ _excluded3 = ["events", "url"];
13862
13863
 
13863
13864
 
13864
13865
 
@@ -13971,7 +13972,7 @@ const _excluded = ["events", "url"],
13971
13972
  });
13972
13973
  }
13973
13974
  };
13974
- const signUpUser = async _payload => {
13975
+ const signUpUserWithUsername = async _payload => {
13975
13976
  const {
13976
13977
  events
13977
13978
  } = _payload,
@@ -13979,10 +13980,86 @@ const _excluded = ["events", "url"],
13979
13980
  setSignUpState({
13980
13981
  loading: true
13981
13982
  });
13983
+ if (!payload.username) {
13984
+ throw new Error('Username is required for username signup');
13985
+ }
13986
+ try {
13987
+ const {
13988
+ routes,
13989
+ onRedirectTo
13990
+ } = store.auth;
13991
+ const {
13992
+ shouldActivate,
13993
+ user,
13994
+ tenantId,
13995
+ userId,
13996
+ tenants = [],
13997
+ activeTenant,
13998
+ activationToken
13999
+ } = await api.auth.signUpUserWithUsername((0,_helpers__WEBPACK_IMPORTED_MODULE_7__.prepareIdentifiersForSignup)(payload));
14000
+ if (!payload.invitationToken) {
14001
+ reportSignupCompletion(payload, userId, tenantId, activationToken, events, _interfaces__WEBPACK_IMPORTED_MODULE_5__.AuthenticationTypes.USERNAME);
14002
+ }
14003
+ if (!shouldActivate && user && (0,_helpers__WEBPACK_IMPORTED_MODULE_7__.isMfaRequired)(user, store.root.appName)) {
14004
+ const mfaRequiredState = await actions.getMfaRequiredState(user, _constants__WEBPACK_IMPORTED_MODULE_11__.DEFAULT_RETRY_CONFIG, true, payload.email);
14005
+ actions.setAuthState(mfaRequiredState);
14006
+ onRedirectTo(routes.loginUrl);
14007
+ } else if (shouldActivate && activationToken) {
14008
+ const searchParams = new URLSearchParams({
14009
+ userId: userId || '',
14010
+ token: activationToken || ''
14011
+ });
14012
+ const url = `${routes.activateWithOTCUrl}?${searchParams.toString()}`;
14013
+ setSignUpState({
14014
+ loading: false,
14015
+ shouldActivate,
14016
+ stage: _interfaces__WEBPACK_IMPORTED_MODULE_12__.SignUpStage.SignUpSuccess
14017
+ });
14018
+ onRedirectTo(url);
14019
+ } else {
14020
+ const tenantsState = store.auth.tenantsState;
14021
+ setSignUpState({
14022
+ loading: false,
14023
+ shouldActivate,
14024
+ stage: _interfaces__WEBPACK_IMPORTED_MODULE_12__.SignUpStage.SignUpSuccess
14025
+ });
14026
+ actions.setAuthState({
14027
+ user,
14028
+ isAuthenticated: !!(user != null && user.accessToken),
14029
+ tenantsState: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, tenantsState, {
14030
+ tenants,
14031
+ activeTenant
14032
+ })
14033
+ });
14034
+ }
14035
+ } catch (e) {
14036
+ contextHolder.setAccessToken(null);
14037
+ contextHolder.setUser(null);
14038
+ setSignUpState({
14039
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.errorHandler)(e)
14040
+ });
14041
+ } finally {
14042
+ setSignUpState({
14043
+ loading: false
14044
+ });
14045
+ }
14046
+ };
14047
+ const signUpUser = async _payload => {
14048
+ const {
14049
+ events
14050
+ } = _payload,
14051
+ payload = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(_payload, _excluded3);
14052
+ setSignUpState({
14053
+ loading: true
14054
+ });
13982
14055
  const phoneNumberStrategy = store.auth.signUpState.strategies.phoneNumber;
13983
14056
  if (phoneNumberStrategy != null && phoneNumberStrategy.required && phoneNumberStrategy != null && phoneNumberStrategy.enabled && payload.phoneNumber) {
13984
14057
  return signUpUserWithPhoneNumber(_payload);
13985
14058
  }
14059
+ const usernameStrategy = store.auth.signUpState.strategies.username;
14060
+ if (usernameStrategy != null && usernameStrategy.required && usernameStrategy != null && usernameStrategy.enabled && payload.username) {
14061
+ return signUpUserWithUsername(_payload);
14062
+ }
13986
14063
  try {
13987
14064
  const {
13988
14065
  routes,
@@ -14100,7 +14177,6 @@ const _excluded = ["events", "url"],
14100
14177
  resetSignUpState,
14101
14178
  resetSignUpStateSoft,
14102
14179
  signUpUser,
14103
- signUpUserWithPhoneNumber,
14104
14180
  loadAllowSignUps,
14105
14181
  loadSignUpStrategies
14106
14182
  };
@@ -14160,6 +14236,10 @@ const initialState = {
14160
14236
  [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__.SignUpStrategyEnum.PhoneNumber]: {
14161
14237
  enabled: false,
14162
14238
  required: false
14239
+ },
14240
+ [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__.SignUpStrategyEnum.Username]: {
14241
+ enabled: false,
14242
+ required: false
14163
14243
  }
14164
14244
  }
14165
14245
  };
@@ -16998,7 +17078,7 @@ __webpack_require__.r(__webpack_exports__);
16998
17078
  /* harmony import */ var _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./StepUpState/helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
16999
17079
 
17000
17080
 
17001
- const _excluded = ["phoneNumber", "email"],
17081
+ const _excluded = ["phoneNumber", "email", "username"],
17002
17082
  _excluded2 = ["authenticatedUrl"];
17003
17083
 
17004
17084
 
@@ -17054,7 +17134,8 @@ const getUri = urlStrategy => {
17054
17134
  const prepareIdentifiersForSignup = payload => {
17055
17135
  const {
17056
17136
  phoneNumber,
17057
- email
17137
+ email,
17138
+ username
17058
17139
  } = payload,
17059
17140
  finalDto = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(payload, _excluded);
17060
17141
  if (email != null && email.length) {
@@ -17067,6 +17148,11 @@ const prepareIdentifiersForSignup = payload => {
17067
17148
  phoneNumber
17068
17149
  });
17069
17150
  }
17151
+ if (username != null && username.length) {
17152
+ Object.assign(finalDto, {
17153
+ username
17154
+ });
17155
+ }
17070
17156
  return finalDto;
17071
17157
  };
17072
17158
  const isAuthRoute = (path, routes) => {
@@ -17506,6 +17592,7 @@ let AuthenticationTypes;
17506
17592
  AuthenticationTypes["SOCIAL_LOGIN"] = "SOCIAL_LOGIN";
17507
17593
  AuthenticationTypes["PASSWORD"] = "PASSWORD";
17508
17594
  AuthenticationTypes["PHONE_NUMBER"] = "PHONE_NUMBER";
17595
+ AuthenticationTypes["USERNAME"] = "USERNAME";
17509
17596
  })(AuthenticationTypes || (AuthenticationTypes = {}));
17510
17597
  let AdminPortalPagesForEvents;
17511
17598
 
@@ -19250,7 +19337,7 @@ __webpack_require__.r(__webpack_exports__);
19250
19337
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
19251
19338
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
19252
19339
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
19253
- /** @license Frontegg v7.83.0
19340
+ /** @license Frontegg v7.84.0-alpha.0
19254
19341
  *
19255
19342
  * This source code is licensed under the MIT license found in the
19256
19343
  * LICENSE file in the root directory of this source tree.
@@ -27427,6 +27514,7 @@ let SignUpStrategyEnum;
27427
27514
  (function (SignUpStrategyEnum) {
27428
27515
  SignUpStrategyEnum["Email"] = "email";
27429
27516
  SignUpStrategyEnum["PhoneNumber"] = "phoneNumber";
27517
+ SignUpStrategyEnum["Username"] = "username";
27430
27518
  })(SignUpStrategyEnum || (SignUpStrategyEnum = {}));
27431
27519
  let EIdentifierType;
27432
27520
  (function (EIdentifierType) {
@@ -27921,14 +28009,14 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
27921
28009
  this.getVendorConfig = async () => {
27922
28010
  return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.configurations.v1}/public`);
27923
28011
  };
27924
- this.signUpUser = async body => {
28012
+ this.signUp = async (signUpUrl, body) => {
27925
28013
  const {
27926
28014
  shouldActivate,
27927
28015
  authResponse,
27928
28016
  userId,
27929
28017
  tenantId,
27930
28018
  activationToken
27931
- } = await this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp`, body);
28019
+ } = await this.post(signUpUrl, body);
27932
28020
  const response = {
27933
28021
  shouldActivate,
27934
28022
  userId,
@@ -27950,34 +28038,14 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
27950
28038
  activationToken
27951
28039
  });
27952
28040
  };
28041
+ this.signUpUser = async body => {
28042
+ return this.signUp(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp`, body);
28043
+ };
27953
28044
  this.signUpUserWithPhoneNumber = async body => {
27954
- const {
27955
- shouldActivate,
27956
- authResponse,
27957
- userId,
27958
- tenantId,
27959
- activationToken
27960
- } = await this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp/phoneNumber`, body);
27961
- const response = {
27962
- shouldActivate,
27963
- userId,
27964
- tenantId
27965
- };
27966
- if (!shouldActivate && authResponse) {
27967
- const {
27968
- user,
27969
- tenants,
27970
- activeTenant
27971
- } = await this.generateLoginResponseV3(authResponse);
27972
- return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, response, {
27973
- user,
27974
- tenants,
27975
- activeTenant
27976
- });
27977
- }
27978
- return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, response, {
27979
- activationToken
27980
- });
28045
+ return this.signUp(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp/phoneNumber`, body);
28046
+ };
28047
+ this.signUpUserWithUsername = async body => {
28048
+ return this.signUp(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.v1}/signUp/username`, body);
27981
28049
  };
27982
28050
  this.getCurrentUserSessions = async () => {
27983
28051
  return this.get(_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.users.sessions.currentUser.v1);
@@ -29546,7 +29614,7 @@ __webpack_require__.r(__webpack_exports__);
29546
29614
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
29547
29615
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
29548
29616
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
29549
- /** @license Frontegg v7.83.0
29617
+ /** @license Frontegg v7.84.0-alpha.0
29550
29618
  *
29551
29619
  * This source code is licensed under the MIT license found in the
29552
29620
  * LICENSE file in the root directory of this source tree.
@@ -32069,6 +32137,7 @@ __webpack_require__.r(__webpack_exports__);
32069
32137
  let SignupFields;
32070
32138
  (function (SignupFields) {
32071
32139
  SignupFields["phoneNumber"] = "phoneNumber";
32140
+ SignupFields["username"] = "username";
32072
32141
  })(SignupFields || (SignupFields = {}));
32073
32142
  let COUNTRY_FILTER_TYPE;
32074
32143
 
@@ -32284,7 +32353,7 @@ __webpack_require__.r(__webpack_exports__);
32284
32353
  /* harmony export */ });
32285
32354
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
32286
32355
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
32287
- /** @license Frontegg v7.83.0
32356
+ /** @license Frontegg v7.84.0-alpha.0
32288
32357
  *
32289
32358
  * This source code is licensed under the MIT license found in the
32290
32359
  * LICENSE file in the root directory of this source tree.