@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/index.js CHANGED
@@ -37,7 +37,66 @@ const errorsReducerForKey = (key) => ({
37
37
  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 }) }) }));
38
38
  },
39
39
  });
40
- const delay = (delayTime = 500) => new Promise((resolve) => setTimeout(resolve, delayTime));
40
+ const delay = (delayTime = 500) => new Promise((resolve) => setTimeout(resolve, delayTime));
41
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
42
+ const lookup = new Uint8Array(256);
43
+ for (let i = 0; i < chars.length; i++) {
44
+ lookup[chars.charCodeAt(i)] = i;
45
+ }
46
+ const base64urlEncode = (arraybuffer) => {
47
+ const bytes = new Uint8Array(arraybuffer);
48
+ const len = bytes.length;
49
+ let i;
50
+ let base64url = '';
51
+ for (i = 0; i < len; i += 3) {
52
+ base64url += chars[bytes[i] >> 2];
53
+ base64url += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
54
+ base64url += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
55
+ base64url += chars[bytes[i + 2] & 63];
56
+ }
57
+ if (len % 3 === 2) {
58
+ base64url = base64url.substring(0, base64url.length - 1);
59
+ }
60
+ else if (len % 3 === 1) {
61
+ base64url = base64url.substring(0, base64url.length - 2);
62
+ }
63
+ return base64url;
64
+ };
65
+ const base64urlDecode = (base64string) => {
66
+ const bufferLength = base64string.length * 0.75;
67
+ let len = base64string.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
68
+ const bytes = new Uint8Array(bufferLength);
69
+ for (i = 0; i < len; i += 4) {
70
+ encoded1 = lookup[base64string.charCodeAt(i)];
71
+ encoded2 = lookup[base64string.charCodeAt(i + 1)];
72
+ encoded3 = lookup[base64string.charCodeAt(i + 2)];
73
+ encoded4 = lookup[base64string.charCodeAt(i + 3)];
74
+ bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
75
+ bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
76
+ bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
77
+ }
78
+ return bytes.buffer;
79
+ };
80
+ const publicKeyCredentialToJSON = (pubKeyCred) => {
81
+ if (pubKeyCred instanceof Array) {
82
+ const arr = [];
83
+ for (const i of pubKeyCred) {
84
+ arr.push(publicKeyCredentialToJSON(i));
85
+ }
86
+ return arr;
87
+ }
88
+ else if (pubKeyCred instanceof ArrayBuffer) {
89
+ return base64urlEncode(pubKeyCred);
90
+ }
91
+ else if (pubKeyCred instanceof Object) {
92
+ const obj = {};
93
+ for (const key in pubKeyCred) {
94
+ obj[key] = publicKeyCredentialToJSON(pubKeyCred[key]);
95
+ }
96
+ return obj;
97
+ }
98
+ return pubKeyCred;
99
+ };
41
100
 
42
101
  var LoginStep;
43
102
  (function (LoginStep) {
@@ -52,9 +111,22 @@ var LoginStep;
52
111
  LoginStep["success"] = "success";
53
112
  LoginStep["forceTwoFactor"] = "forceTwoFactor";
54
113
  LoginStep["recoverTwoFactor"] = "recoverTwoFactor";
55
- })(LoginStep || (LoginStep = {}));
114
+ })(LoginStep || (LoginStep = {}));
115
+ var LoginFlow;
116
+ (function (LoginFlow) {
117
+ LoginFlow["Login"] = "login";
118
+ LoginFlow["RegisterQuickLogin"] = "registerQuickLogin";
119
+ })(LoginFlow || (LoginFlow = {}));
120
+ var QuickLoginStrategy;
121
+ (function (QuickLoginStrategy) {
122
+ QuickLoginStrategy["Internal"] = "internal";
123
+ QuickLoginStrategy["UsbKey"] = "usb-key";
124
+ QuickLoginStrategy["Android"] = "android";
125
+ QuickLoginStrategy["Sms"] = "sms";
126
+ })(QuickLoginStrategy || (QuickLoginStrategy = {}));
56
127
 
