@frontegg/redux-store 7.74.0 → 7.75.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/auth/ProfileState/actions.d.ts +7 -0
- package/auth/ProfileState/actions.js +58 -1
- package/auth/UsersEmailsPolicyState/actions.d.ts +5 -0
- package/auth/UsersEmailsPolicyState/actions.js +26 -0
- package/auth/UsersEmailsPolicyState/index.d.ts +3 -0
- package/auth/UsersEmailsPolicyState/index.js +3 -0
- package/auth/UsersEmailsPolicyState/interfaces.d.ts +8 -0
- package/auth/UsersEmailsPolicyState/interfaces.js +1 -0
- package/auth/UsersEmailsPolicyState/state.d.ts +4 -0
- package/auth/UsersEmailsPolicyState/state.js +6 -0
- package/auth/index.d.ts +5 -1
- package/auth/index.js +7 -2
- package/auth/interfaces.d.ts +2 -0
- package/index.js +1 -1
- package/mocks/auth-mocks/index.js +5 -2
- package/mocks/auth-mocks/profileActions.mocks.d.ts +7 -0
- package/mocks/auth-mocks/profileActions.mocks.js +30 -0
- package/mocks/auth-mocks/usersEmailsPolicyActions.mocks.d.ts +5 -0
- package/mocks/auth-mocks/usersEmailsPolicyActions.mocks.js +6 -0
- package/node/auth/ProfileState/actions.js +58 -1
- package/node/auth/UsersEmailsPolicyState/actions.js +33 -0
- package/node/auth/UsersEmailsPolicyState/index.js +20 -0
- package/node/auth/UsersEmailsPolicyState/interfaces.js +5 -0
- package/node/auth/UsersEmailsPolicyState/state.js +14 -0
- package/node/auth/index.js +19 -3
- package/node/index.js +1 -1
- package/node/mocks/auth-mocks/index.js +5 -2
- package/node/mocks/auth-mocks/profileActions.mocks.js +30 -0
- package/node/mocks/auth-mocks/usersEmailsPolicyActions.mocks.js +13 -0
- package/package.json +2 -2
|
@@ -7,5 +7,12 @@ declare const _default: (store: FronteggState, api: RestApi, sharedActions: Shar
|
|
|
7
7
|
loadProfile: () => Promise<void>;
|
|
8
8
|
saveProfile: (_payload: SaveProfilePayload) => Promise<void>;
|
|
9
9
|
changePassword: (payload: WithCallback<IChangePassword>) => Promise<void>;
|
|
10
|
+
updateEmail: (payload: WithCallback<{
|
|
11
|
+
email: string;
|
|
12
|
+
}, boolean>) => Promise<void>;
|
|
13
|
+
verifyEmail: (payload: WithCallback<{
|
|
14
|
+
email: string;
|
|
15
|
+
code: string;
|
|
16
|
+
}, boolean>) => Promise<void>;
|
|
10
17
|
};
|
|
11
18
|
export default _default;
|
|
@@ -30,6 +30,61 @@ export default ((store, api, sharedActions) => {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
+
const updateEmail = async payload => {
|
|
34
|
+
const {
|
|
35
|
+
email,
|
|
36
|
+
callback
|
|
37
|
+
} = payload;
|
|
38
|
+
setProfileState({
|
|
39
|
+
saving: true,
|
|
40
|
+
error: null,
|
|
41
|
+
loading: true
|
|
42
|
+
});
|
|
43
|
+
try {
|
|
44
|
+
await api.teams.updateEmail(email);
|
|
45
|
+
setProfileState({
|
|
46
|
+
saving: false,
|
|
47
|
+
error: null,
|
|
48
|
+
loading: false
|
|
49
|
+
});
|
|
50
|
+
callback == null ? void 0 : callback(true);
|
|
51
|
+
} catch (e) {
|
|
52
|
+
setProfileState({
|
|
53
|
+
saving: false,
|
|
54
|
+
error: errorHandler(e),
|
|
55
|
+
loading: false
|
|
56
|
+
});
|
|
57
|
+
callback == null ? void 0 : callback(null, e);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const verifyEmail = async payload => {
|
|
61
|
+
const {
|
|
62
|
+
email,
|
|
63
|
+
code,
|
|
64
|
+
callback
|
|
65
|
+
} = payload;
|
|
66
|
+
setProfileState({
|
|
67
|
+
saving: true,
|
|
68
|
+
error: null,
|
|
69
|
+
loading: true
|
|
70
|
+
});
|
|
71
|
+
try {
|
|
72
|
+
await api.teams.verifyEmail(email, code);
|
|
73
|
+
setProfileState({
|
|
74
|
+
saving: false,
|
|
75
|
+
error: null,
|
|
76
|
+
loading: false
|
|
77
|
+
});
|
|
78
|
+
callback == null ? void 0 : callback(true);
|
|
79
|
+
} catch (e) {
|
|
80
|
+
setProfileState({
|
|
81
|
+
saving: false,
|
|
82
|
+
error: errorHandler(e),
|
|
83
|
+
loading: false
|
|
84
|
+
});
|
|
85
|
+
callback == null ? void 0 : callback(null, e);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
33
88
|
const saveProfile = async _payload => {
|
|
34
89
|
const {
|
|
35
90
|
callback,
|
|
@@ -107,6 +162,8 @@ export default ((store, api, sharedActions) => {
|
|
|
107
162
|
resetProfileState,
|
|
108
163
|
loadProfile,
|
|
109
164
|
saveProfile,
|
|
110
|
-
changePassword
|
|
165
|
+
changePassword,
|
|
166
|
+
updateEmail,
|
|
167
|
+
verifyEmail
|
|
111
168
|
};
|
|
112
169
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { errorHandler } from '../../helpers';
|
|
2
|
+
export default ((store, api, sharedActions) => {
|
|
3
|
+
const setUserEmailPolicyState = payload => {
|
|
4
|
+
Object.assign(store.auth.userEmailPolicyState, payload);
|
|
5
|
+
};
|
|
6
|
+
const loadUserEmailPolicyState = async () => {
|
|
7
|
+
setUserEmailPolicyState({
|
|
8
|
+
loading: true
|
|
9
|
+
});
|
|
10
|
+
try {
|
|
11
|
+
const userEmailPolicyConfig = await api.userEmailPolicy.getUserEmailPolicyConfig();
|
|
12
|
+
setUserEmailPolicyState({
|
|
13
|
+
loading: false,
|
|
14
|
+
userEmailPolicyConfig
|
|
15
|
+
});
|
|
16
|
+
} catch (e) {
|
|
17
|
+
setUserEmailPolicyState({
|
|
18
|
+
loading: false,
|
|
19
|
+
error: errorHandler(e)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
loadUserEmailPolicyState
|
|
25
|
+
};
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/auth/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ import { buildSSOActions } from './SSOState';
|
|
|
32
32
|
import { buildStepUpActions } from './StepUpState';
|
|
33
33
|
import { buildTeamActions } from './TeamState';
|
|
34
34
|
import { buildTenantsActions } from './TenantsState';
|
|
35
|
+
import { buildUserEmailPolicyActions } from './UsersEmailsPolicyState';
|
|
35
36
|
import { buildEntitlementsActions } from './Entitlements';
|
|
36
37
|
export * from './AcceptInvitationState/interfaces';
|
|
37
38
|
export * from './AccountSettingsState/interfaces';
|
|
@@ -67,6 +68,7 @@ export * from './SSOState/interfaces';
|
|
|
67
68
|
export * from './StepUpState/interfaces';
|
|
68
69
|
export * from './TeamState/interfaces';
|
|
69
70
|
export * from './TenantsState/interfaces';
|
|
71
|
+
export * from './UsersEmailsPolicyState/interfaces';
|
|
70
72
|
export * from './interfaces';
|
|
71
73
|
export declare const createAuthState: (_overrideState?: DeepPartial<AuthState>) => AuthState;
|
|
72
74
|
export declare const buildAuthActions: (store: FronteggState, api: RestApi, actions: FronteggActions, snapshotAuthState: AuthState) => [AuthActions, AuthStateActions];
|
|
@@ -104,6 +106,7 @@ export type SSOActions = ReturnType<typeof buildSSOActions>;
|
|
|
104
106
|
export type StepUpActions = ReturnType<typeof buildStepUpActions>;
|
|
105
107
|
export type TeamActions = ReturnType<typeof buildTeamActions>;
|
|
106
108
|
export type TenantsActions = ReturnType<typeof buildTenantsActions>;
|
|
109
|
+
export type UsersEmailPolicyActions = ReturnType<typeof buildUserEmailPolicyActions>;
|
|
107
110
|
export type AuthStateActions = {
|
|
108
111
|
acceptInvitationActions: AcceptInvitationActions;
|
|
109
112
|
accountSettingsActions: AccountSettingsActions;
|
|
@@ -139,6 +142,7 @@ export type AuthStateActions = {
|
|
|
139
142
|
stepUpActions: StepUpActions;
|
|
140
143
|
teamActions: TeamActions;
|
|
141
144
|
tenantsActions: TenantsActions;
|
|
145
|
+
usersEmailsPolicyActions: UsersEmailPolicyActions;
|
|
142
146
|
};
|
|
143
147
|
export type AuthActions = {
|
|
144
148
|
/** @deprecated use setAuthState instead */
|
|
@@ -147,4 +151,4 @@ export type AuthActions = {
|
|
|
147
151
|
setErrorByRequestName: (payload: SingleErrorByRequestDataPayload) => void;
|
|
148
152
|
resetAuthState: (state?: Partial<AuthState>) => void;
|
|
149
153
|
setUser: (user: User | null) => void;
|
|
150
|
-
} & AcceptInvitationActions & AccountSettingsActions & UnlockAccountActions & ActivateAccountActions & ApiTokensActions & ApplicationsActions & CustomLoginActions & EntitlementsActions & ForgotPasswordActions & PasswordRotationActions & GroupsActions & GroupsDialogsActions & ImpersonateActions & LoginActions & MfaActions & AllAccountsActions & AllAccountsDialogActions & PasskeysActions & ProfileActions & ProvisioningActions & ResetPhoneNumberActions & RolesActions & RestrictionsActions & SecurityCenterActions & SecurityPolicyActions & SessionsPolicyActions & SessionsActions & SignUpActions & SmsActions & SocialLoginActions & SSOActions & StepUpActions & TeamActions & TenantsActions;
|
|
154
|
+
} & AcceptInvitationActions & AccountSettingsActions & UnlockAccountActions & ActivateAccountActions & ApiTokensActions & ApplicationsActions & CustomLoginActions & EntitlementsActions & ForgotPasswordActions & PasswordRotationActions & GroupsActions & GroupsDialogsActions & ImpersonateActions & LoginActions & MfaActions & AllAccountsActions & AllAccountsDialogActions & PasskeysActions & ProfileActions & ProvisioningActions & ResetPhoneNumberActions & RolesActions & RestrictionsActions & SecurityCenterActions & SecurityPolicyActions & SessionsPolicyActions & SessionsActions & SignUpActions & SmsActions & SocialLoginActions & SSOActions & StepUpActions & TeamActions & TenantsActions & UsersEmailPolicyActions;
|
package/auth/index.js
CHANGED
|
@@ -34,6 +34,7 @@ import { buildSSOActions, createSSOState } from './SSOState';
|
|
|
34
34
|
import { buildStepUpActions, createStepUpState } from './StepUpState';
|
|
35
35
|
import { buildTeamActions, createTeamState } from './TeamState';
|
|
36
36
|
import { buildTenantsActions, createTenantsState } from './TenantsState';
|
|
37
|
+
import { buildUserEmailPolicyActions, createUserEmailPolicyState } from './UsersEmailsPolicyState';
|
|
37
38
|
import { defaultFronteggRoutes } from './LoginState/consts';
|
|
38
39
|
import { deepResetState, isProxy } from '../helpers';
|
|
39
40
|
import { buildEntitlementsActions } from './Entitlements';
|
|
@@ -72,6 +73,7 @@ export * from './SSOState/interfaces';
|
|
|
72
73
|
export * from './StepUpState/interfaces';
|
|
73
74
|
export * from './TeamState/interfaces';
|
|
74
75
|
export * from './TenantsState/interfaces';
|
|
76
|
+
export * from './UsersEmailsPolicyState/interfaces';
|
|
75
77
|
export * from './interfaces';
|
|
76
78
|
export const createAuthState = _overrideState => {
|
|
77
79
|
const _ref = _overrideState != null ? _overrideState : {},
|
|
@@ -126,7 +128,8 @@ export const createAuthState = _overrideState => {
|
|
|
126
128
|
ssoState: createSSOState(overrideState == null ? void 0 : overrideState.ssoState),
|
|
127
129
|
stepUpState: createStepUpState(overrideState == null ? void 0 : overrideState.stepUpState),
|
|
128
130
|
teamState: createTeamState(overrideState == null ? void 0 : overrideState.teamState),
|
|
129
|
-
tenantsState: createTenantsState(overrideState == null ? void 0 : overrideState.tenantsState)
|
|
131
|
+
tenantsState: createTenantsState(overrideState == null ? void 0 : overrideState.tenantsState),
|
|
132
|
+
userEmailPolicyState: createUserEmailPolicyState(overrideState == null ? void 0 : overrideState.userEmailPolicyState)
|
|
130
133
|
}));
|
|
131
134
|
};
|
|
132
135
|
export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
@@ -193,6 +196,7 @@ export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
193
196
|
const stepUpActions = buildStepUpActions(store, api, actions);
|
|
194
197
|
const teamActions = buildTeamActions(store, api, actions);
|
|
195
198
|
const tenantsActions = buildTenantsActions(store, api, actions);
|
|
199
|
+
const usersEmailsPolicyActions = buildUserEmailPolicyActions(store, api, actions);
|
|
196
200
|
const stateActions = {
|
|
197
201
|
acceptInvitationActions,
|
|
198
202
|
accountSettingsActions,
|
|
@@ -227,7 +231,8 @@ export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
227
231
|
ssoActions,
|
|
228
232
|
stepUpActions,
|
|
229
233
|
teamActions,
|
|
230
|
-
tenantsActions
|
|
234
|
+
tenantsActions,
|
|
235
|
+
usersEmailsPolicyActions
|
|
231
236
|
};
|
|
232
237
|
return [_extends({
|
|
233
238
|
setAuthState,
|
package/auth/interfaces.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ import type { IAllAccountsDialogsState, IAllAccountsState } from './MSP/interfac
|
|
|
31
31
|
import { ApplicationsState } from './ApplicationsState/interfaces';
|
|
32
32
|
import { UnlockAccountState } from './UnlockAccountState/interfaces';
|
|
33
33
|
import { PasswordRotationState } from '../toolkit';
|
|
34
|
+
import { UserEmailPolicyState } from './UsersEmailsPolicyState/interfaces';
|
|
34
35
|
export declare enum REQUEST_NAME {
|
|
35
36
|
LOAD_FEATURE_FLAGS = "LOAD_FEATURE_FLAGS,",
|
|
36
37
|
LOAD_ADMIN_BOX_METADATA = "LOAD_ADMIN_BOX_METADATA,",
|
|
@@ -107,6 +108,7 @@ export interface AuthState extends Routes, PluginOptions {
|
|
|
107
108
|
teamState: TeamState;
|
|
108
109
|
tenantsState: TenantsState;
|
|
109
110
|
applicationsState: ApplicationsState;
|
|
111
|
+
userEmailPolicyState: UserEmailPolicyState;
|
|
110
112
|
}
|
|
111
113
|
interface Actor {
|
|
112
114
|
sub?: string;
|
package/index.js
CHANGED
|
@@ -37,6 +37,7 @@ import buildStepUpActions from './stepUpActions.mocks';
|
|
|
37
37
|
import buildTeamActions from './teamActions.mocks';
|
|
38
38
|
import buildTenantsActions from './tenantsActions.mocks';
|
|
39
39
|
import buildUnlockAccountActions from './unlockAccountActions.mocks';
|
|
40
|
+
import buildUserEmailPolicyActions from './usersEmailsPolicyActions.mocks';
|
|
40
41
|
import { deepResetState, isProxy } from '../../helpers';
|
|
41
42
|
export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
42
43
|
const acceptInvitationActions = buildAcceptInvitationActions(store, api, actions);
|
|
@@ -73,6 +74,7 @@ export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
73
74
|
const stepUpActions = buildStepUpActions(store, api, actions);
|
|
74
75
|
const teamActions = buildTeamActions(store, api, actions);
|
|
75
76
|
const tenantsActions = buildTenantsActions(store, api, actions);
|
|
77
|
+
const usersEmailsPolicyActions = buildUserEmailPolicyActions(store, api, actions);
|
|
76
78
|
const authStateActions = {
|
|
77
79
|
acceptInvitationActions,
|
|
78
80
|
accountSettingsActions,
|
|
@@ -107,7 +109,8 @@ export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
107
109
|
ssoActions,
|
|
108
110
|
stepUpActions,
|
|
109
111
|
teamActions,
|
|
110
|
-
tenantsActions
|
|
112
|
+
tenantsActions,
|
|
113
|
+
usersEmailsPolicyActions
|
|
111
114
|
};
|
|
112
115
|
const setAuthState = state => {
|
|
113
116
|
Object.keys(state).forEach(key => {
|
|
@@ -145,7 +148,7 @@ export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
145
148
|
setErrorByRequestName,
|
|
146
149
|
resetAuthState,
|
|
147
150
|
setUser
|
|
148
|
-
}, 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);
|
|
151
|
+
}, 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);
|
|
149
152
|
return {
|
|
150
153
|
authActions,
|
|
151
154
|
authStateActions
|
|
@@ -7,5 +7,12 @@ declare const _default: (store: FronteggState, api: RestApi, actions: SharedActi
|
|
|
7
7
|
loadProfile: () => Promise<void>;
|
|
8
8
|
saveProfile: (_payload: SaveProfilePayload) => Promise<void>;
|
|
9
9
|
changePassword: (payload: WithCallback<IChangePassword>) => Promise<void>;
|
|
10
|
+
updateEmail: (payload: WithCallback<{
|
|
11
|
+
email: string;
|
|
12
|
+
}, boolean>) => Promise<void>;
|
|
13
|
+
verifyEmail: (payload: WithCallback<{
|
|
14
|
+
email: string;
|
|
15
|
+
code: string;
|
|
16
|
+
}, boolean>) => Promise<void>;
|
|
10
17
|
};
|
|
11
18
|
export default _default;
|
|
@@ -63,5 +63,35 @@ export default ((store, api, actions) => {
|
|
|
63
63
|
});
|
|
64
64
|
(_payload$callback = payload.callback) == null ? void 0 : _payload$callback.call(payload, true);
|
|
65
65
|
};
|
|
66
|
+
mockedActions.updateEmail = async payload => {
|
|
67
|
+
var _payload$callback2;
|
|
68
|
+
mockedActions.setProfileState({
|
|
69
|
+
saving: true,
|
|
70
|
+
error: null,
|
|
71
|
+
loading: true
|
|
72
|
+
});
|
|
73
|
+
await delay();
|
|
74
|
+
mockedActions.setProfileState({
|
|
75
|
+
saving: false,
|
|
76
|
+
error: null,
|
|
77
|
+
loading: false
|
|
78
|
+
});
|
|
79
|
+
(_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, true);
|
|
80
|
+
};
|
|
81
|
+
mockedActions.verifyEmail = async payload => {
|
|
82
|
+
var _payload$callback3;
|
|
83
|
+
mockedActions.setProfileState({
|
|
84
|
+
saving: true,
|
|
85
|
+
error: null,
|
|
86
|
+
loading: true
|
|
87
|
+
});
|
|
88
|
+
await delay();
|
|
89
|
+
mockedActions.setProfileState({
|
|
90
|
+
saving: false,
|
|
91
|
+
error: null,
|
|
92
|
+
loading: false
|
|
93
|
+
});
|
|
94
|
+
(_payload$callback3 = payload.callback) == null ? void 0 : _payload$callback3.call(payload, true);
|
|
95
|
+
};
|
|
66
96
|
return mockedActions;
|
|
67
97
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { buildUserEmailPolicyActions } from '../../auth/UsersEmailsPolicyState';
|
|
2
|
+
import { mockActionsExpect } from '../helpers';
|
|
3
|
+
export default ((store, api, sharedActions) => {
|
|
4
|
+
const originalActions = buildUserEmailPolicyActions(store, api, sharedActions);
|
|
5
|
+
return mockActionsExpect(originalActions, ['loadUserEmailPolicyState']);
|
|
6
|
+
});
|
|
@@ -37,6 +37,61 @@ var _default = (store, api, sharedActions) => {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
+
const updateEmail = async payload => {
|
|
41
|
+
const {
|
|
42
|
+
email,
|
|
43
|
+
callback
|
|
44
|
+
} = payload;
|
|
45
|
+
setProfileState({
|
|
46
|
+
saving: true,
|
|
47
|
+
error: null,
|
|
48
|
+
loading: true
|
|
49
|
+
});
|
|
50
|
+
try {
|
|
51
|
+
await api.teams.updateEmail(email);
|
|
52
|
+
setProfileState({
|
|
53
|
+
saving: false,
|
|
54
|
+
error: null,
|
|
55
|
+
loading: false
|
|
56
|
+
});
|
|
57
|
+
callback == null ? void 0 : callback(true);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
setProfileState({
|
|
60
|
+
saving: false,
|
|
61
|
+
error: (0, _helpers.errorHandler)(e),
|
|
62
|
+
loading: false
|
|
63
|
+
});
|
|
64
|
+
callback == null ? void 0 : callback(null, e);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const verifyEmail = async payload => {
|
|
68
|
+
const {
|
|
69
|
+
email,
|
|
70
|
+
code,
|
|
71
|
+
callback
|
|
72
|
+
} = payload;
|
|
73
|
+
setProfileState({
|
|
74
|
+
saving: true,
|
|
75
|
+
error: null,
|
|
76
|
+
loading: true
|
|
77
|
+
});
|
|
78
|
+
try {
|
|
79
|
+
await api.teams.verifyEmail(email, code);
|
|
80
|
+
setProfileState({
|
|
81
|
+
saving: false,
|
|
82
|
+
error: null,
|
|
83
|
+
loading: false
|
|
84
|
+
});
|
|
85
|
+
callback == null ? void 0 : callback(true);
|
|
86
|
+
} catch (e) {
|
|
87
|
+
setProfileState({
|
|
88
|
+
saving: false,
|
|
89
|
+
error: (0, _helpers.errorHandler)(e),
|
|
90
|
+
loading: false
|
|
91
|
+
});
|
|
92
|
+
callback == null ? void 0 : callback(null, e);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
40
95
|
const saveProfile = async _payload => {
|
|
41
96
|
const {
|
|
42
97
|
callback,
|
|
@@ -114,7 +169,9 @@ var _default = (store, api, sharedActions) => {
|
|
|
114
169
|
resetProfileState,
|
|
115
170
|
loadProfile,
|
|
116
171
|
saveProfile,
|
|
117
|
-
changePassword
|
|
172
|
+
changePassword,
|
|
173
|
+
updateEmail,
|
|
174
|
+
verifyEmail
|
|
118
175
|
};
|
|
119
176
|
};
|
|
120
177
|
exports.default = _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 _default = (store, api, sharedActions) => {
|
|
9
|
+
const setUserEmailPolicyState = payload => {
|
|
10
|
+
Object.assign(store.auth.userEmailPolicyState, payload);
|
|
11
|
+
};
|
|
12
|
+
const loadUserEmailPolicyState = async () => {
|
|
13
|
+
setUserEmailPolicyState({
|
|
14
|
+
loading: true
|
|
15
|
+
});
|
|
16
|
+
try {
|
|
17
|
+
const userEmailPolicyConfig = await api.userEmailPolicy.getUserEmailPolicyConfig();
|
|
18
|
+
setUserEmailPolicyState({
|
|
19
|
+
loading: false,
|
|
20
|
+
userEmailPolicyConfig
|
|
21
|
+
});
|
|
22
|
+
} catch (e) {
|
|
23
|
+
setUserEmailPolicyState({
|
|
24
|
+
loading: false,
|
|
25
|
+
error: (0, _helpers.errorHandler)(e)
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
loadUserEmailPolicyState
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
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, "buildUserEmailPolicyActions", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _actions.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "createUserEmailPolicyState", {
|
|
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,14 @@
|
|
|
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
|
+
userEmailPolicyConfig: null,
|
|
10
|
+
loading: false
|
|
11
|
+
};
|
|
12
|
+
exports.initialState = initialState;
|
|
13
|
+
var _default = overrideState => (0, _proxy.createProxy)(initialState, overrideState);
|
|
14
|
+
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 _UsersEmailsPolicyState = require("./UsersEmailsPolicyState");
|
|
46
47
|
var _consts = require("./LoginState/consts");
|
|
47
48
|
var _helpers = require("../helpers");
|
|
48
49
|
var _Entitlements = require("./Entitlements");
|
|
@@ -455,7 +456,7 @@ Object.keys(_interfaces33).forEach(function (key) {
|
|
|
455
456
|
}
|
|
456
457
|
});
|
|
457
458
|
});
|
|
458
|
-
var _interfaces34 = require("./interfaces");
|
|
459
|
+
var _interfaces34 = require("./UsersEmailsPolicyState/interfaces");
|
|
459
460
|
Object.keys(_interfaces34).forEach(function (key) {
|
|
460
461
|
if (key === "default" || key === "__esModule") return;
|
|
461
462
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -467,6 +468,18 @@ Object.keys(_interfaces34).forEach(function (key) {
|
|
|
467
468
|
}
|
|
468
469
|
});
|
|
469
470
|
});
|
|
471
|
+
var _interfaces35 = require("./interfaces");
|
|
472
|
+
Object.keys(_interfaces35).forEach(function (key) {
|
|
473
|
+
if (key === "default" || key === "__esModule") return;
|
|
474
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
475
|
+
if (key in exports && exports[key] === _interfaces35[key]) return;
|
|
476
|
+
Object.defineProperty(exports, key, {
|
|
477
|
+
enumerable: true,
|
|
478
|
+
get: function () {
|
|
479
|
+
return _interfaces35[key];
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
});
|
|
470
483
|
const _excluded = ["routes"],
|
|
471
484
|
_excluded2 = ["requestName"];
|
|
472
485
|
const createAuthState = _overrideState => {
|
|
@@ -522,7 +535,8 @@ const createAuthState = _overrideState => {
|
|
|
522
535
|
ssoState: (0, _SSOState.createSSOState)(overrideState == null ? void 0 : overrideState.ssoState),
|
|
523
536
|
stepUpState: (0, _StepUpState.createStepUpState)(overrideState == null ? void 0 : overrideState.stepUpState),
|
|
524
537
|
teamState: (0, _TeamState.createTeamState)(overrideState == null ? void 0 : overrideState.teamState),
|
|
525
|
-
tenantsState: (0, _TenantsState.createTenantsState)(overrideState == null ? void 0 : overrideState.tenantsState)
|
|
538
|
+
tenantsState: (0, _TenantsState.createTenantsState)(overrideState == null ? void 0 : overrideState.tenantsState),
|
|
539
|
+
userEmailPolicyState: (0, _UsersEmailsPolicyState.createUserEmailPolicyState)(overrideState == null ? void 0 : overrideState.userEmailPolicyState)
|
|
526
540
|
}));
|
|
527
541
|
};
|
|
528
542
|
exports.createAuthState = createAuthState;
|
|
@@ -590,6 +604,7 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
590
604
|
const stepUpActions = (0, _StepUpState.buildStepUpActions)(store, api, actions);
|
|
591
605
|
const teamActions = (0, _TeamState.buildTeamActions)(store, api, actions);
|
|
592
606
|
const tenantsActions = (0, _TenantsState.buildTenantsActions)(store, api, actions);
|
|
607
|
+
const usersEmailsPolicyActions = (0, _UsersEmailsPolicyState.buildUserEmailPolicyActions)(store, api, actions);
|
|
593
608
|
const stateActions = {
|
|
594
609
|
acceptInvitationActions,
|
|
595
610
|
accountSettingsActions,
|
|
@@ -624,7 +639,8 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
624
639
|
ssoActions,
|
|
625
640
|
stepUpActions,
|
|
626
641
|
teamActions,
|
|
627
|
-
tenantsActions
|
|
642
|
+
tenantsActions,
|
|
643
|
+
usersEmailsPolicyActions
|
|
628
644
|
};
|
|
629
645
|
return [(0, _extends2.default)({
|
|
630
646
|
setAuthState,
|
package/node/index.js
CHANGED
|
@@ -41,6 +41,7 @@ var _stepUpActions = _interopRequireDefault(require("./stepUpActions.mocks"));
|
|
|
41
41
|
var _teamActions = _interopRequireDefault(require("./teamActions.mocks"));
|
|
42
42
|
var _tenantsActions = _interopRequireDefault(require("./tenantsActions.mocks"));
|
|
43
43
|
var _unlockAccountActions = _interopRequireDefault(require("./unlockAccountActions.mocks"));
|
|
44
|
+
var _usersEmailsPolicyActions = _interopRequireDefault(require("./usersEmailsPolicyActions.mocks"));
|
|
44
45
|
var _helpers = require("../../helpers");
|
|
45
46
|
const _excluded = ["requestName"];
|
|
46
47
|
const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
@@ -78,6 +79,7 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
78
79
|
const stepUpActions = (0, _stepUpActions.default)(store, api, actions);
|
|
79
80
|
const teamActions = (0, _teamActions.default)(store, api, actions);
|
|
80
81
|
const tenantsActions = (0, _tenantsActions.default)(store, api, actions);
|
|
82
|
+
const usersEmailsPolicyActions = (0, _usersEmailsPolicyActions.default)(store, api, actions);
|
|
81
83
|
const authStateActions = {
|
|
82
84
|
acceptInvitationActions,
|
|
83
85
|
accountSettingsActions,
|
|
@@ -112,7 +114,8 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
112
114
|
ssoActions,
|
|
113
115
|
stepUpActions,
|
|
114
116
|
teamActions,
|
|
115
|
-
tenantsActions
|
|
117
|
+
tenantsActions,
|
|
118
|
+
usersEmailsPolicyActions
|
|
116
119
|
};
|
|
117
120
|
const setAuthState = state => {
|
|
118
121
|
Object.keys(state).forEach(key => {
|
|
@@ -150,7 +153,7 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
|
|
|
150
153
|
setErrorByRequestName,
|
|
151
154
|
resetAuthState,
|
|
152
155
|
setUser
|
|
153
|
-
}, 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);
|
|
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);
|
|
154
157
|
return {
|
|
155
158
|
authActions,
|
|
156
159
|
authStateActions
|
|
@@ -70,6 +70,36 @@ var _default = (store, api, actions) => {
|
|
|
70
70
|
});
|
|
71
71
|
(_payload$callback = payload.callback) == null ? void 0 : _payload$callback.call(payload, true);
|
|
72
72
|
};
|
|
73
|
+
mockedActions.updateEmail = async payload => {
|
|
74
|
+
var _payload$callback2;
|
|
75
|
+
mockedActions.setProfileState({
|
|
76
|
+
saving: true,
|
|
77
|
+
error: null,
|
|
78
|
+
loading: true
|
|
79
|
+
});
|
|
80
|
+
await (0, _helpers.delay)();
|
|
81
|
+
mockedActions.setProfileState({
|
|
82
|
+
saving: false,
|
|
83
|
+
error: null,
|
|
84
|
+
loading: false
|
|
85
|
+
});
|
|
86
|
+
(_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, true);
|
|
87
|
+
};
|
|
88
|
+
mockedActions.verifyEmail = async payload => {
|
|
89
|
+
var _payload$callback3;
|
|
90
|
+
mockedActions.setProfileState({
|
|
91
|
+
saving: true,
|
|
92
|
+
error: null,
|
|
93
|
+
loading: true
|
|
94
|
+
});
|
|
95
|
+
await (0, _helpers.delay)();
|
|
96
|
+
mockedActions.setProfileState({
|
|
97
|
+
saving: false,
|
|
98
|
+
error: null,
|
|
99
|
+
loading: false
|
|
100
|
+
});
|
|
101
|
+
(_payload$callback3 = payload.callback) == null ? void 0 : _payload$callback3.call(payload, true);
|
|
102
|
+
};
|
|
73
103
|
return mockedActions;
|
|
74
104
|
};
|
|
75
105
|
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _UsersEmailsPolicyState = require("../../auth/UsersEmailsPolicyState");
|
|
8
|
+
var _helpers = require("../helpers");
|
|
9
|
+
var _default = (store, api, sharedActions) => {
|
|
10
|
+
const originalActions = (0, _UsersEmailsPolicyState.buildUserEmailPolicyActions)(store, api, sharedActions);
|
|
11
|
+
return (0, _helpers.mockActionsExpect)(originalActions, ['loadUserEmailPolicyState']);
|
|
12
|
+
};
|
|
13
|
+
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.75.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
9
|
"@frontegg/entitlements-javascript-commons": "1.1.2",
|
|
10
|
-
"@frontegg/rest-api": "7.
|
|
10
|
+
"@frontegg/rest-api": "7.75.0-alpha.0",
|
|
11
11
|
"fast-deep-equal": "3.1.3",
|
|
12
12
|
"get-value": "^3.0.1",
|
|
13
13
|
"proxy-compare": "^3.0.0",
|