@frontegg/js 7.73.0 → 7.74.0-alpha.1

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
1
+ /** @license Frontegg v7.74.0-alpha.1
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
1
+ /** @license Frontegg v7.74.0-alpha.1
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'
8
+ cdnVersion: '7.74.0-alpha.1'
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",
3
+ "version": "7.74.0-alpha.1",
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"
9
+ "@frontegg/types": "7.74.0-alpha.1"
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'
1783
+ cdnVersion: '7.74.0-alpha.1'
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,
@@ -7590,6 +7609,7 @@ __webpack_require__.r(__webpack_exports__);
7590
7609
  /* harmony export */ isAbsoluteUrl: () => (/* binding */ isAbsoluteUrl),
7591
7610
  /* harmony export */ isEmailPayload: () => (/* binding */ isEmailPayload),
7592
7611
  /* harmony export */ isOauthCallbackRoute: () => (/* binding */ isOauthCallbackRoute),
7612
+ /* harmony export */ isUsernamePayload: () => (/* binding */ isUsernamePayload),
7593
7613
  /* harmony export */ shouldShowPasswordRotationPromptFunc: () => (/* binding */ shouldShowPasswordRotationPromptFunc)
7594
7614
  /* harmony export */ });
7595
7615
  /* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
@@ -7723,6 +7743,9 @@ const isOauthCallbackRoute = activeUri => {
7723
7743
  function isEmailPayload(payload) {
7724
7744
  return 'email' in payload;
7725
7745
  }
7746
+ function isUsernamePayload(payload) {
7747
+ return 'username' in payload;
7748
+ }
7726
7749
  const getBaseNameWithoutSlashSuffix = state => {
7727
7750
  const basename = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.ContextHolder.for(state.root.appName).getBasename();
7728
7751
  if (basename != null && basename.endsWith('/')) {
@@ -16326,6 +16349,7 @@ __webpack_require__.r(__webpack_exports__);
16326
16349
  /* harmony export */ isOauthCallbackRoute: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.isOauthCallbackRoute),
16327
16350
  /* harmony export */ isResetPasswordRequired: () => (/* binding */ isResetPasswordRequired),
16328
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),
16329
16353
  /* harmony export */ mapMetaDataObjectToActions: () => (/* binding */ mapMetaDataObjectToActions),
16330
16354
  /* harmony export */ prepareIdentifiersForSignup: () => (/* binding */ prepareIdentifiersForSignup),
16331
16355
  /* harmony export */ redirectByStepUpUrl: () => (/* reexport safe */ _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__.redirectByStepUpUrl),
@@ -18550,6 +18574,7 @@ __webpack_require__.r(__webpack_exports__);
18550
18574
  /* harmony export */ isProxy: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.isProxy),
18551
18575
  /* harmony export */ isResetPasswordRequired: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isResetPasswordRequired),
18552
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),
18553
18578
  /* harmony export */ mapMetaDataObjectToActions: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.mapMetaDataObjectToActions),
18554
18579
  /* harmony export */ omitProps: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.omitProps),
18555
18580
  /* harmony export */ prepareIdentifiersForSignup: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.prepareIdentifiersForSignup),
@@ -18575,7 +18600,7 @@ __webpack_require__.r(__webpack_exports__);
18575
18600
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
18576
18601
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
18577
18602
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
18578
- /** @license Frontegg v7.73.0
18603
+ /** @license Frontegg v7.74.0-alpha.1
18579
18604
  *
18580
18605
  * This source code is licensed under the MIT license found in the
18581
18606
  * LICENSE file in the root directory of this source tree.
@@ -24789,16 +24814,16 @@ __webpack_require__.r(__webpack_exports__);
24789
24814
  /* harmony export */ });
24790
24815
  class FronteggNativeModule {
24791
24816
  constructor() {
24792
- this.loginWithSSO = email => {
24817
+ this.loginWithSSO = identifier => {
24793
24818
  if (this.isIOSNativeBridgeAvailable()) {
24794
24819
  var _window$webkit, _window$webkit$messag, _window$webkit$messag2;
24795
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({
24796
24821
  action: 'loginWithSSO',
24797
- payload: email
24822
+ payload: identifier
24798
24823
  }));
24799
24824
  } else if (this.isAndroidNativeBridgeAvailable()) {
24800
24825
  var _window$FronteggNativ;
24801
- (_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(email);
24826
+ (_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(identifier);
24802
24827
  } else {
24803
24828
  throw new Error('FronteggNativeBridge is not available');
24804
24829
  }
@@ -26724,6 +26749,7 @@ const _excluded = ["type"],
26724
26749
 
26725
26750
 
26726
26751
 
26752
+
26727
26753
  class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.BaseApiClient {
26728
26754
  constructor(appName) {
26729
26755
  super(appName);
@@ -27269,11 +27295,19 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
27269
27295
  });
27270
27296
  };
27271
27297
  this.passwordlessPreLogin = async _ref => {
27298
+ var _usernameToTypeMapper;
27272
27299
  let {
27273
27300
  type
27274
27301
  } = _ref,
27275
27302
  body = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(_ref, _excluded);
27276
- 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);
27277
27311
  };
27278
27312
  this.passwordlessPostLoginV2 = async _ref2 => {
27279
27313
  let {
@@ -28739,7 +28773,7 @@ __webpack_require__.r(__webpack_exports__);
28739
28773
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
28740
28774
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
28741
28775
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
28742
- /** @license Frontegg v7.73.0
28776
+ /** @license Frontegg v7.74.0-alpha.1
28743
28777
  *
28744
28778
  * This source code is licensed under the MIT license found in the
28745
28779
  * LICENSE file in the root directory of this source tree.
@@ -31373,7 +31407,7 @@ __webpack_require__.r(__webpack_exports__);
31373
31407
  /* harmony export */ });
31374
31408
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
31375
31409
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
31376
- /** @license Frontegg v7.73.0
31410
+ /** @license Frontegg v7.74.0-alpha.1
31377
31411
  *
31378
31412
  * This source code is licensed under the MIT license found in the
31379
31413
  * LICENSE file in the root directory of this source tree.