@frontegg/redux-store 7.75.0 → 7.76.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/auth/ForgotPasswordState/actions.d.ts +2 -1
- package/auth/ForgotPasswordState/actions.js +42 -1
- package/auth/ForgotPasswordState/interfaces.d.ts +8 -1
- package/auth/ForgotPasswordState/interfaces.js +3 -0
- package/auth/ForgotPasswordState/state.js +1 -1
- package/auth/LoginState/actions/handleVerifyMFAResponse.actions.js +3 -3
- package/auth/LoginState/actions/index.js +35 -16
- package/auth/LoginState/actions/mfaWithAuthenticator.actions.js +3 -3
- package/auth/LoginState/helpers.d.ts +2 -1
- package/auth/LoginState/helpers.js +4 -1
- package/auth/UsernamesState/actions.d.ts +9 -0
- package/auth/UsernamesState/actions.js +100 -0
- package/auth/UsernamesState/index.d.ts +3 -0
- package/auth/UsernamesState/index.js +3 -0
- package/auth/UsernamesState/interfaces.d.ts +7 -0
- package/auth/UsernamesState/interfaces.js +1 -0
- package/auth/UsernamesState/state.d.ts +4 -0
- package/auth/UsernamesState/state.js +8 -0
- package/auth/index.d.ts +5 -1
- package/auth/index.js +5 -0
- package/auth/interfaces.d.ts +2 -0
- package/index.js +1 -1
- package/mocks/auth-mocks/forgotPasswordActions.mocks.d.ts +1 -0
- package/mocks/auth-mocks/index.js +4 -1
- package/node/auth/ForgotPasswordState/actions.js +42 -1
- package/node/auth/ForgotPasswordState/interfaces.js +3 -0
- package/node/auth/ForgotPasswordState/state.js +1 -1
- package/node/auth/LoginState/actions/handleVerifyMFAResponse.actions.js +3 -3
- package/node/auth/LoginState/actions/index.js +34 -15
- package/node/auth/LoginState/actions/mfaWithAuthenticator.actions.js +3 -3
- package/node/auth/LoginState/helpers.js +7 -2
- package/node/auth/UsernamesState/actions.js +107 -0
- package/node/auth/UsernamesState/index.js +20 -0
- package/node/auth/UsernamesState/interfaces.js +5 -0
- package/node/auth/UsernamesState/state.js +16 -0
- package/node/auth/index.js +18 -2
- package/node/index.js +1 -1
- package/node/mocks/auth-mocks/index.js +4 -1
- package/node/toolkit/FronteggNativeModule.js +3 -3
- package/package.json +2 -2
- package/toolkit/FronteggNativeModule.d.ts +1 -1
- package/toolkit/FronteggNativeModule.js +3 -3
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
|
+
var _restApi = require("@frontegg/rest-api");
|
|
9
10
|
var _interfaces = require("./interfaces");
|
|
10
11
|
var _state = require("./state");
|
|
11
12
|
var _helpers = require("../../helpers");
|
|
@@ -40,6 +41,45 @@ var _default = (store, api, sharedActions) => {
|
|
|
40
41
|
(_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, false, e);
|
|
41
42
|
}
|
|
42
43
|
};
|
|
44
|
+
const determinePasswordRecoveryStrategy = async payload => {
|
|
45
|
+
setForgotPasswordState({
|
|
46
|
+
loading: true,
|
|
47
|
+
error: undefined,
|
|
48
|
+
identifier: payload.identifier
|
|
49
|
+
});
|
|
50
|
+
try {
|
|
51
|
+
const strategies = await api.auth.getPasswordRecoveryStrategies();
|
|
52
|
+
const isEmailActive = strategies.some(s => s.strategy === _restApi.PasswordRecoveryStrategyEnum.Email && s.isActive);
|
|
53
|
+
const isSmsActive = strategies.some(s => s.strategy === _restApi.PasswordRecoveryStrategyEnum.Sms && s.isActive);
|
|
54
|
+
if (isEmailActive && isSmsActive) {
|
|
55
|
+
setForgotPasswordState({
|
|
56
|
+
loading: false,
|
|
57
|
+
step: _interfaces.ForgotPasswordStep.passwordRecoverySelector
|
|
58
|
+
});
|
|
59
|
+
} else if (isEmailActive) {
|
|
60
|
+
await forgotPassword({
|
|
61
|
+
email: payload.identifier,
|
|
62
|
+
recaptchaToken: payload.recaptchaToken
|
|
63
|
+
});
|
|
64
|
+
} else if (isSmsActive) {
|
|
65
|
+
setForgotPasswordState({
|
|
66
|
+
loading: false,
|
|
67
|
+
step: _interfaces.ForgotPasswordStep.resetPasswordViaSms
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
const error = 'No active password recovery methods found.';
|
|
71
|
+
setForgotPasswordState({
|
|
72
|
+
loading: false,
|
|
73
|
+
error
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
} catch (e) {
|
|
77
|
+
setForgotPasswordState({
|
|
78
|
+
loading: false,
|
|
79
|
+
error: (0, _helpers.errorHandler)(e, 'An error occurred while determining recovery strategy')
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
43
83
|
const resetPassword = async payload => {
|
|
44
84
|
const {
|
|
45
85
|
callback
|
|
@@ -86,7 +126,8 @@ var _default = (store, api, sharedActions) => {
|
|
|
86
126
|
resetForgotPasswordState,
|
|
87
127
|
forgotPassword,
|
|
88
128
|
resetPassword,
|
|
89
|
-
loadPasswordConfig
|
|
129
|
+
loadPasswordConfig,
|
|
130
|
+
determinePasswordRecoveryStrategy
|
|
90
131
|
};
|
|
91
132
|
};
|
|
92
133
|
exports.default = _default;
|
|
@@ -8,5 +8,8 @@ let ForgotPasswordStep;
|
|
|
8
8
|
exports.ForgotPasswordStep = ForgotPasswordStep;
|
|
9
9
|
(function (ForgotPasswordStep) {
|
|
10
10
|
ForgotPasswordStep["forgotPassword"] = "forgotPassword";
|
|
11
|
+
ForgotPasswordStep["resetPasswordViaSms"] = "resetPasswordViaSms";
|
|
12
|
+
ForgotPasswordStep["passwordRecoverySelector"] = "passwordRecoverySelector";
|
|
13
|
+
ForgotPasswordStep["resetPasswordPage"] = "resetPasswordPage";
|
|
11
14
|
ForgotPasswordStep["success"] = "success";
|
|
12
15
|
})(ForgotPasswordStep || (exports.ForgotPasswordStep = ForgotPasswordStep = {}));
|
|
@@ -35,7 +35,7 @@ function _default(store, api, sharedActions) {
|
|
|
35
35
|
const postHandleVerifyMFAResponseForLogin = async (isAuthenticated, user) => {
|
|
36
36
|
const loginState = store.auth.loginState;
|
|
37
37
|
const mfaStep = store.auth.mfaState.step;
|
|
38
|
-
const [securityCenterLoginFlows
|
|
38
|
+
const [securityCenterLoginFlows] = await actions.getFeatureFlags(['security-center-show-login-flows']);
|
|
39
39
|
if (loginState.flow === _interfaces2.LoginFlow.Login) {
|
|
40
40
|
if (securityCenterLoginFlows && loginState.isBreachedPassword && !isAuthenticated) {
|
|
41
41
|
actions.setLoginState({
|
|
@@ -44,7 +44,7 @@ function _default(store, api, sharedActions) {
|
|
|
44
44
|
});
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
if (
|
|
47
|
+
if ((0, _helpers.isResetPasswordRequired)(user, store.root.appName)) {
|
|
48
48
|
actions.setLoginState({
|
|
49
49
|
step: _interfaces2.LoginStep.passwordRotationExpired,
|
|
50
50
|
loading: false,
|
|
@@ -53,7 +53,7 @@ function _default(store, api, sharedActions) {
|
|
|
53
53
|
});
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
if (
|
|
56
|
+
if ((0, _helpers.shouldShowPasswordRotationPromptFunc)(user)) {
|
|
57
57
|
actions.setLoginState({
|
|
58
58
|
step: _interfaces2.LoginStep.passwordRotationNotification,
|
|
59
59
|
loading: false
|
|
@@ -354,6 +354,7 @@ var _default = (store, api, sharedActions) => {
|
|
|
354
354
|
const preLogin = async payload => {
|
|
355
355
|
const {
|
|
356
356
|
email,
|
|
357
|
+
username,
|
|
357
358
|
recaptchaToken,
|
|
358
359
|
invitationToken,
|
|
359
360
|
callback
|
|
@@ -364,10 +365,13 @@ var _default = (store, api, sharedActions) => {
|
|
|
364
365
|
try {
|
|
365
366
|
const onRedirectTo = store.auth.onRedirectTo;
|
|
366
367
|
const tenantId = (0, _helpers2.getSearchParam)(_helpers2.TENANT_ID_PARAM_KEY);
|
|
367
|
-
const preLoginResult = await api.auth.preLoginV2({
|
|
368
|
-
email
|
|
368
|
+
const preLoginResult = await api.auth.preLoginV2((0, _extends2.default)({}, email ? {
|
|
369
|
+
email
|
|
370
|
+
} : {}, username ? {
|
|
371
|
+
username
|
|
372
|
+
} : {}, {
|
|
369
373
|
tenantId
|
|
370
|
-
});
|
|
374
|
+
}));
|
|
371
375
|
const {
|
|
372
376
|
address,
|
|
373
377
|
idpType
|
|
@@ -381,7 +385,8 @@ var _default = (store, api, sharedActions) => {
|
|
|
381
385
|
ssoRedirectUrl += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
|
|
382
386
|
}
|
|
383
387
|
if (_toolkit.FronteggNativeModule.isLoginWithSSOAvailable()) {
|
|
384
|
-
|
|
388
|
+
var _ref4;
|
|
389
|
+
_toolkit.FronteggNativeModule.loginWithSSO((_ref4 = email != null ? email : username) != null ? _ref4 : '');
|
|
385
390
|
setLoginState({
|
|
386
391
|
loading: false
|
|
387
392
|
});
|
|
@@ -399,16 +404,18 @@ var _default = (store, api, sharedActions) => {
|
|
|
399
404
|
}, 2000);
|
|
400
405
|
}
|
|
401
406
|
} else {
|
|
407
|
+
var _ref5;
|
|
402
408
|
await ssoPreloginFailed({
|
|
403
|
-
email,
|
|
409
|
+
email: (_ref5 = email != null ? email : username) != null ? _ref5 : '',
|
|
404
410
|
recaptchaToken,
|
|
405
411
|
callback,
|
|
406
412
|
invitationToken
|
|
407
413
|
});
|
|
408
414
|
}
|
|
409
415
|
} catch (e) {
|
|
416
|
+
var _ref6;
|
|
410
417
|
await ssoPreloginFailed({
|
|
411
|
-
email,
|
|
418
|
+
email: (_ref6 = email != null ? email : username) != null ? _ref6 : '',
|
|
412
419
|
recaptchaToken,
|
|
413
420
|
callback,
|
|
414
421
|
invitationToken,
|
|
@@ -444,6 +451,7 @@ var _default = (store, api, sharedActions) => {
|
|
|
444
451
|
const login = async payload => {
|
|
445
452
|
const {
|
|
446
453
|
email,
|
|
454
|
+
username,
|
|
447
455
|
password,
|
|
448
456
|
recaptchaToken,
|
|
449
457
|
invitationToken,
|
|
@@ -457,12 +465,15 @@ var _default = (store, api, sharedActions) => {
|
|
|
457
465
|
user,
|
|
458
466
|
tenants = [],
|
|
459
467
|
activeTenant
|
|
460
|
-
} = await api.auth.loginv2({
|
|
461
|
-
email
|
|
468
|
+
} = await api.auth.loginv2((0, _extends2.default)({}, email ? {
|
|
469
|
+
email
|
|
470
|
+
} : {}, username ? {
|
|
471
|
+
username
|
|
472
|
+
} : {}, {
|
|
462
473
|
password,
|
|
463
474
|
recaptchaToken,
|
|
464
475
|
invitationToken
|
|
465
|
-
});
|
|
476
|
+
}));
|
|
466
477
|
const {
|
|
467
478
|
onRedirectTo,
|
|
468
479
|
routes
|
|
@@ -474,8 +485,8 @@ var _default = (store, api, sharedActions) => {
|
|
|
474
485
|
preserveQueryParams: true
|
|
475
486
|
});
|
|
476
487
|
} else {
|
|
477
|
-
const [securityCenterLoginFlows
|
|
478
|
-
if (
|
|
488
|
+
const [securityCenterLoginFlows] = await actions.getFeatureFlags(['security-center-show-login-flows']);
|
|
489
|
+
if ((0, _helpers3.isResetPasswordRequired)(user, store.root.appName)) {
|
|
479
490
|
setLoginState({
|
|
480
491
|
step: _interfaces.LoginStep.passwordRotationExpired,
|
|
481
492
|
loading: false,
|
|
@@ -516,7 +527,7 @@ var _default = (store, api, sharedActions) => {
|
|
|
516
527
|
} else {
|
|
517
528
|
if (isAuthenticated) {
|
|
518
529
|
const shouldShowPasswordRotationPrompt = (0, _helpers2.shouldShowPasswordRotationPromptFunc)(user);
|
|
519
|
-
if (
|
|
530
|
+
if (shouldShowPasswordRotationPrompt) {
|
|
520
531
|
setLoginState({
|
|
521
532
|
step: _interfaces.LoginStep.passwordRotationNotification,
|
|
522
533
|
loading: false
|
|
@@ -702,6 +713,7 @@ var _default = (store, api, sharedActions) => {
|
|
|
702
713
|
} = _payload,
|
|
703
714
|
payload = (0, _objectWithoutPropertiesLoose2.default)(_payload, _excluded5);
|
|
704
715
|
try {
|
|
716
|
+
var _username;
|
|
705
717
|
setLoginState({
|
|
706
718
|
loading: true
|
|
707
719
|
});
|
|
@@ -709,9 +721,16 @@ var _default = (store, api, sharedActions) => {
|
|
|
709
721
|
if ((0, _helpers2.isEmailPayload)(payload)) {
|
|
710
722
|
email = payload.email;
|
|
711
723
|
}
|
|
724
|
+
let username;
|
|
725
|
+
if ((0, _helpers2.isUsernamePayload)(payload)) {
|
|
726
|
+
username = payload.username;
|
|
727
|
+
}
|
|
712
728
|
// TODO: [Typescript 4.8] fix @frontegg/rest-api return value
|
|
713
729
|
// @ts-ignore
|
|
714
|
-
const preloginRes = await api.auth.passwordlessPreLogin(payload
|
|
730
|
+
const preloginRes = await api.auth.passwordlessPreLogin((0, _extends2.default)({}, payload, {
|
|
731
|
+
email,
|
|
732
|
+
username: (_username = username) != null ? _username : ''
|
|
733
|
+
}));
|
|
715
734
|
// @ts-ignore
|
|
716
735
|
const step = _consts.authStrategyLoginStepMap[payload.type];
|
|
717
736
|
setLoginState({
|
|
@@ -1303,11 +1322,11 @@ var _default = (store, api, sharedActions) => {
|
|
|
1303
1322
|
preserveQueryParams: true
|
|
1304
1323
|
});
|
|
1305
1324
|
} else {
|
|
1306
|
-
var
|
|
1325
|
+
var _ref7;
|
|
1307
1326
|
if (user.id) {
|
|
1308
1327
|
localStorage.setItem('userId', user.id);
|
|
1309
1328
|
}
|
|
1310
|
-
const quickLoginToRegister = (
|
|
1329
|
+
const quickLoginToRegister = (_ref7 = localStorage.getItem('register-quick-login')) != null ? _ref7 : loginState.quickLoginToRegister;
|
|
1311
1330
|
const shouldNavigateToRegisterQuickLogin = __shouldNavigateToRegisterQuickLogin(user);
|
|
1312
1331
|
actions.afterAuthenticationStateUpdate({
|
|
1313
1332
|
user: updatedUser,
|
|
@@ -49,7 +49,7 @@ var _default = (store, api, sharedActions) => {
|
|
|
49
49
|
async function __postLoginMfaAuthenticator(isAuthenticated, user, callback) {
|
|
50
50
|
const loginState = store.auth.loginState;
|
|
51
51
|
if (loginState.flow !== _interfaces.LoginFlow.Login) return;
|
|
52
|
-
const [securityCenterLoginFlows
|
|
52
|
+
const [securityCenterLoginFlows] = await actions.getFeatureFlags(['security-center-show-login-flows']);
|
|
53
53
|
if (securityCenterLoginFlows && loginState.isBreachedPassword && !isAuthenticated) {
|
|
54
54
|
actions.setLoginState({
|
|
55
55
|
step: _interfaces.LoginStep.breachedPassword,
|
|
@@ -58,7 +58,7 @@ var _default = (store, api, sharedActions) => {
|
|
|
58
58
|
callback == null ? void 0 : callback(true);
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
if (
|
|
61
|
+
if ((0, _helpers2.isResetPasswordRequired)(user, store.root.appName)) {
|
|
62
62
|
actions.setLoginState({
|
|
63
63
|
step: _interfaces.LoginStep.passwordRotationExpired,
|
|
64
64
|
loading: false,
|
|
@@ -69,7 +69,7 @@ var _default = (store, api, sharedActions) => {
|
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
const shouldShowPasswordRotationPrompt = (0, _helpers2.shouldShowPasswordRotationPromptFunc)(user);
|
|
72
|
-
if (
|
|
72
|
+
if (shouldShowPasswordRotationPrompt) {
|
|
73
73
|
actions.setLoginState({
|
|
74
74
|
step: _interfaces.LoginStep.passwordRotationNotification,
|
|
75
75
|
loading: false
|
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.isAbsoluteUrl = exports.getSearchParamsFromUrl = exports.getSearchParam = exports.getRedirectUrl = exports.getPathAndSearchParamsFromUrl = exports.getNumberOfMfaDevices = exports.getMfaStepForNotEnrolledUsers = exports.getMfaStepForEnrolledUsers = exports.getBaseNameWithoutSlashSuffix = exports.TENANT_ID_PARAM_KEY = void 0;
|
|
7
7
|
exports.isEmailPayload = isEmailPayload;
|
|
8
|
-
exports.
|
|
8
|
+
exports.isOauthCallbackRoute = void 0;
|
|
9
|
+
exports.isUsernamePayload = isUsernamePayload;
|
|
10
|
+
exports.shouldShowPasswordRotationPromptFunc = void 0;
|
|
9
11
|
var _restApi = require("@frontegg/rest-api");
|
|
10
12
|
var _interfaces = require("../MfaState/interfaces");
|
|
11
13
|
const isAbsoluteUrl = path => {
|
|
@@ -142,7 +144,10 @@ const isOauthCallbackRoute = activeUri => {
|
|
|
142
144
|
};
|
|
143
145
|
exports.isOauthCallbackRoute = isOauthCallbackRoute;
|
|
144
146
|
function isEmailPayload(payload) {
|
|
145
|
-
return 'email' in payload;
|
|
147
|
+
return 'email' in payload && typeof payload['email'] === 'string';
|
|
148
|
+
}
|
|
149
|
+
function isUsernamePayload(payload) {
|
|
150
|
+
return 'username' in payload && typeof payload['username'] === 'string';
|
|
146
151
|
}
|
|
147
152
|
const getBaseNameWithoutSlashSuffix = state => {
|
|
148
153
|
const basename = _restApi.ContextHolder.for(state.root.appName).getBasename();
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _helpers = require("../../helpers");
|
|
8
|
+
var _state = require("./state");
|
|
9
|
+
var _default = (store, api, sharedActions) => {
|
|
10
|
+
const setUsernamesState = state => {
|
|
11
|
+
Object.assign(store.auth.usernamesState, state);
|
|
12
|
+
};
|
|
13
|
+
const resetUsernamesState = () => {
|
|
14
|
+
(0, _helpers.deepResetState)(store, ['auth', 'usernamesState'], _state.initialState);
|
|
15
|
+
};
|
|
16
|
+
const loadUserOwnUsername = async () => {
|
|
17
|
+
setUsernamesState({
|
|
18
|
+
loading: true
|
|
19
|
+
});
|
|
20
|
+
try {
|
|
21
|
+
const response = await api.usernames.getUserOwnUsername();
|
|
22
|
+
setUsernamesState({
|
|
23
|
+
username: response == null ? void 0 : response.username,
|
|
24
|
+
loading: false,
|
|
25
|
+
fetching: false
|
|
26
|
+
});
|
|
27
|
+
} catch (e) {
|
|
28
|
+
setUsernamesState({
|
|
29
|
+
error: (0, _helpers.errorHandler)(e),
|
|
30
|
+
fetching: false
|
|
31
|
+
});
|
|
32
|
+
} finally {
|
|
33
|
+
setUsernamesState({
|
|
34
|
+
loading: false,
|
|
35
|
+
fetching: false
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const saveUserUsername = async payload => {
|
|
40
|
+
setUsernamesState({
|
|
41
|
+
loading: true
|
|
42
|
+
});
|
|
43
|
+
try {
|
|
44
|
+
if (store.auth.usernamesState.username === payload.username) {
|
|
45
|
+
var _payload$callback;
|
|
46
|
+
(_payload$callback = payload.callback) == null ? void 0 : _payload$callback.call(payload);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (store.auth.usernamesState.username && store.auth.usernamesState.username !== payload.username) {
|
|
50
|
+
await deleteUserUsername(store.auth.usernamesState.username);
|
|
51
|
+
if (!payload.username) {
|
|
52
|
+
var _payload$callback2;
|
|
53
|
+
setUsernamesState({
|
|
54
|
+
username: undefined,
|
|
55
|
+
loading: false
|
|
56
|
+
});
|
|
57
|
+
(_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!!payload.username) {
|
|
62
|
+
var _payload$callback3;
|
|
63
|
+
await api.usernames.createUsername(payload);
|
|
64
|
+
setUsernamesState({
|
|
65
|
+
username: payload.username,
|
|
66
|
+
loading: false
|
|
67
|
+
});
|
|
68
|
+
(_payload$callback3 = payload.callback) == null ? void 0 : _payload$callback3.call(payload);
|
|
69
|
+
}
|
|
70
|
+
} catch (e) {
|
|
71
|
+
setUsernamesState({
|
|
72
|
+
error: (0, _helpers.errorHandler)(e)
|
|
73
|
+
});
|
|
74
|
+
} finally {
|
|
75
|
+
setUsernamesState({
|
|
76
|
+
loading: false
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const deleteUserUsername = async username => {
|
|
81
|
+
setUsernamesState({
|
|
82
|
+
loading: true
|
|
83
|
+
});
|
|
84
|
+
try {
|
|
85
|
+
await api.usernames.deleteUsername(username);
|
|
86
|
+
setUsernamesState({
|
|
87
|
+
username: undefined,
|
|
88
|
+
loading: false
|
|
89
|
+
});
|
|
90
|
+
} catch (e) {
|
|
91
|
+
setUsernamesState({
|
|
92
|
+
error: (0, _helpers.errorHandler)(e)
|
|
93
|
+
});
|
|
94
|
+
} finally {
|
|
95
|
+
setUsernamesState({
|
|
96
|
+
loading: false
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
resetUsernamesState,
|
|
102
|
+
loadUserOwnUsername,
|
|
103
|
+
saveUserUsername,
|
|
104
|
+
deleteUserUsername
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
exports.default = _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "buildUsernamesActions", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _actions.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "createUsernamesState", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _state.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _state = _interopRequireDefault(require("./state"));
|
|
20
|
+
var _actions = _interopRequireDefault(require("./actions"));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.initialState = exports.default = void 0;
|
|
7
|
+
var _proxy = require("../../toolkit/proxy");
|
|
8
|
+
const initialState = {
|
|
9
|
+
loading: false,
|
|
10
|
+
error: null,
|
|
11
|
+
username: undefined,
|
|
12
|
+
fetching: true
|
|
13
|
+
};
|
|
14
|
+
exports.initialState = initialState;
|
|
15
|
+
var _default = overrideState => (0, _proxy.createProxy)(initialState, overrideState);
|
|
16
|
+
exports.default = _default;
|
package/node/auth/index.js
CHANGED
|
@@ -43,6 +43,7 @@ var _SSOState = require("./SSOState");
|
|
|
43
43
|
var _StepUpState = require("./StepUpState");
|
|
44
44
|
var _TeamState = require("./TeamState");
|
|
45
45
|
var _TenantsState = require("./TenantsState");
|
|
46
|
+
var _UsernamesState = require("./UsernamesState");
|
|
46
47
|
var _UsersEmailsPolicyState = require("./UsersEmailsPolicyState");
|
|
47
48
|
var _consts = require("./LoginState/consts");
|
|
48
49
|
var _helpers = require("../helpers");
|
|
@@ -456,7 +457,7 @@ Object.keys(_interfaces33).forEach(function (key) {
|
|
|
456
457
|
}
|
|
457
458
|
});
|
|
458
459
|
});
|
|
459
|
-
var _interfaces34 = require("./
|
|
460
|
+
var _interfaces34 = require("./UsernamesState/interfaces");
|
|
460
461
|
Object.keys(_interfaces34).forEach(function (key) {
|
|
461
462
|
if (key === "default" || key === "__esModule") return;
|
|
462
463
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -468,7 +469,7 @@ Object.keys(_interfaces34).forEach(function (key) {
|
|
|
468
469
|
}
|
|
469
470
|
});
|
|
470
471
|
});
|
|
471
|
-
var _interfaces35 = require("./interfaces");
|
|
472
|
+
var _interfaces35 = require("./UsersEmailsPolicyState/interfaces");
|
|
472
473
|
Object.keys(_interfaces35).forEach(function (key) {
|
|
473
474
|
if (key === "default" || key === "__esModule") return;
|
|
474
475
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -480,6 +481,18 @@ Object.keys(_interfaces35).forEach(function (key) {
|
|
|
480
481
|
}
|
|
481
482
|
});
|
|
482
483
|
});
|
|
484
|
+
var _interfaces36 = require("./interfaces");
|
|
485
|
+
Object.keys(_interfaces36).forEach(function (key) {
|
|
486
|
+
if (key === "default" || key === "__esModule") return;
|
|
487
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
488
|
+
if (key in exports && exports[key] === _interfaces36[key]) return;
|
|
489
|
+
Object.defineProperty(exports, key, {
|
|
490
|
+
enumerable: true,
|
|
491
|
+
get: function () {
|
|
492
|
+
return _interfaces36[key];
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
});
|
|
483
496
|
const _excluded = ["routes"],
|
|
484
497
|
_excluded2 = ["requestName"];
|
|
485
498
|
const createAuthState = _overrideState => {
|
|
@@ -536,6 +549,7 @@ const createAuthState = _overrideState => {
|
|
|
536
549
|
stepUpState: (0, _StepUpState.createStepUpState)(overrideState == null ? void 0 : overrideState.stepUpState),
|
|
537
550
|
teamState: (0, _TeamState.createTeamState)(overrideState == null ? void 0 : overrideState.teamState),
|
|
538
551
|
tenantsState: (0, _TenantsState.createTenantsState)(overrideState == null ? void 0 : overrideState.tenantsState),
|
|
552
|
+
usernamesState: (0, _UsernamesState.createUsernamesState)(overrideState == null ? void 0 : overrideState.usernamesState),
|
|
539
553
|
userEmailPolicyState: (0, _UsersEmailsPolicyState.createUserEmailPolicyState)(overrideState == null ? void 0 : overrideState.userEmailPolicyState)
|
|
540
554
|
}));
|
|
541
555
|
};
|
|
@@ -604,6 +618,7 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
604
618
|
const stepUpActions = (0, _StepUpState.buildStepUpActions)(store, api, actions);
|
|
605
619
|
const teamActions = (0, _TeamState.buildTeamActions)(store, api, actions);
|
|
606
620
|
const tenantsActions = (0, _TenantsState.buildTenantsActions)(store, api, actions);
|
|
621
|
+
const usernamesActions = (0, _UsernamesState.buildUsernamesActions)(store, api, actions);
|
|
607
622
|
const usersEmailsPolicyActions = (0, _UsersEmailsPolicyState.buildUserEmailPolicyActions)(store, api, actions);
|
|
608
623
|
const stateActions = {
|
|
609
624
|
acceptInvitationActions,
|
|
@@ -640,6 +655,7 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
640
655
|
stepUpActions,
|
|
641
656
|
teamActions,
|
|
642
657
|
tenantsActions,
|
|
658
|
+
usernamesActions,
|
|
643
659
|
usersEmailsPolicyActions
|
|
644
660
|
};
|
|
645
661
|
return [(0, _extends2.default)({
|
package/node/index.js
CHANGED
|
@@ -43,6 +43,7 @@ var _tenantsActions = _interopRequireDefault(require("./tenantsActions.mocks"));
|
|
|
43
43
|
var _unlockAccountActions = _interopRequireDefault(require("./unlockAccountActions.mocks"));
|
|
44
44
|
var _usersEmailsPolicyActions = _interopRequireDefault(require("./usersEmailsPolicyActions.mocks"));
|
|
45
45
|
var _helpers = require("../../helpers");
|
|
46
|
+
var _UsernamesState = require("../../auth/UsernamesState");
|
|
46
47
|
const _excluded = ["requestName"];
|
|
47
48
|
const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
48
49
|
const acceptInvitationActions = (0, _acceptInvitationActions.default)(store, api, actions);
|
|
@@ -79,6 +80,7 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
79
80
|
const stepUpActions = (0, _stepUpActions.default)(store, api, actions);
|
|
80
81
|
const teamActions = (0, _teamActions.default)(store, api, actions);
|
|
81
82
|
const tenantsActions = (0, _tenantsActions.default)(store, api, actions);
|
|
83
|
+
const usernamesActions = (0, _UsernamesState.buildUsernamesActions)(store, api, actions);
|
|
82
84
|
const usersEmailsPolicyActions = (0, _usersEmailsPolicyActions.default)(store, api, actions);
|
|
83
85
|
const authStateActions = {
|
|
84
86
|
acceptInvitationActions,
|
|
@@ -115,6 +117,7 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
115
117
|
stepUpActions,
|
|
116
118
|
teamActions,
|
|
117
119
|
tenantsActions,
|
|
120
|
+
usernamesActions,
|
|
118
121
|
usersEmailsPolicyActions
|
|
119
122
|
};
|
|
120
123
|
const setAuthState = state => {
|
|
@@ -153,7 +156,7 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
153
156
|
setErrorByRequestName,
|
|
154
157
|
resetAuthState,
|
|
155
158
|
setUser
|
|
156
|
-
}, acceptInvitationActions, accountSettingsActions, activateAccountActions, unlockAccountActions, allAccountsActions, allAccountsDialogActions, apiTokensActions, applicationsActions, customLoginActions, entitlementsActions, forgotPasswordActions, passwordRotationActions, groupsActions, groupsDialogsActions, impersonateActions, loginActions, mfaActions, passkeysActions, profileActions, provisioningActions, resetPhoneNumberActions, restrictionsActions, rolesActions, securityCenterActions, securityPolicyActions, sessionsActions, sessionsPolicyActions, signUpActions, smsActions, socialLoginActions, ssoActions, stepUpActions, teamActions, tenantsActions, usersEmailsPolicyActions);
|
|
159
|
+
}, acceptInvitationActions, accountSettingsActions, activateAccountActions, unlockAccountActions, allAccountsActions, allAccountsDialogActions, apiTokensActions, applicationsActions, customLoginActions, entitlementsActions, forgotPasswordActions, passwordRotationActions, groupsActions, groupsDialogsActions, impersonateActions, loginActions, mfaActions, passkeysActions, profileActions, provisioningActions, resetPhoneNumberActions, restrictionsActions, rolesActions, securityCenterActions, securityPolicyActions, sessionsActions, sessionsPolicyActions, signUpActions, smsActions, socialLoginActions, ssoActions, stepUpActions, teamActions, tenantsActions, usernamesActions, usersEmailsPolicyActions);
|
|
157
160
|
return {
|
|
158
161
|
authActions,
|
|
159
162
|
authStateActions
|
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
class FronteggNativeModule {
|
|
8
8
|
constructor() {
|
|
9
|
-
this.loginWithSSO =
|
|
9
|
+
this.loginWithSSO = identifier => {
|
|
10
10
|
if (this.isIOSNativeBridgeAvailable()) {
|
|
11
11
|
var _window$webkit, _window$webkit$messag, _window$webkit$messag2;
|
|
12
12
|
(_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({
|
|
13
13
|
action: 'loginWithSSO',
|
|
14
|
-
payload:
|
|
14
|
+
payload: identifier
|
|
15
15
|
}));
|
|
16
16
|
} else if (this.isAndroidNativeBridgeAvailable()) {
|
|
17
17
|
var _window$FronteggNativ;
|
|
18
|
-
(_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(
|
|
18
|
+
(_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(identifier);
|
|
19
19
|
} else {
|
|
20
20
|
throw new Error('FronteggNativeBridge is not available');
|
|
21
21
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.76.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
9
|
"@frontegg/entitlements-javascript-commons": "1.1.2",
|
|
10
|
-
"@frontegg/rest-api": "7.
|
|
10
|
+
"@frontegg/rest-api": "7.76.0-alpha.1",
|
|
11
11
|
"fast-deep-equal": "3.1.3",
|
|
12
12
|
"get-value": "^3.0.1",
|
|
13
13
|
"proxy-compare": "^3.0.0",
|
|
@@ -30,7 +30,7 @@ declare class FronteggNativeModule {
|
|
|
30
30
|
isLoginWithSSOAvailable(): boolean;
|
|
31
31
|
isSuggestSavePasswordAvailable(): boolean;
|
|
32
32
|
isAvailable(method: string): boolean;
|
|
33
|
-
loginWithSSO: (
|
|
33
|
+
loginWithSSO: (identifier: string) => void;
|
|
34
34
|
/**
|
|
35
35
|
*
|
|
36
36
|
* @deprecated use loginWithSocialLoginProvider instead for pkce flow in mobile
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
class FronteggNativeModule {
|
|
2
2
|
constructor() {
|
|
3
|
-
this.loginWithSSO =
|
|
3
|
+
this.loginWithSSO = identifier => {
|
|
4
4
|
if (this.isIOSNativeBridgeAvailable()) {
|
|
5
5
|
var _window$webkit, _window$webkit$messag, _window$webkit$messag2;
|
|
6
6
|
(_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({
|
|
7
7
|
action: 'loginWithSSO',
|
|
8
|
-
payload:
|
|
8
|
+
payload: identifier
|
|
9
9
|
}));
|
|
10
10
|
} else if (this.isAndroidNativeBridgeAvailable()) {
|
|
11
11
|
var _window$FronteggNativ;
|
|
12
|
-
(_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(
|
|
12
|
+
(_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(identifier);
|
|
13
13
|
} else {
|
|
14
14
|
throw new Error('FronteggNativeBridge is not available');
|
|
15
15
|
}
|