@frontegg/redux-store 5.66.2 → 5.67.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/auth/index.js CHANGED
@@ -1413,7 +1413,7 @@ function* refreshToken() {
1413
1413
  localStorage.setItem('name', user.name);
1414
1414
  }
1415
1415
  const quickLoginToRegister = (_a = localStorage.getItem('register-quick-login')) !== null && _a !== void 0 ? _a : loginState.quickLoginToRegister;
1416
- const shouldNavigateToRegisterQuicKLogin = quickLoginToRegister && localStorage.getItem(`${user.email}-${quickLoginToRegister}`) !== 'true';
1416
+ const shouldNavigateToRegisterQuicKLogin = quickLoginToRegister && localStorage.getItem(`${user.email}-${quickLoginToRegister}`) !== 'true' && !window.location.pathname.endsWith(routes.logoutUrl);
1417
1417
  yield put(actions.setTenantsState({ tenants, loading: false }));
1418
1418
  yield put(actions.setState({
1419
1419
  user,
@@ -1574,6 +1574,7 @@ function* quickSmsPasswordlessPreLogin(_a) {
1574
1574
  loading: false,
1575
1575
  email: payload.email,
1576
1576
  phoneNumber: preloginRes === null || preloginRes === void 0 ? void 0 : preloginRes.phoneNumber,
1577
+ error: undefined,
1577
1578
  }));
1578
1579
  callback === null || callback === void 0 ? void 0 : callback(true);
1579
1580
  }
@@ -1602,6 +1603,7 @@ function* passwordlessPreLogin(_a) {
1602
1603
  loading: false,
1603
1604
  email: payload.email,
1604
1605
  phoneNumber: preloginRes === null || preloginRes === void 0 ? void 0 : preloginRes.phoneNumber,
1606
+ error: undefined
1605
1607
  }));
1606
1608
  callback === null || callback === void 0 ? void 0 : callback();
1607
1609
  }
@@ -1641,6 +1643,7 @@ function* passwordlessPostLogin(_a) {
1641
1643
  localStorage.setItem('name', user.name);
1642
1644
  }
1643
1645
  yield put(actions.setState({ user, isAuthenticated: true }));
1646
+ yield put(actions.setLoginState({ error: undefined }));
1644
1647
  yield put(actions.loadTenants());
1645
1648
  if (loginState.flow === LoginFlow.Login) {
1646
1649
  yield afterAuthNavigation();
@@ -1648,8 +1651,8 @@ function* passwordlessPostLogin(_a) {
1648
1651
  else {
1649
1652
  onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
1650
1653
  }
1654
+ callback === null || callback === void 0 ? void 0 : callback(true);
1651
1655
  }
1652
- callback === null || callback === void 0 ? void 0 : callback(true);
1653
1656
  }
1654
1657
  catch (e) {
1655
1658
  yield put(actions.setLoginState({ error: (_c = e.message) !== null && _c !== void 0 ? _c : 'Failed to authenticate' }));
@@ -1760,6 +1763,7 @@ function* webAuthnPrelogin(_a) {
1760
1763
  const { options } = yield call(api.auth.webAuthnPreLogin, body);
1761
1764
  options.challenge = base64urlDecode(options.challenge);
1762
1765
  options.allowCredentials = (_b = options.allowCredentials) === null || _b === void 0 ? void 0 : _b.map((credentials) => (Object.assign(Object.assign({}, credentials), { id: base64urlDecode(credentials.id) })));
1766
+ yield put(actions.setLoginState({ error: undefined }));
1763
1767
  callback === null || callback === void 0 ? void 0 : callback(options);
1764
1768
  }
1765
1769
  catch (e) {
@@ -1792,9 +1796,10 @@ function* webAuthnPostLogin(_a) {
1792
1796
  }
1793
1797
  yield put(actions.loadTenants());
1794
1798
  yield put(actions.setState({ user, isAuthenticated: true }));
1799
+ yield put(actions.setLoginState({ error: undefined }));
1795
1800
  yield afterAuthNavigation();
1801
+ callback === null || callback === void 0 ? void 0 : callback(true);
1796
1802
  }
1797
- callback === null || callback === void 0 ? void 0 : callback(true);
1798
1803
  }
