@frontegg/redux-store 5.58.1 → 5.60.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/TeamState/index.d.ts +21 -1
- package/auth/TeamState/interfaces.d.ts +10 -1
- package/auth/TenantsState/index.d.ts +6 -0
- package/auth/TenantsState/interfaces.d.ts +2 -1
- package/auth/dummy.d.ts +3 -1
- package/auth/index.d.ts +16 -0
- package/auth/index.js +246 -4
- package/auth/reducer.d.ts +16 -0
- package/node/auth/index.js +1 -1
- package/node/{index-c7535125.js → index-9f052030.js} +246 -4
- package/node/index.js +1 -1
- package/node/toolkit/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAddUser, IDeleteUser, ILoadUsers, IResendActivationLink, IResendInvitationLink, ITeamUser, IUpdateUser, ICreateOrUpdateInviteUserLink } from '@frontegg/rest-api';
|
|
1
|
+
import { IAddUser, IDeleteUser, ILoadUsers, IResendActivationLink, IResendInvitationLink, ITeamUser, IUpdateUser, ICreateOrUpdateInviteUserLink, ILoadAllUsers, ISubTenantUser, AddUserToSubTenantsRequest, RemoveUserFromSubTenantsRequest, UpdateUserRolesForSubTenantsRequestDto } from '@frontegg/rest-api';
|
|
2
2
|
import { ISetAddUserDialog, ISetDeleteUserDialog, TeamState, TeamStateIndicator, LoadRolesAndPermissionsPayload } from './interfaces';
|
|
3
3
|
import { WithCallback, WithSilentLoad } from '../../interfaces';
|
|
4
4
|
declare const teamState: TeamState;
|
|
@@ -90,6 +90,7 @@ declare const reducers: {
|
|
|
90
90
|
};
|
|
91
91
|
declare const actions: {
|
|
92
92
|
loadUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<WithSilentLoad<ILoadUsers>, ITeamUser[]>], WithCallback<WithSilentLoad<ILoadUsers>, ITeamUser[]>, string, never, never>;
|
|
93
|
+
loadAllSubTenantsUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<WithSilentLoad<Partial<ILoadAllUsers>>, ISubTenantUser[]>], WithCallback<WithSilentLoad<Partial<ILoadAllUsers>>, ISubTenantUser[]>, string, never, never>;
|
|
93
94
|
loadRoles: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[({
|
|
94
95
|
callback?: ((data: {
|
|
95
96
|
roles: import("@frontegg/rest-api").ITeamUserRole[];
|
|
@@ -102,8 +103,16 @@ declare const actions: {
|
|
|
102
103
|
} | null, error?: string | undefined) => void) | undefined;
|
|
103
104
|
} | undefined, string, never, never>;
|
|
104
105
|
addUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IAddUser, ITeamUser>], WithCallback<IAddUser, ITeamUser>, string, never, never>;
|
|
106
|
+
addUserToSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<AddUserToSubTenantsRequest, boolean>], WithCallback<AddUserToSubTenantsRequest, boolean>, string, never, never>;
|
|
105
107
|
updateUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<Partial<ITeamUser>, ITeamUser>], WithCallback<Partial<ITeamUser>, ITeamUser>, string, never, never>;
|
|
106
108
|
deleteUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IDeleteUser, boolean>], WithCallback<IDeleteUser, boolean>, string, never, never>;
|
|
109
|
+
setUserRolesForSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<UpdateUserRolesForSubTenantsRequestDto & {
|
|
110
|
+
userId: string;
|
|
111
|
+
}, boolean>], WithCallback<UpdateUserRolesForSubTenantsRequestDto & {
|
|
112
|
+
userId: string;
|
|
113
|
+
}, boolean>, string, never, never>;
|
|
114
|
+
deleteUserFromSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<RemoveUserFromSubTenantsRequest, boolean>], WithCallback<RemoveUserFromSubTenantsRequest, boolean>, string, never, never>;
|
|
115
|
+
lockUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IDeleteUser, boolean>], WithCallback<IDeleteUser, boolean>, string, never, never>;
|
|
107
116
|
resendActivationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IResendActivationLink, boolean>], WithCallback<IResendActivationLink, boolean>, string, never, never>;
|
|
108
117
|
resendInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IResendInvitationLink, boolean>], WithCallback<IResendInvitationLink, boolean>, string, never, never>;
|
|
109
118
|
getInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
@@ -118,6 +127,8 @@ declare const actions: {
|
|
|
118
127
|
closeAddUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[any?], any, string, never, never>;
|
|
119
128
|
openDeleteUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(Pick<import("./interfaces").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined)?], Pick<import("./interfaces").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined, string, never, never>;
|
|
120
129
|
closeDeleteUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[any?], any, string, never, never>;
|
|
130
|
+
openLockUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(Pick<import("./interfaces").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined)?], Pick<import("./interfaces").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined, string, never, never>;
|
|
131
|
+
closeLockUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[any?], any, string, never, never>;
|
|
121
132
|
};
|
|
122
133
|
/**
|
|
123
134
|
* To be used for actions types after dispatch, and should contains
|
|
@@ -129,10 +140,17 @@ declare type DispatchedActions = {
|
|
|
129
140
|
setTeamState: (payload: Partial<TeamState>) => void;
|
|
130
141
|
resetTeamState: () => void;
|
|
131
142
|
loadUsers: (payload: WithCallback<WithSilentLoad<ILoadUsers>, ITeamUser[]>) => void;
|
|
143
|
+
loadAllSubTenantsUsers: (payload: WithCallback<WithSilentLoad<Partial<ILoadAllUsers>>, ISubTenantUser[]>) => void;
|
|
132
144
|
loadRoles: (payload?: LoadRolesAndPermissionsPayload) => void;
|
|
133
145
|
addUser: (payload: WithCallback<IAddUser, ITeamUser>) => void;
|
|
146
|
+
addUserToSubTenants: (payload: WithCallback<AddUserToSubTenantsRequest>) => void;
|
|
147
|
+
setUserRolesForSubTenants: (payload: WithCallback<UpdateUserRolesForSubTenantsRequestDto & {
|
|
148
|
+
userId: string;
|
|
149
|
+
}>) => void;
|
|
134
150
|
updateUser: (payload: WithCallback<IUpdateUser, ITeamUser>) => void;
|
|
135
151
|
deleteUser: (payload: WithCallback<IDeleteUser>) => void;
|
|
152
|
+
deleteUserFromSubTenants: (payload: WithCallback<RemoveUserFromSubTenantsRequest>) => void;
|
|
153
|
+
lockUser: (payload: WithCallback<IDeleteUser>) => void;
|
|
136
154
|
resendActivationLink: (payload: WithCallback<IResendActivationLink>) => void;
|
|
137
155
|
resendInvitationLink: (payload: WithCallback<IResendInvitationLink>) => void;
|
|
138
156
|
getInvitationLink: () => void;
|
|
@@ -143,6 +161,8 @@ declare type DispatchedActions = {
|
|
|
143
161
|
closeAddUserDialog: (payload?: any) => void;
|
|
144
162
|
openDeleteUserDialog: (payload?: ISetDeleteUserDialog) => void;
|
|
145
163
|
closeDeleteUserDialog: (payload?: any) => void;
|
|
164
|
+
openLockUserDialog: (payload?: ISetDeleteUserDialog) => void;
|
|
165
|
+
closeLockUserDialog: (payload?: any) => void;
|
|
146
166
|
};
|
|
147
167
|
export declare type TeamActions = DispatchedActions;
|
|
148
168
|
export { teamState, reducers as teamReducers, actions as teamActions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITeamUserRole, ITeamUser, QuerySort, QueryFilter, ITeamUserPermission } from '@frontegg/rest-api';
|
|
1
|
+
import { ITeamUserRole, ITeamUser, QuerySort, QueryFilter, ITeamUserPermission, ISubTenantUser } from '@frontegg/rest-api';
|
|
2
2
|
import { LoaderIndicatorState, WithCallback } from '../../interfaces';
|
|
3
3
|
export declare enum TeamStateKeys {
|
|
4
4
|
USERS = "USERS",
|
|
@@ -42,6 +42,14 @@ export interface TeamState {
|
|
|
42
42
|
loaders: LoaderIndicatorState<TeamStateKeys>;
|
|
43
43
|
errors: LoaderIndicatorState<TeamStateKeys>;
|
|
44
44
|
users: ITeamUser[];
|
|
45
|
+
allUsers: ISubTenantUser[];
|
|
46
|
+
allUsersQueryParams: {
|
|
47
|
+
_offset: number;
|
|
48
|
+
_limit: number;
|
|
49
|
+
_filter: string | null;
|
|
50
|
+
_sortBy: string;
|
|
51
|
+
_order: 'ASC' | 'DESC';
|
|
52
|
+
};
|
|
45
53
|
pageOffset: number;
|
|
46
54
|
pageSize: number;
|
|
47
55
|
totalPages: number;
|
|
@@ -53,6 +61,7 @@ export interface TeamState {
|
|
|
53
61
|
addedThisWeek?: number;
|
|
54
62
|
addUserDialogState: AddUserDialogState;
|
|
55
63
|
deleteUserDialogState: DeleteUserDialogState;
|
|
64
|
+
lockUserDialogState: DeleteUserDialogState;
|
|
56
65
|
inviteTokenState?: InviteTokenState;
|
|
57
66
|
}
|
|
58
67
|
export interface InviteTokenState {
|
|
@@ -82,6 +82,11 @@ declare const actions: {
|
|
|
82
82
|
} | undefined)?], {
|
|
83
83
|
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
84
84
|
} | undefined, string, never, never>;
|
|
85
|
+
loadSubTenantsTree: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[({
|
|
86
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
87
|
+
} | undefined)?], {
|
|
88
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
89
|
+
} | undefined, string, never, never>;
|
|
85
90
|
};
|
|
86
91
|
/**
|
|
87
92
|
* To be used for actions types after dispatch, and should contains
|
|
@@ -93,6 +98,7 @@ declare type DispatchedActions = {
|
|
|
93
98
|
switchTenant: (payload: WithCallback<ISwitchTenant>) => void;
|
|
94
99
|
loadTenants: (payload?: WithCallback<{}, ITenantsResponse[]>) => void;
|
|
95
100
|
loadSubTenants: (payload?: WithCallback<{}>) => void;
|
|
101
|
+
loadSubTenantsTree: (payload?: WithCallback<{}>) => void;
|
|
96
102
|
};
|
|
97
103
|
export declare type TenantsActions = DispatchedActions;
|
|
98
104
|
export { tenantsState, reducers as tenantsReducers, actions as tenantsActions };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ISubTenant, ITenantsResponse } from '@frontegg/rest-api';
|
|
1
|
+
import { ISubTenant, ISubTenantTree, ITenantsResponse } from '@frontegg/rest-api';
|
|
2
2
|
export { ISubTenant };
|
|
3
3
|
export interface TenantsState {
|
|
4
4
|
tenants: ITenantsResponse[];
|
|
5
5
|
loading: boolean;
|
|
6
6
|
error?: any;
|
|
7
7
|
subTenants: ISubTenant[];
|
|
8
|
+
tenantTree: ISubTenantTree | null;
|
|
8
9
|
}
|
package/auth/dummy.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRole, IRolePermission, ISamlConfiguration, ISamlMetadata, ISecurityPolicy, ISecurityPolicyLockout, ISecurityPolicyMfa, ISecurityPolicyPasswordHistory, ITeamUser, ITeamUserPermission, ITeamUserRole, ITenantsResponse, IUserProfile, IVendorConfig } from '@frontegg/rest-api';
|
|
1
|
+
import { IRole, IRolePermission, ISamlConfiguration, ISamlMetadata, ISecurityPolicy, ISecurityPolicyLockout, ISecurityPolicyMfa, ISecurityPolicyPasswordHistory, ITeamUser, ITeamUserPermission, ITeamUserRole, ITenantsResponse, IUserProfile, IVendorConfig, ISubTenantUser } from '@frontegg/rest-api';
|
|
2
2
|
import { IApiTokensData, ITenantApiTokensData } from './ApiTokensState/interfaces';
|
|
3
3
|
import { User } from './interfaces';
|
|
4
4
|
import { ProfileState } from './ProfileState/interfaces';
|
|
@@ -22,5 +22,7 @@ export declare const ssoStateDemo: SSOState;
|
|
|
22
22
|
export declare const permissionsDemo: ITeamUserPermission[];
|
|
23
23
|
export declare const userTeamDemo2: ITeamUser;
|
|
24
24
|
export declare const userTeamDemo: ITeamUser;
|
|
25
|
+
export declare const userSubTenantDemo: ISubTenantUser;
|
|
25
26
|
export declare const usersDemo: ITeamUser[];
|
|
27
|
+
export declare const allUsersDemo: ISubTenantUser[];
|
|
26
28
|
export declare const tenantsDemo: ITenantsResponse[];
|
package/auth/index.d.ts
CHANGED
|
@@ -65,6 +65,11 @@ declare const _default: {
|
|
|
65
65
|
} | undefined)?], {
|
|
66
66
|
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
67
67
|
} | undefined, string, never, never>;
|
|
68
|
+
loadSubTenantsTree: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[({
|
|
69
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
70
|
+
} | undefined)?], {
|
|
71
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
72
|
+
} | undefined, string, never, never>;
|
|
68
73
|
loadAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(import("../interfaces").WithCallback<{
|
|
69
74
|
silentLoading?: boolean | undefined;
|
|
70
75
|
}, boolean> | undefined)?], import("../interfaces").WithCallback<{
|
|
@@ -93,6 +98,7 @@ declare const _default: {
|
|
|
93
98
|
deleteUserApiToken: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[string], string, string, never, never>;
|
|
94
99
|
deleteTenantApiToken: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[string], string, string, never, never>;
|
|
95
100
|
loadUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("../interfaces").WithSilentLoad<import("@frontegg/rest-api").ILoadUsers>, import("@frontegg/rest-api").ITeamUser[]>], import("../interfaces").WithCallback<import("../interfaces").WithSilentLoad<import("@frontegg/rest-api").ILoadUsers>, import("@frontegg/rest-api").ITeamUser[]>, string, never, never>;
|
|
101
|
+
loadAllSubTenantsUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("../interfaces").WithSilentLoad<Partial<import("@frontegg/rest-api").ILoadAllUsers>>, import("@frontegg/rest-api").ISubTenantUser[]>], import("../interfaces").WithCallback<import("../interfaces").WithSilentLoad<Partial<import("@frontegg/rest-api").ILoadAllUsers>>, import("@frontegg/rest-api").ISubTenantUser[]>, string, never, never>;
|
|
96
102
|
loadRoles: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[({
|
|
97
103
|
callback?: ((data: {
|
|
98
104
|
roles: import("@frontegg/rest-api").ITeamUserRole[];
|
|
@@ -105,8 +111,16 @@ declare const _default: {
|
|
|
105
111
|
} | null, error?: string | undefined) => void) | undefined;
|
|
106
112
|
} | undefined, string, never, never>;
|
|
107
113
|
addUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IAddUser, import("@frontegg/rest-api").ITeamUser>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IAddUser, import("@frontegg/rest-api").ITeamUser>, string, never, never>;
|
|
114
|
+
addUserToSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").AddUserToSubTenantsRequest, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").AddUserToSubTenantsRequest, boolean>, string, never, never>;
|
|
108
115
|
updateUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<Partial<import("@frontegg/rest-api").ITeamUser>, import("@frontegg/rest-api").ITeamUser>], import("../interfaces").WithCallback<Partial<import("@frontegg/rest-api").ITeamUser>, import("@frontegg/rest-api").ITeamUser>, string, never, never>;
|
|
109
116
|
deleteUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>, string, never, never>;
|
|
117
|
+
setUserRolesForSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").UpdateUserRolesForSubTenantsRequestDto & {
|
|
118
|
+
userId: string;
|
|
119
|
+
}, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").UpdateUserRolesForSubTenantsRequestDto & {
|
|
120
|
+
userId: string;
|
|
121
|
+
}, boolean>, string, never, never>;
|
|
122
|
+
deleteUserFromSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").RemoveUserFromSubTenantsRequest, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").RemoveUserFromSubTenantsRequest, boolean>, string, never, never>;
|
|
123
|
+
lockUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>, string, never, never>;
|
|
110
124
|
resendActivationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IResendActivationLink, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IResendActivationLink, boolean>, string, never, never>;
|
|
111
125
|
resendInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>, string, never, never>;
|
|
112
126
|
getInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
@@ -121,6 +135,8 @@ declare const _default: {
|
|
|
121
135
|
closeAddUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[any?], any, string, never, never>;
|
|
122
136
|
openDeleteUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(Pick<import("./TeamState/interfaces").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined)?], Pick<import("./TeamState/interfaces").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined, string, never, never>;
|
|
123
137
|
closeDeleteUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[any?], any, string, never, never>;
|
|
138
|
+
openLockUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(Pick<import("./TeamState/interfaces").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined)?], Pick<import("./TeamState/interfaces").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined, string, never, never>;
|
|
139
|
+
closeLockUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[any?], any, string, never, never>;
|
|
124
140
|
enrollMfa: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
125
141
|
verifyMfa: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IVerifyMfa, string | undefined>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IVerifyMfa, string | undefined>, string, never, never>;
|
|
126
142
|
verifyMfaAfterForce: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").ILoginWithMfa, string | undefined>], import("../interfaces").WithCallback<import("@frontegg/rest-api").ILoginWithMfa, string | undefined>, string, never, never>;
|
package/auth/index.js
CHANGED
|
@@ -271,11 +271,19 @@ const teamState = {
|
|
|
271
271
|
pageSize: 20,
|
|
272
272
|
errors: {},
|
|
273
273
|
users: [],
|
|
274
|
+
allUsers: [],
|
|
274
275
|
roles: [],
|
|
275
276
|
permissions: [],
|
|
276
277
|
totalPages: 0,
|
|
277
278
|
filter: [],
|
|
278
279
|
sort: [],
|
|
280
|
+
allUsersQueryParams: {
|
|
281
|
+
_filter: null,
|
|
282
|
+
_offset: 0,
|
|
283
|
+
_limit: 20,
|
|
284
|
+
_order: 'DESC',
|
|
285
|
+
_sortBy: 'name',
|
|
286
|
+
},
|
|
279
287
|
addUserDialogState: {
|
|
280
288
|
loading: false,
|
|
281
289
|
open: false,
|
|
@@ -284,6 +292,10 @@ const teamState = {
|
|
|
284
292
|
loading: false,
|
|
285
293
|
open: false,
|
|
286
294
|
},
|
|
295
|
+
lockUserDialogState: {
|
|
296
|
+
loading: false,
|
|
297
|
+
open: false,
|
|
298
|
+
},
|
|
287
299
|
};
|
|
288
300
|
const reducers$7 = {
|
|
289
301
|
setTeamLoader: loadersReducerForKey('teamState'),
|
|
@@ -293,12 +305,17 @@ const reducers$7 = {
|
|
|
293
305
|
};
|
|
294
306
|
const actions$8 = {
|
|
295
307
|
loadUsers: createAction(`${authStoreName}/loadUsers`, (payload) => ({ payload })),
|
|
308
|
+
loadAllSubTenantsUsers: createAction(`${authStoreName}/loadAllSubTenantsUsers`, (payload) => ({ payload })),
|
|
296
309
|
loadRoles: createAction(`${authStoreName}/loadRoles`, (payload) => ({ payload })),
|
|
297
310
|
addUser: createAction(`${authStoreName}/addUser`, (payload) => ({ payload })),
|
|
311
|
+
addUserToSubTenants: createAction(`${authStoreName}/addUserToSubTenants`, (payload) => ({ payload })),
|
|
298
312
|
updateUser: createAction(`${authStoreName}/updateUser`, (payload) => ({
|
|
299
313
|
payload,
|
|
300
314
|
})),
|
|
301
315
|
deleteUser: createAction(`${authStoreName}/deleteUser`, (payload) => ({ payload })),
|
|
316
|
+
setUserRolesForSubTenants: createAction(`${authStoreName}/setUserRolesForSubTenants`, (payload) => ({ payload })),
|
|
317
|
+
deleteUserFromSubTenants: createAction(`${authStoreName}/deleteUserFromSubTenants`, (payload) => ({ payload })),
|
|
318
|
+
lockUser: createAction(`${authStoreName}/lockUser`, (payload) => ({ payload })),
|
|
302
319
|
resendActivationLink: createAction(`${authStoreName}/resendActivationLink`, (payload) => ({ payload })),
|
|
303
320
|
resendInvitationLink: createAction(`${authStoreName}/resendInvitationLink`, (payload) => ({ payload })),
|
|
304
321
|
getInvitationLink: createAction(`${authStoreName}/getInvitationLink`),
|
|
@@ -311,6 +328,10 @@ const actions$8 = {
|
|
|
311
328
|
payload,
|
|
312
329
|
})),
|
|
313
330
|
closeDeleteUserDialog: createAction(`${authStoreName}/closeDeleteUserDialog`, (payload) => ({ payload })),
|
|
331
|
+
openLockUserDialog: createAction(`${authStoreName}/openLockUserDialog`, (payload) => ({
|
|
332
|
+
payload,
|
|
333
|
+
})),
|
|
334
|
+
closeLockUserDialog: createAction(`${authStoreName}/closeLockUserDialog`, (payload) => ({ payload })),
|
|
314
335
|
};
|
|
315
336
|
|
|
316
337
|
const socialLoginState = {
|
|
@@ -463,6 +484,7 @@ const tenantsState = {
|
|
|
463
484
|
tenants: [],
|
|
464
485
|
subTenants: [],
|
|
465
486
|
loading: true,
|
|
487
|
+
tenantTree: null,
|
|
466
488
|
};
|
|
467
489
|
const reducers$1 = {
|
|
468
490
|
setTenantsState: typeReducerForKey('tenantsState'),
|
|
@@ -476,6 +498,9 @@ const actions$2 = {
|
|
|
476
498
|
loadSubTenants: createAction(`${authStoreName}/loadSubTenants`, (payload) => ({
|
|
477
499
|
payload,
|
|
478
500
|
})),
|
|
501
|
+
loadSubTenantsTree: createAction(`${authStoreName}/loadSubTenantsTree`, (payload) => ({
|
|
502
|
+
payload,
|
|
503
|
+
})),
|
|
479
504
|
};
|
|
480
505
|
|
|
481
506
|
const rolesState = {
|
|
@@ -805,7 +830,26 @@ const userTeamDemo = {
|
|
|
805
830
|
mfaEnabled: undefined,
|
|
806
831
|
roles: [],
|
|
807
832
|
};
|
|
833
|
+
const userSubTenantDemo = {
|
|
834
|
+
metadata: '',
|
|
835
|
+
mfaEnrolled: false,
|
|
836
|
+
permissions: [],
|
|
837
|
+
provider: '',
|
|
838
|
+
sub: '',
|
|
839
|
+
tenantIds: [],
|
|
840
|
+
tenants: [],
|
|
841
|
+
verified: false,
|
|
842
|
+
id: 'id',
|
|
843
|
+
email: 'email',
|
|
844
|
+
name: 'name',
|
|
845
|
+
tenantId: 'tenantId',
|
|
846
|
+
activatedForTenant: true,
|
|
847
|
+
createdAt: new Date(),
|
|
848
|
+
lastLogin: new Date(),
|
|
849
|
+
roles: [],
|
|
850
|
+
};
|
|
808
851
|
const usersDemo = [userTeamDemo, userTeamDemo2];
|
|
852
|
+
const allUsersDemo = [userSubTenantDemo];
|
|
809
853
|
const tenantsDemo = [
|
|
810
854
|
{
|
|
811
855
|
id: 'my-tenant-id',
|
|
@@ -2448,6 +2492,48 @@ function* loadUsers({ payload }) {
|
|
|
2448
2492
|
}
|
|
2449
2493
|
yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: false }));
|
|
2450
2494
|
}
|
|
2495
|
+
function* loadAllSubTenantsUsers({ payload, }) {
|
|
2496
|
+
var _a, _b, _c, _d, _e;
|
|
2497
|
+
const { silentLoading, callback } = payload;
|
|
2498
|
+
const teamState = yield selectTeamState();
|
|
2499
|
+
const _limit = (_a = payload._limit) !== null && _a !== void 0 ? _a : teamState.allUsersQueryParams._limit;
|
|
2500
|
+
const _offset = (_b = payload._offset) !== null && _b !== void 0 ? _b : teamState.allUsersQueryParams._offset;
|
|
2501
|
+
const _filter = (_c = payload._filter) !== null && _c !== void 0 ? _c : teamState.allUsersQueryParams._filter;
|
|
2502
|
+
const _sortBy = (_d = payload._sortBy) !== null && _d !== void 0 ? _d : teamState.allUsersQueryParams._sortBy;
|
|
2503
|
+
const _order = (_e = payload._order) !== null && _e !== void 0 ? _e : teamState.allUsersQueryParams._order;
|
|
2504
|
+
const allUsersQueryParams = {
|
|
2505
|
+
_limit: _limit || 20,
|
|
2506
|
+
_offset: _offset || 0,
|
|
2507
|
+
_filter: _filter || '',
|
|
2508
|
+
_sortBy: _sortBy || 'name',
|
|
2509
|
+
_order: _order || 'DESC',
|
|
2510
|
+
};
|
|
2511
|
+
yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: !silentLoading }));
|
|
2512
|
+
yield put(actions.setTeamState({
|
|
2513
|
+
allUsersQueryParams,
|
|
2514
|
+
}));
|
|
2515
|
+
try {
|
|
2516
|
+
const [{ items: users, _metadata: { totalPages, totalItems }, }, { items: roles }, { items: permissions },] = yield all([
|
|
2517
|
+
call(api.subTenants.loadAllUsers, Object.assign({}, allUsersQueryParams)),
|
|
2518
|
+
call(api.teams.loadAvailableRoles),
|
|
2519
|
+
call(api.teams.loadAvailablePermissions),
|
|
2520
|
+
]);
|
|
2521
|
+
yield put(actions.setTeamState({
|
|
2522
|
+
allUsers: users,
|
|
2523
|
+
totalPages,
|
|
2524
|
+
totalItems,
|
|
2525
|
+
roles,
|
|
2526
|
+
permissions,
|
|
2527
|
+
}));
|
|
2528
|
+
callback === null || callback === void 0 ? void 0 : callback(users);
|
|
2529
|
+
}
|
|
2530
|
+
catch (e) {
|
|
2531
|
+
yield put(actions.setTeamError({ key: TeamStateKeys.USERS, value: e.message }));
|
|
2532
|
+
yield put(actions.setTeamState({ totalPages: 0, users: [] }));
|
|
2533
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
2534
|
+
}
|
|
2535
|
+
yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: false }));
|
|
2536
|
+
}
|
|
2451
2537
|
function* loadRoles({ payload }) {
|
|
2452
2538
|
var _a, _b;
|
|
2453
2539
|
yield put(actions.setTeamLoader({ key: TeamStateKeys.ROLES_AND_PERMISSIONS, value: true }));
|
|
@@ -2487,6 +2573,34 @@ function* addUser({ payload }) {
|
|
|
2487
2573
|
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2488
2574
|
}
|
|
2489
2575
|
}
|
|
2576
|
+
function* addUserToSubTenants({ payload }) {
|
|
2577
|
+
const { callback } = payload, body = __rest(payload, ["callback"]);
|
|
2578
|
+
const teamState = yield selectTeamState();
|
|
2579
|
+
yield put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
|
|
2580
|
+
try {
|
|
2581
|
+
yield call(api.subTenants.addUserToTenantAndSubTenants, body);
|
|
2582
|
+
const { items: users, _metadata: { totalPages, totalItems }, } = yield call(api.subTenants.loadAllUsers, {
|
|
2583
|
+
_limit: 20,
|
|
2584
|
+
_offset: 0,
|
|
2585
|
+
_filter: '',
|
|
2586
|
+
_sortBy: 'name',
|
|
2587
|
+
_order: 'DESC',
|
|
2588
|
+
});
|
|
2589
|
+
yield put(actions.setTeamState({
|
|
2590
|
+
allUsers: users,
|
|
2591
|
+
totalPages,
|
|
2592
|
+
totalItems,
|
|
2593
|
+
addUserDialogState: { open: false, loading: false },
|
|
2594
|
+
}));
|
|
2595
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
2596
|
+
}
|
|
2597
|
+
catch (e) {
|
|
2598
|
+
yield put(actions.setTeamState({
|
|
2599
|
+
addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: false, error: e.message }),
|
|
2600
|
+
}));
|
|
2601
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2490
2604
|
function* updateUser({ payload }) {
|
|
2491
2605
|
var _a;
|
|
2492
2606
|
const { callback, profileImage } = payload, body = __rest(payload, ["callback", "profileImage"]);
|
|
@@ -2544,6 +2658,58 @@ function* deleteUser({ payload }) {
|
|
|
2544
2658
|
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2545
2659
|
}
|
|
2546
2660
|
}
|
|
2661
|
+
function* setUserRolesForSubTenants({ payload, }) {
|
|
2662
|
+
const { callback, userId } = payload, body = __rest(payload, ["callback", "userId"]);
|
|
2663
|
+
const teamState = yield selectTeamState();
|
|
2664
|
+
yield put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
|
|
2665
|
+
try {
|
|
2666
|
+
yield call(api.subTenants.setUserRolesForSubTenants, userId, body);
|
|
2667
|
+
const updatedUser = teamState.allUsers.find((user) => user.id === userId);
|
|
2668
|
+
if (updatedUser) {
|
|
2669
|
+
updatedUser.tenants = updatedUser.tenants.map((tenant) => {
|
|
2670
|
+
var _a;
|
|
2671
|
+
return (Object.assign(Object.assign({}, tenant), { roles: ((_a = body.subTenantsRoles
|
|
2672
|
+
.find((roleUpdate) => roleUpdate.tenantId === tenant.tenantId)) === null || _a === void 0 ? void 0 : _a.roleIds.map((roleId) => {
|
|
2673
|
+
const role = teamState.roles.find(({ id }) => roleId === id);
|
|
2674
|
+
return role;
|
|
2675
|
+
}).filter((role) => role)) || tenant.roles }));
|
|
2676
|
+
});
|
|
2677
|
+
}
|
|
2678
|
+
yield put(actions.setTeamState({
|
|
2679
|
+
allUsers: [
|
|
2680
|
+
...teamState.allUsers.filter((user) => user.id !== userId),
|
|
2681
|
+
...(updatedUser ? [updatedUser] : []),
|
|
2682
|
+
],
|
|
2683
|
+
addUserDialogState: { open: false, loading: false },
|
|
2684
|
+
}));
|
|
2685
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2686
|
+
}
|
|
2687
|
+
catch (e) {
|
|
2688
|
+
yield put(actions.setTeamState({
|
|
2689
|
+
addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: false, error: e.message }),
|
|
2690
|
+
}));
|
|
2691
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
function* deleteUserFromSubTenants({ payload }) {
|
|
2695
|
+
const { callback } = payload, body = __rest(payload, ["callback"]);
|
|
2696
|
+
const teamState = yield selectTeamState();
|
|
2697
|
+
yield put(actions.setTeamState({ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: true }) }));
|
|
2698
|
+
try {
|
|
2699
|
+
yield call(api.subTenants.removeUserFromTenantAndSubTenants, body);
|
|
2700
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2701
|
+
yield put(actions.setTeamState({
|
|
2702
|
+
allUsers: teamState.allUsers.filter((user) => user.id !== body.userId && user.tenants.length === body.subTenants.length),
|
|
2703
|
+
deleteUserDialogState: { open: false, loading: false },
|
|
2704
|
+
}));
|
|
2705
|
+
}
|
|
2706
|
+
catch (e) {
|
|
2707
|
+
yield put(actions.setTeamState({
|
|
2708
|
+
deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: false, error: e.message }),
|
|
2709
|
+
}));
|
|
2710
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2547
2713
|
function* resendActivationLink({ payload }) {
|
|
2548
2714
|
const { callback } = payload, body = __rest(payload, ["callback"]);
|
|
2549
2715
|
yield put(actions.setTeamLoader({ key: TeamStateKeys.RESEND_ACTIVATE_LINK, value: body.userId }));
|
|
@@ -2592,7 +2758,7 @@ function* getInvitationLink() {
|
|
|
2592
2758
|
yield put(actions.setTeamError({ key: TeamStateKeys.GET_TOKEN_LINK, value: e.message }));
|
|
2593
2759
|
}
|
|
2594
2760
|
}
|
|
2595
|
-
function* createInvitationLink({ payload: { callback } }) {
|
|
2761
|
+
function* createInvitationLink({ payload: { callback }, }) {
|
|
2596
2762
|
yield put(actions.setTeamError({ key: TeamStateKeys.CREATE_TOKEN_LINK, value: false }));
|
|
2597
2763
|
const { inviteTokenState } = yield selectTeamState();
|
|
2598
2764
|
try {
|
|
@@ -2605,7 +2771,7 @@ function* createInvitationLink({ payload: { callback } }) {
|
|
|
2605
2771
|
yield put(actions.setTeamError({ key: TeamStateKeys.CREATE_TOKEN_LINK, value: e.message }));
|
|
2606
2772
|
}
|
|
2607
2773
|
}
|
|
2608
|
-
function* updateInvitationLink({ payload: { callback, expiresInMinutes, shouldSendEmail } }) {
|
|
2774
|
+
function* updateInvitationLink({ payload: { callback, expiresInMinutes, shouldSendEmail }, }) {
|
|
2609
2775
|
const { inviteTokenState } = yield selectTeamState();
|
|
2610
2776
|
yield put(actions.setTeamError({ key: TeamStateKeys.UPDATE_TOKEN_LINK, value: false }));
|
|
2611
2777
|
try {
|
|
@@ -2638,7 +2804,7 @@ function* openAddUserDialog({ payload }) {
|
|
|
2638
2804
|
}
|
|
2639
2805
|
function* closeAddUserDialog({ payload }) {
|
|
2640
2806
|
const teamState = yield selectTeamState();
|
|
2641
|
-
const { addUserDialogState: { onClose } } = teamState;
|
|
2807
|
+
const { addUserDialogState: { onClose }, } = teamState;
|
|
2642
2808
|
onClose === null || onClose === void 0 ? void 0 : onClose(payload);
|
|
2643
2809
|
yield put(actions.setTeamState({
|
|
2644
2810
|
addUserDialogState: {
|
|
@@ -2655,7 +2821,7 @@ function* openDeleteUserDialog({ payload }) {
|
|
|
2655
2821
|
}
|
|
2656
2822
|
function* closeDeleteUserDialog({ payload }) {
|
|
2657
2823
|
const teamState = yield selectTeamState();
|
|
2658
|
-
const { deleteUserDialogState: { onClose } } = teamState;
|
|
2824
|
+
const { deleteUserDialogState: { onClose }, } = teamState;
|
|
2659
2825
|
onClose === null || onClose === void 0 ? void 0 : onClose(payload);
|
|
2660
2826
|
yield put(actions.setTeamState({
|
|
2661
2827
|
deleteUserDialogState: {
|
|
@@ -2667,10 +2833,14 @@ function* closeDeleteUserDialog({ payload }) {
|
|
|
2667
2833
|
}
|
|
2668
2834
|
function* teamSagas() {
|
|
2669
2835
|
yield takeLatest(actions.loadUsers, loadUsers);
|
|
2836
|
+
yield takeLatest(actions.loadAllSubTenantsUsers, loadAllSubTenantsUsers);
|
|
2670
2837
|
yield takeLatest(actions.loadRoles, loadRoles);
|
|
2671
2838
|
yield takeEvery(actions.addUser, addUser);
|
|
2839
|
+
yield takeEvery(actions.addUserToSubTenants, addUserToSubTenants);
|
|
2672
2840
|
yield takeEvery(actions.updateUser, updateUser);
|
|
2841
|
+
yield takeEvery(actions.setUserRolesForSubTenants, setUserRolesForSubTenants);
|
|
2673
2842
|
yield takeEvery(actions.deleteUser, deleteUser);
|
|
2843
|
+
yield takeEvery(actions.deleteUserFromSubTenants, deleteUserFromSubTenants);
|
|
2674
2844
|
yield takeEvery(actions.resendActivationLink, resendActivationLink);
|
|
2675
2845
|
yield takeEvery(actions.resendInvitationLink, resendInvitationLink);
|
|
2676
2846
|
yield takeEvery(actions.getInvitationLink, getInvitationLink);
|
|
@@ -2707,6 +2877,38 @@ function* loadUsersMock({ payload }) {
|
|
|
2707
2877
|
yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: false }));
|
|
2708
2878
|
callback === null || callback === void 0 ? void 0 : callback(usersDemo);
|
|
2709
2879
|
}
|
|
2880
|
+
function* loadAllSubTenantsUsersMock({ payload, }) {
|
|
2881
|
+
var _a, _b, _c, _d, _e;
|
|
2882
|
+
const { silentLoading, callback } = payload;
|
|
2883
|
+
const teamState = yield selectTeamState();
|
|
2884
|
+
const _limit = (_a = payload._limit) !== null && _a !== void 0 ? _a : teamState.allUsersQueryParams._limit;
|
|
2885
|
+
const _offset = (_b = payload._offset) !== null && _b !== void 0 ? _b : teamState.allUsersQueryParams._offset;
|
|
2886
|
+
const _filter = (_c = payload._filter) !== null && _c !== void 0 ? _c : teamState.allUsersQueryParams._filter;
|
|
2887
|
+
const _sortBy = (_d = payload._sortBy) !== null && _d !== void 0 ? _d : teamState.allUsersQueryParams._sortBy;
|
|
2888
|
+
const _order = (_e = payload._order) !== null && _e !== void 0 ? _e : teamState.allUsersQueryParams._order;
|
|
2889
|
+
yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: !silentLoading }));
|
|
2890
|
+
yield put(actions.setTeamState({
|
|
2891
|
+
allUsersQueryParams: {
|
|
2892
|
+
_limit,
|
|
2893
|
+
_offset,
|
|
2894
|
+
_filter,
|
|
2895
|
+
_sortBy,
|
|
2896
|
+
_order,
|
|
2897
|
+
},
|
|
2898
|
+
}));
|
|
2899
|
+
const totalPages = 2;
|
|
2900
|
+
const totalItems = 10;
|
|
2901
|
+
yield delay();
|
|
2902
|
+
yield put(actions.setTeamState({
|
|
2903
|
+
allUsers: allUsersDemo,
|
|
2904
|
+
totalPages,
|
|
2905
|
+
totalItems,
|
|
2906
|
+
roles: rolesDemo,
|
|
2907
|
+
permissions: permissionsDemo,
|
|
2908
|
+
}));
|
|
2909
|
+
yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: false }));
|
|
2910
|
+
callback === null || callback === void 0 ? void 0 : callback(allUsersDemo);
|
|
2911
|
+
}
|
|
2710
2912
|
function* loadRolesMock({ payload }) {
|
|
2711
2913
|
var _a;
|
|
2712
2914
|
yield put(actions.setTeamLoader({ key: TeamStateKeys.ROLES_AND_PERMISSIONS, value: true }));
|
|
@@ -2727,6 +2929,18 @@ function* addUserMock({ payload }) {
|
|
|
2727
2929
|
addUserDialogState: { open: false, loading: false },
|
|
2728
2930
|
}));
|
|
2729
2931
|
}
|
|
2932
|
+
function* addUserToSubTenantsMock({ payload }) {
|
|
2933
|
+
const { callback } = payload, body = __rest(payload, ["callback"]);
|
|
2934
|
+
const teamState = yield selectTeamState();
|
|
2935
|
+
yield put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
|
|
2936
|
+
yield delay();
|
|
2937
|
+
const newUser = Object.assign(Object.assign(Object.assign({}, userTeamDemo), body), { id: `${v4()}` });
|
|
2938
|
+
yield put(actions.setTeamState({
|
|
2939
|
+
users: [newUser, ...teamState.users],
|
|
2940
|
+
addUserDialogState: { open: false, loading: false },
|
|
2941
|
+
}));
|
|
2942
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
2943
|
+
}
|
|
2730
2944
|
function* updateUserMock({ payload }) {
|
|
2731
2945
|
var _a;
|
|
2732
2946
|
const { callback, profileImage } = payload, body = __rest(payload, ["callback", "profileImage"]);
|
|
@@ -2767,6 +2981,17 @@ function* deleteUserMock({ payload }) {
|
|
|
2767
2981
|
deleteUserDialogState: { open: false, loading: false },
|
|
2768
2982
|
}));
|
|
2769
2983
|
}
|
|
2984
|
+
function* deleteUserFromSubTenantsMock({ payload }) {
|
|
2985
|
+
const { callback } = payload, body = __rest(payload, ["callback"]);
|
|
2986
|
+
const teamState = yield selectTeamState();
|
|
2987
|
+
yield put(actions.setTeamState({ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: true }) }));
|
|
2988
|
+
yield delay();
|
|
2989
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2990
|
+
yield put(actions.setTeamState({
|
|
2991
|
+
allUsers: teamState.allUsers.filter((user) => user.id !== body.userId),
|
|
2992
|
+
deleteUserDialogState: { open: false, loading: false },
|
|
2993
|
+
}));
|
|
2994
|
+
}
|
|
2770
2995
|
function* resendActivationLinkMock({ payload }) {
|
|
2771
2996
|
const { callback } = payload, body = __rest(payload, ["callback"]);
|
|
2772
2997
|
yield put(actions.setTeamLoader({ key: TeamStateKeys.RESEND_ACTIVATE_LINK, value: body.userId }));
|
|
@@ -2783,10 +3008,13 @@ function* resendInvitationLinkMock({ payload }) {
|
|
|
2783
3008
|
}
|
|
2784
3009
|
function* teamSagasMock() {
|
|
2785
3010
|
yield takeLatest(actions.loadUsers, loadUsersMock);
|
|
3011
|
+
yield takeLatest(actions.loadAllSubTenantsUsers, loadAllSubTenantsUsersMock);
|
|
2786
3012
|
yield takeLatest(actions.loadRoles, loadRolesMock);
|
|
2787
3013
|
yield takeEvery(actions.addUser, addUserMock);
|
|
3014
|
+
yield takeEvery(actions.addUserToSubTenants, addUserToSubTenantsMock);
|
|
2788
3015
|
yield takeEvery(actions.updateUser, updateUserMock);
|
|
2789
3016
|
yield takeEvery(actions.deleteUser, deleteUserMock);
|
|
3017
|
+
yield takeEvery(actions.deleteUserFromSubTenants, deleteUserFromSubTenantsMock);
|
|
2790
3018
|
yield takeEvery(actions.resendActivationLink, resendActivationLinkMock);
|
|
2791
3019
|
yield takeEvery(actions.resendInvitationLink, resendInvitationLinkMock);
|
|
2792
3020
|
yield takeEvery(actions.openAddUserDialog, openAddUserDialog);
|
|
@@ -3402,10 +3630,24 @@ function* loadSubTenants({ payload }) {
|
|
|
3402
3630
|
(_b = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _b === void 0 ? void 0 : _b.call(payload, null, e);
|
|
3403
3631
|
}
|
|
3404
3632
|
}
|
|
3633
|
+
function* loadSubTenantsTree({ payload }) {
|
|
3634
|
+
var _a, _b;
|
|
3635
|
+
yield put(actions.setTenantsState({ loading: true }));
|
|
3636
|
+
try {
|
|
3637
|
+
const tenantTree = yield call(api.tenants.getSubTenantsAsTree);
|
|
3638
|
+
yield put(actions.setTenantsState({ tenantTree, loading: false }));
|
|
3639
|
+
(_a = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, true);
|
|
3640
|
+
}
|
|
3641
|
+
catch (e) {
|
|
3642
|
+
yield put(actions.setTenantsState({ loading: false }));
|
|
3643
|
+
(_b = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _b === void 0 ? void 0 : _b.call(payload, null, e);
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3405
3646
|
function* tenantsSagas() {
|
|
3406
3647
|
yield takeEvery(actions.loadTenants, loadTenants);
|
|
3407
3648
|
yield takeEvery(actions.loadSubTenants, loadSubTenants);
|
|
3408
3649
|
yield takeEvery(actions.switchTenant, switchTenant);
|
|
3650
|
+
yield takeEvery(actions.loadSubTenantsTree, loadSubTenantsTree);
|
|
3409
3651
|
}
|
|
3410
3652
|
/*********************************
|
|
3411
3653
|
* Preview Sagas
|
package/auth/reducer.d.ts
CHANGED
|
@@ -38,6 +38,11 @@ declare const actions: {
|
|
|
38
38
|
} | undefined)?], {
|
|
39
39
|
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
40
40
|
} | undefined, string, never, never>;
|
|
41
|
+
loadSubTenantsTree: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[({
|
|
42
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
43
|
+
} | undefined)?], {
|
|
44
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
45
|
+
} | undefined, string, never, never>;
|
|
41
46
|
loadAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(import("../interfaces").WithCallback<{
|
|
42
47
|
silentLoading?: boolean | undefined;
|
|
43
48
|
}, boolean> | undefined)?], import("../interfaces").WithCallback<{
|
|
@@ -66,6 +71,7 @@ declare const actions: {
|
|
|
66
71
|
deleteUserApiToken: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[string], string, string, never, never>;
|
|
67
72
|
deleteTenantApiToken: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[string], string, string, never, never>;
|
|
68
73
|
loadUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("../interfaces").WithSilentLoad<import("@frontegg/rest-api").ILoadUsers>, import("@frontegg/rest-api").ITeamUser[]>], import("../interfaces").WithCallback<import("../interfaces").WithSilentLoad<import("@frontegg/rest-api").ILoadUsers>, import("@frontegg/rest-api").ITeamUser[]>, string, never, never>;
|
|
74
|
+
loadAllSubTenantsUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("../interfaces").WithSilentLoad<Partial<import("@frontegg/rest-api").ILoadAllUsers>>, import("@frontegg/rest-api").ISubTenantUser[]>], import("../interfaces").WithCallback<import("../interfaces").WithSilentLoad<Partial<import("@frontegg/rest-api").ILoadAllUsers>>, import("@frontegg/rest-api").ISubTenantUser[]>, string, never, never>;
|
|
69
75
|
loadRoles: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[({
|
|
70
76
|
callback?: ((data: {
|
|
71
77
|
roles: import("@frontegg/rest-api").ITeamUserRole[];
|
|
@@ -78,8 +84,16 @@ declare const actions: {
|
|
|
78
84
|
} | null, error?: string | undefined) => void) | undefined;
|
|
79
85
|
} | undefined, string, never, never>;
|
|
80
86
|
addUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IAddUser, import("@frontegg/rest-api").ITeamUser>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IAddUser, import("@frontegg/rest-api").ITeamUser>, string, never, never>;
|
|
87
|
+
addUserToSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").AddUserToSubTenantsRequest, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").AddUserToSubTenantsRequest, boolean>, string, never, never>;
|
|
81
88
|
updateUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<Partial<import("@frontegg/rest-api").ITeamUser>, import("@frontegg/rest-api").ITeamUser>], import("../interfaces").WithCallback<Partial<import("@frontegg/rest-api").ITeamUser>, import("@frontegg/rest-api").ITeamUser>, string, never, never>;
|
|
82
89
|
deleteUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>, string, never, never>;
|
|
90
|
+
setUserRolesForSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").UpdateUserRolesForSubTenantsRequestDto & {
|
|
91
|
+
userId: string;
|
|
92
|
+
}, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").UpdateUserRolesForSubTenantsRequestDto & {
|
|
93
|
+
userId: string;
|
|
94
|
+
}, boolean>, string, never, never>;
|
|
95
|
+
deleteUserFromSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").RemoveUserFromSubTenantsRequest, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").RemoveUserFromSubTenantsRequest, boolean>, string, never, never>;
|
|
96
|
+
lockUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>, string, never, never>;
|
|
83
97
|
resendActivationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IResendActivationLink, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IResendActivationLink, boolean>, string, never, never>;
|
|
84
98
|
resendInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>, string, never, never>;
|
|
85
99
|
getInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
@@ -94,6 +108,8 @@ declare const actions: {
|
|
|
94
108
|
closeAddUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[any?], any, string, never, never>;
|
|
95
109
|
openDeleteUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(Pick<import(".").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined)?], Pick<import(".").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined, string, never, never>;
|
|
96
110
|
closeDeleteUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[any?], any, string, never, never>;
|
|
111
|
+
openLockUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(Pick<import(".").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined)?], Pick<import(".").DeleteUserDialogState, "email" | "onClose" | "userId"> | undefined, string, never, never>;
|
|
112
|
+
closeLockUserDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[any?], any, string, never, never>;
|
|
97
113
|
enrollMfa: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
98
114
|
verifyMfa: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IVerifyMfa, string | undefined>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IVerifyMfa, string | undefined>, string, never, never>;
|
|
99
115
|
verifyMfaAfterForce: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").ILoginWithMfa, string | undefined>], import("../interfaces").WithCallback<import("@frontegg/rest-api").ILoginWithMfa, string | undefined>, string, never, never>;
|
package/node/auth/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var auth_index = require('../index-
|
|
5
|
+
var auth_index = require('../index-9f052030.js');
|
|
6
6
|
var constants = require('../constants-52e37c08.js');
|
|
7
7
|
var restApi = require('@frontegg/rest-api');
|
|
8
8
|
require('@reduxjs/toolkit');
|
|
@@ -280,11 +280,19 @@ const teamState = {
|
|
|
280
280
|
pageSize: 20,
|
|
281
281
|
errors: {},
|
|
282
282
|
users: [],
|
|
283
|
+
allUsers: [],
|
|
283
284
|
roles: [],
|
|
284
285
|
permissions: [],
|
|
285
286
|
totalPages: 0,
|
|
286
287
|
filter: [],
|
|
287
288
|
sort: [],
|
|
289
|
+
allUsersQueryParams: {
|
|
290
|
+
_filter: null,
|
|
291
|
+
_offset: 0,
|
|
292
|
+
_limit: 20,
|
|
293
|
+
_order: 'DESC',
|
|
294
|
+
_sortBy: 'name',
|
|
295
|
+
},
|
|
288
296
|
addUserDialogState: {
|
|
289
297
|
loading: false,
|
|
290
298
|
open: false,
|
|
@@ -293,6 +301,10 @@ const teamState = {
|
|
|
293
301
|
loading: false,
|
|
294
302
|
open: false,
|
|
295
303
|
},
|
|
304
|
+
lockUserDialogState: {
|
|
305
|
+
loading: false,
|
|
306
|
+
open: false,
|
|
307
|
+
},
|
|
296
308
|
};
|
|
297
309
|
const reducers$7 = {
|
|
298
310
|
setTeamLoader: loadersReducerForKey('teamState'),
|
|
@@ -302,12 +314,17 @@ const reducers$7 = {
|
|
|
302
314
|
};
|
|
303
315
|
const actions$8 = {
|
|
304
316
|
loadUsers: toolkit.createAction(`${constants.authStoreName}/loadUsers`, (payload) => ({ payload })),
|
|
317
|
+
loadAllSubTenantsUsers: toolkit.createAction(`${constants.authStoreName}/loadAllSubTenantsUsers`, (payload) => ({ payload })),
|
|
305
318
|
loadRoles: toolkit.createAction(`${constants.authStoreName}/loadRoles`, (payload) => ({ payload })),
|
|
306
319
|
addUser: toolkit.createAction(`${constants.authStoreName}/addUser`, (payload) => ({ payload })),
|
|
320
|
+
addUserToSubTenants: toolkit.createAction(`${constants.authStoreName}/addUserToSubTenants`, (payload) => ({ payload })),
|
|
307
321
|
updateUser: toolkit.createAction(`${constants.authStoreName}/updateUser`, (payload) => ({
|
|
308
322
|
payload,
|
|
309
323
|
})),
|
|
310
324
|
deleteUser: toolkit.createAction(`${constants.authStoreName}/deleteUser`, (payload) => ({ payload })),
|
|
325
|
+
setUserRolesForSubTenants: toolkit.createAction(`${constants.authStoreName}/setUserRolesForSubTenants`, (payload) => ({ payload })),
|
|
326
|
+
deleteUserFromSubTenants: toolkit.createAction(`${constants.authStoreName}/deleteUserFromSubTenants`, (payload) => ({ payload })),
|
|
327
|
+
lockUser: toolkit.createAction(`${constants.authStoreName}/lockUser`, (payload) => ({ payload })),
|
|
311
328
|
resendActivationLink: toolkit.createAction(`${constants.authStoreName}/resendActivationLink`, (payload) => ({ payload })),
|
|
312
329
|
resendInvitationLink: toolkit.createAction(`${constants.authStoreName}/resendInvitationLink`, (payload) => ({ payload })),
|
|
313
330
|
getInvitationLink: toolkit.createAction(`${constants.authStoreName}/getInvitationLink`),
|
|
@@ -320,6 +337,10 @@ const actions$8 = {
|
|
|
320
337
|
payload,
|
|
321
338
|
})),
|
|
322
339
|
closeDeleteUserDialog: toolkit.createAction(`${constants.authStoreName}/closeDeleteUserDialog`, (payload) => ({ payload })),
|
|
340
|
+
openLockUserDialog: toolkit.createAction(`${constants.authStoreName}/openLockUserDialog`, (payload) => ({
|
|
341
|
+
payload,
|
|
342
|
+
})),
|
|
343
|
+
closeLockUserDialog: toolkit.createAction(`${constants.authStoreName}/closeLockUserDialog`, (payload) => ({ payload })),
|
|
323
344
|
};
|
|
324
345
|
|
|
325
346
|
const socialLoginState = {
|
|
@@ -472,6 +493,7 @@ const tenantsState = {
|
|
|
472
493
|
tenants: [],
|
|
473
494
|
subTenants: [],
|
|
474
495
|
loading: true,
|
|
496
|
+
tenantTree: null,
|
|
475
497
|
};
|
|
476
498
|
const reducers$1 = {
|
|
477
499
|
setTenantsState: typeReducerForKey('tenantsState'),
|
|
@@ -485,6 +507,9 @@ const actions$2 = {
|
|
|
485
507
|
loadSubTenants: toolkit.createAction(`${constants.authStoreName}/loadSubTenants`, (payload) => ({
|
|
486
508
|
payload,
|
|
487
509
|
})),
|
|
510
|
+
loadSubTenantsTree: toolkit.createAction(`${constants.authStoreName}/loadSubTenantsTree`, (payload) => ({
|
|
511
|
+
payload,
|
|
512
|
+
})),
|
|
488
513
|
};
|
|
489
514
|
|
|
490
515
|
const rolesState = {
|
|
@@ -814,7 +839,26 @@ const userTeamDemo = {
|
|
|
814
839
|
mfaEnabled: undefined,
|
|
815
840
|
roles: [],
|
|
816
841
|
};
|
|
842
|
+
const userSubTenantDemo = {
|
|
843
|
+
metadata: '',
|
|
844
|
+
mfaEnrolled: false,
|
|
845
|
+
permissions: [],
|
|
846
|
+
provider: '',
|
|
847
|
+
sub: '',
|
|
848
|
+
tenantIds: [],
|
|
849
|
+
tenants: [],
|
|
850
|
+
verified: false,
|
|
851
|
+
id: 'id',
|
|
852
|
+
email: 'email',
|
|
853
|
+
name: 'name',
|
|
854
|
+
tenantId: 'tenantId',
|
|
855
|
+
activatedForTenant: true,
|
|
856
|
+
createdAt: new Date(),
|
|
857
|
+
lastLogin: new Date(),
|
|
858
|
+
roles: [],
|
|
859
|
+
};
|
|
817
860
|
const usersDemo = [userTeamDemo, userTeamDemo2];
|
|
861
|
+
const allUsersDemo = [userSubTenantDemo];
|
|
818
862
|
const tenantsDemo = [
|
|
819
863
|
{
|
|
820
864
|
id: 'my-tenant-id',
|
|
@@ -2457,6 +2501,48 @@ function* loadUsers({ payload }) {
|
|
|
2457
2501
|
}
|
|
2458
2502
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: false }));
|
|
2459
2503
|
}
|
|
2504
|
+
function* loadAllSubTenantsUsers({ payload, }) {
|
|
2505
|
+
var _a, _b, _c, _d, _e;
|
|
2506
|
+
const { silentLoading, callback } = payload;
|
|
2507
|
+
const teamState = yield selectTeamState();
|
|
2508
|
+
const _limit = (_a = payload._limit) !== null && _a !== void 0 ? _a : teamState.allUsersQueryParams._limit;
|
|
2509
|
+
const _offset = (_b = payload._offset) !== null && _b !== void 0 ? _b : teamState.allUsersQueryParams._offset;
|
|
2510
|
+
const _filter = (_c = payload._filter) !== null && _c !== void 0 ? _c : teamState.allUsersQueryParams._filter;
|
|
2511
|
+
const _sortBy = (_d = payload._sortBy) !== null && _d !== void 0 ? _d : teamState.allUsersQueryParams._sortBy;
|
|
2512
|
+
const _order = (_e = payload._order) !== null && _e !== void 0 ? _e : teamState.allUsersQueryParams._order;
|
|
2513
|
+
const allUsersQueryParams = {
|
|
2514
|
+
_limit: _limit || 20,
|
|
2515
|
+
_offset: _offset || 0,
|
|
2516
|
+
_filter: _filter || '',
|
|
2517
|
+
_sortBy: _sortBy || 'name',
|
|
2518
|
+
_order: _order || 'DESC',
|
|
2519
|
+
};
|
|
2520
|
+
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: !silentLoading }));
|
|
2521
|
+
yield effects.put(actions.setTeamState({
|
|
2522
|
+
allUsersQueryParams,
|
|
2523
|
+
}));
|
|
2524
|
+
try {
|
|
2525
|
+
const [{ items: users, _metadata: { totalPages, totalItems }, }, { items: roles }, { items: permissions },] = yield effects.all([
|
|
2526
|
+
effects.call(restApi.api.subTenants.loadAllUsers, Object.assign({}, allUsersQueryParams)),
|
|
2527
|
+
effects.call(restApi.api.teams.loadAvailableRoles),
|
|
2528
|
+
effects.call(restApi.api.teams.loadAvailablePermissions),
|
|
2529
|
+
]);
|
|
2530
|
+
yield effects.put(actions.setTeamState({
|
|
2531
|
+
allUsers: users,
|
|
2532
|
+
totalPages,
|
|
2533
|
+
totalItems,
|
|
2534
|
+
roles,
|
|
2535
|
+
permissions,
|
|
2536
|
+
}));
|
|
2537
|
+
callback === null || callback === void 0 ? void 0 : callback(users);
|
|
2538
|
+
}
|
|
2539
|
+
catch (e) {
|
|
2540
|
+
yield effects.put(actions.setTeamError({ key: exports.TeamStateKeys.USERS, value: e.message }));
|
|
2541
|
+
yield effects.put(actions.setTeamState({ totalPages: 0, users: [] }));
|
|
2542
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
2543
|
+
}
|
|
2544
|
+
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: false }));
|
|
2545
|
+
}
|
|
2460
2546
|
function* loadRoles({ payload }) {
|
|
2461
2547
|
var _a, _b;
|
|
2462
2548
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.ROLES_AND_PERMISSIONS, value: true }));
|
|
@@ -2496,6 +2582,34 @@ function* addUser({ payload }) {
|
|
|
2496
2582
|
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2497
2583
|
}
|
|
2498
2584
|
}
|
|
2585
|
+
function* addUserToSubTenants({ payload }) {
|
|
2586
|
+
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2587
|
+
const teamState = yield selectTeamState();
|
|
2588
|
+
yield effects.put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
|
|
2589
|
+
try {
|
|
2590
|
+
yield effects.call(restApi.api.subTenants.addUserToTenantAndSubTenants, body);
|
|
2591
|
+
const { items: users, _metadata: { totalPages, totalItems }, } = yield effects.call(restApi.api.subTenants.loadAllUsers, {
|
|
2592
|
+
_limit: 20,
|
|
2593
|
+
_offset: 0,
|
|
2594
|
+
_filter: '',
|
|
2595
|
+
_sortBy: 'name',
|
|
2596
|
+
_order: 'DESC',
|
|
2597
|
+
});
|
|
2598
|
+
yield effects.put(actions.setTeamState({
|
|
2599
|
+
allUsers: users,
|
|
2600
|
+
totalPages,
|
|
2601
|
+
totalItems,
|
|
2602
|
+
addUserDialogState: { open: false, loading: false },
|
|
2603
|
+
}));
|
|
2604
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
2605
|
+
}
|
|
2606
|
+
catch (e) {
|
|
2607
|
+
yield effects.put(actions.setTeamState({
|
|
2608
|
+
addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: false, error: e.message }),
|
|
2609
|
+
}));
|
|
2610
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2499
2613
|
function* updateUser({ payload }) {
|
|
2500
2614
|
var _a;
|
|
2501
2615
|
const { callback, profileImage } = payload, body = tslib.__rest(payload, ["callback", "profileImage"]);
|
|
@@ -2553,6 +2667,58 @@ function* deleteUser({ payload }) {
|
|
|
2553
2667
|
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2554
2668
|
}
|
|
2555
2669
|
}
|
|
2670
|
+
function* setUserRolesForSubTenants({ payload, }) {
|
|
2671
|
+
const { callback, userId } = payload, body = tslib.__rest(payload, ["callback", "userId"]);
|
|
2672
|
+
const teamState = yield selectTeamState();
|
|
2673
|
+
yield effects.put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
|
|
2674
|
+
try {
|
|
2675
|
+
yield effects.call(restApi.api.subTenants.setUserRolesForSubTenants, userId, body);
|
|
2676
|
+
const updatedUser = teamState.allUsers.find((user) => user.id === userId);
|
|
2677
|
+
if (updatedUser) {
|
|
2678
|
+
updatedUser.tenants = updatedUser.tenants.map((tenant) => {
|
|
2679
|
+
var _a;
|
|
2680
|
+
return (Object.assign(Object.assign({}, tenant), { roles: ((_a = body.subTenantsRoles
|
|
2681
|
+
.find((roleUpdate) => roleUpdate.tenantId === tenant.tenantId)) === null || _a === void 0 ? void 0 : _a.roleIds.map((roleId) => {
|
|
2682
|
+
const role = teamState.roles.find(({ id }) => roleId === id);
|
|
2683
|
+
return role;
|
|
2684
|
+
}).filter((role) => role)) || tenant.roles }));
|
|
2685
|
+
});
|
|
2686
|
+
}
|
|
2687
|
+
yield effects.put(actions.setTeamState({
|
|
2688
|
+
allUsers: [
|
|
2689
|
+
...teamState.allUsers.filter((user) => user.id !== userId),
|
|
2690
|
+
...(updatedUser ? [updatedUser] : []),
|
|
2691
|
+
],
|
|
2692
|
+
addUserDialogState: { open: false, loading: false },
|
|
2693
|
+
}));
|
|
2694
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2695
|
+
}
|
|
2696
|
+
catch (e) {
|
|
2697
|
+
yield effects.put(actions.setTeamState({
|
|
2698
|
+
addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: false, error: e.message }),
|
|
2699
|
+
}));
|
|
2700
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
function* deleteUserFromSubTenants({ payload }) {
|
|
2704
|
+
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2705
|
+
const teamState = yield selectTeamState();
|
|
2706
|
+
yield effects.put(actions.setTeamState({ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: true }) }));
|
|
2707
|
+
try {
|
|
2708
|
+
yield effects.call(restApi.api.subTenants.removeUserFromTenantAndSubTenants, body);
|
|
2709
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2710
|
+
yield effects.put(actions.setTeamState({
|
|
2711
|
+
allUsers: teamState.allUsers.filter((user) => user.id !== body.userId && user.tenants.length === body.subTenants.length),
|
|
2712
|
+
deleteUserDialogState: { open: false, loading: false },
|
|
2713
|
+
}));
|
|
2714
|
+
}
|
|
2715
|
+
catch (e) {
|
|
2716
|
+
yield effects.put(actions.setTeamState({
|
|
2717
|
+
deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: false, error: e.message }),
|
|
2718
|
+
}));
|
|
2719
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2556
2722
|
function* resendActivationLink({ payload }) {
|
|
2557
2723
|
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2558
2724
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.RESEND_ACTIVATE_LINK, value: body.userId }));
|
|
@@ -2601,7 +2767,7 @@ function* getInvitationLink() {
|
|
|
2601
2767
|
yield effects.put(actions.setTeamError({ key: exports.TeamStateKeys.GET_TOKEN_LINK, value: e.message }));
|
|
2602
2768
|
}
|
|
2603
2769
|
}
|
|
2604
|
-
function* createInvitationLink({ payload: { callback } }) {
|
|
2770
|
+
function* createInvitationLink({ payload: { callback }, }) {
|
|
2605
2771
|
yield effects.put(actions.setTeamError({ key: exports.TeamStateKeys.CREATE_TOKEN_LINK, value: false }));
|
|
2606
2772
|
const { inviteTokenState } = yield selectTeamState();
|
|
2607
2773
|
try {
|
|
@@ -2614,7 +2780,7 @@ function* createInvitationLink({ payload: { callback } }) {
|
|
|
2614
2780
|
yield effects.put(actions.setTeamError({ key: exports.TeamStateKeys.CREATE_TOKEN_LINK, value: e.message }));
|
|
2615
2781
|
}
|
|
2616
2782
|
}
|
|
2617
|
-
function* updateInvitationLink({ payload: { callback, expiresInMinutes, shouldSendEmail } }) {
|
|
2783
|
+
function* updateInvitationLink({ payload: { callback, expiresInMinutes, shouldSendEmail }, }) {
|
|
2618
2784
|
const { inviteTokenState } = yield selectTeamState();
|
|
2619
2785
|
yield effects.put(actions.setTeamError({ key: exports.TeamStateKeys.UPDATE_TOKEN_LINK, value: false }));
|
|
2620
2786
|
try {
|
|
@@ -2647,7 +2813,7 @@ function* openAddUserDialog({ payload }) {
|
|
|
2647
2813
|
}
|
|
2648
2814
|
function* closeAddUserDialog({ payload }) {
|
|
2649
2815
|
const teamState = yield selectTeamState();
|
|
2650
|
-
const { addUserDialogState: { onClose } } = teamState;
|
|
2816
|
+
const { addUserDialogState: { onClose }, } = teamState;
|
|
2651
2817
|
onClose === null || onClose === void 0 ? void 0 : onClose(payload);
|
|
2652
2818
|
yield effects.put(actions.setTeamState({
|
|
2653
2819
|
addUserDialogState: {
|
|
@@ -2664,7 +2830,7 @@ function* openDeleteUserDialog({ payload }) {
|
|
|
2664
2830
|
}
|
|
2665
2831
|
function* closeDeleteUserDialog({ payload }) {
|
|
2666
2832
|
const teamState = yield selectTeamState();
|
|
2667
|
-
const { deleteUserDialogState: { onClose } } = teamState;
|
|
2833
|
+
const { deleteUserDialogState: { onClose }, } = teamState;
|
|
2668
2834
|
onClose === null || onClose === void 0 ? void 0 : onClose(payload);
|
|
2669
2835
|
yield effects.put(actions.setTeamState({
|
|
2670
2836
|
deleteUserDialogState: {
|
|
@@ -2676,10 +2842,14 @@ function* closeDeleteUserDialog({ payload }) {
|
|
|
2676
2842
|
}
|
|
2677
2843
|
function* teamSagas() {
|
|
2678
2844
|
yield effects.takeLatest(actions.loadUsers, loadUsers);
|
|
2845
|
+
yield effects.takeLatest(actions.loadAllSubTenantsUsers, loadAllSubTenantsUsers);
|
|
2679
2846
|
yield effects.takeLatest(actions.loadRoles, loadRoles);
|
|
2680
2847
|
yield effects.takeEvery(actions.addUser, addUser);
|
|
2848
|
+
yield effects.takeEvery(actions.addUserToSubTenants, addUserToSubTenants);
|
|
2681
2849
|
yield effects.takeEvery(actions.updateUser, updateUser);
|
|
2850
|
+
yield effects.takeEvery(actions.setUserRolesForSubTenants, setUserRolesForSubTenants);
|
|
2682
2851
|
yield effects.takeEvery(actions.deleteUser, deleteUser);
|
|
2852
|
+
yield effects.takeEvery(actions.deleteUserFromSubTenants, deleteUserFromSubTenants);
|
|
2683
2853
|
yield effects.takeEvery(actions.resendActivationLink, resendActivationLink);
|
|
2684
2854
|
yield effects.takeEvery(actions.resendInvitationLink, resendInvitationLink);
|
|
2685
2855
|
yield effects.takeEvery(actions.getInvitationLink, getInvitationLink);
|
|
@@ -2716,6 +2886,38 @@ function* loadUsersMock({ payload }) {
|
|
|
2716
2886
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: false }));
|
|
2717
2887
|
callback === null || callback === void 0 ? void 0 : callback(usersDemo);
|
|
2718
2888
|
}
|
|
2889
|
+
function* loadAllSubTenantsUsersMock({ payload, }) {
|
|
2890
|
+
var _a, _b, _c, _d, _e;
|
|
2891
|
+
const { silentLoading, callback } = payload;
|
|
2892
|
+
const teamState = yield selectTeamState();
|
|
2893
|
+
const _limit = (_a = payload._limit) !== null && _a !== void 0 ? _a : teamState.allUsersQueryParams._limit;
|
|
2894
|
+
const _offset = (_b = payload._offset) !== null && _b !== void 0 ? _b : teamState.allUsersQueryParams._offset;
|
|
2895
|
+
const _filter = (_c = payload._filter) !== null && _c !== void 0 ? _c : teamState.allUsersQueryParams._filter;
|
|
2896
|
+
const _sortBy = (_d = payload._sortBy) !== null && _d !== void 0 ? _d : teamState.allUsersQueryParams._sortBy;
|
|
2897
|
+
const _order = (_e = payload._order) !== null && _e !== void 0 ? _e : teamState.allUsersQueryParams._order;
|
|
2898
|
+
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: !silentLoading }));
|
|
2899
|
+
yield effects.put(actions.setTeamState({
|
|
2900
|
+
allUsersQueryParams: {
|
|
2901
|
+
_limit,
|
|
2902
|
+
_offset,
|
|
2903
|
+
_filter,
|
|
2904
|
+
_sortBy,
|
|
2905
|
+
_order,
|
|
2906
|
+
},
|
|
2907
|
+
}));
|
|
2908
|
+
const totalPages = 2;
|
|
2909
|
+
const totalItems = 10;
|
|
2910
|
+
yield delay();
|
|
2911
|
+
yield effects.put(actions.setTeamState({
|
|
2912
|
+
allUsers: allUsersDemo,
|
|
2913
|
+
totalPages,
|
|
2914
|
+
totalItems,
|
|
2915
|
+
roles: rolesDemo,
|
|
2916
|
+
permissions: permissionsDemo,
|
|
2917
|
+
}));
|
|
2918
|
+
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: false }));
|
|
2919
|
+
callback === null || callback === void 0 ? void 0 : callback(allUsersDemo);
|
|
2920
|
+
}
|
|
2719
2921
|
function* loadRolesMock({ payload }) {
|
|
2720
2922
|
var _a;
|
|
2721
2923
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.ROLES_AND_PERMISSIONS, value: true }));
|
|
@@ -2736,6 +2938,18 @@ function* addUserMock({ payload }) {
|
|
|
2736
2938
|
addUserDialogState: { open: false, loading: false },
|
|
2737
2939
|
}));
|
|
2738
2940
|
}
|
|
2941
|
+
function* addUserToSubTenantsMock({ payload }) {
|
|
2942
|
+
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2943
|
+
const teamState = yield selectTeamState();
|
|
2944
|
+
yield effects.put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
|
|
2945
|
+
yield delay();
|
|
2946
|
+
const newUser = Object.assign(Object.assign(Object.assign({}, userTeamDemo), body), { id: `${uuid.v4()}` });
|
|
2947
|
+
yield effects.put(actions.setTeamState({
|
|
2948
|
+
users: [newUser, ...teamState.users],
|
|
2949
|
+
addUserDialogState: { open: false, loading: false },
|
|
2950
|
+
}));
|
|
2951
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
2952
|
+
}
|
|
2739
2953
|
function* updateUserMock({ payload }) {
|
|
2740
2954
|
var _a;
|
|
2741
2955
|
const { callback, profileImage } = payload, body = tslib.__rest(payload, ["callback", "profileImage"]);
|
|
@@ -2776,6 +2990,17 @@ function* deleteUserMock({ payload }) {
|
|
|
2776
2990
|
deleteUserDialogState: { open: false, loading: false },
|
|
2777
2991
|
}));
|
|
2778
2992
|
}
|
|
2993
|
+
function* deleteUserFromSubTenantsMock({ payload }) {
|
|
2994
|
+
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2995
|
+
const teamState = yield selectTeamState();
|
|
2996
|
+
yield effects.put(actions.setTeamState({ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: true }) }));
|
|
2997
|
+
yield delay();
|
|
2998
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2999
|
+
yield effects.put(actions.setTeamState({
|
|
3000
|
+
allUsers: teamState.allUsers.filter((user) => user.id !== body.userId),
|
|
3001
|
+
deleteUserDialogState: { open: false, loading: false },
|
|
3002
|
+
}));
|
|
3003
|
+
}
|
|
2779
3004
|
function* resendActivationLinkMock({ payload }) {
|
|
2780
3005
|
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2781
3006
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.RESEND_ACTIVATE_LINK, value: body.userId }));
|
|
@@ -2792,10 +3017,13 @@ function* resendInvitationLinkMock({ payload }) {
|
|
|
2792
3017
|
}
|
|
2793
3018
|
function* teamSagasMock() {
|
|
2794
3019
|
yield effects.takeLatest(actions.loadUsers, loadUsersMock);
|
|
3020
|
+
yield effects.takeLatest(actions.loadAllSubTenantsUsers, loadAllSubTenantsUsersMock);
|
|
2795
3021
|
yield effects.takeLatest(actions.loadRoles, loadRolesMock);
|
|
2796
3022
|
yield effects.takeEvery(actions.addUser, addUserMock);
|
|
3023
|
+
yield effects.takeEvery(actions.addUserToSubTenants, addUserToSubTenantsMock);
|
|
2797
3024
|
yield effects.takeEvery(actions.updateUser, updateUserMock);
|
|
2798
3025
|
yield effects.takeEvery(actions.deleteUser, deleteUserMock);
|
|
3026
|
+
yield effects.takeEvery(actions.deleteUserFromSubTenants, deleteUserFromSubTenantsMock);
|
|
2799
3027
|
yield effects.takeEvery(actions.resendActivationLink, resendActivationLinkMock);
|
|
2800
3028
|
yield effects.takeEvery(actions.resendInvitationLink, resendInvitationLinkMock);
|
|
2801
3029
|
yield effects.takeEvery(actions.openAddUserDialog, openAddUserDialog);
|
|
@@ -3411,10 +3639,24 @@ function* loadSubTenants({ payload }) {
|
|
|
3411
3639
|
(_b = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _b === void 0 ? void 0 : _b.call(payload, null, e);
|
|
3412
3640
|
}
|
|
3413
3641
|
}
|
|
3642
|
+
function* loadSubTenantsTree({ payload }) {
|
|
3643
|
+
var _a, _b;
|
|
3644
|
+
yield effects.put(actions.setTenantsState({ loading: true }));
|
|
3645
|
+
try {
|
|
3646
|
+
const tenantTree = yield effects.call(restApi.api.tenants.getSubTenantsAsTree);
|
|
3647
|
+
yield effects.put(actions.setTenantsState({ tenantTree, loading: false }));
|
|
3648
|
+
(_a = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, true);
|
|
3649
|
+
}
|
|
3650
|
+
catch (e) {
|
|
3651
|
+
yield effects.put(actions.setTenantsState({ loading: false }));
|
|
3652
|
+
(_b = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _b === void 0 ? void 0 : _b.call(payload, null, e);
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3414
3655
|
function* tenantsSagas() {
|
|
3415
3656
|
yield effects.takeEvery(actions.loadTenants, loadTenants);
|
|
3416
3657
|
yield effects.takeEvery(actions.loadSubTenants, loadSubTenants);
|
|
3417
3658
|
yield effects.takeEvery(actions.switchTenant, switchTenant);
|
|
3659
|
+
yield effects.takeEvery(actions.loadSubTenantsTree, loadSubTenantsTree);
|
|
3418
3660
|
}
|
|
3419
3661
|
/*********************************
|
|
3420
3662
|
* Preview Sagas
|
package/node/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var auth_index = require('./index-
|
|
5
|
+
var auth_index = require('./index-9f052030.js');
|
|
6
6
|
var audits_index = require('./audits/index.js');
|
|
7
7
|
var connectivity_index = require('./connectivity/index.js');
|
|
8
8
|
var subscriptions_index = require('./subscriptions/index.js');
|
package/node/toolkit/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var auth_index = require('../index-
|
|
5
|
+
var auth_index = require('../index-9f052030.js');
|
|
6
6
|
var toolkit = require('@reduxjs/toolkit');
|
|
7
7
|
var createSagaMiddleware = require('redux-saga');
|
|
8
8
|
var effects = require('redux-saga/effects');
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
3
|
"libName": "FronteggReduxStore",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.60.0",
|
|
5
5
|
"author": "Frontegg LTD",
|
|
6
6
|
"main": "./node/index.js",
|
|
7
7
|
"module": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@frontegg/rest-api": "2.10.
|
|
10
|
+
"@frontegg/rest-api": "2.10.76",
|
|
11
11
|
"@reduxjs/toolkit": "^1.5.0",
|
|
12
12
|
"redux-saga": "^1.1.0",
|
|
13
13
|
"tslib": "^2.3.1",
|