@frontegg/redux-store 6.49.0-alpha.1 → 6.50.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 +3 -1
- package/auth/TeamState/index.js +3 -0
- package/auth/TeamState/interfaces.d.ts +4 -0
- package/auth/TeamState/saga.js +82 -26
- package/auth/index.d.ts +1 -0
- package/auth/reducer.d.ts +1 -0
- package/index.js +1 -1
- package/node/auth/TeamState/index.js +3 -0
- package/node/auth/TeamState/saga.js +79 -26
- package/node/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAddUser, IDeleteUser, ILoadUsers, IResendActivationLink, IResendInvitationLink, IResendInvitationEmail, ITeamUser, IUpdateUser, ICreateOrUpdateInviteUserLink, ILoadAllUsers, ISubTenantUser, AddUserToSubTenantsRequest, RemoveUserFromSubTenantsRequest, UpdateUserRolesForSubTenantsRequestDto } from '@frontegg/rest-api';
|
|
2
|
-
import { ISetAddUserDialog, ISetDeleteUserDialog, TeamState, TeamStateIndicator, LoadRolesAndPermissionsPayload } from './interfaces';
|
|
2
|
+
import { ISetAddUserDialog, ISetDeleteUserDialog, TeamState, TeamStateIndicator, LoadRolesAndPermissionsPayload, IAddUsers } from './interfaces';
|
|
3
3
|
import { WithCallback, WithSilentLoad } from '../../interfaces';
|
|
4
4
|
declare const teamState: TeamState;
|
|
5
5
|
declare const reducers: {
|
|
@@ -115,6 +115,7 @@ declare const actions: {
|
|
|
115
115
|
} | null, error?: string | undefined) => void) | undefined;
|
|
116
116
|
} | undefined, string, never, never>;
|
|
117
117
|
addUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IAddUser, ITeamUser>], WithCallback<IAddUser, ITeamUser>, string, never, never>;
|
|
118
|
+
addUsersBulk: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IAddUsers, boolean>], WithCallback<IAddUsers, boolean>, string, never, never>;
|
|
118
119
|
addUserToSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<AddUserToSubTenantsRequest, boolean>], WithCallback<AddUserToSubTenantsRequest, boolean>, string, never, never>;
|
|
119
120
|
updateUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<Partial<ITeamUser>, ITeamUser>], WithCallback<Partial<ITeamUser>, ITeamUser>, string, never, never>;
|
|
120
121
|
deleteUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IDeleteUser, boolean>], WithCallback<IDeleteUser, boolean>, string, never, never>;
|
|
@@ -156,6 +157,7 @@ declare type DispatchedActions = {
|
|
|
156
157
|
loadUsers: (payload: WithCallback<WithSilentLoad<ILoadUsers>, ITeamUser[]>) => void;
|
|
157
158
|
loadAllSubTenantsUsers: (payload: WithCallback<WithSilentLoad<Partial<ILoadAllUsers>>, ISubTenantUser[]>) => void;
|
|
158
159
|
loadRoles: (payload?: LoadRolesAndPermissionsPayload) => void;
|
|
160
|
+
addUsersBulk: (payload: WithCallback<IAddUsers>) => void;
|
|
159
161
|
addUser: (payload: WithCallback<IAddUser, ITeamUser>) => void;
|
|
160
162
|
addUserToSubTenants: (payload: WithCallback<AddUserToSubTenantsRequest>) => void;
|
|
161
163
|
setUserRolesForSubTenants: (payload: WithCallback<UpdateUserRolesForSubTenantsRequestDto & {
|
package/auth/TeamState/index.js
CHANGED
|
@@ -54,6 +54,9 @@ const actions = {
|
|
|
54
54
|
addUser: createAction(`${authStoreName}/addUser`, payload => ({
|
|
55
55
|
payload
|
|
56
56
|
})),
|
|
57
|
+
addUsersBulk: createAction(`${authStoreName}/addUsersBulk`, payload => ({
|
|
58
|
+
payload
|
|
59
|
+
})),
|
|
57
60
|
addUserToSubTenants: createAction(`${authStoreName}/addUserToSubTenants`, payload => ({
|
|
58
61
|
payload
|
|
59
62
|
})),
|
package/auth/TeamState/saga.js
CHANGED
|
@@ -2,24 +2,25 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["callback"],
|
|
4
4
|
_excluded2 = ["roles"],
|
|
5
|
-
_excluded3 = ["
|
|
6
|
-
_excluded4 = ["callback"
|
|
7
|
-
_excluded5 = ["callback"],
|
|
8
|
-
_excluded6 = ["callback"
|
|
9
|
-
_excluded7 = ["callback"],
|
|
5
|
+
_excluded3 = ["roles"],
|
|
6
|
+
_excluded4 = ["callback"],
|
|
7
|
+
_excluded5 = ["callback", "profileImage"],
|
|
8
|
+
_excluded6 = ["callback"],
|
|
9
|
+
_excluded7 = ["callback", "userId"],
|
|
10
10
|
_excluded8 = ["callback"],
|
|
11
11
|
_excluded9 = ["callback"],
|
|
12
12
|
_excluded10 = ["callback"],
|
|
13
13
|
_excluded11 = ["callback"],
|
|
14
14
|
_excluded12 = ["callback"],
|
|
15
15
|
_excluded13 = ["callback"],
|
|
16
|
-
_excluded14 = ["callback"
|
|
17
|
-
_excluded15 = ["callback"],
|
|
16
|
+
_excluded14 = ["callback"],
|
|
17
|
+
_excluded15 = ["callback", "profileImage"],
|
|
18
18
|
_excluded16 = ["callback"],
|
|
19
19
|
_excluded17 = ["callback"],
|
|
20
20
|
_excluded18 = ["callback"],
|
|
21
21
|
_excluded19 = ["callback"],
|
|
22
|
-
_excluded20 = ["callback"]
|
|
22
|
+
_excluded20 = ["callback"],
|
|
23
|
+
_excluded21 = ["callback"];
|
|
23
24
|
import { takeLatest, put, call, all, takeEvery, select as sagaSelect } from 'redux-saga/effects';
|
|
24
25
|
import { api } from '@frontegg/rest-api';
|
|
25
26
|
import { actions } from '../reducer';
|
|
@@ -261,13 +262,67 @@ function* addUser({
|
|
|
261
262
|
}
|
|
262
263
|
}
|
|
263
264
|
|
|
265
|
+
function* addUsersBulk({
|
|
266
|
+
payload
|
|
267
|
+
}) {
|
|
268
|
+
const {
|
|
269
|
+
callback
|
|
270
|
+
} = payload;
|
|
271
|
+
const teamState = yield selectTeamState();
|
|
272
|
+
yield put(actions.setTeamState({
|
|
273
|
+
addUserDialogState: _extends({}, teamState.addUserDialogState, {
|
|
274
|
+
loading: true
|
|
275
|
+
})
|
|
276
|
+
}));
|
|
277
|
+
|
|
278
|
+
try {
|
|
279
|
+
const bodies = payload.emails.map(email => ({
|
|
280
|
+
email,
|
|
281
|
+
roleIds: payload.roleIds
|
|
282
|
+
}));
|
|
283
|
+
const response = yield all(bodies.map(body => call(api.teams.addUser, body)));
|
|
284
|
+
let newUsers = [];
|
|
285
|
+
response.forEach(res => {
|
|
286
|
+
const {
|
|
287
|
+
roles
|
|
288
|
+
} = res,
|
|
289
|
+
userWithoutRoleIds = _objectWithoutPropertiesLoose(res, _excluded3);
|
|
290
|
+
|
|
291
|
+
const roleIds = roles.map(role => role.id);
|
|
292
|
+
|
|
293
|
+
const newUser = _extends({}, userWithoutRoleIds, {
|
|
294
|
+
roleIds
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
newUsers.push(newUser);
|
|
298
|
+
});
|
|
299
|
+
let newUsersToAdd = newUsers.concat(...teamState.users);
|
|
300
|
+
yield put(actions.setTeamState({
|
|
301
|
+
users: newUsersToAdd,
|
|
302
|
+
addUserDialogState: {
|
|
303
|
+
open: false,
|
|
304
|
+
loading: false
|
|
305
|
+
}
|
|
306
|
+
}));
|
|
307
|
+
callback == null ? void 0 : callback(true);
|
|
308
|
+
} catch (e) {
|
|
309
|
+
yield put(actions.setTeamState({
|
|
310
|
+
addUserDialogState: _extends({}, teamState.addUserDialogState, {
|
|
311
|
+
loading: false,
|
|
312
|
+
error: e.message
|
|
313
|
+
})
|
|
314
|
+
}));
|
|
315
|
+
callback == null ? void 0 : callback(null, e.message);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
264
319
|
function* addUserToSubTenants({
|
|
265
320
|
payload
|
|
266
321
|
}) {
|
|
267
322
|
const {
|
|
268
323
|
callback
|
|
269
324
|
} = payload,
|
|
270
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
325
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded4);
|
|
271
326
|
|
|
272
327
|
const teamState = yield selectTeamState();
|
|
273
328
|
yield put(actions.setTeamState({
|
|
@@ -318,7 +373,7 @@ function* updateUser({
|
|
|
318
373
|
const {
|
|
319
374
|
callback
|
|
320
375
|
} = payload,
|
|
321
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
376
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded5);
|
|
322
377
|
|
|
323
378
|
const {
|
|
324
379
|
id: userId
|
|
@@ -391,7 +446,7 @@ function* deleteUser({
|
|
|
391
446
|
const {
|
|
392
447
|
callback
|
|
393
448
|
} = payload,
|
|
394
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
449
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded6);
|
|
395
450
|
|
|
396
451
|
const teamState = yield selectTeamState();
|
|
397
452
|
yield put(actions.setTeamState({
|
|
@@ -428,7 +483,7 @@ function* setUserRolesForSubTenants({
|
|
|
428
483
|
callback,
|
|
429
484
|
userId
|
|
430
485
|
} = payload,
|
|
431
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
486
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded7);
|
|
432
487
|
|
|
433
488
|
const teamState = yield selectTeamState();
|
|
434
489
|
yield put(actions.setTeamState({
|
|
@@ -484,7 +539,7 @@ function* deleteUserFromSubTenants({
|
|
|
484
539
|
const {
|
|
485
540
|
callback
|
|
486
541
|
} = payload,
|
|
487
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
542
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded8);
|
|
488
543
|
|
|
489
544
|
const teamState = yield selectTeamState();
|
|
490
545
|
yield put(actions.setTeamState({
|
|
@@ -520,7 +575,7 @@ function* resendActivationLink({
|
|
|
520
575
|
const {
|
|
521
576
|
callback
|
|
522
577
|
} = payload,
|
|
523
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
578
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded9);
|
|
524
579
|
|
|
525
580
|
yield put(actions.setTeamLoader({
|
|
526
581
|
key: TeamStateKeys.RESEND_ACTIVATE_LINK,
|
|
@@ -550,7 +605,7 @@ function* resendInvitationLink({
|
|
|
550
605
|
const {
|
|
551
606
|
callback
|
|
552
607
|
} = payload,
|
|
553
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
608
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded10);
|
|
554
609
|
|
|
555
610
|
yield put(actions.setTeamLoader({
|
|
556
611
|
key: TeamStateKeys.RESEND_INVITATION_LINK,
|
|
@@ -580,7 +635,7 @@ function* resendInvitationEmail({
|
|
|
580
635
|
const {
|
|
581
636
|
callback
|
|
582
637
|
} = payload,
|
|
583
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
638
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded11);
|
|
584
639
|
|
|
585
640
|
yield put(actions.setTeamLoader({
|
|
586
641
|
key: TeamStateKeys.RESEND_INVITATION_LINK,
|
|
@@ -610,7 +665,7 @@ function* resendInvitationLinkToAllSubTenants({
|
|
|
610
665
|
const {
|
|
611
666
|
callback
|
|
612
667
|
} = payload,
|
|
613
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
668
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded12);
|
|
614
669
|
|
|
615
670
|
yield put(actions.setTeamLoader({
|
|
616
671
|
key: TeamStateKeys.RESEND_INVITATION_LINK,
|
|
@@ -832,6 +887,7 @@ export function* teamSagas() {
|
|
|
832
887
|
yield takeLatest(actions.loadAllSubTenantsUsers, loadAllSubTenantsUsers);
|
|
833
888
|
yield takeLatest(actions.loadRoles, loadRoles);
|
|
834
889
|
yield takeEvery(actions.addUser, addUser);
|
|
890
|
+
yield takeEvery(actions.addUsersBulk, addUsersBulk);
|
|
835
891
|
yield takeEvery(actions.addUserToSubTenants, addUserToSubTenants);
|
|
836
892
|
yield takeEvery(actions.updateUser, updateUser);
|
|
837
893
|
yield takeEvery(actions.setUserRolesForSubTenants, setUserRolesForSubTenants);
|
|
@@ -976,7 +1032,7 @@ function* addUserMock({
|
|
|
976
1032
|
const {
|
|
977
1033
|
callback
|
|
978
1034
|
} = payload,
|
|
979
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1035
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded13);
|
|
980
1036
|
|
|
981
1037
|
const teamState = yield selectTeamState();
|
|
982
1038
|
yield put(actions.setTeamState({
|
|
@@ -1006,7 +1062,7 @@ function* addUserToSubTenantsMock({
|
|
|
1006
1062
|
const {
|
|
1007
1063
|
callback
|
|
1008
1064
|
} = payload,
|
|
1009
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1065
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded14);
|
|
1010
1066
|
|
|
1011
1067
|
const teamState = yield selectTeamState();
|
|
1012
1068
|
yield put(actions.setTeamState({
|
|
@@ -1038,7 +1094,7 @@ function* updateUserMock({
|
|
|
1038
1094
|
const {
|
|
1039
1095
|
callback
|
|
1040
1096
|
} = payload,
|
|
1041
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1097
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded15);
|
|
1042
1098
|
|
|
1043
1099
|
const {
|
|
1044
1100
|
id: userId
|
|
@@ -1095,7 +1151,7 @@ function* deleteUserMock({
|
|
|
1095
1151
|
const {
|
|
1096
1152
|
callback
|
|
1097
1153
|
} = payload,
|
|
1098
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1154
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded16);
|
|
1099
1155
|
|
|
1100
1156
|
const teamState = yield selectTeamState();
|
|
1101
1157
|
yield put(actions.setTeamState({
|
|
@@ -1120,7 +1176,7 @@ function* deleteUserFromSubTenantsMock({
|
|
|
1120
1176
|
const {
|
|
1121
1177
|
callback
|
|
1122
1178
|
} = payload,
|
|
1123
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1179
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded17);
|
|
1124
1180
|
|
|
1125
1181
|
const teamState = yield selectTeamState();
|
|
1126
1182
|
yield put(actions.setTeamState({
|
|
@@ -1145,7 +1201,7 @@ function* resendActivationLinkMock({
|
|
|
1145
1201
|
const {
|
|
1146
1202
|
callback
|
|
1147
1203
|
} = payload,
|
|
1148
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1204
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded18);
|
|
1149
1205
|
|
|
1150
1206
|
yield put(actions.setTeamLoader({
|
|
1151
1207
|
key: TeamStateKeys.RESEND_ACTIVATE_LINK,
|
|
@@ -1165,7 +1221,7 @@ function* resendInvitationLinkMock({
|
|
|
1165
1221
|
const {
|
|
1166
1222
|
callback
|
|
1167
1223
|
} = payload,
|
|
1168
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1224
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded19);
|
|
1169
1225
|
|
|
1170
1226
|
yield put(actions.setTeamLoader({
|
|
1171
1227
|
key: TeamStateKeys.RESEND_INVITATION_LINK,
|
|
@@ -1185,7 +1241,7 @@ function* resendInvitationEmailMock({
|
|
|
1185
1241
|
const {
|
|
1186
1242
|
callback
|
|
1187
1243
|
} = payload,
|
|
1188
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1244
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded20);
|
|
1189
1245
|
|
|
1190
1246
|
yield put(actions.setTeamLoader({
|
|
1191
1247
|
key: TeamStateKeys.RESEND_INVITATION_LINK,
|
|
@@ -1205,7 +1261,7 @@ function* resendInvitationLinkToAllSubTenantsMock({
|
|
|
1205
1261
|
const {
|
|
1206
1262
|
callback
|
|
1207
1263
|
} = payload,
|
|
1208
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1264
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded21);
|
|
1209
1265
|
|
|
1210
1266
|
yield put(actions.setTeamLoader({
|
|
1211
1267
|
key: TeamStateKeys.RESEND_INVITATION_LINK,
|
package/auth/index.d.ts
CHANGED
|
@@ -165,6 +165,7 @@ declare const _default: {
|
|
|
165
165
|
} | null, error?: string | undefined) => void) | undefined;
|
|
166
166
|
} | undefined, string, never, never>;
|
|
167
167
|
addUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IAddUser, import("@frontegg/rest-api").ITeamUser>], import("..").WithCallback<import("@frontegg/rest-api").IAddUser, import("@frontegg/rest-api").ITeamUser>, string, never, never>;
|
|
168
|
+
addUsersBulk: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("./TeamState/interfaces").IAddUsers, boolean>], import("..").WithCallback<import("./TeamState/interfaces").IAddUsers, boolean>, string, never, never>;
|
|
168
169
|
addUserToSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").AddUserToSubTenantsRequest, boolean>], import("..").WithCallback<import("@frontegg/rest-api").AddUserToSubTenantsRequest, boolean>, string, never, never>;
|
|
169
170
|
updateUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<import("@frontegg/rest-api").ITeamUser>, import("@frontegg/rest-api").ITeamUser>], import("..").WithCallback<Partial<import("@frontegg/rest-api").ITeamUser>, import("@frontegg/rest-api").ITeamUser>, string, never, never>;
|
|
170
171
|
deleteUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>, string, never, never>;
|
package/auth/reducer.d.ts
CHANGED
|
@@ -134,6 +134,7 @@ declare const actions: {
|
|
|
134
134
|
} | null, error?: string | undefined) => void) | undefined;
|
|
135
135
|
} | undefined, string, never, never>;
|
|
136
136
|
addUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IAddUser, import("@frontegg/rest-api").ITeamUser>], import("..").WithCallback<import("@frontegg/rest-api").IAddUser, import("@frontegg/rest-api").ITeamUser>, string, never, never>;
|
|
137
|
+
addUsersBulk: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import(".").IAddUsers, boolean>], import("..").WithCallback<import(".").IAddUsers, boolean>, string, never, never>;
|
|
137
138
|
addUserToSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").AddUserToSubTenantsRequest, boolean>], import("..").WithCallback<import("@frontegg/rest-api").AddUserToSubTenantsRequest, boolean>, string, never, never>;
|
|
138
139
|
updateUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<import("@frontegg/rest-api").ITeamUser>, import("@frontegg/rest-api").ITeamUser>], import("..").WithCallback<Partial<import("@frontegg/rest-api").ITeamUser>, import("@frontegg/rest-api").ITeamUser>, string, never, never>;
|
|
139
140
|
deleteUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IDeleteUser, boolean>, string, never, never>;
|
package/index.js
CHANGED
|
@@ -66,6 +66,9 @@ const actions = {
|
|
|
66
66
|
addUser: (0, _toolkit.createAction)(`${_constants.authStoreName}/addUser`, payload => ({
|
|
67
67
|
payload
|
|
68
68
|
})),
|
|
69
|
+
addUsersBulk: (0, _toolkit.createAction)(`${_constants.authStoreName}/addUsersBulk`, payload => ({
|
|
70
|
+
payload
|
|
71
|
+
})),
|
|
69
72
|
addUserToSubTenants: (0, _toolkit.createAction)(`${_constants.authStoreName}/addUserToSubTenants`, payload => ({
|
|
70
73
|
payload
|
|
71
74
|
})),
|
|
@@ -30,24 +30,25 @@ var _uuid = require("uuid");
|
|
|
30
30
|
|
|
31
31
|
const _excluded = ["callback"],
|
|
32
32
|
_excluded2 = ["roles"],
|
|
33
|
-
_excluded3 = ["
|
|
34
|
-
_excluded4 = ["callback"
|
|
35
|
-
_excluded5 = ["callback"],
|
|
36
|
-
_excluded6 = ["callback"
|
|
37
|
-
_excluded7 = ["callback"],
|
|
33
|
+
_excluded3 = ["roles"],
|
|
34
|
+
_excluded4 = ["callback"],
|
|
35
|
+
_excluded5 = ["callback", "profileImage"],
|
|
36
|
+
_excluded6 = ["callback"],
|
|
37
|
+
_excluded7 = ["callback", "userId"],
|
|
38
38
|
_excluded8 = ["callback"],
|
|
39
39
|
_excluded9 = ["callback"],
|
|
40
40
|
_excluded10 = ["callback"],
|
|
41
41
|
_excluded11 = ["callback"],
|
|
42
42
|
_excluded12 = ["callback"],
|
|
43
43
|
_excluded13 = ["callback"],
|
|
44
|
-
_excluded14 = ["callback"
|
|
45
|
-
_excluded15 = ["callback"],
|
|
44
|
+
_excluded14 = ["callback"],
|
|
45
|
+
_excluded15 = ["callback", "profileImage"],
|
|
46
46
|
_excluded16 = ["callback"],
|
|
47
47
|
_excluded17 = ["callback"],
|
|
48
48
|
_excluded18 = ["callback"],
|
|
49
49
|
_excluded19 = ["callback"],
|
|
50
|
-
_excluded20 = ["callback"]
|
|
50
|
+
_excluded20 = ["callback"],
|
|
51
|
+
_excluded21 = ["callback"];
|
|
51
52
|
|
|
52
53
|
const selectTeamState = () => (0, _effects.select)(_ => _[_constants.authStoreName].teamState); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
54
|
|
|
@@ -276,13 +277,64 @@ function* addUser({
|
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
279
|
|
|
280
|
+
function* addUsersBulk({
|
|
281
|
+
payload
|
|
282
|
+
}) {
|
|
283
|
+
const {
|
|
284
|
+
callback
|
|
285
|
+
} = payload;
|
|
286
|
+
const teamState = yield selectTeamState();
|
|
287
|
+
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
288
|
+
addUserDialogState: (0, _extends2.default)({}, teamState.addUserDialogState, {
|
|
289
|
+
loading: true
|
|
290
|
+
})
|
|
291
|
+
}));
|
|
292
|
+
|
|
293
|
+
try {
|
|
294
|
+
const bodies = payload.emails.map(email => ({
|
|
295
|
+
email,
|
|
296
|
+
roleIds: payload.roleIds
|
|
297
|
+
}));
|
|
298
|
+
const response = yield (0, _effects.all)(bodies.map(body => (0, _effects.call)(_restApi.api.teams.addUser, body)));
|
|
299
|
+
let newUsers = [];
|
|
300
|
+
response.forEach(res => {
|
|
301
|
+
const {
|
|
302
|
+
roles
|
|
303
|
+
} = res,
|
|
304
|
+
userWithoutRoleIds = (0, _objectWithoutPropertiesLoose2.default)(res, _excluded3);
|
|
305
|
+
const roleIds = roles.map(role => role.id);
|
|
306
|
+
const newUser = (0, _extends2.default)({}, userWithoutRoleIds, {
|
|
307
|
+
roleIds
|
|
308
|
+
});
|
|
309
|
+
newUsers.push(newUser);
|
|
310
|
+
});
|
|
311
|
+
let newUsersToAdd = newUsers.concat(...teamState.users);
|
|
312
|
+
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
313
|
+
users: newUsersToAdd,
|
|
314
|
+
addUserDialogState: {
|
|
315
|
+
open: false,
|
|
316
|
+
loading: false
|
|
317
|
+
}
|
|
318
|
+
}));
|
|
319
|
+
callback == null ? void 0 : callback(true);
|
|
320
|
+
} catch (e) {
|
|
321
|
+
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
322
|
+
addUserDialogState: (0, _extends2.default)({}, teamState.addUserDialogState, {
|
|
323
|
+
loading: false,
|
|
324
|
+
error: e.message
|
|
325
|
+
})
|
|
326
|
+
}));
|
|
327
|
+
callback == null ? void 0 : callback(null, e.message);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
279
331
|
function* addUserToSubTenants({
|
|
280
332
|
payload
|
|
281
333
|
}) {
|
|
282
334
|
const {
|
|
283
335
|
callback
|
|
284
336
|
} = payload,
|
|
285
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
337
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded4);
|
|
286
338
|
const teamState = yield selectTeamState();
|
|
287
339
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
288
340
|
addUserDialogState: (0, _extends2.default)({}, teamState.addUserDialogState, {
|
|
@@ -332,7 +384,7 @@ function* updateUser({
|
|
|
332
384
|
const {
|
|
333
385
|
callback
|
|
334
386
|
} = payload,
|
|
335
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
387
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded5);
|
|
336
388
|
const {
|
|
337
389
|
id: userId
|
|
338
390
|
} = body;
|
|
@@ -404,7 +456,7 @@ function* deleteUser({
|
|
|
404
456
|
const {
|
|
405
457
|
callback
|
|
406
458
|
} = payload,
|
|
407
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
459
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded6);
|
|
408
460
|
const teamState = yield selectTeamState();
|
|
409
461
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
410
462
|
deleteUserDialogState: (0, _extends2.default)({}, teamState.deleteUserDialogState, {
|
|
@@ -440,7 +492,7 @@ function* setUserRolesForSubTenants({
|
|
|
440
492
|
callback,
|
|
441
493
|
userId
|
|
442
494
|
} = payload,
|
|
443
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
495
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded7);
|
|
444
496
|
const teamState = yield selectTeamState();
|
|
445
497
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
446
498
|
addUserDialogState: (0, _extends2.default)({}, teamState.addUserDialogState, {
|
|
@@ -495,7 +547,7 @@ function* deleteUserFromSubTenants({
|
|
|
495
547
|
const {
|
|
496
548
|
callback
|
|
497
549
|
} = payload,
|
|
498
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
550
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded8);
|
|
499
551
|
const teamState = yield selectTeamState();
|
|
500
552
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
501
553
|
deleteUserDialogState: (0, _extends2.default)({}, teamState.deleteUserDialogState, {
|
|
@@ -530,7 +582,7 @@ function* resendActivationLink({
|
|
|
530
582
|
const {
|
|
531
583
|
callback
|
|
532
584
|
} = payload,
|
|
533
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
585
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded9);
|
|
534
586
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
535
587
|
key: _interfaces.TeamStateKeys.RESEND_ACTIVATE_LINK,
|
|
536
588
|
value: body.userId
|
|
@@ -559,7 +611,7 @@ function* resendInvitationLink({
|
|
|
559
611
|
const {
|
|
560
612
|
callback
|
|
561
613
|
} = payload,
|
|
562
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
614
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded10);
|
|
563
615
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
564
616
|
key: _interfaces.TeamStateKeys.RESEND_INVITATION_LINK,
|
|
565
617
|
value: body.email
|
|
@@ -588,7 +640,7 @@ function* resendInvitationEmail({
|
|
|
588
640
|
const {
|
|
589
641
|
callback
|
|
590
642
|
} = payload,
|
|
591
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
643
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded11);
|
|
592
644
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
593
645
|
key: _interfaces.TeamStateKeys.RESEND_INVITATION_LINK,
|
|
594
646
|
value: body.email
|
|
@@ -617,7 +669,7 @@ function* resendInvitationLinkToAllSubTenants({
|
|
|
617
669
|
const {
|
|
618
670
|
callback
|
|
619
671
|
} = payload,
|
|
620
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
672
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded12);
|
|
621
673
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
622
674
|
key: _interfaces.TeamStateKeys.RESEND_INVITATION_LINK,
|
|
623
675
|
value: body.email
|
|
@@ -838,6 +890,7 @@ function* teamSagas() {
|
|
|
838
890
|
yield (0, _effects.takeLatest)(_reducer.actions.loadAllSubTenantsUsers, loadAllSubTenantsUsers);
|
|
839
891
|
yield (0, _effects.takeLatest)(_reducer.actions.loadRoles, loadRoles);
|
|
840
892
|
yield (0, _effects.takeEvery)(_reducer.actions.addUser, addUser);
|
|
893
|
+
yield (0, _effects.takeEvery)(_reducer.actions.addUsersBulk, addUsersBulk);
|
|
841
894
|
yield (0, _effects.takeEvery)(_reducer.actions.addUserToSubTenants, addUserToSubTenants);
|
|
842
895
|
yield (0, _effects.takeEvery)(_reducer.actions.updateUser, updateUser);
|
|
843
896
|
yield (0, _effects.takeEvery)(_reducer.actions.setUserRolesForSubTenants, setUserRolesForSubTenants);
|
|
@@ -983,7 +1036,7 @@ function* addUserMock({
|
|
|
983
1036
|
const {
|
|
984
1037
|
callback
|
|
985
1038
|
} = payload,
|
|
986
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1039
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded13);
|
|
987
1040
|
const teamState = yield selectTeamState();
|
|
988
1041
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
989
1042
|
addUserDialogState: (0, _extends2.default)({}, teamState.addUserDialogState, {
|
|
@@ -1010,7 +1063,7 @@ function* addUserToSubTenantsMock({
|
|
|
1010
1063
|
const {
|
|
1011
1064
|
callback
|
|
1012
1065
|
} = payload,
|
|
1013
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1066
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded14);
|
|
1014
1067
|
const teamState = yield selectTeamState();
|
|
1015
1068
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
1016
1069
|
addUserDialogState: (0, _extends2.default)({}, teamState.addUserDialogState, {
|
|
@@ -1039,7 +1092,7 @@ function* updateUserMock({
|
|
|
1039
1092
|
const {
|
|
1040
1093
|
callback
|
|
1041
1094
|
} = payload,
|
|
1042
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1095
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded15);
|
|
1043
1096
|
const {
|
|
1044
1097
|
id: userId
|
|
1045
1098
|
} = body;
|
|
@@ -1093,7 +1146,7 @@ function* deleteUserMock({
|
|
|
1093
1146
|
const {
|
|
1094
1147
|
callback
|
|
1095
1148
|
} = payload,
|
|
1096
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1149
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded16);
|
|
1097
1150
|
const teamState = yield selectTeamState();
|
|
1098
1151
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
1099
1152
|
deleteUserDialogState: (0, _extends2.default)({}, teamState.deleteUserDialogState, {
|
|
@@ -1117,7 +1170,7 @@ function* deleteUserFromSubTenantsMock({
|
|
|
1117
1170
|
const {
|
|
1118
1171
|
callback
|
|
1119
1172
|
} = payload,
|
|
1120
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1173
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded17);
|
|
1121
1174
|
const teamState = yield selectTeamState();
|
|
1122
1175
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
1123
1176
|
deleteUserDialogState: (0, _extends2.default)({}, teamState.deleteUserDialogState, {
|
|
@@ -1141,7 +1194,7 @@ function* resendActivationLinkMock({
|
|
|
1141
1194
|
const {
|
|
1142
1195
|
callback
|
|
1143
1196
|
} = payload,
|
|
1144
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1197
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded18);
|
|
1145
1198
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1146
1199
|
key: _interfaces.TeamStateKeys.RESEND_ACTIVATE_LINK,
|
|
1147
1200
|
value: body.userId
|
|
@@ -1160,7 +1213,7 @@ function* resendInvitationLinkMock({
|
|
|
1160
1213
|
const {
|
|
1161
1214
|
callback
|
|
1162
1215
|
} = payload,
|
|
1163
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1216
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded19);
|
|
1164
1217
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1165
1218
|
key: _interfaces.TeamStateKeys.RESEND_INVITATION_LINK,
|
|
1166
1219
|
value: body.email
|
|
@@ -1179,7 +1232,7 @@ function* resendInvitationEmailMock({
|
|
|
1179
1232
|
const {
|
|
1180
1233
|
callback
|
|
1181
1234
|
} = payload,
|
|
1182
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1235
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded20);
|
|
1183
1236
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1184
1237
|
key: _interfaces.TeamStateKeys.RESEND_INVITATION_LINK,
|
|
1185
1238
|
value: body.email
|
|
@@ -1198,7 +1251,7 @@ function* resendInvitationLinkToAllSubTenantsMock({
|
|
|
1198
1251
|
const {
|
|
1199
1252
|
callback
|
|
1200
1253
|
} = payload,
|
|
1201
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1254
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded21);
|
|
1202
1255
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1203
1256
|
key: _interfaces.TeamStateKeys.RESEND_INVITATION_LINK,
|
|
1204
1257
|
value: body.email
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.50.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
|
-
"@frontegg/rest-api": "^3.0.
|
|
9
|
+
"@frontegg/rest-api": "^3.0.49",
|
|
10
10
|
"@reduxjs/toolkit": "^1.8.5",
|
|
11
11
|
"redux-saga": "^1.2.1",
|
|
12
12
|
"uuid": "^8.3.2"
|