@frontegg/redux-store 5.59.1 → 5.61.1
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/LoginState/index.d.ts +14 -2
- package/auth/LoginState/interfaces.d.ts +21 -2
- package/auth/LoginState/saga.d.ts +5 -1
- package/auth/SecurityPolicyState/index.d.ts +47 -1
- package/auth/SecurityPolicyState/interfaces.d.ts +3 -1
- package/auth/SecurityPolicyState/saga.d.ts +6 -0
- 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 +30 -0
- package/auth/index.js +493 -36
- package/auth/reducer.d.ts +30 -0
- package/auth/utils.d.ts +3 -0
- package/index.js +1 -1
- package/node/auth/index.js +15 -3
- package/node/{index-c7535125.js → index-5642a636.js} +513 -146
- package/node/index-6906e508.js +151 -0
- package/node/index.js +14 -2
- package/node/toolkit/index.js +2 -2
- package/node/vendor/index.js +1 -1
- package/package.json +2 -2
- package/node/index-2ab7009b.js +0 -52
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var toolkit = require('@reduxjs/toolkit');
|
|
4
|
+
var vendor_index = require('./index-6906e508.js');
|
|
4
5
|
var restApi = require('@frontegg/rest-api');
|
|
5
6
|
var constants = require('./constants-52e37c08.js');
|
|
6
7
|
var tslib = require('tslib');
|
|
7
8
|
var effects = require('redux-saga/effects');
|
|
8
|
-
var vendor_index = require('./index-2ab7009b.js');
|
|
9
9
|
var uuid = require('uuid');
|
|
10
10
|
var audits_index = require('./audits/index.js');
|
|
11
11
|
var connectivity_index = require('./connectivity/index.js');
|
|
@@ -17,37 +17,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
17
17
|
|
|
18
18
|
var createSagaMiddleware__default = /*#__PURE__*/_interopDefaultLegacy(createSagaMiddleware);
|
|
19
19
|
|
|
20
|
-
const resetStateByKey = (key, initialState) => (state) => (Object.assign(Object.assign({}, state), { [key]: initialState[key] }));
|
|
21
|
-
const typeReducer = (key) => (state, { payload }) => (Object.assign(Object.assign({}, state), { [key]: payload }));
|
|
22
|
-
const typeReducerForKey = (key) => ({
|
|
23
|
-
prepare: (payload) => ({ payload }),
|
|
24
|
-
reducer: (state, { payload }) => {
|
|
25
|
-
return Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), payload) });
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
const typeReducerNestedKey = (key, nestedKey) => ({
|
|
29
|
-
prepare: (payload) => ({ payload }),
|
|
30
|
-
reducer: (state, { payload }) => {
|
|
31
|
-
var _a;
|
|
32
|
-
return Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), { [nestedKey]: Object.assign(Object.assign({}, (_a = state === null || state === void 0 ? void 0 : state[key]) === null || _a === void 0 ? void 0 : _a[nestedKey]), payload) }) });
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
const loadersReducerForKey = (key) => ({
|
|
36
|
-
prepare: (payload) => ({ payload }),
|
|
37
|
-
reducer: (state, { payload }) => {
|
|
38
|
-
var _a;
|
|
39
|
-
return (Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), { loaders: Object.assign(Object.assign({}, state[key].loaders), { [payload.key]: (_a = payload.value) !== null && _a !== void 0 ? _a : true }) }) }));
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
const errorsReducerForKey = (key) => ({
|
|
43
|
-
prepare: (payload) => ({ payload }),
|
|
44
|
-
reducer: (state, { payload }) => {
|
|
45
|
-
var _a;
|
|
46
|
-
return (Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), { errors: Object.assign(Object.assign({}, state[key].errors), { [payload.key]: (_a = payload.value) !== null && _a !== void 0 ? _a : true }) }) }));
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
const delay = (delayTime = 500) => new Promise((resolve) => setTimeout(resolve, delayTime));
|
|
50
|
-
|
|
51
20
|
exports.LoginStep = void 0;
|
|
52
21
|
(function (LoginStep) {
|
|
53
22
|
LoginStep["preLogin"] = "preLogin";
|
|
@@ -61,17 +30,30 @@ exports.LoginStep = void 0;
|
|
|
61
30
|
LoginStep["success"] = "success";
|
|
62
31
|
LoginStep["forceTwoFactor"] = "forceTwoFactor";
|
|
63
32
|
LoginStep["recoverTwoFactor"] = "recoverTwoFactor";
|
|
64
|
-
})(exports.LoginStep || (exports.LoginStep = {}));
|
|
33
|
+
})(exports.LoginStep || (exports.LoginStep = {}));
|
|
34
|
+
exports.LoginFlow = void 0;
|
|
35
|
+
(function (LoginFlow) {
|
|
36
|
+
LoginFlow["Login"] = "login";
|
|
37
|
+
LoginFlow["RegisterQuickLogin"] = "registerQuickLogin";
|
|
38
|
+
})(exports.LoginFlow || (exports.LoginFlow = {}));
|
|
39
|
+
exports.QuickLoginStrategy = void 0;
|
|
40
|
+
(function (QuickLoginStrategy) {
|
|
41
|
+
QuickLoginStrategy["Internal"] = "internal";
|
|
42
|
+
QuickLoginStrategy["UsbKey"] = "usb-key";
|
|
43
|
+
QuickLoginStrategy["Android"] = "android";
|
|
44
|
+
QuickLoginStrategy["Sms"] = "sms";
|
|
45
|
+
})(exports.QuickLoginStrategy || (exports.QuickLoginStrategy = {}));
|
|
65
46
|
|
|
66
47
|
const loginState = {
|
|
48
|
+
flow: exports.LoginFlow.Login,
|
|
67
49
|
step: exports.LoginStep.preLogin,
|
|
68
50
|
loading: false,
|
|
69
51
|
email: '',
|
|
70
52
|
tenants: [],
|
|
71
53
|
};
|
|
72
54
|
const reducers$f = {
|
|
73
|
-
setLoginState: typeReducerForKey('loginState'),
|
|
74
|
-
resetLoginState: resetStateByKey('loginState', { loginState }),
|
|
55
|
+
setLoginState: vendor_index.typeReducerForKey('loginState'),
|
|
56
|
+
resetLoginState: vendor_index.resetStateByKey('loginState', { loginState }),
|
|
75
57
|
};
|
|
76
58
|
const actions$g = {
|
|
77
59
|
requestAuthorize: toolkit.createAction(`${constants.authStoreName}/requestAuthorize`, (payload = false) => ({ payload })),
|
|
@@ -90,6 +72,10 @@ const actions$g = {
|
|
|
90
72
|
passwordlessPreLogin: toolkit.createAction(`${constants.authStoreName}/passwordlessPreLogin`, (payload) => ({ payload })),
|
|
91
73
|
passwordlessPostLogin: toolkit.createAction(`${constants.authStoreName}/passwordlessPostLogin`, (payload) => ({ payload })),
|
|
92
74
|
verifyInviteToken: toolkit.createAction(`${constants.authStoreName}/verifyInviteToken`, (payload) => ({ payload })),
|
|
75
|
+
webAuthnPrelogin: toolkit.createAction(`${constants.authStoreName}/webAuthnPrelogin`, (payload) => ({ payload })),
|
|
76
|
+
webAuthnPostLogin: toolkit.createAction(`${constants.authStoreName}/webAuthnPostLogin`, (payload) => ({ payload })),
|
|
77
|
+
webAuthnCreateNewDeviceSession: toolkit.createAction(`${constants.authStoreName}/webAuthnCreateNewDeviceSession`, (payload) => ({ payload })),
|
|
78
|
+
webAuthnVerifyNewDeviceSession: toolkit.createAction(`${constants.authStoreName}/webAuthnVerifyNewDeviceSession`, (payload) => ({ payload })),
|
|
93
79
|
};
|
|
94
80
|
|
|
95
81
|
exports.ActivateAccountStep = void 0;
|
|
@@ -109,9 +95,9 @@ const activateState = {
|
|
|
109
95
|
},
|
|
110
96
|
};
|
|
111
97
|
const reducers$e = {
|
|
112
|
-
setActivateState: typeReducerForKey('activateState'),
|
|
113
|
-
resetActivateState: resetStateByKey('activateState', { activateState }),
|
|
114
|
-
setActivateStrategyState: typeReducerNestedKey('activateState', 'activationStrategy'),
|
|
98
|
+
setActivateState: vendor_index.typeReducerForKey('activateState'),
|
|
99
|
+
resetActivateState: vendor_index.resetStateByKey('activateState', { activateState }),
|
|
100
|
+
setActivateStrategyState: vendor_index.typeReducerNestedKey('activateState', 'activationStrategy'),
|
|
115
101
|
};
|
|
116
102
|
const actions$f = {
|
|
117
103
|
activateAccount: toolkit.createAction(`${constants.authStoreName}/activateAccount`, (payload) => ({ payload })),
|
|
@@ -135,8 +121,8 @@ const acceptInvitationState = {
|
|
|
135
121
|
step: exports.AcceptInvitationStep.validate,
|
|
136
122
|
};
|
|
137
123
|
const reducers$d = {
|
|
138
|
-
setAcceptInvitationState: typeReducerForKey('acceptInvitationState'),
|
|
139
|
-
resetAcceptInvitationState: resetStateByKey('acceptInvitationState', {
|
|
124
|
+
setAcceptInvitationState: vendor_index.typeReducerForKey('acceptInvitationState'),
|
|
125
|
+
resetAcceptInvitationState: vendor_index.resetStateByKey('acceptInvitationState', {
|
|
140
126
|
acceptInvitationState,
|
|
141
127
|
}),
|
|
142
128
|
};
|
|
@@ -157,8 +143,8 @@ const forgotPasswordState = {
|
|
|
157
143
|
passwordConfig: null,
|
|
158
144
|
};
|
|
159
145
|
const reducers$c = {
|
|
160
|
-
setForgotPasswordState: typeReducerForKey('forgotPasswordState'),
|
|
161
|
-
resetForgotPasswordState: resetStateByKey('forgotPasswordState', { forgotPasswordState }),
|
|
146
|
+
setForgotPasswordState: vendor_index.typeReducerForKey('forgotPasswordState'),
|
|
147
|
+
resetForgotPasswordState: vendor_index.resetStateByKey('forgotPasswordState', { forgotPasswordState }),
|
|
162
148
|
};
|
|
163
149
|
const actions$d = {
|
|
164
150
|
forgotPassword: toolkit.createAction(`${constants.authStoreName}/forgotPassword`, (payload) => ({ payload })),
|
|
@@ -180,8 +166,8 @@ const resetPhoneNumberState = {
|
|
|
180
166
|
loading: false,
|
|
181
167
|
};
|
|
182
168
|
const reducers$b = {
|
|
183
|
-
setResetPhoneNumberState: typeReducerForKey('resetPhoneNumberState'),
|
|
184
|
-
resetResetPhoneNumberState: resetStateByKey('resetPhoneNumberState', { resetPhoneNumberState }),
|
|
169
|
+
setResetPhoneNumberState: vendor_index.typeReducerForKey('resetPhoneNumberState'),
|
|
170
|
+
resetResetPhoneNumberState: vendor_index.resetStateByKey('resetPhoneNumberState', { resetPhoneNumberState }),
|
|
185
171
|
};
|
|
186
172
|
const actions$c = {
|
|
187
173
|
resetPhoneNumber: toolkit.createAction(`${constants.authStoreName}/resetPhoneNumber`, (payload) => ({ payload })),
|
|
@@ -198,10 +184,10 @@ const ssoState = {
|
|
|
198
184
|
ssoConfigurations: []
|
|
199
185
|
};
|
|
200
186
|
const reducers$a = {
|
|
201
|
-
setSSOLoader: loadersReducerForKey('ssoState'),
|
|
202
|
-
setSSOError: errorsReducerForKey('ssoState'),
|
|
203
|
-
setSSOState: typeReducerForKey('ssoState'),
|
|
204
|
-
resetSSOState: resetStateByKey('ssoState', { ssoState }),
|
|
187
|
+
setSSOLoader: vendor_index.loadersReducerForKey('ssoState'),
|
|
188
|
+
setSSOError: vendor_index.errorsReducerForKey('ssoState'),
|
|
189
|
+
setSSOState: vendor_index.typeReducerForKey('ssoState'),
|
|
190
|
+
resetSSOState: vendor_index.resetStateByKey('ssoState', { ssoState }),
|
|
205
191
|
};
|
|
206
192
|
const actions$b = {
|
|
207
193
|
loadSSOConfigurationsV2: toolkit.createAction(`${constants.authStoreName}/loadSSOConfigurationsV2`),
|
|
@@ -238,8 +224,8 @@ const profileState = {
|
|
|
238
224
|
error: null,
|
|
239
225
|
};
|
|
240
226
|
const reducers$9 = {
|
|
241
|
-
setProfileState: typeReducerForKey('profileState'),
|
|
242
|
-
resetProfileState: resetStateByKey('profileState', { profileState }),
|
|
227
|
+
setProfileState: vendor_index.typeReducerForKey('profileState'),
|
|
228
|
+
resetProfileState: vendor_index.resetStateByKey('profileState', { profileState }),
|
|
243
229
|
};
|
|
244
230
|
const actions$a = {
|
|
245
231
|
loadProfile: toolkit.createAction(`${constants.authStoreName}/loadProfile`),
|
|
@@ -260,8 +246,8 @@ const mfaState = {
|
|
|
260
246
|
loading: false,
|
|
261
247
|
};
|
|
262
248
|
const reducers$8 = {
|
|
263
|
-
setMfaState: typeReducerForKey('mfaState'),
|
|
264
|
-
resetMfaState: resetStateByKey('mfaState', { mfaState }),
|
|
249
|
+
setMfaState: vendor_index.typeReducerForKey('mfaState'),
|
|
250
|
+
resetMfaState: vendor_index.resetStateByKey('mfaState', { mfaState }),
|
|
265
251
|
};
|
|
266
252
|
const actions$9 = {
|
|
267
253
|
enrollMfa: toolkit.createAction(`${constants.authStoreName}/enrollMfa`),
|
|
@@ -280,11 +266,19 @@ const teamState = {
|
|
|
280
266
|
pageSize: 20,
|
|
281
267
|
errors: {},
|
|
282
268
|
users: [],
|
|
269
|
+
allUsers: [],
|
|
283
270
|
roles: [],
|
|
284
271
|
permissions: [],
|
|
285
272
|
totalPages: 0,
|
|
286
273
|
filter: [],
|
|
287
274
|
sort: [],
|
|
275
|
+
allUsersQueryParams: {
|
|
276
|
+
_filter: null,
|
|
277
|
+
_offset: 0,
|
|
278
|
+
_limit: 20,
|
|
279
|
+
_order: 'DESC',
|
|
280
|
+
_sortBy: 'name',
|
|
281
|
+
},
|
|
288
282
|
addUserDialogState: {
|
|
289
283
|
loading: false,
|
|
290
284
|
open: false,
|
|
@@ -293,21 +287,30 @@ const teamState = {
|
|
|
293
287
|
loading: false,
|
|
294
288
|
open: false,
|
|
295
289
|
},
|
|
290
|
+
lockUserDialogState: {
|
|
291
|
+
loading: false,
|
|
292
|
+
open: false,
|
|
293
|
+
},
|
|
296
294
|
};
|
|
297
295
|
const reducers$7 = {
|
|
298
|
-
setTeamLoader: loadersReducerForKey('teamState'),
|
|
299
|
-
setTeamError: errorsReducerForKey('teamState'),
|
|
300
|
-
setTeamState: typeReducerForKey('teamState'),
|
|
301
|
-
resetTeamState: resetStateByKey('teamState', { teamState }),
|
|
296
|
+
setTeamLoader: vendor_index.loadersReducerForKey('teamState'),
|
|
297
|
+
setTeamError: vendor_index.errorsReducerForKey('teamState'),
|
|
298
|
+
setTeamState: vendor_index.typeReducerForKey('teamState'),
|
|
299
|
+
resetTeamState: vendor_index.resetStateByKey('teamState', { teamState }),
|
|
302
300
|
};
|
|
303
301
|
const actions$8 = {
|
|
304
302
|
loadUsers: toolkit.createAction(`${constants.authStoreName}/loadUsers`, (payload) => ({ payload })),
|
|
303
|
+
loadAllSubTenantsUsers: toolkit.createAction(`${constants.authStoreName}/loadAllSubTenantsUsers`, (payload) => ({ payload })),
|
|
305
304
|
loadRoles: toolkit.createAction(`${constants.authStoreName}/loadRoles`, (payload) => ({ payload })),
|
|
306
305
|
addUser: toolkit.createAction(`${constants.authStoreName}/addUser`, (payload) => ({ payload })),
|
|
306
|
+
addUserToSubTenants: toolkit.createAction(`${constants.authStoreName}/addUserToSubTenants`, (payload) => ({ payload })),
|
|
307
307
|
updateUser: toolkit.createAction(`${constants.authStoreName}/updateUser`, (payload) => ({
|
|
308
308
|
payload,
|
|
309
309
|
})),
|
|
310
310
|
deleteUser: toolkit.createAction(`${constants.authStoreName}/deleteUser`, (payload) => ({ payload })),
|
|
311
|
+
setUserRolesForSubTenants: toolkit.createAction(`${constants.authStoreName}/setUserRolesForSubTenants`, (payload) => ({ payload })),
|
|
312
|
+
deleteUserFromSubTenants: toolkit.createAction(`${constants.authStoreName}/deleteUserFromSubTenants`, (payload) => ({ payload })),
|
|
313
|
+
lockUser: toolkit.createAction(`${constants.authStoreName}/lockUser`, (payload) => ({ payload })),
|
|
311
314
|
resendActivationLink: toolkit.createAction(`${constants.authStoreName}/resendActivationLink`, (payload) => ({ payload })),
|
|
312
315
|
resendInvitationLink: toolkit.createAction(`${constants.authStoreName}/resendInvitationLink`, (payload) => ({ payload })),
|
|
313
316
|
getInvitationLink: toolkit.createAction(`${constants.authStoreName}/getInvitationLink`),
|
|
@@ -320,6 +323,10 @@ const actions$8 = {
|
|
|
320
323
|
payload,
|
|
321
324
|
})),
|
|
322
325
|
closeDeleteUserDialog: toolkit.createAction(`${constants.authStoreName}/closeDeleteUserDialog`, (payload) => ({ payload })),
|
|
326
|
+
openLockUserDialog: toolkit.createAction(`${constants.authStoreName}/openLockUserDialog`, (payload) => ({
|
|
327
|
+
payload,
|
|
328
|
+
})),
|
|
329
|
+
closeLockUserDialog: toolkit.createAction(`${constants.authStoreName}/closeLockUserDialog`, (payload) => ({ payload })),
|
|
323
330
|
};
|
|
324
331
|
|
|
325
332
|
const socialLoginState = {
|
|
@@ -328,8 +335,8 @@ const socialLoginState = {
|
|
|
328
335
|
error: '',
|
|
329
336
|
};
|
|
330
337
|
const reducers$6 = {
|
|
331
|
-
setSocialLoginsState: typeReducerForKey('socialLoginState'),
|
|
332
|
-
resetSocialLoginsState: resetStateByKey('socialLoginState', { socialLoginState }),
|
|
338
|
+
setSocialLoginsState: vendor_index.typeReducerForKey('socialLoginState'),
|
|
339
|
+
resetSocialLoginsState: vendor_index.resetStateByKey('socialLoginState', { socialLoginState }),
|
|
333
340
|
};
|
|
334
341
|
const actions$7 = {
|
|
335
342
|
loadSocialLoginsConfiguration: toolkit.createAction(`${constants.authStoreName}/loadSocialLoginsConfiguration`),
|
|
@@ -356,8 +363,8 @@ const signUpState = {
|
|
|
356
363
|
stage: exports.SignUpStage.SignUp,
|
|
357
364
|
};
|
|
358
365
|
const reducers$5 = {
|
|
359
|
-
setSignUpState: typeReducerForKey('signUpState'),
|
|
360
|
-
resetSignUpState: resetStateByKey('signUpState', { signUpState }),
|
|
366
|
+
setSignUpState: vendor_index.typeReducerForKey('signUpState'),
|
|
367
|
+
resetSignUpState: vendor_index.resetStateByKey('signUpState', { signUpState }),
|
|
361
368
|
};
|
|
362
369
|
const actions$6 = {
|
|
363
370
|
signUpUser: toolkit.createAction(`${constants.authStoreName}/signUpUser`, (payload) => ({ payload })),
|
|
@@ -386,10 +393,10 @@ const apiTokensState = {
|
|
|
386
393
|
errors: {},
|
|
387
394
|
};
|
|
388
395
|
const reducers$4 = {
|
|
389
|
-
setApiTokensLoader: loadersReducerForKey('apiTokensState'),
|
|
390
|
-
setApiTokensError: errorsReducerForKey('apiTokensState'),
|
|
391
|
-
setApiTokensState: typeReducerForKey('apiTokensState'),
|
|
392
|
-
resetApiTokensState: resetStateByKey('apiTokensState', { apiTokensState }),
|
|
396
|
+
setApiTokensLoader: vendor_index.loadersReducerForKey('apiTokensState'),
|
|
397
|
+
setApiTokensError: vendor_index.errorsReducerForKey('apiTokensState'),
|
|
398
|
+
setApiTokensState: vendor_index.typeReducerForKey('apiTokensState'),
|
|
399
|
+
resetApiTokensState: vendor_index.resetStateByKey('apiTokensState', { apiTokensState }),
|
|
393
400
|
};
|
|
394
401
|
const actions$5 = {
|
|
395
402
|
loadApiTokens: toolkit.createAction(`${constants.authStoreName}/loadApiTokens`, (payload) => ({
|
|
@@ -429,18 +436,22 @@ const securityPolicyState = {
|
|
|
429
436
|
passwordPolicy: {
|
|
430
437
|
loading: true,
|
|
431
438
|
},
|
|
439
|
+
publicAuthStrategyPolicy: {
|
|
440
|
+
loading: true,
|
|
441
|
+
},
|
|
432
442
|
};
|
|
433
443
|
const reducers$3 = {
|
|
434
|
-
setSecurityPolicyState: typeReducerForKey('securityPolicyState'),
|
|
435
|
-
setSecurityPolicyGlobalState: typeReducerNestedKey('securityPolicyState', 'globalPolicy'),
|
|
436
|
-
setSecurityPolicyPublicState: typeReducerNestedKey('securityPolicyState', 'publicPolicy'),
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
+
setSecurityPolicyState: vendor_index.typeReducerForKey('securityPolicyState'),
|
|
445
|
+
setSecurityPolicyGlobalState: vendor_index.typeReducerNestedKey('securityPolicyState', 'globalPolicy'),
|
|
446
|
+
setSecurityPolicyPublicState: vendor_index.typeReducerNestedKey('securityPolicyState', 'publicPolicy'),
|
|
447
|
+
setSecurityPolicyAuthStrategyPublicState: vendor_index.typeReducerNestedKey('securityPolicyState', 'publicAuthStrategyPolicy'),
|
|
448
|
+
setSecurityPolicyMfaState: vendor_index.typeReducerNestedKey('securityPolicyState', 'mfaPolicy'),
|
|
449
|
+
setSecurityPolicyVendorMfaState: vendor_index.typeReducerNestedKey('securityPolicyState', 'vendorMfaPolicy'),
|
|
450
|
+
setSecurityPolicyLockoutState: vendor_index.typeReducerNestedKey('securityPolicyState', 'lockoutPolicy'),
|
|
451
|
+
setSecurityPolicyCaptchaState: vendor_index.typeReducerNestedKey('securityPolicyState', 'captchaPolicy'),
|
|
452
|
+
setSecurityPolicyPasswordHistoryState: vendor_index.typeReducerNestedKey('securityPolicyState', 'passwordHistoryPolicy'),
|
|
453
|
+
setSecurityPolicyPasswordState: vendor_index.typeReducerNestedKey('securityPolicyState', 'passwordPolicy'),
|
|
454
|
+
resetSecurityPolicyState: vendor_index.resetStateByKey('securityPolicyState', { securityPolicyState }),
|
|
444
455
|
};
|
|
445
456
|
const actions$4 = {
|
|
446
457
|
loadSecurityPolicy: toolkit.createAction(`${constants.authStoreName}/loadSecurityPolicy`),
|
|
@@ -454,14 +465,15 @@ const actions$4 = {
|
|
|
454
465
|
loadSecurityPolicyPasswordHistory: toolkit.createAction(`${constants.authStoreName}/loadSecurityPolicyPasswordHistory`),
|
|
455
466
|
saveSecurityPolicyPasswordHistory: toolkit.createAction(`${constants.authStoreName}/saveSecurityPolicyPasswordHistory`, (payload) => ({ payload })),
|
|
456
467
|
loadVendorPasswordConfig: toolkit.createAction(`${constants.authStoreName}/loadVendorPasswordConfig`),
|
|
468
|
+
loadPublicAuthStrategiesPolicy: toolkit.createAction(`${constants.authStoreName}/loadPublicAuthStrategiesPolicy`),
|
|
457
469
|
};
|
|
458
470
|
|
|
459
471
|
const accountSettingsState = {
|
|
460
472
|
loading: false,
|
|
461
473
|
};
|
|
462
474
|
const reducers$2 = {
|
|
463
|
-
setAccountSettingsState: typeReducerForKey('accountSettingsState'),
|
|
464
|
-
resetAccountSettingsState: resetStateByKey('accountSettingsState', { accountSettingsState }),
|
|
475
|
+
setAccountSettingsState: vendor_index.typeReducerForKey('accountSettingsState'),
|
|
476
|
+
resetAccountSettingsState: vendor_index.resetStateByKey('accountSettingsState', { accountSettingsState }),
|
|
465
477
|
};
|
|
466
478
|
const actions$3 = {
|
|
467
479
|
loadAccountSettings: toolkit.createAction(`${constants.authStoreName}/loadAccountSettings`, (payload) => ({ payload })),
|
|
@@ -472,10 +484,11 @@ const tenantsState = {
|
|
|
472
484
|
tenants: [],
|
|
473
485
|
subTenants: [],
|
|
474
486
|
loading: true,
|
|
487
|
+
tenantTree: null,
|
|
475
488
|
};
|
|
476
489
|
const reducers$1 = {
|
|
477
|
-
setTenantsState: typeReducerForKey('tenantsState'),
|
|
478
|
-
resetTenantsState: resetStateByKey('tenantsState', { tenantsState }),
|
|
490
|
+
setTenantsState: vendor_index.typeReducerForKey('tenantsState'),
|
|
491
|
+
resetTenantsState: vendor_index.resetStateByKey('tenantsState', { tenantsState }),
|
|
479
492
|
};
|
|
480
493
|
const actions$2 = {
|
|
481
494
|
switchTenant: toolkit.createAction(`${constants.authStoreName}/switchTenant`, (payload) => ({ payload })),
|
|
@@ -485,6 +498,9 @@ const actions$2 = {
|
|
|
485
498
|
loadSubTenants: toolkit.createAction(`${constants.authStoreName}/loadSubTenants`, (payload) => ({
|
|
486
499
|
payload,
|
|
487
500
|
})),
|
|
501
|
+
loadSubTenantsTree: toolkit.createAction(`${constants.authStoreName}/loadSubTenantsTree`, (payload) => ({
|
|
502
|
+
payload,
|
|
503
|
+
})),
|
|
488
504
|
};
|
|
489
505
|
|
|
490
506
|
const rolesState = {
|
|
@@ -494,8 +510,8 @@ const rolesState = {
|
|
|
494
510
|
permissionCategories: [],
|
|
495
511
|
};
|
|
496
512
|
const reducers = {
|
|
497
|
-
setRolesState: typeReducerForKey('rolesState'),
|
|
498
|
-
resetRolesState: resetStateByKey('rolesState', { rolesState }),
|
|
513
|
+
setRolesState: vendor_index.typeReducerForKey('rolesState'),
|
|
514
|
+
resetRolesState: vendor_index.resetStateByKey('rolesState', { rolesState }),
|
|
499
515
|
};
|
|
500
516
|
const actions$1 = {
|
|
501
517
|
loadRolesAndPermissions: toolkit.createAction(`${constants.authStoreName}/loadRoles`, (payload) => ({ payload })),
|
|
@@ -548,7 +564,7 @@ const initialState$1 = Object.assign({ routes: {
|
|
|
548
564
|
const { reducer, actions: sliceActions } = toolkit.createSlice({
|
|
549
565
|
name: constants.authStoreName,
|
|
550
566
|
initialState: initialState$1,
|
|
551
|
-
reducers: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ resetState: (state) => (Object.assign(Object.assign({}, state), reinitializeState)), setState: (state, { payload }) => (Object.assign(Object.assign({}, state), payload)), setUser: typeReducer('user') }, reducers$f), reducers$6), reducers$e), reducers$d), reducers$c), reducers$b), reducers$5), reducers$9), reducers$a), reducers$8), reducers$7), reducers$4), reducers$3), reducers$2), reducers$1), reducers),
|
|
567
|
+
reducers: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ resetState: (state) => (Object.assign(Object.assign({}, state), reinitializeState)), setState: (state, { payload }) => (Object.assign(Object.assign({}, state), payload)), setUser: vendor_index.typeReducer('user') }, reducers$f), reducers$6), reducers$e), reducers$d), reducers$c), reducers$b), reducers$5), reducers$9), reducers$a), reducers$8), reducers$7), reducers$4), reducers$3), reducers$2), reducers$1), reducers),
|
|
552
568
|
});
|
|
553
569
|
const actions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sliceActions), actions$g), actions$7), actions$f), actions$e), actions$d), actions$c), actions$6), actions$a), actions$b), actions$9), actions$8), actions$5), actions$4), actions$3), actions$2), actions$1);
|
|
554
570
|
|
|
@@ -814,7 +830,26 @@ const userTeamDemo = {
|
|
|
814
830
|
mfaEnabled: undefined,
|
|
815
831
|
roles: [],
|
|
816
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
|
+
};
|
|
817
851
|
const usersDemo = [userTeamDemo, userTeamDemo2];
|
|
852
|
+
const allUsersDemo = [userSubTenantDemo];
|
|
818
853
|
const tenantsDemo = [
|
|
819
854
|
{
|
|
820
855
|
id: 'my-tenant-id',
|
|
@@ -1006,6 +1041,7 @@ function* getMfaRequiredState(user) {
|
|
|
1006
1041
|
return Object.assign(Object.assign({ user: undefined, isAuthenticated: false }, setMfaState), { loginState: Object.assign(Object.assign({}, loginState), { mfaToken: user.mfaToken, mfaRequired: user.mfaRequired, loading: false, error: undefined, step, tenantsLoading: true, tenants: [], allowRememberMfaDevice: isAllowedToRemember, mfaDeviceExpiration }) });
|
|
1007
1042
|
}
|
|
1008
1043
|
function* refreshToken() {
|
|
1044
|
+
var _a;
|
|
1009
1045
|
try {
|
|
1010
1046
|
const onRedirectTo = restApi.ContextHolder.onRedirectTo;
|
|
1011
1047
|
const { routes, loginState } = yield effects.select((state) => state.auth);
|
|
@@ -1016,18 +1052,23 @@ function* refreshToken() {
|
|
|
1016
1052
|
onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
|
|
1017
1053
|
}
|
|
1018
1054
|
else {
|
|
1055
|
+
if (user.email) {
|
|
1056
|
+
localStorage.setItem('email', user.email);
|
|
1057
|
+
}
|
|
1058
|
+
const quickLoginToRegister = (_a = localStorage.getItem('register-quick-login')) !== null && _a !== void 0 ? _a : loginState.quickLoginToRegister;
|
|
1059
|
+
const shouldNavigateToRegisterQuicKLogin = quickLoginToRegister && localStorage.getItem(`${user.email}-${quickLoginToRegister}`) !== 'true';
|
|
1019
1060
|
yield effects.put(actions.setTenantsState({ tenants, loading: false }));
|
|
1020
|
-
yield effects.put(actions.setState({
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
routes.
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1061
|
+
yield effects.put(actions.setState({
|
|
1062
|
+
user,
|
|
1063
|
+
isAuthenticated: true,
|
|
1064
|
+
loginState: Object.assign(Object.assign({}, loginState), { quickLoginToRegister, flow: shouldNavigateToRegisterQuicKLogin ? exports.LoginFlow.RegisterQuickLogin : exports.LoginFlow.Login })
|
|
1065
|
+
}));
|
|
1066
|
+
if (shouldNavigateToRegisterQuicKLogin) {
|
|
1067
|
+
onRedirectTo(routes.loginUrl);
|
|
1068
|
+
}
|
|
1069
|
+
else if ([routes.loginUrl, routes.socialLoginCallbackUrl, routes.signUpUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl]
|
|
1070
|
+
.some(url => url && window.location.pathname.endsWith(url))) {
|
|
1071
|
+
if (loginState.isNewUser && routes.signUpSuccessUrl && routes.socialLoginCallbackUrl === window.location.pathname) {
|
|
1031
1072
|
onRedirectTo(routes.signUpSuccessUrl, { refresh: routes.signUpSuccessUrl.startsWith('http') });
|
|
1032
1073
|
}
|
|
1033
1074
|
else {
|
|
@@ -1175,14 +1216,15 @@ function* passwordlessPostLogin(_a) {
|
|
|
1175
1216
|
try {
|
|
1176
1217
|
yield effects.put(actions.setLoginState({ loading: true }));
|
|
1177
1218
|
const data = yield effects.call(restApi.api.auth.passwordlessPostLogin, payload);
|
|
1219
|
+
const onRedirectTo = restApi.ContextHolder.onRedirectTo;
|
|
1220
|
+
const { routes } = yield effects.select((state) => state.auth);
|
|
1178
1221
|
if (isMfaRequired(data)) {
|
|
1179
|
-
const onRedirectTo = restApi.ContextHolder.onRedirectTo;
|
|
1180
|
-
const { routes } = yield effects.select((state) => state.auth);
|
|
1181
1222
|
const mfaRequiredState = yield getMfaRequiredState(data);
|
|
1182
1223
|
yield effects.put(actions.setState(mfaRequiredState));
|
|
1183
1224
|
onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
|
|
1184
1225
|
}
|
|
1185
1226
|
else {
|
|
1227
|
+
const { loginState } = yield effects.select((state) => state.auth);
|
|
1186
1228
|
const user = yield effects.call(restApi.api.auth.generateLoginResponse, data);
|
|
1187
1229
|
if (data.emailVerified) {
|
|
1188
1230
|
(_b = events === null || events === void 0 ? void 0 : events.userVerified) === null || _b === void 0 ? void 0 : _b.call(events, {
|
|
@@ -1194,9 +1236,17 @@ function* passwordlessPostLogin(_a) {
|
|
|
1194
1236
|
name: user.name,
|
|
1195
1237
|
});
|
|
1196
1238
|
}
|
|
1197
|
-
|
|
1239
|
+
if (user.email) {
|
|
1240
|
+
localStorage.setItem('email', user.email);
|
|
1241
|
+
}
|
|
1198
1242
|
yield effects.put(actions.setState({ user, isAuthenticated: true }));
|
|
1199
|
-
yield
|
|
1243
|
+
yield effects.put(actions.loadTenants());
|
|
1244
|
+
if (loginState.flow === exports.LoginFlow.Login) {
|
|
1245
|
+
yield afterAuthNavigation();
|
|
1246
|
+
}
|
|
1247
|
+
else {
|
|
1248
|
+
onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
|
|
1249
|
+
}
|
|
1200
1250
|
}
|
|
1201
1251
|
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
1202
1252
|
}
|
|
@@ -1222,14 +1272,14 @@ function* verifyInviteToken({ payload }) {
|
|
|
1222
1272
|
yield effects.put(actions.setLoginState({ loading: false }));
|
|
1223
1273
|
}
|
|
1224
1274
|
}
|
|
1225
|
-
function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback }, }) {
|
|
1275
|
+
function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback, }, }) {
|
|
1226
1276
|
yield effects.put(actions.setLoginState({ loading: true }));
|
|
1227
1277
|
try {
|
|
1228
1278
|
const onRedirectTo = yield effects.select(({ auth: { onRedirectTo } }) => onRedirectTo);
|
|
1229
1279
|
let { address, idpType } = yield effects.call(restApi.api.auth.preLoginV2, { email });
|
|
1230
1280
|
if (address) {
|
|
1231
1281
|
if (idpType === exports.SamlVendors.Oidc && !address.includes('redirect_uri')) {
|
|
1232
|
-
const { routes: { oidcRedirectUrl }
|
|
1282
|
+
const { routes: { oidcRedirectUrl } } = yield effects.select(({ auth: { routes } }) => ({ routes }));
|
|
1233
1283
|
address += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
|
|
1234
1284
|
}
|
|
1235
1285
|
yield effects.put(actions.setLoginState({ step: exports.LoginStep.redirectToSSO, loading: false, ssoRedirectUrl: address }));
|
|
@@ -1247,7 +1297,7 @@ function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback
|
|
|
1247
1297
|
}
|
|
1248
1298
|
function* ssoPreloginFailed(_a) {
|
|
1249
1299
|
var { callback } = _a, body = tslib.__rest(_a, ["callback"]);
|
|
1250
|
-
const publicPolicy = yield effects.select(({ auth: { securityPolicyState: { publicPolicy: { policy: publicPolicy }
|
|
1300
|
+
const publicPolicy = yield effects.select(({ auth: { securityPolicyState: { publicPolicy: { policy: publicPolicy } } } }) => publicPolicy);
|
|
1251
1301
|
if (!(publicPolicy === null || publicPolicy === void 0 ? void 0 : publicPolicy.authStrategy)) {
|
|
1252
1302
|
yield effects.put(actions.setLoginState({ step: exports.LoginStep.loginWithPassword, loading: false }));
|
|
1253
1303
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
@@ -1265,6 +1315,90 @@ function* ssoPreloginFailed(_a) {
|
|
|
1265
1315
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
1266
1316
|
}
|
|
1267
1317
|
}
|
|
1318
|
+
function* webAuthnCreateNewDeviceSession({ payload: { callback } }) {
|
|
1319
|
+
try {
|
|
1320
|
+
yield effects.put(actions.setLoginState({ loading: true }));
|
|
1321
|
+
const { options } = yield effects.call(restApi.api.auth.webAuthnCreateNewDeviceSession);
|
|
1322
|
+
options.user.id = vendor_index.base64urlDecode(options.user.id);
|
|
1323
|
+
options.challenge = vendor_index.base64urlDecode(options.challenge);
|
|
1324
|
+
options.excludeCredentials = [];
|
|
1325
|
+
callback === null || callback === void 0 ? void 0 : callback(options);
|
|
1326
|
+
}
|
|
1327
|
+
catch (e) {
|
|
1328
|
+
yield effects.put(actions.setLoginState({ error: e.message }));
|
|
1329
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
1330
|
+
}
|
|
1331
|
+
finally {
|
|
1332
|
+
yield effects.put(actions.setLoginState({ loading: false }));
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
function* webAuthnVerifyNewDeviceSession(_a) {
|
|
1336
|
+
var _b = _a.payload, { callback } = _b, body = tslib.__rest(_b, ["callback"]);
|
|
1337
|
+
try {
|
|
1338
|
+
yield effects.put(actions.setLoginState({ loading: true }));
|
|
1339
|
+
const publicKey = vendor_index.publicKeyCredentialToJSON(body.publicKey);
|
|
1340
|
+
yield effects.call(restApi.api.auth.verifyNewDeviceSession, {
|
|
1341
|
+
id: publicKey.id,
|
|
1342
|
+
response: publicKey.response
|
|
1343
|
+
});
|
|
1344
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
1345
|
+
}
|
|
1346
|
+
catch (e) {
|
|
1347
|
+
yield effects.put(actions.setLoginState({ error: e.message }));
|
|
1348
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
1349
|
+
}
|
|
1350
|
+
finally {
|
|
1351
|
+
yield effects.put(actions.setLoginState({ loading: false }));
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
function* webAuthnPrelogin(_a) {
|
|
1355
|
+
var _b;
|
|
1356
|
+
var _c = _a.payload, { callback } = _c, body = tslib.__rest(_c, ["callback"]);
|
|
1357
|
+
try {
|
|
1358
|
+
yield effects.put(actions.setLoginState({ loading: true }));
|
|
1359
|
+
const { options } = yield effects.call(restApi.api.auth.webAuthnPreLogin, body);
|
|
1360
|
+
options.challenge = vendor_index.base64urlDecode(options.challenge);
|
|
1361
|
+
options.allowCredentials = (_b = options.allowCredentials) === null || _b === void 0 ? void 0 : _b.map((credentials) => (Object.assign(Object.assign({}, credentials), { id: vendor_index.base64urlDecode(credentials.id) })));
|
|
1362
|
+
callback === null || callback === void 0 ? void 0 : callback(options);
|
|
1363
|
+
}
|
|
1364
|
+
catch (e) {
|
|
1365
|
+
yield effects.put(actions.setLoginState({ error: e.message }));
|
|
1366
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
1367
|
+
}
|
|
1368
|
+
finally {
|
|
1369
|
+
yield effects.put(actions.setLoginState({ loading: false }));
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
function* webAuthnPostLogin(_a) {
|
|
1373
|
+
var _b;
|
|
1374
|
+
var _c = _a.payload, { callback } = _c, body = tslib.__rest(_c, ["callback"]);
|
|
1375
|
+
try {
|
|
1376
|
+
yield effects.put(actions.setLoginState({ loading: true }));
|
|
1377
|
+
const publicKey = vendor_index.publicKeyCredentialToJSON(body.publicKey);
|
|
1378
|
+
const data = yield effects.call(restApi.api.auth.webAuthnPostLogin, Object.assign(Object.assign({}, publicKey), { response: Object.assign(Object.assign({}, publicKey.response), { userHandle: (_b = publicKey.response.userHandle) !== null && _b !== void 0 ? _b : undefined }), recaptchaToken: body.recaptchaToken, invitationToken: body.invitationToken }));
|
|
1379
|
+
if (isMfaRequired(data)) {
|
|
1380
|
+
const onRedirectTo = restApi.ContextHolder.onRedirectTo;
|
|
1381
|
+
const { routes } = yield effects.select((state) => state.auth);
|
|
1382
|
+
const mfaRequiredState = yield getMfaRequiredState(data);
|
|
1383
|
+
yield effects.put(actions.setState(mfaRequiredState));
|
|
1384
|
+
onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
|
|
1385
|
+
}
|
|
1386
|
+
else {
|
|
1387
|
+
const user = yield effects.call(restApi.api.auth.generateLoginResponse, data);
|
|
1388
|
+
yield effects.put(actions.loadTenants());
|
|
1389
|
+
yield effects.put(actions.setState({ user, isAuthenticated: true }));
|
|
1390
|
+
yield afterAuthNavigation();
|
|
1391
|
+
}
|
|
1392
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
1393
|
+
}
|
|
1394
|
+
catch (e) {
|
|
1395
|
+
yield effects.put(actions.setLoginState({ error: e.message }));
|
|
1396
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
1397
|
+
}
|
|
1398
|
+
finally {
|
|
1399
|
+
yield effects.put(actions.setLoginState({ loading: false }));
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1268
1402
|
function* postLogin({ payload }) {
|
|
1269
1403
|
const { onRedirectTo, routes } = yield effects.select(({ auth: { onRedirectTo, routes } }) => ({ onRedirectTo, routes }));
|
|
1270
1404
|
yield effects.put(actions.setLoginState({ loading: true }));
|
|
@@ -1285,7 +1419,7 @@ function* postLogin({ payload }) {
|
|
|
1285
1419
|
yield effects.put(actions.setLoginState({ step: exports.LoginStep.loginWithSSOFailed, loading: false }));
|
|
1286
1420
|
}
|
|
1287
1421
|
}
|
|
1288
|
-
function* login({ payload: { email, password, recaptchaToken, invitationToken, callback }, }) {
|
|
1422
|
+
function* login({ payload: { email, password, recaptchaToken, invitationToken, callback, }, }) {
|
|
1289
1423
|
yield effects.put(actions.setLoginState({ loading: true }));
|
|
1290
1424
|
try {
|
|
1291
1425
|
const user = yield effects.call(restApi.api.auth.login, {
|
|
@@ -1313,26 +1447,35 @@ function* login({ payload: { email, password, recaptchaToken, invitationToken, c
|
|
|
1313
1447
|
step = exports.LoginStep.forceTwoFactor;
|
|
1314
1448
|
}
|
|
1315
1449
|
}
|
|
1316
|
-
const
|
|
1317
|
-
const
|
|
1450
|
+
const { loginState } = yield effects.select((state) => state.auth);
|
|
1451
|
+
const isLoginSucceeded = step === exports.LoginStep.success;
|
|
1452
|
+
const isAuthenticated = isLoginSucceeded && !!user.accessToken;
|
|
1453
|
+
const loggedInUser = isLoginSucceeded ? user : undefined;
|
|
1318
1454
|
let allowRememberDevice = { isAllowedToRemember: false, mfaDeviceExpiration: 0 };
|
|
1319
1455
|
if (user.mfaRequired && user.mfaToken) {
|
|
1320
1456
|
allowRememberDevice = yield effects.call(restApi.api.auth.checkIfAllowToRememberMfaDevice, user.mfaToken);
|
|
1321
1457
|
}
|
|
1322
1458
|
const { isAllowedToRemember, mfaDeviceExpiration } = allowRememberDevice;
|
|
1459
|
+
if (user.email) {
|
|
1460
|
+
localStorage.setItem('email', user.email);
|
|
1461
|
+
}
|
|
1323
1462
|
yield effects.put(actions.setState(Object.assign(Object.assign({ user: loggedInUser, isAuthenticated }, setMfaState), { loginState: {
|
|
1463
|
+
flow: loginState.flow,
|
|
1464
|
+
quickLoginToRegister: loginState.quickLoginToRegister,
|
|
1324
1465
|
email,
|
|
1325
1466
|
loading: false,
|
|
1326
1467
|
error: undefined,
|
|
1327
1468
|
mfaToken: user.mfaToken,
|
|
1328
|
-
step,
|
|
1469
|
+
step: (!isLoginSucceeded || loginState.flow === exports.LoginFlow.Login) ? step : loginState.step,
|
|
1329
1470
|
tenants: [],
|
|
1330
1471
|
tenantsLoading: true,
|
|
1331
1472
|
allowRememberMfaDevice: isAllowedToRemember,
|
|
1332
1473
|
mfaDeviceExpiration,
|
|
1333
1474
|
} })));
|
|
1334
|
-
if (
|
|
1475
|
+
if (isLoginSucceeded) {
|
|
1335
1476
|
yield effects.put(actions.loadTenants());
|
|
1477
|
+
}
|
|
1478
|
+
if (isAuthenticated && loginState.flow === exports.LoginFlow.Login) {
|
|
1336
1479
|
yield afterAuthNavigation();
|
|
1337
1480
|
}
|
|
1338
1481
|
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
@@ -1351,17 +1494,21 @@ function* loginWithMfa({ payload: { mfaToken, value, rememberDevice, callback },
|
|
|
1351
1494
|
yield effects.put(actions.setLoginState({ loading: true }));
|
|
1352
1495
|
try {
|
|
1353
1496
|
const user = yield effects.call(restApi.api.auth.loginWithMfa, { mfaToken, value, rememberDevice });
|
|
1354
|
-
const
|
|
1497
|
+
const { loginState } = yield effects.select((state) => state.auth);
|
|
1498
|
+
const step = loginState.flow === exports.LoginFlow.Login ? exports.LoginStep.success : loginState.step;
|
|
1355
1499
|
yield effects.put(actions.setState({
|
|
1356
|
-
loginState: { loading: false, error: undefined,
|
|
1500
|
+
loginState: { flow: loginState.flow, quickLoginToRegister: loginState.quickLoginToRegister, loading: false, step, error: undefined, tenantsLoading: true, tenants: [] },
|
|
1357
1501
|
user,
|
|
1358
1502
|
isAuthenticated: true,
|
|
1359
1503
|
}));
|
|
1504
|
+
if (user.email) {
|
|
1505
|
+
localStorage.setItem('email', user.email);
|
|
1506
|
+
}
|
|
1360
1507
|
yield effects.put(actions.loadTenants());
|
|
1361
|
-
|
|
1362
|
-
if (step === exports.LoginStep.success) {
|
|
1508
|
+
if (loginState.flow === exports.LoginFlow.Login) {
|
|
1363
1509
|
yield afterAuthNavigation();
|
|
1364
1510
|
}
|
|
1511
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
1365
1512
|
}
|
|
1366
1513
|
catch (e) {
|
|
1367
1514
|
yield effects.put(actions.setLoginState({ error: e.message, loading: false }));
|
|
@@ -1384,7 +1531,8 @@ function* logout({ payload }) {
|
|
|
1384
1531
|
try {
|
|
1385
1532
|
yield effects.call(restApi.api.auth.logout);
|
|
1386
1533
|
}
|
|
1387
|
-
catch (_a) {
|
|
1534
|
+
catch (_a) {
|
|
1535
|
+
}
|
|
1388
1536
|
yield effects.put(actions.resetState());
|
|
1389
1537
|
yield effects.put(actions.requestAuthorize(true));
|
|
1390
1538
|
payload === null || payload === void 0 ? void 0 : payload();
|
|
@@ -1393,7 +1541,8 @@ function* silentLogout({ payload }) {
|
|
|
1393
1541
|
try {
|
|
1394
1542
|
yield effects.call(restApi.api.auth.logout);
|
|
1395
1543
|
}
|
|
1396
|
-
catch (_a) {
|
|
1544
|
+
catch (_a) {
|
|
1545
|
+
}
|
|
1397
1546
|
setTimeout(() => payload === null || payload === void 0 ? void 0 : payload(), 500);
|
|
1398
1547
|
}
|
|
1399
1548
|
function* loginSagas() {
|
|
@@ -1411,6 +1560,11 @@ function* loginSagas() {
|
|
|
1411
1560
|
yield effects.takeLeading(actions.passwordlessPreLogin, passwordlessPreLogin);
|
|
1412
1561
|
yield effects.takeLeading(actions.passwordlessPostLogin, passwordlessPostLogin);
|
|
1413
1562
|
yield effects.takeLeading(actions.verifyInviteToken, verifyInviteToken);
|
|
1563
|
+
yield effects.takeLeading(actions.webAuthnPrelogin, webAuthnPrelogin);
|
|
1564
|
+
yield effects.takeLeading(actions.webAuthnPostLogin, webAuthnPostLogin);
|
|
1565
|
+
yield effects.takeLeading(actions.webAuthnCreateNewDeviceSession, webAuthnCreateNewDeviceSession);
|
|
1566
|
+
yield effects.takeLeading(actions.webAuthnVerifyNewDeviceSession, webAuthnVerifyNewDeviceSession);
|
|
1567
|
+
yield effects.takeLeading(actions.afterAuthNavigation, afterAuthNavigation);
|
|
1414
1568
|
}
|
|
1415
1569
|
/*********************************
|
|
1416
1570
|
* Preview Sagas
|
|
@@ -1648,7 +1802,7 @@ function* ssoSagas$1() {
|
|
|
1648
1802
|
*********************************/
|
|
1649
1803
|
function* loadSSOConfigurationsMock() {
|
|
1650
1804
|
yield effects.put(actions.setSSOState({ loading: true }));
|
|
1651
|
-
yield delay();
|
|
1805
|
+
yield vendor_index.delay();
|
|
1652
1806
|
yield effects.put(actions.setSSOState({ samlConfiguration: samlConfigurationDemo, loading: false, firstLoad: false }));
|
|
1653
1807
|
}
|
|
1654
1808
|
function* saveSSOConfigurationsFileMock({ payload: configFile }) {
|
|
@@ -1675,7 +1829,7 @@ function* saveSSOConfigurationsMock({ payload }) {
|
|
|
1675
1829
|
else {
|
|
1676
1830
|
yield effects.put(actions.setSSOState({ error: undefined, [loaderKey]: true }));
|
|
1677
1831
|
}
|
|
1678
|
-
yield delay();
|
|
1832
|
+
yield vendor_index.delay();
|
|
1679
1833
|
samlConfiguration.acsUrl = (_a = samlMetadataDemo === null || samlMetadataDemo === void 0 ? void 0 : samlMetadataDemo.configuration) === null || _a === void 0 ? void 0 : _a.acsUrl;
|
|
1680
1834
|
samlConfiguration.spEntityId = (_b = samlMetadataDemo === null || samlMetadataDemo === void 0 ? void 0 : samlMetadataDemo.configuration) === null || _b === void 0 ? void 0 : _b.spEntityId;
|
|
1681
1835
|
const updateSamlConfiguration = omitProps(samlConfiguration, [
|
|
@@ -1690,14 +1844,14 @@ function* saveSSOConfigurationsMock({ payload }) {
|
|
|
1690
1844
|
updateSamlConfiguration.signRequest = false;
|
|
1691
1845
|
}
|
|
1692
1846
|
updateSamlConfiguration.type = samlVendor === null || samlVendor === void 0 ? void 0 : samlVendor.toLowerCase();
|
|
1693
|
-
yield delay();
|
|
1847
|
+
yield vendor_index.delay();
|
|
1694
1848
|
yield effects.put(actions.setSSOState({ samlConfiguration: updateSamlConfiguration, error: undefined, [loaderKey]: false }));
|
|
1695
1849
|
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
1696
1850
|
}
|
|
1697
1851
|
function* validateSSODomainMock({ payload: { callback } = {} }) {
|
|
1698
1852
|
const samlConfiguration = ssoStateDemo.samlConfiguration;
|
|
1699
1853
|
yield effects.put(actions.setSSOState({ error: undefined, saving: true }));
|
|
1700
|
-
yield delay();
|
|
1854
|
+
yield vendor_index.delay();
|
|
1701
1855
|
yield effects.put(actions.setSSOState({
|
|
1702
1856
|
samlConfiguration: Object.assign(Object.assign({}, samlConfiguration), { validated: true }),
|
|
1703
1857
|
error: undefined,
|
|
@@ -1706,7 +1860,7 @@ function* validateSSODomainMock({ payload: { callback } = {} }) {
|
|
|
1706
1860
|
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
1707
1861
|
}
|
|
1708
1862
|
function* getAuthorizationRolesMock() {
|
|
1709
|
-
yield delay();
|
|
1863
|
+
yield vendor_index.delay();
|
|
1710
1864
|
const data = { roleIds: ['1', '2', '3'] };
|
|
1711
1865
|
yield effects.put(actions.setSSOState({
|
|
1712
1866
|
authorizationRoles: data.roleIds,
|
|
@@ -1715,7 +1869,7 @@ function* getAuthorizationRolesMock() {
|
|
|
1715
1869
|
}
|
|
1716
1870
|
function* updateAuthorizationRolesMock({ payload: { callback, authorizationRoles }, }) {
|
|
1717
1871
|
yield effects.put(actions.setSSOState({ error: undefined, saving: true }));
|
|
1718
|
-
yield delay();
|
|
1872
|
+
yield vendor_index.delay();
|
|
1719
1873
|
yield effects.put(actions.setSSOState({ authorizationRoles, error: undefined, saving: false }));
|
|
1720
1874
|
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
1721
1875
|
}
|
|
@@ -2093,7 +2247,7 @@ function* profileSagas() {
|
|
|
2093
2247
|
*********************************/
|
|
2094
2248
|
function* loadProfileMock() {
|
|
2095
2249
|
yield effects.put(actions.setProfileState({ loading: true }));
|
|
2096
|
-
yield delay();
|
|
2250
|
+
yield vendor_index.delay();
|
|
2097
2251
|
yield effects.put(actions.setUser(Object.assign(Object.assign({}, (userDemo)), userProfileDemo)));
|
|
2098
2252
|
yield effects.put(actions.setProfileState({ loading: false, profile: userProfileDemo }));
|
|
2099
2253
|
}
|
|
@@ -2110,7 +2264,7 @@ function* saveProfileMock(_a) {
|
|
|
2110
2264
|
}
|
|
2111
2265
|
const newProfileData = Object.assign(Object.assign(Object.assign({}, oldProfileData.profile), payload), { profilePictureUrl: newProfilePictureUrl });
|
|
2112
2266
|
const currentUser = userDemo;
|
|
2113
|
-
yield delay();
|
|
2267
|
+
yield vendor_index.delay();
|
|
2114
2268
|
yield effects.put(actions.setUser(Object.assign(Object.assign({}, currentUser), newProfileData)));
|
|
2115
2269
|
yield effects.put(actions.setProfileState({ loading: false, error: null, saving: false, profile: newProfileData }));
|
|
2116
2270
|
callback === null || callback === void 0 ? void 0 : callback(newProfileData);
|
|
@@ -2118,7 +2272,7 @@ function* saveProfileMock(_a) {
|
|
|
2118
2272
|
function* changePasswordMock({ payload }) {
|
|
2119
2273
|
var _a;
|
|
2120
2274
|
yield effects.put(actions.setProfileState({ loading: true }));
|
|
2121
|
-
yield delay();
|
|
2275
|
+
yield vendor_index.delay();
|
|
2122
2276
|
yield effects.put(actions.setProfileState({ loading: false, error: undefined }));
|
|
2123
2277
|
(_a = payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, true);
|
|
2124
2278
|
}
|
|
@@ -2215,7 +2369,7 @@ function* enrollMfaMock() {
|
|
|
2215
2369
|
}
|
|
2216
2370
|
function* verifyMfaMock({ payload: { callback }, }) {
|
|
2217
2371
|
yield effects.put(actions.setMfaState({ loading: true }));
|
|
2218
|
-
yield delay();
|
|
2372
|
+
yield vendor_index.delay();
|
|
2219
2373
|
const data = { token: 'token', recoveryCode: 'recoveryCode' };
|
|
2220
2374
|
const mfaState = {
|
|
2221
2375
|
step: exports.MFAStep.recoveryCode,
|
|
@@ -2232,7 +2386,7 @@ function* verifyMfaMock({ payload: { callback }, }) {
|
|
|
2232
2386
|
function* verifyMfaAfterForceMock(_a) {
|
|
2233
2387
|
var _b = _a.payload, { callback } = _b, payload = tslib.__rest(_b, ["callback"]);
|
|
2234
2388
|
yield effects.put(actions.setMfaState({ loading: true }));
|
|
2235
|
-
yield delay();
|
|
2389
|
+
yield vendor_index.delay();
|
|
2236
2390
|
const data = Object.assign(Object.assign({}, payload), { recoveryCode: 'recoveryCode' });
|
|
2237
2391
|
const mfaState = {
|
|
2238
2392
|
step: exports.MFAStep.recoveryCode,
|
|
@@ -2243,14 +2397,14 @@ function* verifyMfaAfterForceMock(_a) {
|
|
|
2243
2397
|
mfaState.recoveryCode = data.recoveryCode;
|
|
2244
2398
|
}
|
|
2245
2399
|
yield effects.put(actions.setMfaState(mfaState));
|
|
2246
|
-
yield delay();
|
|
2400
|
+
yield vendor_index.delay();
|
|
2247
2401
|
yield effects.put(actions.setUser(Object.assign(Object.assign({}, userDemo), { mfaEnrolled: true })));
|
|
2248
2402
|
callback === null || callback === void 0 ? void 0 : callback(mfaState.recoveryCode);
|
|
2249
2403
|
}
|
|
2250
2404
|
function* disableMfaMock({ payload }) {
|
|
2251
2405
|
var _a;
|
|
2252
2406
|
yield effects.put(actions.setMfaState({ loading: true }));
|
|
2253
|
-
yield delay();
|
|
2407
|
+
yield vendor_index.delay();
|
|
2254
2408
|
yield effects.put(actions.setMfaState({ loading: false, error: undefined }));
|
|
2255
2409
|
yield effects.put(actions.setUser(Object.assign(Object.assign({}, userDemo), { mfaEnrolled: false })));
|
|
2256
2410
|
(_a = payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, true);
|
|
@@ -2457,6 +2611,48 @@ function* loadUsers({ payload }) {
|
|
|
2457
2611
|
}
|
|
2458
2612
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: false }));
|
|
2459
2613
|
}
|
|
2614
|
+
function* loadAllSubTenantsUsers({ payload, }) {
|
|
2615
|
+
var _a, _b, _c, _d, _e;
|
|
2616
|
+
const { silentLoading, callback } = payload;
|
|
2617
|
+
const teamState = yield selectTeamState();
|
|
2618
|
+
const _limit = (_a = payload._limit) !== null && _a !== void 0 ? _a : teamState.allUsersQueryParams._limit;
|
|
2619
|
+
const _offset = (_b = payload._offset) !== null && _b !== void 0 ? _b : teamState.allUsersQueryParams._offset;
|
|
2620
|
+
const _filter = (_c = payload._filter) !== null && _c !== void 0 ? _c : teamState.allUsersQueryParams._filter;
|
|
2621
|
+
const _sortBy = (_d = payload._sortBy) !== null && _d !== void 0 ? _d : teamState.allUsersQueryParams._sortBy;
|
|
2622
|
+
const _order = (_e = payload._order) !== null && _e !== void 0 ? _e : teamState.allUsersQueryParams._order;
|
|
2623
|
+
const allUsersQueryParams = {
|
|
2624
|
+
_limit: _limit || 20,
|
|
2625
|
+
_offset: _offset || 0,
|
|
2626
|
+
_filter: _filter || '',
|
|
2627
|
+
_sortBy: _sortBy || 'name',
|
|
2628
|
+
_order: _order || 'DESC',
|
|
2629
|
+
};
|
|
2630
|
+
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: !silentLoading }));
|
|
2631
|
+
yield effects.put(actions.setTeamState({
|
|
2632
|
+
allUsersQueryParams,
|
|
2633
|
+
}));
|
|
2634
|
+
try {
|
|
2635
|
+
const [{ items: users, _metadata: { totalPages, totalItems }, }, { items: roles }, { items: permissions },] = yield effects.all([
|
|
2636
|
+
effects.call(restApi.api.subTenants.loadAllUsers, Object.assign({}, allUsersQueryParams)),
|
|
2637
|
+
effects.call(restApi.api.teams.loadAvailableRoles),
|
|
2638
|
+
effects.call(restApi.api.teams.loadAvailablePermissions),
|
|
2639
|
+
]);
|
|
2640
|
+
yield effects.put(actions.setTeamState({
|
|
2641
|
+
allUsers: users,
|
|
2642
|
+
totalPages,
|
|
2643
|
+
totalItems,
|
|
2644
|
+
roles,
|
|
2645
|
+
permissions,
|
|
2646
|
+
}));
|
|
2647
|
+
callback === null || callback === void 0 ? void 0 : callback(users);
|
|
2648
|
+
}
|
|
2649
|
+
catch (e) {
|
|
2650
|
+
yield effects.put(actions.setTeamError({ key: exports.TeamStateKeys.USERS, value: e.message }));
|
|
2651
|
+
yield effects.put(actions.setTeamState({ totalPages: 0, users: [] }));
|
|
2652
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
2653
|
+
}
|
|
2654
|
+
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: false }));
|
|
2655
|
+
}
|
|
2460
2656
|
function* loadRoles({ payload }) {
|
|
2461
2657
|
var _a, _b;
|
|
2462
2658
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.ROLES_AND_PERMISSIONS, value: true }));
|
|
@@ -2496,6 +2692,34 @@ function* addUser({ payload }) {
|
|
|
2496
2692
|
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2497
2693
|
}
|
|
2498
2694
|
}
|
|
2695
|
+
function* addUserToSubTenants({ payload }) {
|
|
2696
|
+
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2697
|
+
const teamState = yield selectTeamState();
|
|
2698
|
+
yield effects.put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
|
|
2699
|
+
try {
|
|
2700
|
+
yield effects.call(restApi.api.subTenants.addUserToTenantAndSubTenants, body);
|
|
2701
|
+
const { items: users, _metadata: { totalPages, totalItems }, } = yield effects.call(restApi.api.subTenants.loadAllUsers, {
|
|
2702
|
+
_limit: 20,
|
|
2703
|
+
_offset: 0,
|
|
2704
|
+
_filter: '',
|
|
2705
|
+
_sortBy: 'name',
|
|
2706
|
+
_order: 'DESC',
|
|
2707
|
+
});
|
|
2708
|
+
yield effects.put(actions.setTeamState({
|
|
2709
|
+
allUsers: users,
|
|
2710
|
+
totalPages,
|
|
2711
|
+
totalItems,
|
|
2712
|
+
addUserDialogState: { open: false, loading: false },
|
|
2713
|
+
}));
|
|
2714
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
2715
|
+
}
|
|
2716
|
+
catch (e) {
|
|
2717
|
+
yield effects.put(actions.setTeamState({
|
|
2718
|
+
addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: false, error: e.message }),
|
|
2719
|
+
}));
|
|
2720
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2499
2723
|
function* updateUser({ payload }) {
|
|
2500
2724
|
var _a;
|
|
2501
2725
|
const { callback, profileImage } = payload, body = tslib.__rest(payload, ["callback", "profileImage"]);
|
|
@@ -2553,6 +2777,58 @@ function* deleteUser({ payload }) {
|
|
|
2553
2777
|
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2554
2778
|
}
|
|
2555
2779
|
}
|
|
2780
|
+
function* setUserRolesForSubTenants({ payload, }) {
|
|
2781
|
+
const { callback, userId } = payload, body = tslib.__rest(payload, ["callback", "userId"]);
|
|
2782
|
+
const teamState = yield selectTeamState();
|
|
2783
|
+
yield effects.put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
|
|
2784
|
+
try {
|
|
2785
|
+
yield effects.call(restApi.api.subTenants.setUserRolesForSubTenants, userId, body);
|
|
2786
|
+
const updatedUser = teamState.allUsers.find((user) => user.id === userId);
|
|
2787
|
+
if (updatedUser) {
|
|
2788
|
+
updatedUser.tenants = updatedUser.tenants.map((tenant) => {
|
|
2789
|
+
var _a;
|
|
2790
|
+
return (Object.assign(Object.assign({}, tenant), { roles: ((_a = body.subTenantsRoles
|
|
2791
|
+
.find((roleUpdate) => roleUpdate.tenantId === tenant.tenantId)) === null || _a === void 0 ? void 0 : _a.roleIds.map((roleId) => {
|
|
2792
|
+
const role = teamState.roles.find(({ id }) => roleId === id);
|
|
2793
|
+
return role;
|
|
2794
|
+
}).filter((role) => role)) || tenant.roles }));
|
|
2795
|
+
});
|
|
2796
|
+
}
|
|
2797
|
+
yield effects.put(actions.setTeamState({
|
|
2798
|
+
allUsers: [
|
|
2799
|
+
...teamState.allUsers.filter((user) => user.id !== userId),
|
|
2800
|
+
...(updatedUser ? [updatedUser] : []),
|
|
2801
|
+
],
|
|
2802
|
+
addUserDialogState: { open: false, loading: false },
|
|
2803
|
+
}));
|
|
2804
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2805
|
+
}
|
|
2806
|
+
catch (e) {
|
|
2807
|
+
yield effects.put(actions.setTeamState({
|
|
2808
|
+
addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: false, error: e.message }),
|
|
2809
|
+
}));
|
|
2810
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
function* deleteUserFromSubTenants({ payload }) {
|
|
2814
|
+
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2815
|
+
const teamState = yield selectTeamState();
|
|
2816
|
+
yield effects.put(actions.setTeamState({ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: true }) }));
|
|
2817
|
+
try {
|
|
2818
|
+
yield effects.call(restApi.api.subTenants.removeUserFromTenantAndSubTenants, body);
|
|
2819
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2820
|
+
yield effects.put(actions.setTeamState({
|
|
2821
|
+
allUsers: teamState.allUsers.filter((user) => user.id !== body.userId && user.tenants.length === body.subTenants.length),
|
|
2822
|
+
deleteUserDialogState: { open: false, loading: false },
|
|
2823
|
+
}));
|
|
2824
|
+
}
|
|
2825
|
+
catch (e) {
|
|
2826
|
+
yield effects.put(actions.setTeamState({
|
|
2827
|
+
deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: false, error: e.message }),
|
|
2828
|
+
}));
|
|
2829
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e.message);
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2556
2832
|
function* resendActivationLink({ payload }) {
|
|
2557
2833
|
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2558
2834
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.RESEND_ACTIVATE_LINK, value: body.userId }));
|
|
@@ -2601,7 +2877,7 @@ function* getInvitationLink() {
|
|
|
2601
2877
|
yield effects.put(actions.setTeamError({ key: exports.TeamStateKeys.GET_TOKEN_LINK, value: e.message }));
|
|
2602
2878
|
}
|
|
2603
2879
|
}
|
|
2604
|
-
function* createInvitationLink({ payload: { callback } }) {
|
|
2880
|
+
function* createInvitationLink({ payload: { callback }, }) {
|
|
2605
2881
|
yield effects.put(actions.setTeamError({ key: exports.TeamStateKeys.CREATE_TOKEN_LINK, value: false }));
|
|
2606
2882
|
const { inviteTokenState } = yield selectTeamState();
|
|
2607
2883
|
try {
|
|
@@ -2614,7 +2890,7 @@ function* createInvitationLink({ payload: { callback } }) {
|
|
|
2614
2890
|
yield effects.put(actions.setTeamError({ key: exports.TeamStateKeys.CREATE_TOKEN_LINK, value: e.message }));
|
|
2615
2891
|
}
|
|
2616
2892
|
}
|
|
2617
|
-
function* updateInvitationLink({ payload: { callback, expiresInMinutes, shouldSendEmail } }) {
|
|
2893
|
+
function* updateInvitationLink({ payload: { callback, expiresInMinutes, shouldSendEmail }, }) {
|
|
2618
2894
|
const { inviteTokenState } = yield selectTeamState();
|
|
2619
2895
|
yield effects.put(actions.setTeamError({ key: exports.TeamStateKeys.UPDATE_TOKEN_LINK, value: false }));
|
|
2620
2896
|
try {
|
|
@@ -2647,7 +2923,7 @@ function* openAddUserDialog({ payload }) {
|
|
|
2647
2923
|
}
|
|
2648
2924
|
function* closeAddUserDialog({ payload }) {
|
|
2649
2925
|
const teamState = yield selectTeamState();
|
|
2650
|
-
const { addUserDialogState: { onClose } } = teamState;
|
|
2926
|
+
const { addUserDialogState: { onClose }, } = teamState;
|
|
2651
2927
|
onClose === null || onClose === void 0 ? void 0 : onClose(payload);
|
|
2652
2928
|
yield effects.put(actions.setTeamState({
|
|
2653
2929
|
addUserDialogState: {
|
|
@@ -2664,7 +2940,7 @@ function* openDeleteUserDialog({ payload }) {
|
|
|
2664
2940
|
}
|
|
2665
2941
|
function* closeDeleteUserDialog({ payload }) {
|
|
2666
2942
|
const teamState = yield selectTeamState();
|
|
2667
|
-
const { deleteUserDialogState: { onClose } } = teamState;
|
|
2943
|
+
const { deleteUserDialogState: { onClose }, } = teamState;
|
|
2668
2944
|
onClose === null || onClose === void 0 ? void 0 : onClose(payload);
|
|
2669
2945
|
yield effects.put(actions.setTeamState({
|
|
2670
2946
|
deleteUserDialogState: {
|
|
@@ -2676,10 +2952,14 @@ function* closeDeleteUserDialog({ payload }) {
|
|
|
2676
2952
|
}
|
|
2677
2953
|
function* teamSagas() {
|
|
2678
2954
|
yield effects.takeLatest(actions.loadUsers, loadUsers);
|
|
2955
|
+
yield effects.takeLatest(actions.loadAllSubTenantsUsers, loadAllSubTenantsUsers);
|
|
2679
2956
|
yield effects.takeLatest(actions.loadRoles, loadRoles);
|
|
2680
2957
|
yield effects.takeEvery(actions.addUser, addUser);
|
|
2958
|
+
yield effects.takeEvery(actions.addUserToSubTenants, addUserToSubTenants);
|
|
2681
2959
|
yield effects.takeEvery(actions.updateUser, updateUser);
|
|
2960
|
+
yield effects.takeEvery(actions.setUserRolesForSubTenants, setUserRolesForSubTenants);
|
|
2682
2961
|
yield effects.takeEvery(actions.deleteUser, deleteUser);
|
|
2962
|
+
yield effects.takeEvery(actions.deleteUserFromSubTenants, deleteUserFromSubTenants);
|
|
2683
2963
|
yield effects.takeEvery(actions.resendActivationLink, resendActivationLink);
|
|
2684
2964
|
yield effects.takeEvery(actions.resendInvitationLink, resendInvitationLink);
|
|
2685
2965
|
yield effects.takeEvery(actions.getInvitationLink, getInvitationLink);
|
|
@@ -2711,15 +2991,47 @@ function* loadUsersMock({ payload }) {
|
|
|
2711
2991
|
}));
|
|
2712
2992
|
const totalPages = 2;
|
|
2713
2993
|
const totalItems = 10;
|
|
2714
|
-
yield delay();
|
|
2994
|
+
yield vendor_index.delay();
|
|
2715
2995
|
yield effects.put(actions.setTeamState({ users: usersDemo, totalPages, totalItems, roles: rolesDemo, permissions: permissionsDemo }));
|
|
2716
2996
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: false }));
|
|
2717
2997
|
callback === null || callback === void 0 ? void 0 : callback(usersDemo);
|
|
2718
2998
|
}
|
|
2999
|
+
function* loadAllSubTenantsUsersMock({ payload, }) {
|
|
3000
|
+
var _a, _b, _c, _d, _e;
|
|
3001
|
+
const { silentLoading, callback } = payload;
|
|
3002
|
+
const teamState = yield selectTeamState();
|
|
3003
|
+
const _limit = (_a = payload._limit) !== null && _a !== void 0 ? _a : teamState.allUsersQueryParams._limit;
|
|
3004
|
+
const _offset = (_b = payload._offset) !== null && _b !== void 0 ? _b : teamState.allUsersQueryParams._offset;
|
|
3005
|
+
const _filter = (_c = payload._filter) !== null && _c !== void 0 ? _c : teamState.allUsersQueryParams._filter;
|
|
3006
|
+
const _sortBy = (_d = payload._sortBy) !== null && _d !== void 0 ? _d : teamState.allUsersQueryParams._sortBy;
|
|
3007
|
+
const _order = (_e = payload._order) !== null && _e !== void 0 ? _e : teamState.allUsersQueryParams._order;
|
|
3008
|
+
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: !silentLoading }));
|
|
3009
|
+
yield effects.put(actions.setTeamState({
|
|
3010
|
+
allUsersQueryParams: {
|
|
3011
|
+
_limit,
|
|
3012
|
+
_offset,
|
|
3013
|
+
_filter,
|
|
3014
|
+
_sortBy,
|
|
3015
|
+
_order,
|
|
3016
|
+
},
|
|
3017
|
+
}));
|
|
3018
|
+
const totalPages = 2;
|
|
3019
|
+
const totalItems = 10;
|
|
3020
|
+
yield vendor_index.delay();
|
|
3021
|
+
yield effects.put(actions.setTeamState({
|
|
3022
|
+
allUsers: allUsersDemo,
|
|
3023
|
+
totalPages,
|
|
3024
|
+
totalItems,
|
|
3025
|
+
roles: rolesDemo,
|
|
3026
|
+
permissions: permissionsDemo,
|
|
3027
|
+
}));
|
|
3028
|
+
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: false }));
|
|
3029
|
+
callback === null || callback === void 0 ? void 0 : callback(allUsersDemo);
|
|
3030
|
+
}
|
|
2719
3031
|
function* loadRolesMock({ payload }) {
|
|
2720
3032
|
var _a;
|
|
2721
3033
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.ROLES_AND_PERMISSIONS, value: true }));
|
|
2722
|
-
yield delay();
|
|
3034
|
+
yield vendor_index.delay();
|
|
2723
3035
|
yield effects.put(actions.setTeamState({ roles: rolesDemo, permissions: permissionsDemo }));
|
|
2724
3036
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.ROLES_AND_PERMISSIONS, value: true }));
|
|
2725
3037
|
(_a = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, { roles: rolesDemo, permissions: permissionsDemo });
|
|
@@ -2728,7 +3040,7 @@ function* addUserMock({ payload }) {
|
|
|
2728
3040
|
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2729
3041
|
const teamState = yield selectTeamState();
|
|
2730
3042
|
yield effects.put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
|
|
2731
|
-
yield delay();
|
|
3043
|
+
yield vendor_index.delay();
|
|
2732
3044
|
const newUser = Object.assign(Object.assign(Object.assign({}, userTeamDemo), body), { id: `${uuid.v4()}` });
|
|
2733
3045
|
callback === null || callback === void 0 ? void 0 : callback(newUser);
|
|
2734
3046
|
yield effects.put(actions.setTeamState({
|
|
@@ -2736,6 +3048,18 @@ function* addUserMock({ payload }) {
|
|
|
2736
3048
|
addUserDialogState: { open: false, loading: false },
|
|
2737
3049
|
}));
|
|
2738
3050
|
}
|
|
3051
|
+
function* addUserToSubTenantsMock({ payload }) {
|
|
3052
|
+
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
3053
|
+
const teamState = yield selectTeamState();
|
|
3054
|
+
yield effects.put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
|
|
3055
|
+
yield vendor_index.delay();
|
|
3056
|
+
const newUser = Object.assign(Object.assign(Object.assign({}, userTeamDemo), body), { id: `${uuid.v4()}` });
|
|
3057
|
+
yield effects.put(actions.setTeamState({
|
|
3058
|
+
users: [newUser, ...teamState.users],
|
|
3059
|
+
addUserDialogState: { open: false, loading: false },
|
|
3060
|
+
}));
|
|
3061
|
+
callback === null || callback === void 0 ? void 0 : callback(null);
|
|
3062
|
+
}
|
|
2739
3063
|
function* updateUserMock({ payload }) {
|
|
2740
3064
|
var _a;
|
|
2741
3065
|
const { callback, profileImage } = payload, body = tslib.__rest(payload, ["callback", "profileImage"]);
|
|
@@ -2756,7 +3080,7 @@ function* updateUserMock({ payload }) {
|
|
|
2756
3080
|
if (oldUserData.roleIds.length > 0 && ((_a = body.roleIds) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
2757
3081
|
body.roleIds = [''];
|
|
2758
3082
|
}
|
|
2759
|
-
yield delay();
|
|
3083
|
+
yield vendor_index.delay();
|
|
2760
3084
|
const newUser = Object.assign(Object.assign({}, oldUserData), body);
|
|
2761
3085
|
callback === null || callback === void 0 ? void 0 : callback(newUser);
|
|
2762
3086
|
yield effects.put(actions.setTeamState({
|
|
@@ -2769,33 +3093,47 @@ function* deleteUserMock({ payload }) {
|
|
|
2769
3093
|
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2770
3094
|
const teamState = yield selectTeamState();
|
|
2771
3095
|
yield effects.put(actions.setTeamState({ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: true }) }));
|
|
2772
|
-
yield delay();
|
|
3096
|
+
yield vendor_index.delay();
|
|
2773
3097
|
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2774
3098
|
yield effects.put(actions.setTeamState({
|
|
2775
3099
|
users: teamState.users.filter((user) => user.id !== body.userId),
|
|
2776
3100
|
deleteUserDialogState: { open: false, loading: false },
|
|
2777
3101
|
}));
|
|
2778
3102
|
}
|
|
3103
|
+
function* deleteUserFromSubTenantsMock({ payload }) {
|
|
3104
|
+
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
3105
|
+
const teamState = yield selectTeamState();
|
|
3106
|
+
yield effects.put(actions.setTeamState({ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: true }) }));
|
|
3107
|
+
yield vendor_index.delay();
|
|
3108
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
3109
|
+
yield effects.put(actions.setTeamState({
|
|
3110
|
+
allUsers: teamState.allUsers.filter((user) => user.id !== body.userId),
|
|
3111
|
+
deleteUserDialogState: { open: false, loading: false },
|
|
3112
|
+
}));
|
|
3113
|
+
}
|
|
2779
3114
|
function* resendActivationLinkMock({ payload }) {
|
|
2780
3115
|
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2781
3116
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.RESEND_ACTIVATE_LINK, value: body.userId }));
|
|
2782
|
-
yield delay();
|
|
3117
|
+
yield vendor_index.delay();
|
|
2783
3118
|
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2784
3119
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.RESEND_ACTIVATE_LINK, value: false }));
|
|
2785
3120
|
}
|
|
2786
3121
|
function* resendInvitationLinkMock({ payload }) {
|
|
2787
3122
|
const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
|
|
2788
3123
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.RESEND_INVITATION_LINK, value: body.email }));
|
|
2789
|
-
yield delay();
|
|
3124
|
+
yield vendor_index.delay();
|
|
2790
3125
|
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
2791
3126
|
yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.RESEND_INVITATION_LINK, value: false }));
|
|
2792
3127
|
}
|
|
2793
3128
|
function* teamSagasMock() {
|
|
2794
3129
|
yield effects.takeLatest(actions.loadUsers, loadUsersMock);
|
|
3130
|
+
yield effects.takeLatest(actions.loadAllSubTenantsUsers, loadAllSubTenantsUsersMock);
|
|
2795
3131
|
yield effects.takeLatest(actions.loadRoles, loadRolesMock);
|
|
2796
3132
|
yield effects.takeEvery(actions.addUser, addUserMock);
|
|
3133
|
+
yield effects.takeEvery(actions.addUserToSubTenants, addUserToSubTenantsMock);
|
|
2797
3134
|
yield effects.takeEvery(actions.updateUser, updateUserMock);
|
|
2798
3135
|
yield effects.takeEvery(actions.deleteUser, deleteUserMock);
|
|
3136
|
+
yield effects.takeEvery(actions.deleteUserFromSubTenants, deleteUserFromSubTenantsMock);
|
|
2799
3137
|
yield effects.takeEvery(actions.resendActivationLink, resendActivationLinkMock);
|
|
2800
3138
|
yield effects.takeEvery(actions.resendInvitationLink, resendInvitationLinkMock);
|
|
2801
3139
|
yield effects.takeEvery(actions.openAddUserDialog, openAddUserDialog);
|
|
@@ -2856,6 +3194,9 @@ function* loginViaSocialLogin(_a) {
|
|
|
2856
3194
|
name,
|
|
2857
3195
|
});
|
|
2858
3196
|
}
|
|
3197
|
+
if (email) {
|
|
3198
|
+
localStorage.setItem('email', email);
|
|
3199
|
+
}
|
|
2859
3200
|
yield effects.put(actions.setLoginState({ email, isNewUser }));
|
|
2860
3201
|
yield refreshToken();
|
|
2861
3202
|
yield effects.put(actions.setSocialLoginsState({ loading: false }));
|
|
@@ -3094,6 +3435,7 @@ function* loadSecurityPolicy() {
|
|
|
3094
3435
|
yield effects.put(actions.loadSecurityPolicyVendorMfa());
|
|
3095
3436
|
yield effects.put(actions.loadSecurityPolicyLockout());
|
|
3096
3437
|
yield effects.put(actions.loadSecurityPolicyCaptcha());
|
|
3438
|
+
yield effects.put(actions.loadPublicAuthStrategiesPolicy());
|
|
3097
3439
|
}
|
|
3098
3440
|
function* loadPublicSecurityPolicy() {
|
|
3099
3441
|
yield effects.put(actions.setSecurityPolicyPublicState({ loading: true, error: null }));
|
|
@@ -3105,6 +3447,16 @@ function* loadPublicSecurityPolicy() {
|
|
|
3105
3447
|
yield effects.put(actions.setSecurityPolicyPublicState({ error: e.message, loading: false }));
|
|
3106
3448
|
}
|
|
3107
3449
|
}
|
|
3450
|
+
function* loadPublicAuthStrategiesPolicy() {
|
|
3451
|
+
yield effects.put(actions.setSecurityPolicyAuthStrategyPublicState({ loading: true, error: null }));
|
|
3452
|
+
try {
|
|
3453
|
+
const policy = yield effects.call(restApi.api.auth.getVendorPublicAuthStrategiesConfig);
|
|
3454
|
+
yield effects.put(actions.setSecurityPolicyAuthStrategyPublicState({ policy, loading: false }));
|
|
3455
|
+
}
|
|
3456
|
+
catch (e) {
|
|
3457
|
+
yield effects.put(actions.setSecurityPolicyAuthStrategyPublicState({ error: e.message, loading: false }));
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3108
3460
|
function* loadSecurityPolicyMfa() {
|
|
3109
3461
|
yield effects.put(actions.setSecurityPolicyMfaState({ loading: true, error: null }));
|
|
3110
3462
|
try {
|
|
@@ -3216,6 +3568,7 @@ function* securityPolicySagas() {
|
|
|
3216
3568
|
yield effects.takeEvery(actions.loadSecurityPolicyPasswordHistory, loadSecurityPolicyPasswordHistory);
|
|
3217
3569
|
yield effects.takeEvery(actions.loadVendorPasswordConfig, loadVendorPasswordConfig);
|
|
3218
3570
|
yield effects.takeEvery(actions.loadPublicSecurityPolicy, loadPublicSecurityPolicy);
|
|
3571
|
+
yield effects.takeEvery(actions.loadPublicAuthStrategiesPolicy, loadPublicAuthStrategiesPolicy);
|
|
3219
3572
|
}
|
|
3220
3573
|
/*********************************
|
|
3221
3574
|
* Preview Sagas
|
|
@@ -3231,7 +3584,7 @@ function* loadPublicSecurityPolicyMock() {
|
|
|
3231
3584
|
}
|
|
3232
3585
|
function* loadSecurityPolicyMock() {
|
|
3233
3586
|
yield effects.put(actions.setSecurityPolicyGlobalState({ loading: true, error: null }));
|
|
3234
|
-
yield delay();
|
|
3587
|
+
yield vendor_index.delay();
|
|
3235
3588
|
yield effects.put(actions.setSecurityPolicyGlobalState({ policy: policyDemo, loading: false }));
|
|
3236
3589
|
yield effects.put(actions.loadSecurityPolicyMfa());
|
|
3237
3590
|
yield effects.put(actions.loadSecurityPolicyVendorMfa());
|
|
@@ -3240,12 +3593,12 @@ function* loadSecurityPolicyMock() {
|
|
|
3240
3593
|
}
|
|
3241
3594
|
function* loadSecurityPolicyMfaMock() {
|
|
3242
3595
|
yield effects.put(actions.setSecurityPolicyMfaState({ loading: true, error: null }));
|
|
3243
|
-
yield delay();
|
|
3596
|
+
yield vendor_index.delay();
|
|
3244
3597
|
yield effects.put(actions.setSecurityPolicyMfaState({ policy: policyMfaDemo, loading: false }));
|
|
3245
3598
|
}
|
|
3246
3599
|
function* loadSecurityPolicyVendorMfaMock() {
|
|
3247
3600
|
yield effects.put(actions.setSecurityPolicyVendorMfaState({ loading: true, error: null }));
|
|
3248
|
-
yield delay();
|
|
3601
|
+
yield vendor_index.delay();
|
|
3249
3602
|
yield effects.put(actions.setSecurityPolicyVendorMfaState({ policy: policyMfaDemo, loading: false }));
|
|
3250
3603
|
}
|
|
3251
3604
|
function* saveSecurityPolicyMfaMock(_a) {
|
|
@@ -3253,37 +3606,37 @@ function* saveSecurityPolicyMfaMock(_a) {
|
|
|
3253
3606
|
var _c = _a.payload, { callback } = _c, newSecurityPolicy = tslib.__rest(_c, ["callback"]);
|
|
3254
3607
|
yield effects.put(actions.setSecurityPolicyMfaState({ saving: true, error: null }));
|
|
3255
3608
|
const policy = Object.assign(Object.assign({}, policyLockoutDemo), { id: (_b = newSecurityPolicy.id) !== null && _b !== void 0 ? _b : policyLockoutDemo.id, enforceMFAType: newSecurityPolicy.enforceMFAType });
|
|
3256
|
-
yield delay();
|
|
3609
|
+
yield vendor_index.delay();
|
|
3257
3610
|
yield effects.put(actions.setSecurityPolicyMfaState({ policy, saving: false }));
|
|
3258
3611
|
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
3259
3612
|
}
|
|
3260
3613
|
function* loadSecurityPolicyLockoutMock() {
|
|
3261
3614
|
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
3262
|
-
yield delay();
|
|
3615
|
+
yield vendor_index.delay();
|
|
3263
3616
|
yield effects.put(actions.setSecurityPolicyLockoutState({ policy: policyLockoutDemo, loading: false }));
|
|
3264
3617
|
}
|
|
3265
3618
|
function* saveSecurityPolicyLockoutMock(_a) {
|
|
3266
3619
|
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
3267
3620
|
yield effects.put(actions.setSecurityPolicyLockoutState({ saving: true, error: null }));
|
|
3268
|
-
yield delay();
|
|
3621
|
+
yield vendor_index.delay();
|
|
3269
3622
|
const policy = Object.assign(Object.assign(Object.assign({}, newSecurityPolicy), policyLockoutDemo), { id: newSecurityPolicy.id ? newSecurityPolicy.id : policyLockoutDemo.id });
|
|
3270
3623
|
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
3271
3624
|
yield effects.put(actions.setSecurityPolicyLockoutState({ policy, saving: false }));
|
|
3272
3625
|
}
|
|
3273
3626
|
function* loadSecurityPolicyCaptchaMock() {
|
|
3274
3627
|
yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
|
|
3275
|
-
yield delay();
|
|
3628
|
+
yield vendor_index.delay();
|
|
3276
3629
|
yield effects.put(actions.setSecurityPolicyLockoutState({ policy: policyLockoutDemo, loading: false }));
|
|
3277
3630
|
}
|
|
3278
3631
|
function* loadSecurityPolicyPasswordHistoryMock() {
|
|
3279
3632
|
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ loading: true, error: null }));
|
|
3280
|
-
yield delay();
|
|
3633
|
+
yield vendor_index.delay();
|
|
3281
3634
|
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy: policyPasswordHistoryDemo, loading: false }));
|
|
3282
3635
|
}
|
|
3283
3636
|
function* saveSecurityPolicyPasswordHistoryMock(_a) {
|
|
3284
3637
|
var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
|
|
3285
3638
|
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ saving: true, error: null }));
|
|
3286
|
-
yield delay();
|
|
3639
|
+
yield vendor_index.delay();
|
|
3287
3640
|
const policy = Object.assign(Object.assign(Object.assign({}, newSecurityPolicy), policyPasswordHistoryDemo), { id: newSecurityPolicy.id ? newSecurityPolicy.id : policyPasswordHistoryDemo.id });
|
|
3288
3641
|
callback === null || callback === void 0 ? void 0 : callback(policy);
|
|
3289
3642
|
yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy, saving: false }));
|
|
@@ -3341,7 +3694,7 @@ function* accountSettingsSaga() {
|
|
|
3341
3694
|
function* saveAccountSettingsMock({ payload }) {
|
|
3342
3695
|
var _a;
|
|
3343
3696
|
yield effects.put(actions.setAccountSettingsState({ loading: true }));
|
|
3344
|
-
yield delay();
|
|
3697
|
+
yield vendor_index.delay();
|
|
3345
3698
|
const { accountSettingsState } = yield effects.select((state) => state.auth);
|
|
3346
3699
|
const { address, timezone, dateFormat, timeFormat, currency, logo } = accountSettingsState;
|
|
3347
3700
|
const body = Object.assign({ address,
|
|
@@ -3355,7 +3708,7 @@ function* saveAccountSettingsMock({ payload }) {
|
|
|
3355
3708
|
}
|
|
3356
3709
|
function* loadAccountSettingsMock({ payload }) {
|
|
3357
3710
|
yield effects.put(actions.setAccountSettingsState({ loading: !(payload === null || payload === void 0 ? void 0 : payload.silentLoading), error: null }));
|
|
3358
|
-
yield delay();
|
|
3711
|
+
yield vendor_index.delay();
|
|
3359
3712
|
yield effects.put(actions.setAccountSettingsState({
|
|
3360
3713
|
address: 'Tel-aviv',
|
|
3361
3714
|
timezone: 'Asia/Jerusalem',
|
|
@@ -3411,17 +3764,31 @@ function* loadSubTenants({ payload }) {
|
|
|
3411
3764
|
(_b = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _b === void 0 ? void 0 : _b.call(payload, null, e);
|
|
3412
3765
|
}
|
|
3413
3766
|
}
|
|
3767
|
+
function* loadSubTenantsTree({ payload }) {
|
|
3768
|
+
var _a, _b;
|
|
3769
|
+
yield effects.put(actions.setTenantsState({ loading: true }));
|
|
3770
|
+
try {
|
|
3771
|
+
const tenantTree = yield effects.call(restApi.api.tenants.getSubTenantsAsTree);
|
|
3772
|
+
yield effects.put(actions.setTenantsState({ tenantTree, loading: false }));
|
|
3773
|
+
(_a = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, true);
|
|
3774
|
+
}
|
|
3775
|
+
catch (e) {
|
|
3776
|
+
yield effects.put(actions.setTenantsState({ loading: false }));
|
|
3777
|
+
(_b = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _b === void 0 ? void 0 : _b.call(payload, null, e);
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3414
3780
|
function* tenantsSagas() {
|
|
3415
3781
|
yield effects.takeEvery(actions.loadTenants, loadTenants);
|
|
3416
3782
|
yield effects.takeEvery(actions.loadSubTenants, loadSubTenants);
|
|
3417
3783
|
yield effects.takeEvery(actions.switchTenant, switchTenant);
|
|
3784
|
+
yield effects.takeEvery(actions.loadSubTenantsTree, loadSubTenantsTree);
|
|
3418
3785
|
}
|
|
3419
3786
|
/*********************************
|
|
3420
3787
|
* Preview Sagas
|
|
3421
3788
|
*********************************/
|
|
3422
3789
|
function* loadTenantsMock({}) {
|
|
3423
3790
|
yield effects.put(actions.setTenantsState({ loading: true }));
|
|
3424
|
-
yield delay();
|
|
3791
|
+
yield vendor_index.delay();
|
|
3425
3792
|
yield effects.put(actions.setTenantsState({ tenants: tenantsDemo, loading: false }));
|
|
3426
3793
|
}
|
|
3427
3794
|
function* tenantsSagasMock() {
|