@frontegg/redux-store 6.163.0 → 6.164.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 +7 -1
- package/auth/TeamState/index.js +7 -0
- package/auth/TeamState/interfaces.d.ts +6 -2
- package/auth/TeamState/interfaces.js +2 -0
- package/auth/TeamState/saga.js +167 -14
- package/auth/index.d.ts +3 -0
- package/auth/interfaces.d.ts +2 -0
- package/auth/reducer.d.ts +3 -0
- package/index.js +1 -1
- package/node/auth/TeamState/index.js +7 -0
- package/node/auth/TeamState/interfaces.js +2 -0
- package/node/auth/TeamState/saga.js +167 -14
- package/node/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAddUser, IDeleteUser, IResendActivationLink, IResendInvitationLink, IResendInvitationEmail, ITeamUser, IUpdateUser, ICreateOrUpdateInviteUserLink, ILoadAllUsers, ISubTenantUser, AddUserToSubTenantsRequest, RemoveUserFromSubTenantsRequest, UpdateUserRolesForSubTenantsRequestDto, ILoadUsers } from '@frontegg/rest-api';
|
|
1
|
+
import { IAddUser, IDeleteUser, IResendActivationLink, IResendInvitationLink, IResendInvitationEmail, ITeamUser, IUpdateUser, ICreateOrUpdateInviteUserLink, ILoadAllUsers, ISubTenantUser, AddUserToSubTenantsRequest, RemoveUserFromSubTenantsRequest, UpdateUserRolesForSubTenantsRequestDto, ILoadUsers, IUpdateUserExpiration } from '@frontegg/rest-api';
|
|
2
2
|
import { ISetAddUserDialog, ISetDeleteUserDialog, TeamState, TeamStateIndicator, LoadRolesAndPermissionsPayload, IAddUsers, BulkInvintationData, IGetUsersV2Payload } from './interfaces';
|
|
3
3
|
import { WithCallback, WithSilentLoad } from '../../interfaces';
|
|
4
4
|
declare const teamState: TeamState;
|
|
@@ -155,6 +155,9 @@ declare const actions: {
|
|
|
155
155
|
resendInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IResendInvitationLink, boolean>], WithCallback<IResendInvitationLink, boolean>, string, never, never>;
|
|
156
156
|
resendInvitationEmail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IResendInvitationEmail, boolean>], WithCallback<IResendInvitationEmail, boolean>, string, never, never>;
|
|
157
157
|
resendInvitationLinkToAllSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IResendInvitationLink, boolean>], WithCallback<IResendInvitationLink, boolean>, string, never, never>;
|
|
158
|
+
getTemporaryUsersConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
159
|
+
updateUserExpirationTime: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IUpdateUserExpiration, boolean>], WithCallback<IUpdateUserExpiration, boolean>, string, never, never>;
|
|
160
|
+
setUserAsPermanent: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<Pick<IUpdateUserExpiration, "userId">, boolean>], WithCallback<Pick<IUpdateUserExpiration, "userId">, boolean>, string, never, never>;
|
|
158
161
|
getInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
159
162
|
createInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<ICreateOrUpdateInviteUserLink, string>], WithCallback<ICreateOrUpdateInviteUserLink, string>, string, never, never>;
|
|
160
163
|
updateInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<ICreateOrUpdateInviteUserLink, boolean>], WithCallback<ICreateOrUpdateInviteUserLink, boolean>, string, never, never>;
|
|
@@ -200,6 +203,9 @@ declare type DispatchedActions = {
|
|
|
200
203
|
resendInvitationLink: (payload: WithCallback<IResendInvitationLink>) => void;
|
|
201
204
|
resendInvitationEmail: (payload: WithCallback<IResendInvitationEmail>) => void;
|
|
202
205
|
resendInvitationLinkToAllSubTenants: (payload: WithCallback<IResendInvitationLink>) => void;
|
|
206
|
+
getTemporaryUsersConfig: () => void;
|
|
207
|
+
updateUserExpirationTime: (payload: WithCallback<IUpdateUserExpiration>) => void;
|
|
208
|
+
setUserAsPermanent: (payload: WithCallback<Pick<IUpdateUserExpiration, 'userId'>>) => void;
|
|
203
209
|
getInvitationLink: () => void;
|
|
204
210
|
createInvitationLink: (payload: WithCallback<ICreateOrUpdateInviteUserLink, string>) => void;
|
|
205
211
|
updateInvitationLink: (payload: WithCallback<ICreateOrUpdateInviteUserLink>) => void;
|
package/auth/TeamState/index.js
CHANGED
|
@@ -89,6 +89,13 @@ const actions = {
|
|
|
89
89
|
resendInvitationLinkToAllSubTenants: createAction(`${authStoreName}/resendInvitationLinkToAllSubTenants`, payload => ({
|
|
90
90
|
payload
|
|
91
91
|
})),
|
|
92
|
+
getTemporaryUsersConfig: createAction(`${authStoreName}/getTemporaryUsersConfig`),
|
|
93
|
+
updateUserExpirationTime: createAction(`${authStoreName}/updateUserExpirationTime`, payload => ({
|
|
94
|
+
payload
|
|
95
|
+
})),
|
|
96
|
+
setUserAsPermanent: createAction(`${authStoreName}/setUserAsPermanent`, payload => ({
|
|
97
|
+
payload
|
|
98
|
+
})),
|
|
92
99
|
getInvitationLink: createAction(`${authStoreName}/getInvitationLink`),
|
|
93
100
|
createInvitationLink: createAction(`${authStoreName}/createInvitationLink`, payload => ({
|
|
94
101
|
payload
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITeamUserRole, ITeamUser, ITeamUserPermission, ISubTenantUser, SortByEnum, ISearchUserQueryParamsV2, QueryFilter, QuerySort, IRole, IUsersV3Data } from '@frontegg/rest-api';
|
|
1
|
+
import { ITeamUserRole, ITeamUser, ITeamUserPermission, ISubTenantUser, SortByEnum, ISearchUserQueryParamsV2, QueryFilter, QuerySort, IRole, IUsersV3Data, ITemporaryUserConfiguration } from '@frontegg/rest-api';
|
|
2
2
|
import { GroupsState } from '../GroupsState/interfaces';
|
|
3
3
|
import { LoaderIndicatorState, WithCallback } from '../../interfaces';
|
|
4
4
|
export declare enum TeamStateKeys {
|
|
@@ -13,7 +13,9 @@ export declare enum TeamStateKeys {
|
|
|
13
13
|
GET_TOKEN_LINK = "GET_TOKEN_LINK",
|
|
14
14
|
UPDATE_TOKEN_LINK = "UPDATE_TOKEN_LINK",
|
|
15
15
|
DELETE_TOKEN_LINK = "DELETE_TOKEN_LINK",
|
|
16
|
-
CONFIG_TOKEN_LINK = "CONFIG_TOKEN_LINK"
|
|
16
|
+
CONFIG_TOKEN_LINK = "CONFIG_TOKEN_LINK",
|
|
17
|
+
CONFIG_TEMPORARY_USERS = "CONFIG_TEMPORARY_USERS",
|
|
18
|
+
UPDATE_USER_EXPIRATION_TIME = "UPDATE_USER_EXPIRATION_TIME"
|
|
17
19
|
}
|
|
18
20
|
export declare type TeamStateIndicator = {
|
|
19
21
|
key: TeamStateKeys;
|
|
@@ -70,6 +72,7 @@ export interface TeamState {
|
|
|
70
72
|
deleteUserDialogState: DeleteUserDialogState;
|
|
71
73
|
lockUserDialogState: DeleteUserDialogState;
|
|
72
74
|
inviteTokenState?: InviteTokenState;
|
|
75
|
+
temporaryUsersConfig?: ITemporaryUserConfiguration;
|
|
73
76
|
}
|
|
74
77
|
export interface InviteTokenState {
|
|
75
78
|
id?: string;
|
|
@@ -85,6 +88,7 @@ export interface InviteTokenState {
|
|
|
85
88
|
export interface IAddUsers {
|
|
86
89
|
emails: string[];
|
|
87
90
|
roleIds: string[];
|
|
91
|
+
expirationInSeconds?: number;
|
|
88
92
|
}
|
|
89
93
|
export interface BulkInvintationData {
|
|
90
94
|
unallowedEmails: string[];
|
|
@@ -12,4 +12,6 @@ export let TeamStateKeys;
|
|
|
12
12
|
TeamStateKeys["UPDATE_TOKEN_LINK"] = "UPDATE_TOKEN_LINK";
|
|
13
13
|
TeamStateKeys["DELETE_TOKEN_LINK"] = "DELETE_TOKEN_LINK";
|
|
14
14
|
TeamStateKeys["CONFIG_TOKEN_LINK"] = "CONFIG_TOKEN_LINK";
|
|
15
|
+
TeamStateKeys["CONFIG_TEMPORARY_USERS"] = "CONFIG_TEMPORARY_USERS";
|
|
16
|
+
TeamStateKeys["UPDATE_USER_EXPIRATION_TIME"] = "UPDATE_USER_EXPIRATION_TIME";
|
|
15
17
|
})(TeamStateKeys || (TeamStateKeys = {}));
|
package/auth/TeamState/saga.js
CHANGED
|
@@ -13,13 +13,17 @@ const _excluded = ["callback"],
|
|
|
13
13
|
_excluded11 = ["callback"],
|
|
14
14
|
_excluded12 = ["callback"],
|
|
15
15
|
_excluded13 = ["callback"],
|
|
16
|
-
_excluded14 = ["callback"
|
|
16
|
+
_excluded14 = ["callback"],
|
|
17
17
|
_excluded15 = ["callback"],
|
|
18
|
-
_excluded16 = ["callback"],
|
|
18
|
+
_excluded16 = ["callback", "profileImage"],
|
|
19
19
|
_excluded17 = ["callback"],
|
|
20
20
|
_excluded18 = ["callback"],
|
|
21
21
|
_excluded19 = ["callback"],
|
|
22
|
-
_excluded20 = ["callback"]
|
|
22
|
+
_excluded20 = ["callback"],
|
|
23
|
+
_excluded21 = ["callback"],
|
|
24
|
+
_excluded22 = ["callback"],
|
|
25
|
+
_excluded23 = ["callback"],
|
|
26
|
+
_excluded24 = ["callback"];
|
|
23
27
|
import { takeLatest, put, call, all, takeEvery, select as sagaSelect } from 'redux-saga/effects';
|
|
24
28
|
import { api } from '@frontegg/rest-api';
|
|
25
29
|
import { actions } from '../reducer';
|
|
@@ -347,9 +351,11 @@ function* addUsersBulk({
|
|
|
347
351
|
}));
|
|
348
352
|
const allowedEmails = [];
|
|
349
353
|
const unallowedEmails = [];
|
|
350
|
-
const bodies = payload.emails.map(email => ({
|
|
354
|
+
const bodies = payload.emails.map(email => _extends({
|
|
351
355
|
email,
|
|
352
356
|
roleIds: payload.roleIds
|
|
357
|
+
}, payload.expirationInSeconds && {
|
|
358
|
+
expirationInSeconds: payload.expirationInSeconds
|
|
353
359
|
}));
|
|
354
360
|
yield put(actions.setTeamState({
|
|
355
361
|
addUserDialogState: {
|
|
@@ -739,6 +745,93 @@ function* getInvitationLinkConfig() {
|
|
|
739
745
|
}));
|
|
740
746
|
}
|
|
741
747
|
}
|
|
748
|
+
function* getTemporaryUsersConfig() {
|
|
749
|
+
yield put(actions.setTeamError({
|
|
750
|
+
key: TeamStateKeys.CONFIG_TEMPORARY_USERS,
|
|
751
|
+
value: false
|
|
752
|
+
}));
|
|
753
|
+
try {
|
|
754
|
+
const temporaryUsersConfig = yield call(api.teams.getTemporaryUserConfiguration);
|
|
755
|
+
yield put(actions.setTeamState({
|
|
756
|
+
temporaryUsersConfig
|
|
757
|
+
}));
|
|
758
|
+
} catch (e) {
|
|
759
|
+
yield put(actions.setTeamError({
|
|
760
|
+
key: TeamStateKeys.CONFIG_TEMPORARY_USERS,
|
|
761
|
+
value: errorHandler(e)
|
|
762
|
+
}));
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
function* updateUserExpirationTime({
|
|
766
|
+
payload
|
|
767
|
+
}) {
|
|
768
|
+
const {
|
|
769
|
+
callback
|
|
770
|
+
} = payload,
|
|
771
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded12);
|
|
772
|
+
const teamState = yield selectTeamState();
|
|
773
|
+
yield put(actions.setTeamLoader({
|
|
774
|
+
key: TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
775
|
+
value: true
|
|
776
|
+
}));
|
|
777
|
+
try {
|
|
778
|
+
const res = yield call(api.teams.updateUserExpirationTime, body);
|
|
779
|
+
yield put(actions.setTeamState({
|
|
780
|
+
users: teamState.users.map(user => {
|
|
781
|
+
return user.id === body.userId ? _extends({}, user, {
|
|
782
|
+
temporaryExpirationDate: new Date(res.temporaryExpirationDate)
|
|
783
|
+
}) : user;
|
|
784
|
+
})
|
|
785
|
+
}));
|
|
786
|
+
callback == null ? void 0 : callback(true);
|
|
787
|
+
} catch (e) {
|
|
788
|
+
yield put(actions.setTeamError({
|
|
789
|
+
key: TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
790
|
+
value: errorHandler(e)
|
|
791
|
+
}));
|
|
792
|
+
callback == null ? void 0 : callback(null, e);
|
|
793
|
+
} finally {
|
|
794
|
+
yield put(actions.setTeamLoader({
|
|
795
|
+
key: TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
796
|
+
value: false
|
|
797
|
+
}));
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
function* setUserAsPermanent({
|
|
801
|
+
payload
|
|
802
|
+
}) {
|
|
803
|
+
const {
|
|
804
|
+
callback
|
|
805
|
+
} = payload,
|
|
806
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded13);
|
|
807
|
+
const teamState = yield selectTeamState();
|
|
808
|
+
yield put(actions.setTeamLoader({
|
|
809
|
+
key: TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
810
|
+
value: true
|
|
811
|
+
}));
|
|
812
|
+
try {
|
|
813
|
+
yield call(api.teams.setPermanentUser, body.userId);
|
|
814
|
+
yield put(actions.setTeamState({
|
|
815
|
+
users: teamState.users.map(user => {
|
|
816
|
+
return user.id === body.userId ? _extends({}, user, {
|
|
817
|
+
temporaryExpirationDate: undefined
|
|
818
|
+
}) : user;
|
|
819
|
+
})
|
|
820
|
+
}));
|
|
821
|
+
callback == null ? void 0 : callback(true);
|
|
822
|
+
} catch (e) {
|
|
823
|
+
yield put(actions.setTeamError({
|
|
824
|
+
key: TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
825
|
+
value: errorHandler(e)
|
|
826
|
+
}));
|
|
827
|
+
callback == null ? void 0 : callback(null, e);
|
|
828
|
+
} finally {
|
|
829
|
+
yield put(actions.setTeamLoader({
|
|
830
|
+
key: TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
831
|
+
value: false
|
|
832
|
+
}));
|
|
833
|
+
}
|
|
834
|
+
}
|
|
742
835
|
function* getInvitationLink() {
|
|
743
836
|
yield put(actions.setTeamError({
|
|
744
837
|
key: TeamStateKeys.GET_TOKEN_LINK,
|
|
@@ -917,6 +1010,9 @@ export function* teamSagas() {
|
|
|
917
1010
|
yield takeEvery(actions.resendInvitationLink, resendInvitationLink);
|
|
918
1011
|
yield takeEvery(actions.resendInvitationEmail, resendInvitationEmail);
|
|
919
1012
|
yield takeEvery(actions.resendInvitationLinkToAllSubTenants, resendInvitationLinkToAllSubTenants);
|
|
1013
|
+
yield takeEvery(actions.getTemporaryUsersConfig, getTemporaryUsersConfig);
|
|
1014
|
+
yield takeEvery(actions.updateUserExpirationTime, updateUserExpirationTime);
|
|
1015
|
+
yield takeEvery(actions.setUserAsPermanent, setUserAsPermanent);
|
|
920
1016
|
yield takeEvery(actions.getInvitationLink, getInvitationLink);
|
|
921
1017
|
yield takeEvery(actions.createInvitationLink, createInvitationLink);
|
|
922
1018
|
yield takeEvery(actions.updateInvitationLink, updateInvitationLink);
|
|
@@ -1041,7 +1137,7 @@ function* addUserMock({
|
|
|
1041
1137
|
const {
|
|
1042
1138
|
callback
|
|
1043
1139
|
} = payload,
|
|
1044
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1140
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded14);
|
|
1045
1141
|
const teamState = yield selectTeamState();
|
|
1046
1142
|
yield put(actions.setTeamState({
|
|
1047
1143
|
addUserDialogState: _extends({}, teamState.addUserDialogState, {
|
|
@@ -1049,10 +1145,12 @@ function* addUserMock({
|
|
|
1049
1145
|
})
|
|
1050
1146
|
}));
|
|
1051
1147
|
yield delay();
|
|
1148
|
+
const date = new Date();
|
|
1052
1149
|
const newUser = _extends({}, userTeamDemo, {
|
|
1053
1150
|
groups: []
|
|
1054
1151
|
}, body, {
|
|
1055
|
-
id: `${uuidv4()}
|
|
1152
|
+
id: `${uuidv4()}`,
|
|
1153
|
+
temporaryExpirationDate: body.expirationInSeconds ? new Date(date.setSeconds(date.getSeconds() + body.expirationInSeconds)) : undefined
|
|
1056
1154
|
});
|
|
1057
1155
|
callback == null ? void 0 : callback(newUser);
|
|
1058
1156
|
yield put(actions.setTeamState({
|
|
@@ -1069,7 +1167,7 @@ function* addUserToSubTenantsMock({
|
|
|
1069
1167
|
const {
|
|
1070
1168
|
callback
|
|
1071
1169
|
} = payload,
|
|
1072
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1170
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded15);
|
|
1073
1171
|
const teamState = yield selectTeamState();
|
|
1074
1172
|
yield put(actions.setTeamState({
|
|
1075
1173
|
addUserDialogState: _extends({}, teamState.addUserDialogState, {
|
|
@@ -1096,7 +1194,7 @@ function* updateUserMock({
|
|
|
1096
1194
|
const {
|
|
1097
1195
|
callback
|
|
1098
1196
|
} = payload,
|
|
1099
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1197
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded16);
|
|
1100
1198
|
const {
|
|
1101
1199
|
id: userId
|
|
1102
1200
|
} = body;
|
|
@@ -1146,7 +1244,7 @@ function* deleteUserMock({
|
|
|
1146
1244
|
const {
|
|
1147
1245
|
callback
|
|
1148
1246
|
} = payload,
|
|
1149
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1247
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded17);
|
|
1150
1248
|
const teamState = yield selectTeamState();
|
|
1151
1249
|
yield put(actions.setTeamState({
|
|
1152
1250
|
deleteUserDialogState: _extends({}, teamState.deleteUserDialogState, {
|
|
@@ -1169,7 +1267,7 @@ function* deleteUserFromSubTenantsMock({
|
|
|
1169
1267
|
const {
|
|
1170
1268
|
callback
|
|
1171
1269
|
} = payload,
|
|
1172
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1270
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded18);
|
|
1173
1271
|
const teamState = yield selectTeamState();
|
|
1174
1272
|
yield put(actions.setTeamState({
|
|
1175
1273
|
deleteUserDialogState: _extends({}, teamState.deleteUserDialogState, {
|
|
@@ -1192,7 +1290,7 @@ function* resendActivationLinkMock({
|
|
|
1192
1290
|
const {
|
|
1193
1291
|
callback
|
|
1194
1292
|
} = payload,
|
|
1195
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1293
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded19);
|
|
1196
1294
|
yield put(actions.setTeamLoader({
|
|
1197
1295
|
key: TeamStateKeys.RESEND_ACTIVATE_LINK,
|
|
1198
1296
|
value: body.userId
|
|
@@ -1210,7 +1308,7 @@ function* resendInvitationLinkMock({
|
|
|
1210
1308
|
const {
|
|
1211
1309
|
callback
|
|
1212
1310
|
} = payload,
|
|
1213
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1311
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded20);
|
|
1214
1312
|
yield put(actions.setTeamLoader({
|
|
1215
1313
|
key: TeamStateKeys.RESEND_INVITATION_LINK,
|
|
1216
1314
|
value: body.email
|
|
@@ -1228,7 +1326,7 @@ function* resendInvitationEmailMock({
|
|
|
1228
1326
|
const {
|
|
1229
1327
|
callback
|
|
1230
1328
|
} = payload,
|
|
1231
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1329
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded21);
|
|
1232
1330
|
yield put(actions.setTeamLoader({
|
|
1233
1331
|
key: TeamStateKeys.RESEND_INVITATION_LINK,
|
|
1234
1332
|
value: body.email
|
|
@@ -1246,7 +1344,7 @@ function* resendInvitationLinkToAllSubTenantsMock({
|
|
|
1246
1344
|
const {
|
|
1247
1345
|
callback
|
|
1248
1346
|
} = payload,
|
|
1249
|
-
body = _objectWithoutPropertiesLoose(payload,
|
|
1347
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded22);
|
|
1250
1348
|
yield put(actions.setTeamLoader({
|
|
1251
1349
|
key: TeamStateKeys.RESEND_INVITATION_LINK,
|
|
1252
1350
|
value: body.email
|
|
@@ -1258,6 +1356,59 @@ function* resendInvitationLinkToAllSubTenantsMock({
|
|
|
1258
1356
|
value: false
|
|
1259
1357
|
}));
|
|
1260
1358
|
}
|
|
1359
|
+
function* updateUserExpirationTimeMock({
|
|
1360
|
+
payload
|
|
1361
|
+
}) {
|
|
1362
|
+
const {
|
|
1363
|
+
callback
|
|
1364
|
+
} = payload,
|
|
1365
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded23);
|
|
1366
|
+
const teamState = yield selectTeamState();
|
|
1367
|
+
yield put(actions.setTeamLoader({
|
|
1368
|
+
key: TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
1369
|
+
value: true
|
|
1370
|
+
}));
|
|
1371
|
+
const date = new Date();
|
|
1372
|
+
yield put(actions.setTeamState({
|
|
1373
|
+
users: teamState.users.map(user => {
|
|
1374
|
+
return user.id === body.userId ? _extends({}, user, {
|
|
1375
|
+
temporaryExpirationDate: body.expirationInSeconds ? new Date(date.setSeconds(date.getSeconds() + body.expirationInSeconds)) : undefined
|
|
1376
|
+
}) : user;
|
|
1377
|
+
})
|
|
1378
|
+
}));
|
|
1379
|
+
yield delay();
|
|
1380
|
+
callback == null ? void 0 : callback(true);
|
|
1381
|
+
yield put(actions.setTeamLoader({
|
|
1382
|
+
key: TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
1383
|
+
value: false
|
|
1384
|
+
}));
|
|
1385
|
+
}
|
|
1386
|
+
function* setUserAsPermanentMock({
|
|
1387
|
+
payload
|
|
1388
|
+
}) {
|
|
1389
|
+
const {
|
|
1390
|
+
callback
|
|
1391
|
+
} = payload,
|
|
1392
|
+
body = _objectWithoutPropertiesLoose(payload, _excluded24);
|
|
1393
|
+
const teamState = yield selectTeamState();
|
|
1394
|
+
yield put(actions.setTeamLoader({
|
|
1395
|
+
key: TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
1396
|
+
value: true
|
|
1397
|
+
}));
|
|
1398
|
+
yield put(actions.setTeamState({
|
|
1399
|
+
users: teamState.users.map(user => {
|
|
1400
|
+
return user.id === body.userId ? _extends({}, user, {
|
|
1401
|
+
temporaryExpirationDate: undefined
|
|
1402
|
+
}) : user;
|
|
1403
|
+
})
|
|
1404
|
+
}));
|
|
1405
|
+
yield delay();
|
|
1406
|
+
callback == null ? void 0 : callback(true);
|
|
1407
|
+
yield put(actions.setTeamLoader({
|
|
1408
|
+
key: TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
1409
|
+
value: false
|
|
1410
|
+
}));
|
|
1411
|
+
}
|
|
1261
1412
|
export function* teamSagasMock() {
|
|
1262
1413
|
yield takeLatest(actions.loadUsersV2, loadUsersMock);
|
|
1263
1414
|
yield takeLatest(actions.loadAllSubTenantsUsers, loadAllSubTenantsUsersMock);
|
|
@@ -1266,6 +1417,8 @@ export function* teamSagasMock() {
|
|
|
1266
1417
|
yield takeEvery(actions.addUserToSubTenants, addUserToSubTenantsMock);
|
|
1267
1418
|
yield takeEvery(actions.updateUser, updateUserMock);
|
|
1268
1419
|
yield takeEvery(actions.deleteUser, deleteUserMock);
|
|
1420
|
+
yield takeEvery(actions.updateUserExpirationTime, updateUserExpirationTimeMock);
|
|
1421
|
+
yield takeEvery(actions.setUserAsPermanent, setUserAsPermanentMock);
|
|
1269
1422
|
yield takeEvery(actions.deleteUserFromSubTenants, deleteUserFromSubTenantsMock);
|
|
1270
1423
|
yield takeEvery(actions.resendActivationLink, resendActivationLinkMock);
|
|
1271
1424
|
yield takeEvery(actions.resendInvitationLink, resendInvitationLinkMock);
|
package/auth/index.d.ts
CHANGED
|
@@ -306,6 +306,9 @@ declare const _default: {
|
|
|
306
306
|
resendInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>, string, never, never>;
|
|
307
307
|
resendInvitationEmail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationEmail, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationEmail, boolean>, string, never, never>;
|
|
308
308
|
resendInvitationLinkToAllSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>, string, never, never>;
|
|
309
|
+
getTemporaryUsersConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
310
|
+
updateUserExpirationTime: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IUpdateUserExpiration, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IUpdateUserExpiration, boolean>, string, never, never>;
|
|
311
|
+
setUserAsPermanent: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Pick<import("@frontegg/rest-api").IUpdateUserExpiration, "userId">, boolean>], import("..").WithCallback<Pick<import("@frontegg/rest-api").IUpdateUserExpiration, "userId">, boolean>, string, never, never>;
|
|
309
312
|
getInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
310
313
|
createInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").ICreateOrUpdateInviteUserLink, string>], import("..").WithCallback<import("@frontegg/rest-api").ICreateOrUpdateInviteUserLink, string>, string, never, never>;
|
|
311
314
|
updateInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").ICreateOrUpdateInviteUserLink, boolean>], import("..").WithCallback<import("@frontegg/rest-api").ICreateOrUpdateInviteUserLink, boolean>, string, never, never>;
|
package/auth/interfaces.d.ts
CHANGED
|
@@ -232,11 +232,13 @@ export interface IInviteMemberSubmitPayload {
|
|
|
232
232
|
invitedUserEmail: string;
|
|
233
233
|
invitedUserPhoneNumber?: string;
|
|
234
234
|
invitedUserRoles?: string[];
|
|
235
|
+
expirationInSeconds?: number;
|
|
235
236
|
}
|
|
236
237
|
export interface IInviteMembersSubmitPayload {
|
|
237
238
|
email: string;
|
|
238
239
|
invitedUserEmails: string[];
|
|
239
240
|
invitedUsersRoles?: string[];
|
|
241
|
+
expirationInSeconds?: number;
|
|
240
242
|
}
|
|
241
243
|
export interface ISignUpCompletePayload {
|
|
242
244
|
name?: string;
|
package/auth/reducer.d.ts
CHANGED
|
@@ -264,6 +264,9 @@ declare const actions: {
|
|
|
264
264
|
resendInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>, string, never, never>;
|
|
265
265
|
resendInvitationEmail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationEmail, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationEmail, boolean>, string, never, never>;
|
|
266
266
|
resendInvitationLinkToAllSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IResendInvitationLink, boolean>, string, never, never>;
|
|
267
|
+
getTemporaryUsersConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
268
|
+
updateUserExpirationTime: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IUpdateUserExpiration, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IUpdateUserExpiration, boolean>, string, never, never>;
|
|
269
|
+
setUserAsPermanent: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Pick<import("@frontegg/rest-api").IUpdateUserExpiration, "userId">, boolean>], import("..").WithCallback<Pick<import("@frontegg/rest-api").IUpdateUserExpiration, "userId">, boolean>, string, never, never>;
|
|
267
270
|
getInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
268
271
|
createInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").ICreateOrUpdateInviteUserLink, string>], import("..").WithCallback<import("@frontegg/rest-api").ICreateOrUpdateInviteUserLink, string>, string, never, never>;
|
|
269
272
|
updateInvitationLink: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").ICreateOrUpdateInviteUserLink, boolean>], import("..").WithCallback<import("@frontegg/rest-api").ICreateOrUpdateInviteUserLink, boolean>, string, never, never>;
|
package/index.js
CHANGED
|
@@ -97,6 +97,13 @@ const actions = {
|
|
|
97
97
|
resendInvitationLinkToAllSubTenants: (0, _toolkit.createAction)(`${_constants.authStoreName}/resendInvitationLinkToAllSubTenants`, payload => ({
|
|
98
98
|
payload
|
|
99
99
|
})),
|
|
100
|
+
getTemporaryUsersConfig: (0, _toolkit.createAction)(`${_constants.authStoreName}/getTemporaryUsersConfig`),
|
|
101
|
+
updateUserExpirationTime: (0, _toolkit.createAction)(`${_constants.authStoreName}/updateUserExpirationTime`, payload => ({
|
|
102
|
+
payload
|
|
103
|
+
})),
|
|
104
|
+
setUserAsPermanent: (0, _toolkit.createAction)(`${_constants.authStoreName}/setUserAsPermanent`, payload => ({
|
|
105
|
+
payload
|
|
106
|
+
})),
|
|
100
107
|
getInvitationLink: (0, _toolkit.createAction)(`${_constants.authStoreName}/getInvitationLink`),
|
|
101
108
|
createInvitationLink: (0, _toolkit.createAction)(`${_constants.authStoreName}/createInvitationLink`, payload => ({
|
|
102
109
|
payload
|
|
@@ -19,4 +19,6 @@ exports.TeamStateKeys = TeamStateKeys;
|
|
|
19
19
|
TeamStateKeys["UPDATE_TOKEN_LINK"] = "UPDATE_TOKEN_LINK";
|
|
20
20
|
TeamStateKeys["DELETE_TOKEN_LINK"] = "DELETE_TOKEN_LINK";
|
|
21
21
|
TeamStateKeys["CONFIG_TOKEN_LINK"] = "CONFIG_TOKEN_LINK";
|
|
22
|
+
TeamStateKeys["CONFIG_TEMPORARY_USERS"] = "CONFIG_TEMPORARY_USERS";
|
|
23
|
+
TeamStateKeys["UPDATE_USER_EXPIRATION_TIME"] = "UPDATE_USER_EXPIRATION_TIME";
|
|
22
24
|
})(TeamStateKeys || (exports.TeamStateKeys = TeamStateKeys = {}));
|
|
@@ -31,13 +31,17 @@ const _excluded = ["callback"],
|
|
|
31
31
|
_excluded11 = ["callback"],
|
|
32
32
|
_excluded12 = ["callback"],
|
|
33
33
|
_excluded13 = ["callback"],
|
|
34
|
-
_excluded14 = ["callback"
|
|
34
|
+
_excluded14 = ["callback"],
|
|
35
35
|
_excluded15 = ["callback"],
|
|
36
|
-
_excluded16 = ["callback"],
|
|
36
|
+
_excluded16 = ["callback", "profileImage"],
|
|
37
37
|
_excluded17 = ["callback"],
|
|
38
38
|
_excluded18 = ["callback"],
|
|
39
39
|
_excluded19 = ["callback"],
|
|
40
|
-
_excluded20 = ["callback"]
|
|
40
|
+
_excluded20 = ["callback"],
|
|
41
|
+
_excluded21 = ["callback"],
|
|
42
|
+
_excluded22 = ["callback"],
|
|
43
|
+
_excluded23 = ["callback"],
|
|
44
|
+
_excluded24 = ["callback"];
|
|
41
45
|
const selectTeamState = () => (0, _effects.select)(_ => _[_constants.authStoreName].teamState);
|
|
42
46
|
function* getGroupsForUsers() {
|
|
43
47
|
try {
|
|
@@ -355,9 +359,11 @@ function* addUsersBulk({
|
|
|
355
359
|
}));
|
|
356
360
|
const allowedEmails = [];
|
|
357
361
|
const unallowedEmails = [];
|
|
358
|
-
const bodies = payload.emails.map(email => ({
|
|
362
|
+
const bodies = payload.emails.map(email => (0, _extends2.default)({
|
|
359
363
|
email,
|
|
360
364
|
roleIds: payload.roleIds
|
|
365
|
+
}, payload.expirationInSeconds && {
|
|
366
|
+
expirationInSeconds: payload.expirationInSeconds
|
|
361
367
|
}));
|
|
362
368
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
363
369
|
addUserDialogState: {
|
|
@@ -747,6 +753,93 @@ function* getInvitationLinkConfig() {
|
|
|
747
753
|
}));
|
|
748
754
|
}
|
|
749
755
|
}
|
|
756
|
+
function* getTemporaryUsersConfig() {
|
|
757
|
+
yield (0, _effects.put)(_reducer.actions.setTeamError({
|
|
758
|
+
key: _interfaces.TeamStateKeys.CONFIG_TEMPORARY_USERS,
|
|
759
|
+
value: false
|
|
760
|
+
}));
|
|
761
|
+
try {
|
|
762
|
+
const temporaryUsersConfig = yield (0, _effects.call)(_restApi.api.teams.getTemporaryUserConfiguration);
|
|
763
|
+
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
764
|
+
temporaryUsersConfig
|
|
765
|
+
}));
|
|
766
|
+
} catch (e) {
|
|
767
|
+
yield (0, _effects.put)(_reducer.actions.setTeamError({
|
|
768
|
+
key: _interfaces.TeamStateKeys.CONFIG_TEMPORARY_USERS,
|
|
769
|
+
value: (0, _utils2.errorHandler)(e)
|
|
770
|
+
}));
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
function* updateUserExpirationTime({
|
|
774
|
+
payload
|
|
775
|
+
}) {
|
|
776
|
+
const {
|
|
777
|
+
callback
|
|
778
|
+
} = payload,
|
|
779
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded12);
|
|
780
|
+
const teamState = yield selectTeamState();
|
|
781
|
+
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
782
|
+
key: _interfaces.TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
783
|
+
value: true
|
|
784
|
+
}));
|
|
785
|
+
try {
|
|
786
|
+
const res = yield (0, _effects.call)(_restApi.api.teams.updateUserExpirationTime, body);
|
|
787
|
+
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
788
|
+
users: teamState.users.map(user => {
|
|
789
|
+
return user.id === body.userId ? (0, _extends2.default)({}, user, {
|
|
790
|
+
temporaryExpirationDate: new Date(res.temporaryExpirationDate)
|
|
791
|
+
}) : user;
|
|
792
|
+
})
|
|
793
|
+
}));
|
|
794
|
+
callback == null ? void 0 : callback(true);
|
|
795
|
+
} catch (e) {
|
|
796
|
+
yield (0, _effects.put)(_reducer.actions.setTeamError({
|
|
797
|
+
key: _interfaces.TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
798
|
+
value: (0, _utils2.errorHandler)(e)
|
|
799
|
+
}));
|
|
800
|
+
callback == null ? void 0 : callback(null, e);
|
|
801
|
+
} finally {
|
|
802
|
+
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
803
|
+
key: _interfaces.TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
804
|
+
value: false
|
|
805
|
+
}));
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
function* setUserAsPermanent({
|
|
809
|
+
payload
|
|
810
|
+
}) {
|
|
811
|
+
const {
|
|
812
|
+
callback
|
|
813
|
+
} = payload,
|
|
814
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded13);
|
|
815
|
+
const teamState = yield selectTeamState();
|
|
816
|
+
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
817
|
+
key: _interfaces.TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
818
|
+
value: true
|
|
819
|
+
}));
|
|
820
|
+
try {
|
|
821
|
+
yield (0, _effects.call)(_restApi.api.teams.setPermanentUser, body.userId);
|
|
822
|
+
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
823
|
+
users: teamState.users.map(user => {
|
|
824
|
+
return user.id === body.userId ? (0, _extends2.default)({}, user, {
|
|
825
|
+
temporaryExpirationDate: undefined
|
|
826
|
+
}) : user;
|
|
827
|
+
})
|
|
828
|
+
}));
|
|
829
|
+
callback == null ? void 0 : callback(true);
|
|
830
|
+
} catch (e) {
|
|
831
|
+
yield (0, _effects.put)(_reducer.actions.setTeamError({
|
|
832
|
+
key: _interfaces.TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
833
|
+
value: (0, _utils2.errorHandler)(e)
|
|
834
|
+
}));
|
|
835
|
+
callback == null ? void 0 : callback(null, e);
|
|
836
|
+
} finally {
|
|
837
|
+
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
838
|
+
key: _interfaces.TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
839
|
+
value: false
|
|
840
|
+
}));
|
|
841
|
+
}
|
|
842
|
+
}
|
|
750
843
|
function* getInvitationLink() {
|
|
751
844
|
yield (0, _effects.put)(_reducer.actions.setTeamError({
|
|
752
845
|
key: _interfaces.TeamStateKeys.GET_TOKEN_LINK,
|
|
@@ -925,6 +1018,9 @@ function* teamSagas() {
|
|
|
925
1018
|
yield (0, _effects.takeEvery)(_reducer.actions.resendInvitationLink, resendInvitationLink);
|
|
926
1019
|
yield (0, _effects.takeEvery)(_reducer.actions.resendInvitationEmail, resendInvitationEmail);
|
|
927
1020
|
yield (0, _effects.takeEvery)(_reducer.actions.resendInvitationLinkToAllSubTenants, resendInvitationLinkToAllSubTenants);
|
|
1021
|
+
yield (0, _effects.takeEvery)(_reducer.actions.getTemporaryUsersConfig, getTemporaryUsersConfig);
|
|
1022
|
+
yield (0, _effects.takeEvery)(_reducer.actions.updateUserExpirationTime, updateUserExpirationTime);
|
|
1023
|
+
yield (0, _effects.takeEvery)(_reducer.actions.setUserAsPermanent, setUserAsPermanent);
|
|
928
1024
|
yield (0, _effects.takeEvery)(_reducer.actions.getInvitationLink, getInvitationLink);
|
|
929
1025
|
yield (0, _effects.takeEvery)(_reducer.actions.createInvitationLink, createInvitationLink);
|
|
930
1026
|
yield (0, _effects.takeEvery)(_reducer.actions.updateInvitationLink, updateInvitationLink);
|
|
@@ -1049,7 +1145,7 @@ function* addUserMock({
|
|
|
1049
1145
|
const {
|
|
1050
1146
|
callback
|
|
1051
1147
|
} = payload,
|
|
1052
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1148
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded14);
|
|
1053
1149
|
const teamState = yield selectTeamState();
|
|
1054
1150
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
1055
1151
|
addUserDialogState: (0, _extends2.default)({}, teamState.addUserDialogState, {
|
|
@@ -1057,10 +1153,12 @@ function* addUserMock({
|
|
|
1057
1153
|
})
|
|
1058
1154
|
}));
|
|
1059
1155
|
yield (0, _utils.delay)();
|
|
1156
|
+
const date = new Date();
|
|
1060
1157
|
const newUser = (0, _extends2.default)({}, _dummy.userTeamDemo, {
|
|
1061
1158
|
groups: []
|
|
1062
1159
|
}, body, {
|
|
1063
|
-
id: `${(0, _uuid.v4)()}
|
|
1160
|
+
id: `${(0, _uuid.v4)()}`,
|
|
1161
|
+
temporaryExpirationDate: body.expirationInSeconds ? new Date(date.setSeconds(date.getSeconds() + body.expirationInSeconds)) : undefined
|
|
1064
1162
|
});
|
|
1065
1163
|
callback == null ? void 0 : callback(newUser);
|
|
1066
1164
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
@@ -1077,7 +1175,7 @@ function* addUserToSubTenantsMock({
|
|
|
1077
1175
|
const {
|
|
1078
1176
|
callback
|
|
1079
1177
|
} = payload,
|
|
1080
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1178
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded15);
|
|
1081
1179
|
const teamState = yield selectTeamState();
|
|
1082
1180
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
1083
1181
|
addUserDialogState: (0, _extends2.default)({}, teamState.addUserDialogState, {
|
|
@@ -1104,7 +1202,7 @@ function* updateUserMock({
|
|
|
1104
1202
|
const {
|
|
1105
1203
|
callback
|
|
1106
1204
|
} = payload,
|
|
1107
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1205
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded16);
|
|
1108
1206
|
const {
|
|
1109
1207
|
id: userId
|
|
1110
1208
|
} = body;
|
|
@@ -1154,7 +1252,7 @@ function* deleteUserMock({
|
|
|
1154
1252
|
const {
|
|
1155
1253
|
callback
|
|
1156
1254
|
} = payload,
|
|
1157
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1255
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded17);
|
|
1158
1256
|
const teamState = yield selectTeamState();
|
|
1159
1257
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
1160
1258
|
deleteUserDialogState: (0, _extends2.default)({}, teamState.deleteUserDialogState, {
|
|
@@ -1177,7 +1275,7 @@ function* deleteUserFromSubTenantsMock({
|
|
|
1177
1275
|
const {
|
|
1178
1276
|
callback
|
|
1179
1277
|
} = payload,
|
|
1180
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1278
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded18);
|
|
1181
1279
|
const teamState = yield selectTeamState();
|
|
1182
1280
|
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
1183
1281
|
deleteUserDialogState: (0, _extends2.default)({}, teamState.deleteUserDialogState, {
|
|
@@ -1200,7 +1298,7 @@ function* resendActivationLinkMock({
|
|
|
1200
1298
|
const {
|
|
1201
1299
|
callback
|
|
1202
1300
|
} = payload,
|
|
1203
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1301
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded19);
|
|
1204
1302
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1205
1303
|
key: _interfaces.TeamStateKeys.RESEND_ACTIVATE_LINK,
|
|
1206
1304
|
value: body.userId
|
|
@@ -1218,7 +1316,7 @@ function* resendInvitationLinkMock({
|
|
|
1218
1316
|
const {
|
|
1219
1317
|
callback
|
|
1220
1318
|
} = payload,
|
|
1221
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1319
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded20);
|
|
1222
1320
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1223
1321
|
key: _interfaces.TeamStateKeys.RESEND_INVITATION_LINK,
|
|
1224
1322
|
value: body.email
|
|
@@ -1236,7 +1334,7 @@ function* resendInvitationEmailMock({
|
|
|
1236
1334
|
const {
|
|
1237
1335
|
callback
|
|
1238
1336
|
} = payload,
|
|
1239
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1337
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded21);
|
|
1240
1338
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1241
1339
|
key: _interfaces.TeamStateKeys.RESEND_INVITATION_LINK,
|
|
1242
1340
|
value: body.email
|
|
@@ -1254,7 +1352,7 @@ function* resendInvitationLinkToAllSubTenantsMock({
|
|
|
1254
1352
|
const {
|
|
1255
1353
|
callback
|
|
1256
1354
|
} = payload,
|
|
1257
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(payload,
|
|
1355
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded22);
|
|
1258
1356
|
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1259
1357
|
key: _interfaces.TeamStateKeys.RESEND_INVITATION_LINK,
|
|
1260
1358
|
value: body.email
|
|
@@ -1266,6 +1364,59 @@ function* resendInvitationLinkToAllSubTenantsMock({
|
|
|
1266
1364
|
value: false
|
|
1267
1365
|
}));
|
|
1268
1366
|
}
|
|
1367
|
+
function* updateUserExpirationTimeMock({
|
|
1368
|
+
payload
|
|
1369
|
+
}) {
|
|
1370
|
+
const {
|
|
1371
|
+
callback
|
|
1372
|
+
} = payload,
|
|
1373
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded23);
|
|
1374
|
+
const teamState = yield selectTeamState();
|
|
1375
|
+
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1376
|
+
key: _interfaces.TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
1377
|
+
value: true
|
|
1378
|
+
}));
|
|
1379
|
+
const date = new Date();
|
|
1380
|
+
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
1381
|
+
users: teamState.users.map(user => {
|
|
1382
|
+
return user.id === body.userId ? (0, _extends2.default)({}, user, {
|
|
1383
|
+
temporaryExpirationDate: body.expirationInSeconds ? new Date(date.setSeconds(date.getSeconds() + body.expirationInSeconds)) : undefined
|
|
1384
|
+
}) : user;
|
|
1385
|
+
})
|
|
1386
|
+
}));
|
|
1387
|
+
yield (0, _utils.delay)();
|
|
1388
|
+
callback == null ? void 0 : callback(true);
|
|
1389
|
+
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1390
|
+
key: _interfaces.TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
1391
|
+
value: false
|
|
1392
|
+
}));
|
|
1393
|
+
}
|
|
1394
|
+
function* setUserAsPermanentMock({
|
|
1395
|
+
payload
|
|
1396
|
+
}) {
|
|
1397
|
+
const {
|
|
1398
|
+
callback
|
|
1399
|
+
} = payload,
|
|
1400
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded24);
|
|
1401
|
+
const teamState = yield selectTeamState();
|
|
1402
|
+
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1403
|
+
key: _interfaces.TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
1404
|
+
value: true
|
|
1405
|
+
}));
|
|
1406
|
+
yield (0, _effects.put)(_reducer.actions.setTeamState({
|
|
1407
|
+
users: teamState.users.map(user => {
|
|
1408
|
+
return user.id === body.userId ? (0, _extends2.default)({}, user, {
|
|
1409
|
+
temporaryExpirationDate: undefined
|
|
1410
|
+
}) : user;
|
|
1411
|
+
})
|
|
1412
|
+
}));
|
|
1413
|
+
yield (0, _utils.delay)();
|
|
1414
|
+
callback == null ? void 0 : callback(true);
|
|
1415
|
+
yield (0, _effects.put)(_reducer.actions.setTeamLoader({
|
|
1416
|
+
key: _interfaces.TeamStateKeys.UPDATE_USER_EXPIRATION_TIME,
|
|
1417
|
+
value: false
|
|
1418
|
+
}));
|
|
1419
|
+
}
|
|
1269
1420
|
function* teamSagasMock() {
|
|
1270
1421
|
yield (0, _effects.takeLatest)(_reducer.actions.loadUsersV2, loadUsersMock);
|
|
1271
1422
|
yield (0, _effects.takeLatest)(_reducer.actions.loadAllSubTenantsUsers, loadAllSubTenantsUsersMock);
|
|
@@ -1274,6 +1425,8 @@ function* teamSagasMock() {
|
|
|
1274
1425
|
yield (0, _effects.takeEvery)(_reducer.actions.addUserToSubTenants, addUserToSubTenantsMock);
|
|
1275
1426
|
yield (0, _effects.takeEvery)(_reducer.actions.updateUser, updateUserMock);
|
|
1276
1427
|
yield (0, _effects.takeEvery)(_reducer.actions.deleteUser, deleteUserMock);
|
|
1428
|
+
yield (0, _effects.takeEvery)(_reducer.actions.updateUserExpirationTime, updateUserExpirationTimeMock);
|
|
1429
|
+
yield (0, _effects.takeEvery)(_reducer.actions.setUserAsPermanent, setUserAsPermanentMock);
|
|
1277
1430
|
yield (0, _effects.takeEvery)(_reducer.actions.deleteUserFromSubTenants, deleteUserFromSubTenantsMock);
|
|
1278
1431
|
yield (0, _effects.takeEvery)(_reducer.actions.resendActivationLink, resendActivationLinkMock);
|
|
1279
1432
|
yield (0, _effects.takeEvery)(_reducer.actions.resendInvitationLink, resendInvitationLinkMock);
|
package/node/index.js
CHANGED