@frontegg/js 7.73.0-alpha.0 → 7.74.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.73.0-alpha.0
1
+ /** @license Frontegg v7.74.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.73.0-alpha.0
1
+ /** @license Frontegg v7.74.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.73.0-alpha.0'
8
+ cdnVersion: '7.74.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.73.0-alpha.0",
3
+ "version": "7.74.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.73.0-alpha.0"
9
+ "@frontegg/types": "7.74.0-alpha.0"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1780,7 +1780,7 @@ __webpack_require__.r(__webpack_exports__);
1780
1780
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1781
1781
  /* harmony export */ });
1782
1782
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1783
- cdnVersion: '7.73.0-alpha.0'
1783
+ cdnVersion: '7.74.0-alpha.0'
1784
1784
  });
1785
1785
 
1786
1786
  /***/ }),
@@ -5835,6 +5835,7 @@ const _excluded = ["callback", "error"],
5835
5835
  const preLogin = async payload => {
5836
5836
  const {
5837
5837
  email,
5838
+ username,
5838
5839
  recaptchaToken,
5839
5840
  invitationToken,
5840
5841
  callback
@@ -5845,10 +5846,13 @@ const _excluded = ["callback", "error"],
5845
5846
  try {
5846
5847
  const onRedirectTo = store.auth.onRedirectTo;
5847
5848
  const tenantId = (0,_helpers__WEBPACK_IMPORTED_MODULE_12__.getSearchParam)(_helpers__WEBPACK_IMPORTED_MODULE_12__.TENANT_ID_PARAM_KEY);
5848
- const preLoginResult = await api.auth.preLoginV2({
5849
- email,
5849
+ const preLoginResult = await api.auth.preLoginV2((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, email ? {
5850
+ email
5851
+ } : {}, username ? {
5852
+ username
5853
+ } : {}, {
5850
5854
  tenantId
5851
- });
5855
+ }));
5852
5856
  const {
5853
5857
  address,
5854
5858
  idpType
@@ -5862,7 +5866,8 @@ const _excluded = ["callback", "error"],
5862
5866
  ssoRedirectUrl += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
5863
5867
  }
5864
5868
  if (_toolkit__WEBPACK_IMPORTED_MODULE_14__["default"].isLoginWithSSOAvailable()) {
5865
- _toolkit__WEBPACK_IMPORTED_MODULE_14__["default"].loginWithSSO(email);
5869
+ var _ref4;
5870
+ _toolkit__WEBPACK_IMPORTED_MODULE_14__["default"].loginWithSSO((_ref4 = email != null ? email : username) != null ? _ref4 : '');
5866
5871
  setLoginState({
5867
5872
  loading: false
5868
5873
  });
@@ -5880,16 +5885,18 @@ const _excluded = ["callback", "error"],
5880
5885
  }, 2000);
5881
5886
  }
5882
5887
  } else {
5888
+ var _ref5;
5883
5889
  await ssoPreloginFailed({
5884
- email,
5890
+ email: (_ref5 = email != null ? email : username) != null ? _ref5 : '',
5885
5891
  recaptchaToken,
5886
5892
  callback,
5887
5893
  invitationToken
5888
5894
  });
5889
5895
  }