1799
1804
  catch (e) {
1800
1805
  yield put(actions.setLoginState({ error: e.message }));
@@ -1912,6 +1917,7 @@ function* loginWithMfa({ payload: { mfaToken, value, rememberDevice, callback },
1912
1917
  localStorage.setItem('name', user.name);
1913
1918
  }
1914
1919
  yield put(actions.loadTenants());
1920
+ yield put(actions.setLoginState({ error: undefined, loading: false }));
1915
1921
  if (loginState.flow === LoginFlow.Login) {
1916
1922
  yield afterAuthNavigation();
1917
1923
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var auth_index = require('../index-7cc852ed.js');
5
+ var auth_index = require('../index-8034da1b.js');
6
6
  var constants = require('../constants-52e37c08.js');
7
7
  var restApi = require('@frontegg/rest-api');
8
8
  require('@reduxjs/toolkit');
@@ -1332,7 +1332,7 @@ function* refreshToken() {
1332
1332
  localStorage.setItem('name', user.name);
1333
1333
  }
1334
1334
  const quickLoginToRegister = (_a = localStorage.getItem('register-quick-login')) !== null && _a !== void 0 ? _a : loginState.quickLoginToRegister;
1335
- const shouldNavigateToRegisterQuicKLogin = quickLoginToRegister && localStorage.getItem(`${user.email}-${quickLoginToRegister}`) !== 'true';
1335
+ const shouldNavigateToRegisterQuicKLogin = quickLoginToRegister && localStorage.getItem(`${user.email}-${quickLoginToRegister}`) !== 'true' && !window.location.pathname.endsWith(routes.logoutUrl);
1336
1336
  yield effects.put(actions.setTenantsState({ tenants, loading: false }));
1337
1337
  yield effects.put(actions.setState({
1338
1338
  user,
@@ -1493,6 +1493,7 @@ function* quickSmsPasswordlessPreLogin(_a) {
1493
1493
  loading: false,
1494
1494
  email: payload.email,
1495
1495
  phoneNumber: preloginRes === null || preloginRes === void 0 ? void 0 : preloginRes.phoneNumber,
1496
+ error: undefined,
1496
1497
  }));
1497
1498
  callback === null || callback === void 0 ? void 0 : callback(true);
1498
1499
  }
@@ -1521,6 +1522,7 @@ function* passwordlessPreLogin(_a) {
1521
1522
  loading: false,
1522
1523
  email: payload.email,
1523
1524
  phoneNumber: preloginRes === null || preloginRes === void 0 ? void 0 : preloginRes.phoneNumber,
1525
+ error: undefined
1524
1526
  }));
1525
1527
  callback === null || callback === void 0 ? void 0 : callback();
1526
1528
  }
@@ -1560,6 +1562,7 @@ function* passwordlessPostLogin(_a) {
1560
1562
  localStorage.setItem('name', user.name);
1561
1563
  }
1562
1564
  yield effects.put(actions.setState({ user, isAuthenticated: true }));
1565
+ yield effects.put(actions.setLoginState({ error: undefined }));
1563
1566
  yield effects.put(actions.loadTenants());
1564
1567
  if (loginState.flow === exports.LoginFlow.Login) {
1565
1568
  yield afterAuthNavigation();
@@ -1567,8 +1570,8 @@ function* passwordlessPostLogin(_a) {
1567
1570
  else {
1568
1571
  onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
1569
1572
  }
1573
+ callback === null || callback === void 0 ? void 0 : callback(true);
1570
1574
  }
1571
- callback === null || callback === void 0 ? void 0 : callback(true);
1572
1575
  }
1573
1576
  catch (e) {
1574
1577
  yield effects.put(actions.setLoginState({ error: (_c = e.message) !== null && _c !== void 0 ? _c : 'Failed to authenticate' }));
@@ -1679,6 +1682,7 @@ function* webAuthnPrelogin(_a) {
1679
1682
  const { options } = yield effects.call(restApi.api.auth.webAuthnPreLogin, body);
1680
1683
  options.challenge = vendor_index.base64urlDecode(options.challenge);
1681
1684
  options.allowCredentials = (_b = options.allowCredentials) === null || _b === void 0 ? void 0 : _b.map((credentials) => (Object.assign(Object.assign({}, credentials), { id: vendor_index.base64urlDecode(credentials.id) })));
1685
+ yield effects.put(actions.setLoginState({ error: undefined }));
1682
1686
  callback === null || callback === void 0 ? void 0 : callback(options);
1683
1687
  }
1684
1688
  catch (e) {
@@ -1711,9 +1715,10 @@ function* webAuthnPostLogin(_a) {
1711
1715
  }
1712
1716
  yield effects.put(actions.loadTenants());
1713
1717
  yield effects.put(actions.setState({ user, isAuthenticated: true }));
1718
+ yield effects.put(actions.setLoginState({ error: undefined }));
1714
1719
  yield afterAuthNavigation();
1720
+ callback === null || callback === void 0 ? void 0 : callback(true);
1715
1721
  }
1716
- callback === null || callback === void 0 ? void 0 : callback(true);
1717
1722
  }
1718
1723
  catch (e) {
1719
1724
  yield effects.put(actions.setLoginState({ error: e.message }));
@@ -1831,6 +1836,7 @@ function* loginWithMfa({ payload: { mfaToken, value, rememberDevice, callback },
1831
1836
  localStorage.setItem('name', user.name);
1832
1837
  }
1833
1838
  yield effects.put(actions.loadTenants());
1839
+ yield effects.put(actions.setLoginState({ error: undefined, loading: false }));
1834
1840
  if (loginState.flow === exports.LoginFlow.Login) {
1835
1841
  yield afterAuthNavigation();
1836
1842
  }
package/node/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var auth_index = require('./index-7cc852ed.js');
5
+ var auth_index = require('./index-8034da1b.js');
6
6
  var audits_index = require('./audits/index.js');
7
7
  var connectivity_index = require('./connectivity/index.js');
8
8
  var subscriptions_index = require('./subscriptions/index.js');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var auth_index = require('../index-7cc852ed.js');
5
+ var auth_index = require('../index-8034da1b.js');
6
6
  var toolkit = require('@reduxjs/toolkit');
7
7
  var createSagaMiddleware = require('redux-saga');
8
8
  var effects = require('redux-saga/effects');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
3
  "libName": "FronteggReduxStore",
4
- "version": "5.66.2",
4
+ "version": "5.67.0",
5
5
  "author": "Frontegg LTD",
6
6
  "main": "./node/index.js",
7
7
  "module": "./index.js",