57
128
  const loginState = {
129
+ flow: LoginFlow.Login,
58
130
  step: LoginStep.preLogin,
59
131
  loading: false,
60
132
  email: '',
@@ -81,6 +153,10 @@ const actions$g = {
81
153
  passwordlessPreLogin: createAction(`${authStoreName}/passwordlessPreLogin`, (payload) => ({ payload })),
82
154
  passwordlessPostLogin: createAction(`${authStoreName}/passwordlessPostLogin`, (payload) => ({ payload })),
83
155
  verifyInviteToken: createAction(`${authStoreName}/verifyInviteToken`, (payload) => ({ payload })),
156
+ webAuthnPrelogin: createAction(`${authStoreName}/webAuthnPrelogin`, (payload) => ({ payload })),
157
+ webAuthnPostLogin: createAction(`${authStoreName}/webAuthnPostLogin`, (payload) => ({ payload })),
158
+ webAuthnCreateNewDeviceSession: createAction(`${authStoreName}/webAuthnCreateNewDeviceSession`, (payload) => ({ payload })),
159
+ webAuthnVerifyNewDeviceSession: createAction(`${authStoreName}/webAuthnVerifyNewDeviceSession`, (payload) => ({ payload })),
84
160
  };
85
161
 
86
162
  var ActivateAccountStep;
@@ -271,11 +347,19 @@ const teamState = {
271
347
  pageSize: 20,
272
348
  errors: {},
273
349
  users: [],
350
+ allUsers: [],
274
351
  roles: [],
275
352
  permissions: [],
276
353
  totalPages: 0,
277
354
  filter: [],
278
355
  sort: [],
356
+ allUsersQueryParams: {
357
+ _filter: null,
358
+ _offset: 0,
359
+ _limit: 20,
360
+ _order: 'DESC',
361
+ _sortBy: 'name',
362
+ },
279
363
  addUserDialogState: {
280
364
  loading: false,
281
365
  open: false,
@@ -284,6 +368,10 @@ const teamState = {
284
368
  loading: false,
285
369
  open: false,
286
370
  },
371
+ lockUserDialogState: {
372
+ loading: false,
373
+ open: false,
374
+ },
287
375
  };
288
376
  const reducers$7 = {
289
377
  setTeamLoader: loadersReducerForKey('teamState'),
@@ -293,12 +381,17 @@ const reducers$7 = {
293
381
  };
294
382
  const actions$8 = {
295
383
  loadUsers: createAction(`${authStoreName}/loadUsers`, (payload) => ({ payload })),
384
+ loadAllSubTenantsUsers: createAction(`${authStoreName}/loadAllSubTenantsUsers`, (payload) => ({ payload })),
296
385
  loadRoles: createAction(`${authStoreName}/loadRoles`, (payload) => ({ payload })),
297
386
  addUser: createAction(`${authStoreName}/addUser`, (payload) => ({ payload })),
387
+ addUserToSubTenants: createAction(`${authStoreName}/addUserToSubTenants`, (payload) => ({ payload })),
298
388
  updateUser: createAction(`${authStoreName}/updateUser`, (payload) => ({
299
389
  payload,
300
390
  })),
301
391
  deleteUser: createAction(`${authStoreName}/deleteUser`, (payload) => ({ payload })),
392
+ setUserRolesForSubTenants: createAction(`${authStoreName}/setUserRolesForSubTenants`, (payload) => ({ payload })),
393
+ deleteUserFromSubTenants: createAction(`${authStoreName}/deleteUserFromSubTenants`, (payload) => ({ payload })),
394
+ lockUser: createAction(`${authStoreName}/lockUser`, (payload) => ({ payload })),
302
395
  resendActivationLink: createAction(`${authStoreName}/resendActivationLink`, (payload) => ({ payload })),
303
396
  resendInvitationLink: createAction(`${authStoreName}/resendInvitationLink`, (payload) => ({ payload })),
304
397
  getInvitationLink: createAction(`${authStoreName}/getInvitationLink`),
@@ -311,6 +404,10 @@ const actions$8 = {
311
404
  payload,
312
405
  })),
313
406
  closeDeleteUserDialog: createAction(`${authStoreName}/closeDeleteUserDialog`, (payload) => ({ payload })),
407
+ openLockUserDialog: createAction(`${authStoreName}/openLockUserDialog`, (payload) => ({
408
+ payload,
409
+ })),
410
+ closeLockUserDialog: createAction(`${authStoreName}/closeLockUserDialog`, (payload) => ({ payload })),
314
411
  };
315
412
 
316
413
  const socialLoginState = {
@@ -420,11 +517,15 @@ const securityPolicyState = {
420
517
  passwordPolicy: {
421
518
  loading: true,
422
519
  },
520
+ publicAuthStrategyPolicy: {
521
+ loading: true,
522
+ },
423
523
  };
424
524
  const reducers$3 = {
425
525
  setSecurityPolicyState: typeReducerForKey('securityPolicyState'),
426
526
  setSecurityPolicyGlobalState: typeReducerNestedKey('securityPolicyState', 'globalPolicy'),
427
527
  setSecurityPolicyPublicState: typeReducerNestedKey('securityPolicyState', 'publicPolicy'),
528
+ setSecurityPolicyAuthStrategyPublicState: typeReducerNestedKey('securityPolicyState', 'publicAuthStrategyPolicy'),
428
529
  setSecurityPolicyMfaState: typeReducerNestedKey('securityPolicyState', 'mfaPolicy'),
429
530
  setSecurityPolicyVendorMfaState: typeReducerNestedKey('securityPolicyState', 'vendorMfaPolicy'),
430
531
  setSecurityPolicyLockoutState: typeReducerNestedKey('securityPolicyState', 'lockoutPolicy'),
@@ -445,6 +546,7 @@ const actions$4 = {
445
546
  loadSecurityPolicyPasswordHistory: createAction(`${authStoreName}/loadSecurityPolicyPasswordHistory`),
446
547
  saveSecurityPolicyPasswordHistory: createAction(`${authStoreName}/saveSecurityPolicyPasswordHistory`, (payload) => ({ payload })),
447
548
  loadVendorPasswordConfig: createAction(`${authStoreName}/loadVendorPasswordConfig`),
549
+ loadPublicAuthStrategiesPolicy: createAction(`${authStoreName}/loadPublicAuthStrategiesPolicy`),
448
550
  };
449
551
 
450
552
  const accountSettingsState = {
@@ -463,6 +565,7 @@ const tenantsState = {
463
565
  tenants: [],
464
566
  subTenants: [],
465
567
  loading: true,
568
+ tenantTree: null,
466
569
  };
467
570
  const reducers$1 = {
468
571
  setTenantsState: typeReducerForKey('tenantsState'),
@@ -476,6 +579,9 @@ const actions$2 = {
476
579
  loadSubTenants: createAction(`${authStoreName}/loadSubTenants`, (payload) => ({
477
580
  payload,
478
581
  })),
582
+ loadSubTenantsTree: createAction(`${authStoreName}/loadSubTenantsTree`, (payload) => ({
583
+ payload,
584
+ })),
479
585
  };
480
586
 
481
587
  const rolesState = {
@@ -805,7 +911,26 @@ const userTeamDemo = {
805
911
  mfaEnabled: undefined,
806
912
  roles: [],
807
913
  };
914
+ const userSubTenantDemo = {
915
+ metadata: '',
916
+ mfaEnrolled: false,
917
+ permissions: [],
918
+ provider: '',
919
+ sub: '',
920
+ tenantIds: [],
921
+ tenants: [],
922
+ verified: false,
923
+ id: 'id',
924
+ email: 'email',
925
+ name: 'name',
926
+ tenantId: 'tenantId',
927
+ activatedForTenant: true,
928
+ createdAt: new Date(),
929
+ lastLogin: new Date(),
930
+ roles: [],
931
+ };
808
932
  const usersDemo = [userTeamDemo, userTeamDemo2];
933
+ const allUsersDemo = [userSubTenantDemo];
809
934
  const tenantsDemo = [
810
935
  {
811
936
  id: 'my-tenant-id',
@@ -997,6 +1122,7 @@ function* getMfaRequiredState(user) {
997
1122
  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 }) });
998
1123
  }
999
1124
  function* refreshToken() {
1125
+ var _a;
1000
1126
  try {
1001
1127
  const onRedirectTo = ContextHolder.onRedirectTo;
1002
1128
  const { routes, loginState } = yield select((state) => state.auth);
@@ -1007,18 +1133,23 @@ function* refreshToken() {
1007
1133
  onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
1008
1134
  }
1009
1135
  else {
1136
+ if (user.email) {
1137
+ localStorage.setItem('email', user.email);
1138
+ }
1139
+ const quickLoginToRegister = (_a = localStorage.getItem('register-quick-login')) !== null && _a !== void 0 ? _a : loginState.quickLoginToRegister;
1140
+ const shouldNavigateToRegisterQuicKLogin = quickLoginToRegister && localStorage.getItem(`${user.email}-${quickLoginToRegister}`) !== 'true';
1010
1141
  yield put(actions.setTenantsState({ tenants, loading: false }));
1011
- yield put(actions.setState({ user, isAuthenticated: true }));
1012
- if ([
1013
- routes.loginUrl,
1014
- routes.socialLoginCallbackUrl,
1015
- routes.signUpUrl,
1016
- routes.oidcRedirectUrl,
1017
- routes.samlCallbackUrl,
1018
- ].some((url) => url && window.location.pathname.endsWith(url))) {
1019
- if (loginState.isNewUser &&
1020
- routes.signUpSuccessUrl &&
1021
- routes.socialLoginCallbackUrl === window.location.pathname) {
1142
+ yield put(actions.setState({
1143
+ user,
1144
+ isAuthenticated: true,
1145
+ loginState: Object.assign(Object.assign({}, loginState), { quickLoginToRegister, flow: shouldNavigateToRegisterQuicKLogin ? LoginFlow.RegisterQuickLogin : LoginFlow.Login })
1146
+ }));
1147
+ if (shouldNavigateToRegisterQuicKLogin) {
1148
+ onRedirectTo(routes.loginUrl);
1149
+ }
1150
+ else if ([routes.loginUrl, routes.socialLoginCallbackUrl, routes.signUpUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl]
1151
+ .some(url => url && window.location.pathname.endsWith(url))) {
1152
+ if (loginState.isNewUser && routes.signUpSuccessUrl && routes.socialLoginCallbackUrl === window.location.pathname) {
1022
1153
  onRedirectTo(routes.signUpSuccessUrl, { refresh: routes.signUpSuccessUrl.startsWith('http') });
1023
1154
  }
1024
1155
  else {
@@ -1166,14 +1297,15 @@ function* passwordlessPostLogin(_a) {
1166
1297
  try {
1167
1298
  yield put(actions.setLoginState({ loading: true }));
1168
1299
  const data = yield call(api.auth.passwordlessPostLogin, payload);
1300
+ const onRedirectTo = ContextHolder.onRedirectTo;
1301
+ const { routes } = yield select((state) => state.auth);
1169
1302
  if (isMfaRequired(data)) {
1170
- const onRedirectTo = ContextHolder.onRedirectTo;
1171
- const { routes } = yield select((state) => state.auth);
1172
1303
  const mfaRequiredState = yield getMfaRequiredState(data);
1173
1304
  yield put(actions.setState(mfaRequiredState));
1174
1305
  onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
1175
1306
  }
1176
1307
  else {
1308
+ const { loginState } = yield select((state) => state.auth);
1177
1309
  const user = yield call(api.auth.generateLoginResponse, data);
1178
1310
  if (data.emailVerified) {
1179
1311
  (_b = events === null || events === void 0 ? void 0 : events.userVerified) === null || _b === void 0 ? void 0 : _b.call(events, {
@@ -1185,9 +1317,17 @@ function* passwordlessPostLogin(_a) {
1185
1317
  name: user.name,
1186
1318
  });
1187
1319
  }
1188
- yield put(actions.loadTenants());
1320
+ if (user.email) {
1321
+ localStorage.setItem('email', user.email);
1322
+ }
1189
1323
  yield put(actions.setState({ user, isAuthenticated: true }));
1190
- yield afterAuthNavigation();
1324
+ yield put(actions.loadTenants());
1325
+ if (loginState.flow === LoginFlow.Login) {
1326
+ yield afterAuthNavigation();
1327
+ }
1328
+ else {
1329
+ onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
1330
+ }
1191
1331
  }
1192
1332
  callback === null || callback === void 0 ? void 0 : callback(true);
1193
1333
  }
@@ -1213,14 +1353,14 @@ function* verifyInviteToken({ payload }) {
1213
1353
  yield put(actions.setLoginState({ loading: false }));
1214
1354
  }
1215
1355
  }
1216
- function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback }, }) {
1356
+ function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback, }, }) {
1217
1357
  yield put(actions.setLoginState({ loading: true }));
1218
1358
  try {
1219
1359
  const onRedirectTo = yield select(({ auth: { onRedirectTo } }) => onRedirectTo);
1220
1360
  let { address, idpType } = yield call(api.auth.preLoginV2, { email });
1221
1361
  if (address) {
1222
1362
  if (idpType === SamlVendors.Oidc && !address.includes('redirect_uri')) {
1223
- const { routes: { oidcRedirectUrl }, } = yield select(({ auth: { routes } }) => ({ routes }));
1363
+ const { routes: { oidcRedirectUrl } } = yield select(({ auth: { routes } }) => ({ routes }));
1224
1364
  address += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
1225
1365
  }
1226
1366
  yield put(actions.setLoginState({ step: LoginStep.redirectToSSO, loading: false, ssoRedirectUrl: address }));
@@ -1238,7 +1378,7 @@ function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback
1238
1378
  }
1239
1379
  function* ssoPreloginFailed(_a) {
1240
1380
  var { callback } = _a, body = __rest(_a, ["callback"]);
1241
- const publicPolicy = yield select(({ auth: { securityPolicyState: { publicPolicy: { policy: publicPolicy }, }, }, }) => publicPolicy);
1381
+ const publicPolicy = yield select(({ auth: { securityPolicyState: { publicPolicy: { policy: publicPolicy } } } }) => publicPolicy);
1242
1382
  if (!(publicPolicy === null || publicPolicy === void 0 ? void 0 : publicPolicy.authStrategy)) {
1243
1383
  yield put(actions.setLoginState({ step: LoginStep.loginWithPassword, loading: false }));
1244
1384
  callback === null || callback === void 0 ? void 0 : callback();
@@ -1256,6 +1396,90 @@ function* ssoPreloginFailed(_a) {
1256
1396
  callback === null || callback === void 0 ? void 0 : callback();
1257
1397
  }
1258
1398
  }
1399
+ function* webAuthnCreateNewDeviceSession({ payload: { callback } }) {
1400
+ try {
1401
+ yield put(actions.setLoginState({ loading: true }));
1402
+ const { options } = yield call(api.auth.webAuthnCreateNewDeviceSession);
1403
+ options.user.id = base64urlDecode(options.user.id);
1404
+ options.challenge = base64urlDecode(options.challenge);
1405
+ options.excludeCredentials = [];
1406
+ callback === null || callback === void 0 ? void 0 : callback(options);
1407
+ }
1408
+ catch (e) {
1409
+ yield put(actions.setLoginState({ error: e.message }));
1410
+ callback === null || callback === void 0 ? void 0 : callback(null);
1411
+ }
1412
+ finally {
1413
+ yield put(actions.setLoginState({ loading: false }));
1414
+ }
1415
+ }
1416
+ function* webAuthnVerifyNewDeviceSession(_a) {
1417
+ var _b = _a.payload, { callback } = _b, body = __rest(_b, ["callback"]);
1418
+ try {
1419
+ yield put(actions.setLoginState({ loading: true }));
1420
+ const publicKey = publicKeyCredentialToJSON(body.publicKey);
1421
+ yield call(api.auth.verifyNewDeviceSession, {
1422
+ id: publicKey.id,
1423
+ response: publicKey.response
1424
+ });
1425
+ callback === null || callback === void 0 ? void 0 : callback(true);
1426
+ }
1427
+ catch (e) {
1428
+ yield put(actions.setLoginState({ error: e.message }));
1429
+ callback === null || callback === void 0 ? void 0 : callback(null);
1430
+ }
1431
+ finally {
1432
+ yield put(actions.setLoginState({ loading: false }));
1433
+ }
1434
+ }
1435
+ function* webAuthnPrelogin(_a) {
1436
+ var _b;
1437
+ var _c = _a.payload, { callback } = _c, body = __rest(_c, ["callback"]);
1438
+ try {
1439
+ yield put(actions.setLoginState({ loading: true }));
1440
+ const { options } = yield call(api.auth.webAuthnPreLogin, body);
1441
+ options.challenge = base64urlDecode(options.challenge);
1442
+ options.allowCredentials = (_b = options.allowCredentials) === null || _b === void 0 ? void 0 : _b.map((credentials) => (Object.assign(Object.assign({}, credentials), { id: base64urlDecode(credentials.id) })));
1443
+ callback === null || callback === void 0 ? void 0 : callback(options);
1444
+ }
1445
+ catch (e) {
1446
+ yield put(actions.setLoginState({ error: e.message }));
1447
+ callback === null || callback === void 0 ? void 0 : callback(null);
1448
+ }
1449
+ finally {
1450
+ yield put(actions.setLoginState({ loading: false }));
1451
+ }
1452
+ }
1453
+ function* webAuthnPostLogin(_a) {
1454
+ var _b;
1455
+ var _c = _a.payload, { callback } = _c, body = __rest(_c, ["callback"]);
1456
+ try {
1457
+ yield put(actions.setLoginState({ loading: true }));
1458
+ const publicKey = publicKeyCredentialToJSON(body.publicKey);
1459
+ const data = yield call(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 }));
1460
+ if (isMfaRequired(data)) {
1461
+ const onRedirectTo = ContextHolder.onRedirectTo;
1462
+ const { routes } = yield select((state) => state.auth);
1463
+ const mfaRequiredState = yield getMfaRequiredState(data);
1464
+ yield put(actions.setState(mfaRequiredState));
1465
+ onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
1466
+ }
1467
+ else {
1468
+ const user = yield call(api.auth.generateLoginResponse, data);
1469
+ yield put(actions.loadTenants());
1470
+ yield put(actions.setState({ user, isAuthenticated: true }));
1471
+ yield afterAuthNavigation();
1472
+ }
1473
+ callback === null || callback === void 0 ? void 0 : callback(true);
1474
+ }
1475
+ catch (e) {
1476
+ yield put(actions.setLoginState({ error: e.message }));
1477
+ callback === null || callback === void 0 ? void 0 : callback(null);
1478
+ }
1479
+ finally {
1480
+ yield put(actions.setLoginState({ loading: false }));
1481
+ }
1482
+ }
1259
1483
  function* postLogin({ payload }) {
1260
1484
  const { onRedirectTo, routes } = yield select(({ auth: { onRedirectTo, routes } }) => ({ onRedirectTo, routes }));
1261
1485
  yield put(actions.setLoginState({ loading: true }));
@@ -1276,7 +1500,7 @@ function* postLogin({ payload }) {
1276
1500
  yield put(actions.setLoginState({ step: LoginStep.loginWithSSOFailed, loading: false }));
1277
1501
  }
1278
1502
  }
1279
- function* login({ payload: { email, password, recaptchaToken, invitationToken, callback }, }) {
1503
+ function* login({ payload: { email, password, recaptchaToken, invitationToken, callback, }, }) {
1280
1504
  yield put(actions.setLoginState({ loading: true }));
1281
1505
  try {
1282
1506
  const user = yield call(api.auth.login, {
@@ -1304,26 +1528,35 @@ function* login({ payload: { email, password, recaptchaToken, invitationToken, c
1304
1528
  step = LoginStep.forceTwoFactor;
1305
1529
  }
1306
1530
  }
1307
- const isAuthenticated = step === LoginStep.success && !!user.accessToken;
1308
- const loggedInUser = step === LoginStep.success && step === LoginStep.success ? user : undefined;
1531
+ const { loginState } = yield select((state) => state.auth);
1532
+ const isLoginSucceeded = step === LoginStep.success;
1533
+ const isAuthenticated = isLoginSucceeded && !!user.accessToken;
1534
+ const loggedInUser = isLoginSucceeded ? user : undefined;
1309
1535
  let allowRememberDevice = { isAllowedToRemember: false, mfaDeviceExpiration: 0 };
1310
1536
  if (user.mfaRequired && user.mfaToken) {
1311
1537
  allowRememberDevice = yield call(api.auth.checkIfAllowToRememberMfaDevice, user.mfaToken);
1312
1538
  }
1313
1539
  const { isAllowedToRemember, mfaDeviceExpiration } = allowRememberDevice;
1540
+ if (user.email) {
1541
+ localStorage.setItem('email', user.email);
1542
+ }
1314
1543
  yield put(actions.setState(Object.assign(Object.assign({ user: loggedInUser, isAuthenticated }, setMfaState), { loginState: {
1544
+ flow: loginState.flow,
1545
+ quickLoginToRegister: loginState.quickLoginToRegister,
1315
1546
  email,
1316
1547
  loading: false,
1317
1548
  error: undefined,
1318
1549
  mfaToken: user.mfaToken,
1319
- step,
1550
+ step: (!isLoginSucceeded || loginState.flow === LoginFlow.Login) ? step : loginState.step,
1320
1551
  tenants: [],
1321
1552
  tenantsLoading: true,
1322
1553
  allowRememberMfaDevice: isAllowedToRemember,
1323
1554
  mfaDeviceExpiration,
1324
1555
  } })));
1325
- if (step === LoginStep.success) {
1556
+ if (isLoginSucceeded) {
1326
1557
  yield put(actions.loadTenants());
1558
+ }
1559
+ if (isAuthenticated && loginState.flow === LoginFlow.Login) {
1327
1560
  yield afterAuthNavigation();
1328
1561
  }
1329
1562
  callback === null || callback === void 0 ? void 0 : callback(true);
@@ -1342,17 +1575,21 @@ function* loginWithMfa({ payload: { mfaToken, value, rememberDevice, callback },
1342
1575
  yield put(actions.setLoginState({ loading: true }));
1343
1576
  try {
1344
1577
  const user = yield call(api.auth.loginWithMfa, { mfaToken, value, rememberDevice });
1345
- const step = LoginStep.success;
1578
+ const { loginState } = yield select((state) => state.auth);
1579
+ const step = loginState.flow === LoginFlow.Login ? LoginStep.success : loginState.step;
1346
1580
  yield put(actions.setState({
1347
- loginState: { loading: false, error: undefined, step, tenantsLoading: true, tenants: [] },
1581
+ loginState: { flow: loginState.flow, quickLoginToRegister: loginState.quickLoginToRegister, loading: false, step, error: undefined, tenantsLoading: true, tenants: [] },
1348
1582
  user,
1349
1583
  isAuthenticated: true,
1350
1584
  }));
1585
+ if (user.email) {
1586
+ localStorage.setItem('email', user.email);
1587
+ }
1351
1588
  yield put(actions.loadTenants());
1352
- callback === null || callback === void 0 ? void 0 : callback(true);
1353
- if (step === LoginStep.success) {
1589
+ if (loginState.flow === LoginFlow.Login) {
1354
1590
  yield afterAuthNavigation();
1355
1591
  }
1592
+ callback === null || callback === void 0 ? void 0 : callback(true);
1356
1593
  }
1357
1594
  catch (e) {
1358
1595
  yield put(actions.setLoginState({ error: e.message, loading: false }));
@@ -1375,7 +1612,8 @@ function* logout({ payload }) {
1375
1612
  try {
1376
1613
  yield call(api.auth.logout);
1377
1614
  }
1378
- catch (_a) { }
1615
+ catch (_a) {
1616
+ }
1379
1617
  yield put(actions.resetState());
1380
1618
  yield put(actions.requestAuthorize(true));
1381
1619
  payload === null || payload === void 0 ? void 0 : payload();
@@ -1384,7 +1622,8 @@ function* silentLogout({ payload }) {
1384
1622
  try {
1385
1623
  yield call(api.auth.logout);
1386
1624
  }
1387
- catch (_a) { }
1625
+ catch (_a) {
1626
+ }
1388
1627
  setTimeout(() => payload === null || payload === void 0 ? void 0 : payload(), 500);
1389
1628
  }
1390
1629
  function* loginSagas() {
@@ -1402,6 +1641,11 @@ function* loginSagas() {
1402
1641
  yield takeLeading(actions.passwordlessPreLogin, passwordlessPreLogin);
1403
1642
  yield takeLeading(actions.passwordlessPostLogin, passwordlessPostLogin);
1404
1643
  yield takeLeading(actions.verifyInviteToken, verifyInviteToken);
1644
+ yield takeLeading(actions.webAuthnPrelogin, webAuthnPrelogin);
1645
+ yield takeLeading(actions.webAuthnPostLogin, webAuthnPostLogin);
1646
+ yield takeLeading(actions.webAuthnCreateNewDeviceSession, webAuthnCreateNewDeviceSession);
1647
+ yield takeLeading(actions.webAuthnVerifyNewDeviceSession, webAuthnVerifyNewDeviceSession);
1648
+ yield takeLeading(actions.afterAuthNavigation, afterAuthNavigation);
1405
1649
  }
1406
1650
  /*********************************
1407
1651
  * Preview Sagas
@@ -2448,6 +2692,48 @@ function* loadUsers({ payload }) {
2448
2692
  }
2449
2693
  yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: false }));
2450
2694
  }
2695
+ function* loadAllSubTenantsUsers({ payload, }) {
2696
+ var _a, _b, _c, _d, _e;
2697
+ const { silentLoading, callback } = payload;
2698
+ const teamState = yield selectTeamState();
2699
+ const _limit = (_a = payload._limit) !== null && _a !== void 0 ? _a : teamState.allUsersQueryParams._limit;
2700
+ const _offset = (_b = payload._offset) !== null && _b !== void 0 ? _b : teamState.allUsersQueryParams._offset;
2701
+ const _filter = (_c = payload._filter) !== null && _c !== void 0 ? _c : teamState.allUsersQueryParams._filter;
2702
+ const _sortBy = (_d = payload._sortBy) !== null && _d !== void 0 ? _d : teamState.allUsersQueryParams._sortBy;
2703
+ const _order = (_e = payload._order) !== null && _e !== void 0 ? _e : teamState.allUsersQueryParams._order;
2704
+ const allUsersQueryParams = {
2705
+ _limit: _limit || 20,
2706
+ _offset: _offset || 0,
2707
+ _filter: _filter || '',
2708
+ _sortBy: _sortBy || 'name',
2709
+ _order: _order || 'DESC',
2710
+ };
2711
+ yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: !silentLoading }));
2712
+ yield put(actions.setTeamState({
2713
+ allUsersQueryParams,
2714
+ }));
2715
+ try {
2716
+ const [{ items: users, _metadata: { totalPages, totalItems }, }, { items: roles }, { items: permissions },] = yield all([
2717
+ call(api.subTenants.loadAllUsers, Object.assign({}, allUsersQueryParams)),
2718
+ call(api.teams.loadAvailableRoles),
2719
+ call(api.teams.loadAvailablePermissions),
2720
+ ]);
2721
+ yield put(actions.setTeamState({
2722
+ allUsers: users,
2723
+ totalPages,
2724
+ totalItems,
2725
+ roles,
2726
+ permissions,
2727
+ }));
2728
+ callback === null || callback === void 0 ? void 0 : callback(users);
2729
+ }
2730
+ catch (e) {
2731
+ yield put(actions.setTeamError({ key: TeamStateKeys.USERS, value: e.message }));
2732
+ yield put(actions.setTeamState({ totalPages: 0, users: [] }));
2733
+ callback === null || callback === void 0 ? void 0 : callback(null, e);
2734
+ }
2735
+ yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: false }));
2736
+ }
2451
2737
  function* loadRoles({ payload }) {
2452
2738
  var _a, _b;
2453
2739
  yield put(actions.setTeamLoader({ key: TeamStateKeys.ROLES_AND_PERMISSIONS, value: true }));
@@ -2487,6 +2773,34 @@ function* addUser({ payload }) {
2487
2773
  callback === null || callback === void 0 ? void 0 : callback(null, e.message);
2488
2774
  }
2489
2775
  }
2776
+ function* addUserToSubTenants({ payload }) {
2777
+ const { callback } = payload, body = __rest(payload, ["callback"]);
2778
+ const teamState = yield selectTeamState();
2779
+ yield put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
2780
+ try {
2781
+ yield call(api.subTenants.addUserToTenantAndSubTenants, body);
2782
+ const { items: users, _metadata: { totalPages, totalItems }, } = yield call(api.subTenants.loadAllUsers, {
2783
+ _limit: 20,
2784
+ _offset: 0,
2785
+ _filter: '',
2786
+ _sortBy: 'name',
2787
+ _order: 'DESC',
2788
+ });
2789
+ yield put(actions.setTeamState({
2790
+ allUsers: users,
2791
+ totalPages,
2792
+ totalItems,
2793
+ addUserDialogState: { open: false, loading: false },
2794
+ }));
2795
+ callback === null || callback === void 0 ? void 0 : callback(null);
2796
+ }
2797
+ catch (e) {
2798
+ yield put(actions.setTeamState({
2799
+ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: false, error: e.message }),
2800
+ }));
2801
+ callback === null || callback === void 0 ? void 0 : callback(null, e.message);
2802
+ }
2803
+ }
2490
2804
  function* updateUser({ payload }) {
2491
2805
  var _a;
2492
2806
  const { callback, profileImage } = payload, body = __rest(payload, ["callback", "profileImage"]);
@@ -2544,6 +2858,58 @@ function* deleteUser({ payload }) {
2544
2858
  callback === null || callback === void 0 ? void 0 : callback(null, e.message);
2545
2859
  }
2546
2860
  }
2861
+ function* setUserRolesForSubTenants({ payload, }) {
2862
+ const { callback, userId } = payload, body = __rest(payload, ["callback", "userId"]);
2863
+ const teamState = yield selectTeamState();
2864
+ yield put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
2865
+ try {
2866
+ yield call(api.subTenants.setUserRolesForSubTenants, userId, body);
2867
+ const updatedUser = teamState.allUsers.find((user) => user.id === userId);
2868
+ if (updatedUser) {
2869
+ updatedUser.tenants = updatedUser.tenants.map((tenant) => {
2870
+ var _a;
2871
+ return (Object.assign(Object.assign({}, tenant), { roles: ((_a = body.subTenantsRoles
2872
+ .find((roleUpdate) => roleUpdate.tenantId === tenant.tenantId)) === null || _a === void 0 ? void 0 : _a.roleIds.map((roleId) => {
2873
+ const role = teamState.roles.find(({ id }) => roleId === id);
2874
+ return role;
2875
+ }).filter((role) => role)) || tenant.roles }));
2876
+ });
2877
+ }
2878
+ yield put(actions.setTeamState({
2879
+ allUsers: [
2880
+ ...teamState.allUsers.filter((user) => user.id !== userId),
2881
+ ...(updatedUser ? [updatedUser] : []),
2882
+ ],
2883
+ addUserDialogState: { open: false, loading: false },
2884
+ }));
2885
+ callback === null || callback === void 0 ? void 0 : callback(true);
2886
+ }
2887
+ catch (e) {
2888
+ yield put(actions.setTeamState({
2889
+ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: false, error: e.message }),
2890
+ }));
2891
+ callback === null || callback === void 0 ? void 0 : callback(null, e.message);
2892
+ }
2893
+ }
2894
+ function* deleteUserFromSubTenants({ payload }) {
2895
+ const { callback } = payload, body = __rest(payload, ["callback"]);
2896
+ const teamState = yield selectTeamState();
2897
+ yield put(actions.setTeamState({ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: true }) }));
2898
+ try {
2899
+ yield call(api.subTenants.removeUserFromTenantAndSubTenants, body);
2900
+ callback === null || callback === void 0 ? void 0 : callback(true);
2901
+ yield put(actions.setTeamState({
2902
+ allUsers: teamState.allUsers.filter((user) => user.id !== body.userId && user.tenants.length === body.subTenants.length),
2903
+ deleteUserDialogState: { open: false, loading: false },
2904
+ }));
2905
+ }
2906
+ catch (e) {
2907
+ yield put(actions.setTeamState({
2908
+ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: false, error: e.message }),
2909
+ }));
2910
+ callback === null || callback === void 0 ? void 0 : callback(null, e.message);
2911
+ }
2912
+ }
2547
2913
  function* resendActivationLink({ payload }) {
2548
2914
  const { callback } = payload, body = __rest(payload, ["callback"]);
2549
2915
  yield put(actions.setTeamLoader({ key: TeamStateKeys.RESEND_ACTIVATE_LINK, value: body.userId }));
@@ -2592,7 +2958,7 @@ function* getInvitationLink() {
2592
2958
  yield put(actions.setTeamError({ key: TeamStateKeys.GET_TOKEN_LINK, value: e.message }));
2593
2959
  }
2594
2960
  }
2595
- function* createInvitationLink({ payload: { callback } }) {
2961
+ function* createInvitationLink({ payload: { callback }, }) {
2596
2962
  yield put(actions.setTeamError({ key: TeamStateKeys.CREATE_TOKEN_LINK, value: false }));
2597
2963
  const { inviteTokenState } = yield selectTeamState();
2598
2964
  try {
@@ -2605,7 +2971,7 @@ function* createInvitationLink({ payload: { callback } }) {
2605
2971
  yield put(actions.setTeamError({ key: TeamStateKeys.CREATE_TOKEN_LINK, value: e.message }));
2606
2972
  }
2607
2973
  }
2608
- function* updateInvitationLink({ payload: { callback, expiresInMinutes, shouldSendEmail } }) {
2974
+ function* updateInvitationLink({ payload: { callback, expiresInMinutes, shouldSendEmail }, }) {
2609
2975
  const { inviteTokenState } = yield selectTeamState();
2610
2976
  yield put(actions.setTeamError({ key: TeamStateKeys.UPDATE_TOKEN_LINK, value: false }));
2611
2977
  try {
@@ -2638,7 +3004,7 @@ function* openAddUserDialog({ payload }) {
2638
3004
  }
2639
3005
  function* closeAddUserDialog({ payload }) {
2640
3006
  const teamState = yield selectTeamState();
2641
- const { addUserDialogState: { onClose } } = teamState;
3007
+ const { addUserDialogState: { onClose }, } = teamState;
2642
3008
  onClose === null || onClose === void 0 ? void 0 : onClose(payload);
2643
3009
  yield put(actions.setTeamState({
2644
3010
  addUserDialogState: {
@@ -2655,7 +3021,7 @@ function* openDeleteUserDialog({ payload }) {
2655
3021
  }
2656
3022
  function* closeDeleteUserDialog({ payload }) {
2657
3023
  const teamState = yield selectTeamState();
2658
- const { deleteUserDialogState: { onClose } } = teamState;
3024
+ const { deleteUserDialogState: { onClose }, } = teamState;
2659
3025
  onClose === null || onClose === void 0 ? void 0 : onClose(payload);
2660
3026
  yield put(actions.setTeamState({
2661
3027
  deleteUserDialogState: {
@@ -2667,10 +3033,14 @@ function* closeDeleteUserDialog({ payload }) {
2667
3033
  }
2668
3034
  function* teamSagas() {
2669
3035
  yield takeLatest(actions.loadUsers, loadUsers);
3036
+ yield takeLatest(actions.loadAllSubTenantsUsers, loadAllSubTenantsUsers);
2670
3037
  yield takeLatest(actions.loadRoles, loadRoles);
2671
3038
  yield takeEvery(actions.addUser, addUser);
3039
+ yield takeEvery(actions.addUserToSubTenants, addUserToSubTenants);
2672
3040
  yield takeEvery(actions.updateUser, updateUser);
3041
+ yield takeEvery(actions.setUserRolesForSubTenants, setUserRolesForSubTenants);
2673
3042
  yield takeEvery(actions.deleteUser, deleteUser);
3043
+ yield takeEvery(actions.deleteUserFromSubTenants, deleteUserFromSubTenants);
2674
3044
  yield takeEvery(actions.resendActivationLink, resendActivationLink);
2675
3045
  yield takeEvery(actions.resendInvitationLink, resendInvitationLink);
2676
3046
  yield takeEvery(actions.getInvitationLink, getInvitationLink);
@@ -2707,6 +3077,38 @@ function* loadUsersMock({ payload }) {
2707
3077
  yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: false }));
2708
3078
  callback === null || callback === void 0 ? void 0 : callback(usersDemo);
2709
3079
  }
3080
+ function* loadAllSubTenantsUsersMock({ payload, }) {
3081
+ var _a, _b, _c, _d, _e;
3082
+ const { silentLoading, callback } = payload;
3083
+ const teamState = yield selectTeamState();
3084
+ const _limit = (_a = payload._limit) !== null && _a !== void 0 ? _a : teamState.allUsersQueryParams._limit;
3085
+ const _offset = (_b = payload._offset) !== null && _b !== void 0 ? _b : teamState.allUsersQueryParams._offset;
3086
+ const _filter = (_c = payload._filter) !== null && _c !== void 0 ? _c : teamState.allUsersQueryParams._filter;
3087
+ const _sortBy = (_d = payload._sortBy) !== null && _d !== void 0 ? _d : teamState.allUsersQueryParams._sortBy;
3088
+ const _order = (_e = payload._order) !== null && _e !== void 0 ? _e : teamState.allUsersQueryParams._order;
3089
+ yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: !silentLoading }));
3090
+ yield put(actions.setTeamState({
3091
+ allUsersQueryParams: {
3092
+ _limit,
3093
+ _offset,
3094
+ _filter,
3095
+ _sortBy,
3096
+ _order,
3097
+ },
3098
+ }));
3099
+ const totalPages = 2;
3100
+ const totalItems = 10;
3101
+ yield delay();
3102
+ yield put(actions.setTeamState({
3103
+ allUsers: allUsersDemo,
3104
+ totalPages,
3105
+ totalItems,
3106
+ roles: rolesDemo,
3107
+ permissions: permissionsDemo,
3108
+ }));
3109
+ yield put(actions.setTeamLoader({ key: TeamStateKeys.USERS, value: false }));
3110
+ callback === null || callback === void 0 ? void 0 : callback(allUsersDemo);
3111
+ }
2710
3112
  function* loadRolesMock({ payload }) {
2711
3113
  var _a;
2712
3114
  yield put(actions.setTeamLoader({ key: TeamStateKeys.ROLES_AND_PERMISSIONS, value: true }));
@@ -2727,6 +3129,18 @@ function* addUserMock({ payload }) {
2727
3129
  addUserDialogState: { open: false, loading: false },
2728
3130
  }));
2729
3131
  }
3132
+ function* addUserToSubTenantsMock({ payload }) {
3133
+ const { callback } = payload, body = __rest(payload, ["callback"]);
3134
+ const teamState = yield selectTeamState();
3135
+ yield put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
3136
+ yield delay();
3137
+ const newUser = Object.assign(Object.assign(Object.assign({}, userTeamDemo), body), { id: `${v4()}` });
3138
+ yield put(actions.setTeamState({
3139
+ users: [newUser, ...teamState.users],
3140
+ addUserDialogState: { open: false, loading: false },
3141
+ }));
3142
+ callback === null || callback === void 0 ? void 0 : callback(null);
3143
+ }
2730
3144
  function* updateUserMock({ payload }) {
2731
3145
  var _a;
2732
3146
  const { callback, profileImage } = payload, body = __rest(payload, ["callback", "profileImage"]);
@@ -2767,6 +3181,17 @@ function* deleteUserMock({ payload }) {
2767
3181
  deleteUserDialogState: { open: false, loading: false },
2768
3182
  }));
2769
3183
  }
3184
+ function* deleteUserFromSubTenantsMock({ payload }) {
3185
+ const { callback } = payload, body = __rest(payload, ["callback"]);
3186
+ const teamState = yield selectTeamState();
3187
+ yield put(actions.setTeamState({ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: true }) }));
3188
+ yield delay();
3189
+ callback === null || callback === void 0 ? void 0 : callback(true);
3190
+ yield put(actions.setTeamState({
3191
+ allUsers: teamState.allUsers.filter((user) => user.id !== body.userId),
3192
+ deleteUserDialogState: { open: false, loading: false },
3193
+ }));
3194
+ }
2770
3195
  function* resendActivationLinkMock({ payload }) {
2771
3196
  const { callback } = payload, body = __rest(payload, ["callback"]);
2772
3197
  yield put(actions.setTeamLoader({ key: TeamStateKeys.RESEND_ACTIVATE_LINK, value: body.userId }));
@@ -2783,10 +3208,13 @@ function* resendInvitationLinkMock({ payload }) {
2783
3208
  }
2784
3209
  function* teamSagasMock() {
2785
3210
  yield takeLatest(actions.loadUsers, loadUsersMock);
3211
+ yield takeLatest(actions.loadAllSubTenantsUsers, loadAllSubTenantsUsersMock);
2786
3212
  yield takeLatest(actions.loadRoles, loadRolesMock);
2787
3213
  yield takeEvery(actions.addUser, addUserMock);
3214
+ yield takeEvery(actions.addUserToSubTenants, addUserToSubTenantsMock);
2788
3215
  yield takeEvery(actions.updateUser, updateUserMock);
2789
3216
  yield takeEvery(actions.deleteUser, deleteUserMock);
3217
+ yield takeEvery(actions.deleteUserFromSubTenants, deleteUserFromSubTenantsMock);
2790
3218
  yield takeEvery(actions.resendActivationLink, resendActivationLinkMock);
2791
3219
  yield takeEvery(actions.resendInvitationLink, resendInvitationLinkMock);
2792
3220
  yield takeEvery(actions.openAddUserDialog, openAddUserDialog);
@@ -2847,6 +3275,9 @@ function* loginViaSocialLogin(_a) {
2847
3275
  name,
2848
3276
  });
2849
3277
  }
3278
+ if (email) {
3279
+ localStorage.setItem('email', email);
3280
+ }
2850
3281
  yield put(actions.setLoginState({ email, isNewUser }));
2851
3282
  yield refreshToken();
2852
3283
  yield put(actions.setSocialLoginsState({ loading: false }));
@@ -3085,6 +3516,7 @@ function* loadSecurityPolicy() {
3085
3516
  yield put(actions.loadSecurityPolicyVendorMfa());
3086
3517
  yield put(actions.loadSecurityPolicyLockout());
3087
3518
  yield put(actions.loadSecurityPolicyCaptcha());
3519
+ yield put(actions.loadPublicAuthStrategiesPolicy());
3088
3520
  }
3089
3521
  function* loadPublicSecurityPolicy() {
3090
3522
  yield put(actions.setSecurityPolicyPublicState({ loading: true, error: null }));
@@ -3096,6 +3528,16 @@ function* loadPublicSecurityPolicy() {
3096
3528
  yield put(actions.setSecurityPolicyPublicState({ error: e.message, loading: false }));
3097
3529
  }
3098
3530
  }
3531
+ function* loadPublicAuthStrategiesPolicy() {
3532
+ yield put(actions.setSecurityPolicyAuthStrategyPublicState({ loading: true, error: null }));
3533
+ try {
3534
+ const policy = yield call(api.auth.getVendorPublicAuthStrategiesConfig);
3535
+ yield put(actions.setSecurityPolicyAuthStrategyPublicState({ policy, loading: false }));
3536
+ }
3537
+ catch (e) {
3538
+ yield put(actions.setSecurityPolicyAuthStrategyPublicState({ error: e.message, loading: false }));
3539
+ }
3540
+ }
3099
3541
  function* loadSecurityPolicyMfa() {
3100
3542
  yield put(actions.setSecurityPolicyMfaState({ loading: true, error: null }));
3101
3543
  try {
@@ -3207,6 +3649,7 @@ function* securityPolicySagas() {
3207
3649
  yield takeEvery(actions.loadSecurityPolicyPasswordHistory, loadSecurityPolicyPasswordHistory);
3208
3650
  yield takeEvery(actions.loadVendorPasswordConfig, loadVendorPasswordConfig);
3209
3651
  yield takeEvery(actions.loadPublicSecurityPolicy, loadPublicSecurityPolicy);
3652
+ yield takeEvery(actions.loadPublicAuthStrategiesPolicy, loadPublicAuthStrategiesPolicy);
3210
3653
  }
3211
3654
  /*********************************
3212
3655
  * Preview Sagas
@@ -3402,10 +3845,24 @@ function* loadSubTenants({ payload }) {
3402
3845
  (_b = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _b === void 0 ? void 0 : _b.call(payload, null, e);
3403
3846
  }
3404
3847
  }
3848
+ function* loadSubTenantsTree({ payload }) {
3849
+ var _a, _b;
3850
+ yield put(actions.setTenantsState({ loading: true }));
3851
+ try {
3852
+ const tenantTree = yield call(api.tenants.getSubTenantsAsTree);
3853
+ yield put(actions.setTenantsState({ tenantTree, loading: false }));
3854
+ (_a = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, true);
3855
+ }
3856
+ catch (e) {
3857
+ yield put(actions.setTenantsState({ loading: false }));
3858
+ (_b = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _b === void 0 ? void 0 : _b.call(payload, null, e);
3859
+ }
3860
+ }
3405
3861
  function* tenantsSagas() {
3406
3862
  yield takeEvery(actions.loadTenants, loadTenants);
3407
3863
  yield takeEvery(actions.loadSubTenants, loadSubTenants);
3408
3864
  yield takeEvery(actions.switchTenant, switchTenant);
3865
+ yield takeEvery(actions.loadSubTenantsTree, loadSubTenantsTree);
3409
3866
  }
3410
3867
  /*********************************
3411
3868
  * Preview Sagas
@@ -3618,4 +4075,4 @@ var authStore = {
3618
4075
  actions,
3619
4076
  };
3620
4077
 
3621
- export { AcceptInvitationStep, ActivateAccountStep, ApiStateKeys, AuthenticationTypes, ForgotPasswordStep, LoginStep, MFAStep, ResetPhoneNumberStep, SSOStateKeys, SamlVendors, SignUpStage, TeamStateKeys, UserVeirifedOriginTypes, actions$e as acceptInvitationActions, reducers$d as acceptInvitationReducers, acceptInvitationState, actions$3 as accountSettingsActions, reducers$2 as accountSettingsReducers, accountSettingsState, actions$f as activateAccountActions, reducers$e as activateAccountReducers, activateState, actions$5 as apiTokensActions, reducers$4 as apiTokensReducers, apiTokensState, actions as authActions, initialState as authInitialState, mockSagas as authMockSagas, reducer as authReducers, sagas as authSagas, authStore as default, actions$d as forgotPasswordActions, reducers$c as forgotPasswordReducers, forgotPasswordState, actions$g as loginActions, reducers$f as loginReducers, loginState, actions$9 as mfaActions, reducers$8 as mfaReducers, mfaState, actions$a as profileActions, reducers$9 as profileReducers, profileState, actions$c as resetPhoneNumberActions, reducers$b as resetPhoneNumberReducers, resetPhoneNumberState, actions$1 as rolesActions, reducers as rolesReducers, rolesState, actions$4 as securityPolicyActions, reducers$3 as securityPolicyReducers, securityPolicyState, actions$6 as signUpActions, reducers$5 as signUpReducers, signUpState, socialLoginState, actions$7 as socialLoginsActions, reducers$6 as socialLoginsReducer, actions$b as ssoActions, reducers$a as ssoReducers, ssoState, actions$8 as teamActions, reducers$7 as teamReducers, teamState, actions$2 as tenantsActions, reducers$1 as tenantsReducers, tenantsState };
4078
+ export { AcceptInvitationStep, ActivateAccountStep, ApiStateKeys, AuthenticationTypes, ForgotPasswordStep, LoginFlow, LoginStep, MFAStep, QuickLoginStrategy, ResetPhoneNumberStep, SSOStateKeys, SamlVendors, SignUpStage, TeamStateKeys, UserVeirifedOriginTypes, actions$e as acceptInvitationActions, reducers$d as acceptInvitationReducers, acceptInvitationState, actions$3 as accountSettingsActions, reducers$2 as accountSettingsReducers, accountSettingsState, actions$f as activateAccountActions, reducers$e as activateAccountReducers, activateState, actions$5 as apiTokensActions, reducers$4 as apiTokensReducers, apiTokensState, actions as authActions, initialState as authInitialState, mockSagas as authMockSagas, reducer as authReducers, sagas as authSagas, authStore as default, actions$d as forgotPasswordActions, reducers$c as forgotPasswordReducers, forgotPasswordState, actions$g as loginActions, reducers$f as loginReducers, loginState, actions$9 as mfaActions, reducers$8 as mfaReducers, mfaState, actions$a as profileActions, reducers$9 as profileReducers, profileState, actions$c as resetPhoneNumberActions, reducers$b as resetPhoneNumberReducers, resetPhoneNumberState, actions$1 as rolesActions, reducers as rolesReducers, rolesState, actions$4 as securityPolicyActions, reducers$3 as securityPolicyReducers, securityPolicyState, actions$6 as signUpActions, reducers$5 as signUpReducers, signUpState, socialLoginState, actions$7 as socialLoginsActions, reducers$6 as socialLoginsReducer, actions$b as ssoActions, reducers$a as ssoReducers, ssoState, actions$8 as teamActions, reducers$7 as teamReducers, teamState, actions$2 as tenantsActions, reducers$1 as tenantsReducers, tenantsState };