5890
5896
  } catch (e) {
5897
+ var _ref6;
5891
5898
  await ssoPreloginFailed({
5892
- email,
5899
+ email: (_ref6 = email != null ? email : username) != null ? _ref6 : '',
5893
5900
  recaptchaToken,
5894
5901
  callback,
5895
5902
  invitationToken,
@@ -5925,6 +5932,7 @@ const _excluded = ["callback", "error"],
5925
5932
  const login = async payload => {
5926
5933
  const {
5927
5934
  email,
5935
+ username,
5928
5936
  password,
5929
5937
  recaptchaToken,
5930
5938
  invitationToken,
@@ -5938,12 +5946,15 @@ const _excluded = ["callback", "error"],
5938
5946
  user,
5939
5947
  tenants = [],
5940
5948
  activeTenant
5941
- } = await api.auth.loginv2({
5942
- email,
5949
+ } = await api.auth.loginv2((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, email ? {
5950
+ email
5951
+ } : {}, username ? {
5952
+ username
5953
+ } : {}, {
5943
5954
  password,
5944
5955
  recaptchaToken,
5945
5956
  invitationToken
5946
- });
5957
+ }));
5947
5958
  const {
5948
5959
  onRedirectTo,
5949
5960
  routes
@@ -6183,6 +6194,7 @@ const _excluded = ["callback", "error"],
6183
6194
  } = _payload,
6184
6195
  payload = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(_payload, _excluded5);
6185
6196
  try {
6197
+ var _username;
6186
6198
  setLoginState({
6187
6199
  loading: true
6188
6200
  });
@@ -6190,9 +6202,16 @@ const _excluded = ["callback", "error"],
6190
6202
  if ((0,_helpers__WEBPACK_IMPORTED_MODULE_12__.isEmailPayload)(payload)) {
6191
6203
  email = payload.email;
6192
6204
  }
6205
+ let username;
6206
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_12__.isUsernamePayload)(payload)) {
6207
+ username = payload.username;
6208
+ }
6193
6209
  // TODO: [Typescript 4.8] fix @frontegg/rest-api return value
6194
6210
  // @ts-ignore
6195
- const preloginRes = await api.auth.passwordlessPreLogin(payload);
6211
+ const preloginRes = await api.auth.passwordlessPreLogin((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, payload, {
6212
+ email,
6213
+ username: (_username = username) != null ? _username : ''
6214
+ }));
6196
6215
  // @ts-ignore
6197
6216
  const step = _consts__WEBPACK_IMPORTED_MODULE_16__.authStrategyLoginStepMap[payload.type];
6198
6217
  setLoginState({
@@ -6784,11 +6803,11 @@ const _excluded = ["callback", "error"],
6784
6803
  preserveQueryParams: true
6785
6804
  });
6786
6805
  } else {
6787
- var _ref4;
6806
+ var _ref7;
6788
6807
  if (user.id) {
6789
6808
  localStorage.setItem('userId', user.id);
6790
6809
  }
6791
- const quickLoginToRegister = (_ref4 = localStorage.getItem('register-quick-login')) != null ? _ref4 : loginState.quickLoginToRegister;
6810
+ const quickLoginToRegister = (_ref7 = localStorage.getItem('register-quick-login')) != null ? _ref7 : loginState.quickLoginToRegister;
6792
6811
  const shouldNavigateToRegisterQuickLogin = __shouldNavigateToRegisterQuickLogin(user);
6793
6812
  actions.afterAuthenticationStateUpdate({
6794
6813
  user: updatedUser,
@@ -7535,7 +7554,11 @@ const authStrategyLoginStepMap = {
7535
7554
  [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.AuthStrategyEnum.Code]: _interfaces__WEBPACK_IMPORTED_MODULE_1__.LoginStep.loginWithOtc,
7536
7555
  [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.AuthStrategyEnum.EmailAndPassword]: _interfaces__WEBPACK_IMPORTED_MODULE_1__.LoginStep.loginWithPassword,
7537
7556
  [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.AuthStrategyEnum.MagicLink]: _interfaces__WEBPACK_IMPORTED_MODULE_1__.LoginStep.magicLinkPreLoginSuccess,
7538
- [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.AuthStrategyEnum.SmsCode]: _interfaces__WEBPACK_IMPORTED_MODULE_1__.LoginStep.loginWithSmsOtc
7557
+ [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.AuthStrategyEnum.SmsCode]: _interfaces__WEBPACK_IMPORTED_MODULE_1__.LoginStep.loginWithSmsOtc,
7558
+ [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.AuthStrategyEnum.UsernameAndPassword]: _interfaces__WEBPACK_IMPORTED_MODULE_1__.LoginStep.loginWithPassword,
7559
+ [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.AuthStrategyEnum.UsernameAndMagicLink]: _interfaces__WEBPACK_IMPORTED_MODULE_1__.LoginStep.magicLinkPreLoginSuccess,
7560
+ [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.AuthStrategyEnum.UsernameAndCode]: _interfaces__WEBPACK_IMPORTED_MODULE_1__.LoginStep.loginWithOtc,
7561
+ [_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.AuthStrategyEnum.UsernameAndSms]: _interfaces__WEBPACK_IMPORTED_MODULE_1__.LoginStep.loginWithSmsOtc
7539
7562
  };
7540
7563
 
7541
7564
  // don't remove this object because it is used in next js middleware (notice top of the file)
@@ -7586,6 +7609,7 @@ __webpack_require__.r(__webpack_exports__);
7586
7609
  /* harmony export */ isAbsoluteUrl: () => (/* binding */ isAbsoluteUrl),
7587
7610
  /* harmony export */ isEmailPayload: () => (/* binding */ isEmailPayload),
7588
7611
  /* harmony export */ isOauthCallbackRoute: () => (/* binding */ isOauthCallbackRoute),
7612
+ /* harmony export */ isUsernamePayload: () => (/* binding */ isUsernamePayload),
7589
7613
  /* harmony export */ shouldShowPasswordRotationPromptFunc: () => (/* binding */ shouldShowPasswordRotationPromptFunc)
7590
7614
  /* harmony export */ });
7591
7615
  /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
@@ -7719,6 +7743,9 @@ const isOauthCallbackRoute = activeUri => {
7719
7743
  function isEmailPayload(payload) {
7720
7744
  return 'email' in payload;
7721
7745
  }
7746
+ function isUsernamePayload(payload) {
7747
+ return 'username' in payload;
7748
+ }
7722
7749
  const getBaseNameWithoutSlashSuffix = state => {
7723
7750
  const basename = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.ContextHolder.for(state.root.appName).getBasename();
7724
7751
  if (basename != null && basename.endsWith('/')) {
@@ -16322,6 +16349,7 @@ __webpack_require__.r(__webpack_exports__);
16322
16349
  /* harmony export */ isOauthCallbackRoute: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.isOauthCallbackRoute),
16323
16350
  /* harmony export */ isResetPasswordRequired: () => (/* binding */ isResetPasswordRequired),
16324
16351
  /* harmony export */ isSteppedUp: () => (/* reexport safe */ _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__.isSteppedUp),
16352
+ /* harmony export */ isUsernamePayload: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.isUsernamePayload),
16325
16353
  /* harmony export */ mapMetaDataObjectToActions: () => (/* binding */ mapMetaDataObjectToActions),
16326
16354
  /* harmony export */ prepareIdentifiersForSignup: () => (/* binding */ prepareIdentifiersForSignup),
16327
16355
  /* harmony export */ redirectByStepUpUrl: () => (/* reexport safe */ _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__.redirectByStepUpUrl),
@@ -18546,6 +18574,7 @@ __webpack_require__.r(__webpack_exports__);
18546
18574
  /* harmony export */ isProxy: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.isProxy),
18547
18575
  /* harmony export */ isResetPasswordRequired: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isResetPasswordRequired),
18548
18576
  /* harmony export */ isSteppedUp: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isSteppedUp),
