@frontegg/redux-store 7.75.0-alpha.1 → 7.75.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.
Files changed (41) hide show
  1. package/audits/index.d.ts +2 -1
  2. package/auth/ApiTokensState/interfaces.d.ts +0 -1
  3. package/auth/ApiTokensState/state.js +0 -1
  4. package/auth/ProfileState/actions.d.ts +7 -0
  5. package/auth/ProfileState/actions.js +59 -1
  6. package/auth/UsersEmailsPolicyState/actions.d.ts +5 -0
  7. package/auth/UsersEmailsPolicyState/actions.js +26 -0
  8. package/auth/UsersEmailsPolicyState/index.d.ts +3 -0
  9. package/auth/UsersEmailsPolicyState/index.js +3 -0
  10. package/auth/UsersEmailsPolicyState/interfaces.d.ts +13 -0
  11. package/auth/UsersEmailsPolicyState/interfaces.js +6 -0
  12. package/auth/UsersEmailsPolicyState/state.d.ts +4 -0
  13. package/auth/UsersEmailsPolicyState/state.js +6 -0
  14. package/auth/index.d.ts +7 -2
  15. package/auth/index.js +7 -2
  16. package/auth/interfaces.d.ts +2 -0
  17. package/index.js +1 -1
  18. package/interfaces.d.ts +1 -3
  19. package/mocks/auth-mocks/index.js +5 -2
  20. package/mocks/auth-mocks/profileActions.mocks.d.ts +7 -0
  21. package/mocks/auth-mocks/profileActions.mocks.js +30 -0
  22. package/mocks/auth-mocks/usersEmailsPolicyActions.mocks.d.ts +5 -0
  23. package/mocks/auth-mocks/usersEmailsPolicyActions.mocks.js +6 -0
  24. package/node/auth/ApiTokensState/state.js +0 -1
  25. package/node/auth/ProfileState/actions.js +59 -1
  26. package/node/auth/UsersEmailsPolicyState/actions.js +33 -0
  27. package/node/auth/UsersEmailsPolicyState/index.js +20 -0
  28. package/node/auth/UsersEmailsPolicyState/interfaces.js +13 -0
  29. package/node/auth/UsersEmailsPolicyState/state.js +14 -0
  30. package/node/auth/index.js +19 -3
  31. package/node/index.js +1 -1
  32. package/node/mocks/auth-mocks/index.js +5 -2
  33. package/node/mocks/auth-mocks/profileActions.mocks.js +30 -0
  34. package/node/mocks/auth-mocks/usersEmailsPolicyActions.mocks.js +13 -0
  35. package/node/types.js +5 -0
  36. package/package.json +2 -2
  37. package/subscriptions/Billing/index.d.ts +2 -1
  38. package/subscriptions/index.d.ts +2 -1
  39. package/toolkit/store.d.ts +2 -1
  40. package/types.d.ts +3 -0
  41. package/types.js +1 -0
package/audits/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { buildAuditLogsActions } from './AuditLogsState';
2
2
  import { buildAuditsMetadataActions } from './AuditsMetadataState';
3
- import { DeepPartial, FronteggState, RestApi, SharedActions } from '../interfaces';
3
+ import { FronteggState, RestApi, SharedActions } from '../interfaces';
4
+ import { DeepPartial } from '../types';
4
5
  import { AuditsState } from './interfaces';
5
6
  export declare const createAuditsState: (overrideState?: DeepPartial<AuditsState>) => AuditsState;
