@frontegg/redux-store 6.167.0-alpha.0 → 6.167.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/LoginState/saga.js +15 -15
- package/index.js +1 -1
- package/node/auth/LoginState/saga.js +15 -15
- package/node/index.js +1 -1
- package/package.json +1 -1
- package/toolkit/interfaces.d.ts +0 -1
package/auth/LoginState/saga.js
CHANGED
|
@@ -37,6 +37,7 @@ import { isEntitlementsDeeplyEqual } from '../Entitlements';
|
|
|
37
37
|
import { loadCustomLoginRoutes } from '../CustomLoginState/saga';
|
|
38
38
|
import { FronteggNativeModule } from '../../toolkit';
|
|
39
39
|
import { afterAuthenticationStateUpdate, shouldShowPromptPasskeys } from './saga.utils';
|
|
40
|
+
import { isSteppedUp } from '../StepUpState/utils';
|
|
40
41
|
import { afterAuthNavigation, loginWithMfa, preVerifyMFASMSForLogin, verifyMFASMSForLogin, preVerifyMFAWebAuthnForLogin, verifyMFAWebAuthnForLogin, preVerifyMFAEmailCodeForLogin, verifyMFAEmailCodeForLogin, afterStepUpAuthNavigation } from './sagas';
|
|
41
42
|
import { SHOULD_STEP_UP_KEY } from '../StepUpState/consts';
|
|
42
43
|
|
|
@@ -441,6 +442,9 @@ function* requestHostedLoginSilentAuthorize() {
|
|
|
441
442
|
function* refreshOrRequestHostedLoginAuthorize({
|
|
442
443
|
payload: additionalParams
|
|
443
444
|
}) {
|
|
445
|
+
var _localStorage;
|
|
446
|
+
// when the user pause the step up flow we may still have the key in the local storage in hosted - Remove it
|
|
447
|
+
(_localStorage = localStorage) == null ? void 0 : _localStorage.removeItem(SHOULD_STEP_UP_KEY);
|
|
444
448
|
const {
|
|
445
449
|
disableSilentRefresh
|
|
446
450
|
} = yield select(state => ({
|
|
@@ -467,7 +471,9 @@ function* refreshOrRequestHostedLoginAuthorizeV2({
|
|
|
467
471
|
loginDirectAction
|
|
468
472
|
}
|
|
469
473
|
}) {
|
|
470
|
-
var _additionalParams;
|
|
474
|
+
var _localStorage2, _additionalParams;
|
|
475
|
+
// when the user pause the step up flow we may still have the key in the local storage in hosted - Remove it
|
|
476
|
+
(_localStorage2 = localStorage) == null ? void 0 : _localStorage2.removeItem(SHOULD_STEP_UP_KEY);
|
|
471
477
|
if (firstTime) {
|
|
472
478
|
const {
|
|
473
479
|
urlStrategy
|
|
@@ -620,9 +626,14 @@ function* handleHostedLoginCallback({
|
|
|
620
626
|
}));
|
|
621
627
|
console.error('Failed to exchangeOAuthTokens', e);
|
|
622
628
|
} finally {
|
|
629
|
+
const user = yield select(({
|
|
630
|
+
auth
|
|
631
|
+
}) => auth.user);
|
|
623
632
|
const isStepUpFlow = window.localStorage.getItem(SHOULD_STEP_UP_KEY);
|
|
624
633
|
window.localStorage.removeItem(SHOULD_STEP_UP_KEY);
|
|
625
|
-
|
|
634
|
+
|
|
635
|
+
// when the user pause the step up flow we may still have the key in the local storage in hosted. Ignore it.
|
|
636
|
+
if (isStepUpFlow && isSteppedUp(user)) {
|
|
626
637
|
yield afterStepUpAuthNavigation();
|
|
627
638
|
} else {
|
|
628
639
|
yield afterAuthNavigation();
|
|
@@ -1312,25 +1323,14 @@ function* logout({
|
|
|
1312
1323
|
payload
|
|
1313
1324
|
}) {
|
|
1314
1325
|
const {
|
|
1315
|
-
hostedLoginBox
|
|
1316
|
-
|
|
1317
|
-
} = yield select(state => ({
|
|
1318
|
-
hostedLoginBox: state.auth.hostedLoginBox,
|
|
1319
|
-
isNextJs: state.root.framework === 'nextjs'
|
|
1320
|
-
}));
|
|
1326
|
+
hostedLoginBox
|
|
1327
|
+
} = yield select(state => state.auth);
|
|
1321
1328
|
yield put(actions.setState({
|
|
1322
1329
|
isLoading: true
|
|
1323
1330
|
}));
|
|
1324
1331
|
try {
|
|
1325
1332
|
if (hostedLoginBox) {
|
|
1326
1333
|
yield call(api.auth.OAuthLogout);
|
|
1327
|
-
if (isNextJs) {
|
|
1328
|
-
var _ContextHolder$getCon;
|
|
1329
|
-
const contextBaseUrl = (_ContextHolder$getCon = ContextHolder.getContext()) == null ? void 0 : _ContextHolder$getCon.baseUrl;
|
|
1330
|
-
const baseUrl = typeof contextBaseUrl === 'function' ? contextBaseUrl('') : contextBaseUrl;
|
|
1331
|
-
const logoutRoute = `${baseUrl}/oauth/logout?post_logout_redirect_uri=${encodeURIComponent(window.location.href)}`;
|
|
1332
|
-
window.location.href = logoutRoute;
|
|
1333
|
-
}
|
|
1334
1334
|
} else {
|
|
1335
1335
|
yield call(api.auth.logout);
|
|
1336
1336
|
}
|
package/index.js
CHANGED
|
@@ -47,6 +47,7 @@ var _Entitlements = require("../Entitlements");
|
|
|
47
47
|
var _saga4 = require("../CustomLoginState/saga");
|
|
48
48
|
var _toolkit = require("../../toolkit");
|
|
49
49
|
var _saga5 = require("./saga.utils");
|
|
50
|
+
var _utils4 = require("../StepUpState/utils");
|
|
50
51
|
var _sagas = require("./sagas");
|
|
51
52
|
var _consts2 = require("../StepUpState/consts");
|
|
52
53
|
var _afterAuthNavigation = require("./sagas/afterAuthNavigation.saga");
|
|
@@ -467,6 +468,9 @@ function* requestHostedLoginSilentAuthorize() {
|
|
|
467
468
|
function* refreshOrRequestHostedLoginAuthorize({
|
|
468
469
|
payload: additionalParams
|
|
469
470
|
}) {
|
|
471
|
+
var _localStorage;
|
|
472
|
+
// when the user pause the step up flow we may still have the key in the local storage in hosted - Remove it
|
|
473
|
+
(_localStorage = localStorage) == null ? void 0 : _localStorage.removeItem(_consts2.SHOULD_STEP_UP_KEY);
|
|
470
474
|
const {
|
|
471
475
|
disableSilentRefresh
|
|
472
476
|
} = yield (0, _effects.select)(state => ({
|
|
@@ -493,7 +497,9 @@ function* refreshOrRequestHostedLoginAuthorizeV2({
|
|
|
493
497
|
loginDirectAction
|
|
494
498
|
}
|
|
495
499
|
}) {
|
|
496
|
-
var _additionalParams;
|
|
500
|
+
var _localStorage2, _additionalParams;
|
|
501
|
+
// when the user pause the step up flow we may still have the key in the local storage in hosted - Remove it
|
|
502
|
+
(_localStorage2 = localStorage) == null ? void 0 : _localStorage2.removeItem(_consts2.SHOULD_STEP_UP_KEY);
|
|
497
503
|
if (firstTime) {
|
|
498
504
|
const {
|
|
499
505
|
urlStrategy
|
|
@@ -646,9 +652,14 @@ function* handleHostedLoginCallback({
|
|
|
646
652
|
}));
|
|
647
653
|
console.error('Failed to exchangeOAuthTokens', e);
|
|
648
654
|
} finally {
|
|
655
|
+
const user = yield (0, _effects.select)(({
|
|
656
|
+
auth
|
|
657
|
+
}) => auth.user);
|
|
649
658
|
const isStepUpFlow = window.localStorage.getItem(_consts2.SHOULD_STEP_UP_KEY);
|
|
650
659
|
window.localStorage.removeItem(_consts2.SHOULD_STEP_UP_KEY);
|
|
651
|
-
|
|
660
|
+
|
|
661
|
+
// when the user pause the step up flow we may still have the key in the local storage in hosted. Ignore it.
|
|
662
|
+
if (isStepUpFlow && (0, _utils4.isSteppedUp)(user)) {
|
|
652
663
|
yield (0, _sagas.afterStepUpAuthNavigation)();
|
|
653
664
|
} else {
|
|
654
665
|
yield (0, _sagas.afterAuthNavigation)();
|
|
@@ -1338,25 +1349,14 @@ function* logout({
|
|
|
1338
1349
|
payload
|
|
1339
1350
|
}) {
|
|
1340
1351
|
const {
|
|
1341
|
-
hostedLoginBox
|
|
1342
|
-
|
|
1343
|
-
} = yield (0, _effects.select)(state => ({
|
|
1344
|
-
hostedLoginBox: state.auth.hostedLoginBox,
|
|
1345
|
-
isNextJs: state.root.framework === 'nextjs'
|
|
1346
|
-
}));
|
|
1352
|
+
hostedLoginBox
|
|
1353
|
+
} = yield (0, _effects.select)(state => state.auth);
|
|
1347
1354
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
1348
1355
|
isLoading: true
|
|
1349
1356
|
}));
|
|
1350
1357
|
try {
|
|
1351
1358
|
if (hostedLoginBox) {
|
|
1352
1359
|
yield (0, _effects.call)(_restApi.api.auth.OAuthLogout);
|
|
1353
|
-
if (isNextJs) {
|
|
1354
|
-
var _ContextHolder$getCon;
|
|
1355
|
-
const contextBaseUrl = (_ContextHolder$getCon = _restApi.ContextHolder.getContext()) == null ? void 0 : _ContextHolder$getCon.baseUrl;
|
|
1356
|
-
const baseUrl = typeof contextBaseUrl === 'function' ? contextBaseUrl('') : contextBaseUrl;
|
|
1357
|
-
const logoutRoute = `${baseUrl}/oauth/logout?post_logout_redirect_uri=${encodeURIComponent(window.location.href)}`;
|
|
1358
|
-
window.location.href = logoutRoute;
|
|
1359
|
-
}
|
|
1360
1360
|
} else {
|
|
1361
1361
|
yield (0, _effects.call)(_restApi.api.auth.logout);
|
|
1362
1362
|
}
|
package/node/index.js
CHANGED
package/package.json
CHANGED