18577
+ /* harmony export */ isUsernamePayload: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isUsernamePayload),
18549
18578
  /* harmony export */ mapMetaDataObjectToActions: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.mapMetaDataObjectToActions),
18550
18579
  /* harmony export */ omitProps: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.omitProps),
18551
18580
  /* harmony export */ prepareIdentifiersForSignup: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.prepareIdentifiersForSignup),
@@ -18571,7 +18600,7 @@ __webpack_require__.r(__webpack_exports__);
18571
18600
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
18572
18601
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
18573
18602
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
18574
- /** @license Frontegg v7.73.0-alpha.0
18603
+ /** @license Frontegg v7.74.0-alpha.0
18575
18604
  *
18576
18605
  * This source code is licensed under the MIT license found in the
18577
18606
  * LICENSE file in the root directory of this source tree.
@@ -24785,16 +24814,16 @@ __webpack_require__.r(__webpack_exports__);
24785
24814
  /* harmony export */ });
24786
24815
  class FronteggNativeModule {
24787
24816
  constructor() {
24788
- this.loginWithSSO = email => {
24817
+ this.loginWithSSO = identifier => {
24789
24818
  if (this.isIOSNativeBridgeAvailable()) {
24790
24819
  var _window$webkit, _window$webkit$messag, _window$webkit$messag2;
24791
24820
  (_window$webkit = window.webkit) == null ? void 0 : (_window$webkit$messag = _window$webkit.messageHandlers) == null ? void 0 : (_window$webkit$messag2 = _window$webkit$messag.FronteggNativeBridge) == null ? void 0 : _window$webkit$messag2.postMessage(JSON.stringify({
24792
24821
  action: 'loginWithSSO',
24793
- payload: email
24822
+ payload: identifier
24794
24823
  }));
24795
24824
  } else if (this.isAndroidNativeBridgeAvailable()) {
24796
24825
  var _window$FronteggNativ;
24797
- (_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(email);
24826
+ (_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(identifier);
24798
24827
  } else {
24799
24828
  throw new Error('FronteggNativeBridge is not available');
24800
24829
  }
@@ -26646,6 +26675,11 @@ let AuthStrategyEnum;
26646
26675
  AuthStrategyEnum["Code"] = "Code";
26647
26676
  AuthStrategyEnum["NoLocalAuthentication"] = "NoLocalAuthentication";
26648
26677
  AuthStrategyEnum["SmsCode"] = "SmsCode";
26678
+ AuthStrategyEnum["WebAuthN"] = "WebAuthN";
26679
+ AuthStrategyEnum["UsernameAndPassword"] = "UsernameAndPassword";
26680
+ AuthStrategyEnum["UsernameAndMagicLink"] = "UsernameAndMagicLink";
26681
+ AuthStrategyEnum["UsernameAndCode"] = "UsernameAndCode";
26682
+ AuthStrategyEnum["UsernameAndSms"] = "UsernameAndSms";
26649
26683
  })(AuthStrategyEnum || (AuthStrategyEnum = {}));
26650
26684
  let MachineToMachineAuthStrategy;
26651
26685
  (function (MachineToMachineAuthStrategy) {
@@ -26715,6 +26749,7 @@ const _excluded = ["type"],
26715
26749
 
26716
26750
 
26717
26751
 
26752
+
26718
26753
  class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.BaseApiClient {
26719
26754
  constructor(appName) {
26720
26755
  super(appName);
@@ -27260,11 +27295,19 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
27260
27295
  });
27261
27296
  };
27262
27297
  this.passwordlessPreLogin = async _ref => {
27298
+ var _usernameToTypeMapper;
27263
27299
  let {
27264
27300
  type
27265
27301
  } = _ref,
27266
27302
  body = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(_ref, _excluded);
27267
- return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/prelogin`, body);
27303
+ const usernameToTypeMapper = {
27304
+ [_enums__WEBPACK_IMPORTED_MODULE_3__.AuthStrategyEnum.UsernameAndCode]: _enums__WEBPACK_IMPORTED_MODULE_3__.AuthStrategyEnum.Code,
27305
+ [_enums__WEBPACK_IMPORTED_MODULE_3__.AuthStrategyEnum.UsernameAndMagicLink]: _enums__WEBPACK_IMPORTED_MODULE_3__.AuthStrategyEnum.MagicLink,
27306
+ [_enums__WEBPACK_IMPORTED_MODULE_3__.AuthStrategyEnum.UsernameAndSms]: _enums__WEBPACK_IMPORTED_MODULE_3__.AuthStrategyEnum.SmsCode,
27307
+ [_enums__WEBPACK_IMPORTED_MODULE_3__.AuthStrategyEnum.UsernameAndPassword]: _enums__WEBPACK_IMPORTED_MODULE_3__.AuthStrategyEnum.EmailAndPassword
27308
+ };
27309
+ const mappedType = ((_usernameToTypeMapper = usernameToTypeMapper[type]) == null ? void 0 : _usernameToTypeMapper.toLowerCase()) || type.toLowerCase();
27310
+ return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.identity.auth.v1}/passwordless/${mappedType}/prelogin`, body);
27268
27311
  };
27269
27312
  this.passwordlessPostLoginV2 = async _ref2 => {
27270
27313
  let {
@@ -28730,7 +28773,7 @@ __webpack_require__.r(__webpack_exports__);
28730
28773
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
28731
28774
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
28732
28775
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
28733
- /** @license Frontegg v7.73.0-alpha.0
28776
+ /** @license Frontegg v7.74.0-alpha.0
28734
28777
  *
28735
28778
  * This source code is licensed under the MIT license found in the
28736
28779
  * LICENSE file in the root directory of this source tree.
@@ -31364,7 +31407,7 @@ __webpack_require__.r(__webpack_exports__);
31364
31407
  /* harmony export */ });
31365
31408
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
31366
31409
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
31367
- /** @license Frontegg v7.73.0-alpha.0
31410
+ /** @license Frontegg v7.74.0-alpha.0
31368
31411
  *
31369
31412
  * This source code is licensed under the MIT license found in the
31370
31413
  * LICENSE file in the root directory of this source tree.