6
7
  export declare const buildAuditsActions: (store: FronteggState, api: RestApi, sharedActions: SharedActions) => {
@@ -2,7 +2,6 @@ import { FronteggApiError, ITeamUserPermission, ITeamUserRole, MachineToMachineA
2
2
  import { LoaderIndicatorState, WithCallback } from '../../interfaces';
3
3
  export interface ApiTokensState {
4
4
  loaders: LoaderIndicatorState<ApiStateKeys>;
5
- searchValue: string;
6
5
  apiTokensDataTenant: ITenantApiTokensData[];
7
6
  apiTokensDataUser: IApiTokensData[];
8
7
  showAddTokenDialog: boolean;
@@ -1,7 +1,6 @@
1
1
  import { createProxy } from '../../toolkit/proxy';
2
2
  export const initialState = {
3
3
  apiTokenType: null,
4
- searchValue: '',
5
4
  showAddTokenDialog: false,
6
5
  createdByUserIdColumn: 'show',
7
6
  deleteTokenDialog: {
@@ -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,62 @@ 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
+ await actions.__refreshToken();
74
+ setProfileState({
75
+ saving: false,
76
+ error: null,
77
+ loading: false
78
+ });
79
+ callback == null ? void 0 : callback(true);
80
+ } catch (e) {
81
+ setProfileState({
82
+ saving: false,
83
+ error: errorHandler(e),
84
+ loading: false
85
+ });
86
+ callback == null ? void 0 : callback(null, e);
87
+ }
88
+ };
33
89
  const saveProfile = async _payload => {
34
90
  const {
35
91
  callback,
@@ -107,6 +163,8 @@ export default ((store, api, sharedActions) => {
107
163
  resetProfileState,
108
164
  loadProfile,
109
165
  saveProfile,
110
- changePassword
166
+ changePassword,
167
+ updateEmail,
168
+ verifyEmail
111
169
  };
112
170
  });
@@ -0,0 +1,5 @@
1
+ import type { FronteggState, RestApi, SharedActions } from '../../interfaces';
2
+ declare const _default: (store: FronteggState, api: RestApi, sharedActions: SharedActions) => {
3
+ loadUserEmailPolicyState: () => Promise<void>;
4
+ };
5
+ export default _default;
@@ -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,3 @@
1
+ import createUserEmailPolicyState from './state';
2
+ import buildUserEmailPolicyActions from './actions';
3
+ export { createUserEmailPolicyState, buildUserEmailPolicyActions };
@@ -0,0 +1,3 @@
1
+ import createUserEmailPolicyState from './state';
2
+ import buildUserEmailPolicyActions from './actions';
3
+ export { createUserEmailPolicyState, buildUserEmailPolicyActions };
@@ -0,0 +1,13 @@
1
+ export interface UserEmailPolicyConfig {
2
+ allowEmailChange: boolean;
3
+ }
4
+ export interface UserEmailPolicyState {
5
+ userEmailPolicyConfig: Partial<UserEmailPolicyConfig> | null;
6
+ loading: boolean;
7
+ error?: any;
8
+ }
9
+ export declare enum EditEmailView {
10
+ Email = 0,
11
+ Otc = 1,
12
+ Success = 2
13
+ }
@@ -0,0 +1,6 @@
1
+ export let EditEmailView;
2
+ (function (EditEmailView) {
3
+ EditEmailView[EditEmailView["Email"] = 0] = "Email";
4
+ EditEmailView[EditEmailView["Otc"] = 1] = "Otc";
5
+ EditEmailView[EditEmailView["Success"] = 2] = "Success";
6
+ })(EditEmailView || (EditEmailView = {}));
@@ -0,0 +1,4 @@
1
+ import { UserEmailPolicyState } from './interfaces';
2
+ export declare const initialState: UserEmailPolicyState;
3
+ declare const _default: (overrideState?: Partial<UserEmailPolicyState>) => UserEmailPolicyState;
4
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { createProxy } from '../../toolkit/proxy';
2
+ export const initialState = {
3
+ userEmailPolicyConfig: null,
4
+ loading: false
5
+ };
6
+ export default (overrideState => createProxy(initialState, overrideState));
package/auth/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { DeepPartial, FronteggActions, FronteggState, RestApi } from '../interfaces';
1
+ import { FronteggActions, FronteggState, RestApi } from '../interfaces';
2
+ import { DeepPartial } from '../types';
2
3
  import { AuthState, SingleErrorByRequestDataPayload, User } from './interfaces';
3
4
  import { buildAcceptInvitationActions } from './AcceptInvitationState';
4
5
  import { buildAccountSettingsActions } from './AccountSettingsState';
@@ -32,6 +33,7 @@ import { buildSSOActions } from './SSOState';
32
33
  import { buildStepUpActions } from './StepUpState';
33
34
  import { buildTeamActions } from './TeamState';
34
35
  import { buildTenantsActions } from './TenantsState';
36
+ import { buildUserEmailPolicyActions } from './UsersEmailsPolicyState';
35
37
  import { buildEntitlementsActions } from './Entitlements';
36
38
  export * from './AcceptInvitationState/interfaces';
37
39
  export * from './AccountSettingsState/interfaces';
@@ -67,6 +69,7 @@ export * from './SSOState/interfaces';
67
69
  export * from './StepUpState/interfaces';
68
70
  export * from './TeamState/interfaces';
69
71
  export * from './TenantsState/interfaces';
72
+ export * from './UsersEmailsPolicyState/interfaces';
70
73
  export * from './interfaces';
71
74
  export declare const createAuthState: (_overrideState?: DeepPartial<AuthState>) => AuthState;
72
75
  export declare const buildAuthActions: (store: FronteggState, api: RestApi, actions: FronteggActions, snapshotAuthState: AuthState) => [AuthActions, AuthStateActions];
@@ -104,6 +107,7 @@ export type SSOActions = ReturnType<typeof buildSSOActions>;
104
107
  export type StepUpActions = ReturnType<typeof buildStepUpActions>;
105
108
  export type TeamActions = ReturnType<typeof buildTeamActions>;
106
109
  export type TenantsActions = ReturnType<typeof buildTenantsActions>;
110
+ export type UsersEmailPolicyActions = ReturnType<typeof buildUserEmailPolicyActions>;
107
111
  export type AuthStateActions = {
108
112
  acceptInvitationActions: AcceptInvitationActions;
109
113
  accountSettingsActions: AccountSettingsActions;
@@ -139,6 +143,7 @@ export type AuthStateActions = {
139
143
  stepUpActions: StepUpActions;
140
144
  teamActions: TeamActions;
141
145
  tenantsActions: TenantsActions;
146
+ usersEmailsPolicyActions: UsersEmailPolicyActions;
142
147
  };
143
148
  export type AuthActions = {
144
149
  /** @deprecated use setAuthState instead */
@@ -147,4 +152,4 @@ export type AuthActions = {
147
152
  setErrorByRequestName: (payload: SingleErrorByRequestDataPayload) => void;
148
153
  resetAuthState: (state?: Partial<AuthState>) => void;
149
154
  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;
155
+ } & 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,
@@ -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
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.75.0-alpha.1
1
+ /** @license Frontegg v7.75.0
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/interfaces.d.ts CHANGED
@@ -11,6 +11,7 @@ import { AuditsState } from './audits/interfaces';
11
11
  import { AuditsActions } from './audits';
12
12
  import { OldAuditsState } from './audits-backward-compatibility/interfaces';
13
13
  import { OldAuditsActions } from './audits-backward-compatibility';
14
+ import { DeepPartial } from './types';
14
15
  /**
15
16
  * @deprecated use FronteggStore instead
16
17
  */
@@ -110,6 +111,3 @@ export type LoaderIndicatorState<T extends string, V = string | boolean> = Parti
110
111
  export type ErrorsIndicatorState<T extends string> = Partial<{
111
112
  [key in T]: FronteggApiError | boolean;
112
113
  }>;
113
- export type DeepPartial<T> = {
114
- [P in keyof T]?: T[P] extends any[] | undefined ? T[P] : T[P] extends Function ? T[P] : T[P] extends object | undefined ? Partial<T[P]> : T[P];
115
- };
@@ -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,5 @@
1
+ import { FronteggState, RestApi, SharedActions } from '../../interfaces';
2
+ declare const _default: (store: FronteggState, api: RestApi, sharedActions: SharedActions) => {
3
+ loadUserEmailPolicyState: () => Promise<void>;
4
+ };
5
+ export default _default;
@@ -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
+ });
@@ -7,7 +7,6 @@ exports.initialState = exports.default = void 0;
7
7
  var _proxy = require("../../toolkit/proxy");
8
8
  const initialState = {
9
9
  apiTokenType: null,
10
- searchValue: '',
11
10
  showAddTokenDialog: false,
12
11
  createdByUserIdColumn: 'show',
13
12
  deleteTokenDialog: {
@@ -37,6 +37,62 @@ 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
+ await actions.__refreshToken();
81
+ setProfileState({
82
+ saving: false,
83
+ error: null,
84
+ loading: false
85
+ });
86
+ callback == null ? void 0 : callback(true);
87
+ } catch (e) {
88
+ setProfileState({
89
+ saving: false,
90
+ error: (0, _helpers.errorHandler)(e),
91
+ loading: false
92
+ });
93
+ callback == null ? void 0 : callback(null, e);
94
+ }
95
+ };
40
96
  const saveProfile = async _payload => {
41
97
  const {
42
98
  callback,
@@ -114,7 +170,9 @@ var _default = (store, api, sharedActions) => {
114
170
  resetProfileState,
115
171
  loadProfile,
116
172
  saveProfile,
117
- changePassword
173
+ changePassword,
174
+ updateEmail,
175
+ verifyEmail
118
176
  };
119
177
  };
120
178
  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,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EditEmailView = void 0;
7
+ let EditEmailView;
8
+ exports.EditEmailView = EditEmailView;
9
+ (function (EditEmailView) {
10
+ EditEmailView[EditEmailView["Email"] = 0] = "Email";
11
+ EditEmailView[EditEmailView["Otc"] = 1] = "Otc";
12
+ EditEmailView[EditEmailView["Success"] = 2] = "Success";
13
+ })(EditEmailView || (exports.EditEmailView = EditEmailView = {}));
@@ -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;
@@ -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
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.75.0-alpha.1
1
+ /** @license Frontegg v7.75.0
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.
@@ -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/node/types.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "7.75.0-alpha.1",
3
+ "version": "7.75.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.75.0-alpha.1",
10
+ "@frontegg/rest-api": "7.75.0",
11
11
  "fast-deep-equal": "3.1.3",
12
12
  "get-value": "^3.0.1",
13
13
  "proxy-compare": "^3.0.0",
@@ -1,4 +1,5 @@
1
- import { DeepPartial, FronteggState, RestApi, SharedActions } from '../../interfaces';
1
+ import { FronteggState, RestApi, SharedActions } from '../../interfaces';
2
+ import { DeepPartial } from '../../types';
2
3
  import { BillingState } from './interfaces';
3
4
  import { buildInformationActions } from './Information';
4
5
  import { buildInvoicesActions } from './Invoices';
@@ -1,4 +1,5 @@
1
- import { DeepPartial, FronteggActions, FronteggState, RestApi } from '../interfaces';
1
+ import { FronteggActions, FronteggState, RestApi } from '../interfaces';
2
+ import { DeepPartial } from '../types';
2
3
  export * from './Checkout/interfaces';
3
4
  export * from './Billing/interfaces';
4
5
  export * from './Plans/interfaces';
@@ -1,5 +1,6 @@
1
1
  import { ContextOptions } from '@frontegg/rest-api';
2
- import { DeepPartial, FronteggActions, FronteggStateActions, FronteggStore, PartialFronteggState, RootState } from '../interfaces';
2
+ import { FronteggActions, FronteggStateActions, FronteggStore, PartialFronteggState, RootState } from '../interfaces';
3
+ import { DeepPartial } from '../types';
3
4
  import { AuthState } from '../auth';
4
5
  export * from '../auth';
5
6
  export * from '../interfaces';
package/types.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type DeepPartial<T> = {
2
+ [P in keyof T]?: T[P] extends any[] | undefined ? T[P] : T[P] extends Function ? T[P] : T[P] extends object | undefined ? Partial<T[P]> : T[P];
3
+ };
package/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};