@frontegg/redux-store 6.136.0-alpha.9 → 6.136.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -130,6 +130,8 @@ declare const actions: {
130
130
  callback?: import("../../../interfaces").CallbackMethod<boolean> | undefined;
131
131
  }, string, never, never>;
132
132
  loadBreachedPasswordUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[ISearchUserQueryParamsV3], ISearchUserQueryParamsV3, string, never, never>;
133
+ loadUnenrolledMfaUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[ISearchUserQueryParamsV3], ISearchUserQueryParamsV3, string, never, never>;
134
+ loadInactiveUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[ISearchUserQueryParamsV3], ISearchUserQueryParamsV3, string, never, never>;
133
135
  };
134
136
  /**
135
137
  * To be used for actions types after dispatch, and should contains
@@ -144,6 +146,8 @@ declare type DispatchedActions = {
144
146
  loadInsights: () => void;
145
147
  sendResetBreachedPasswordEmails: (payload: WithCallback) => void;
146
148
  loadBreachedPasswordUsers: (payload: ISearchUserQueryParamsV3) => void;
149
+ loadUnenrolledMfaUsers: (payload: ISearchUserQueryParamsV3) => void;
150
+ loadInactiveUsers: (payload: ISearchUserQueryParamsV3) => void;
147
151
  };
148
152
  export declare type SecurityCenterActions = DispatchedActions;
149
153
  export { securityCenterState, reducers as securityCenterReducers, actions as securityCenterActions };
@@ -16,6 +16,26 @@ const securityCenterState = {
16
16
  _offset: 0,
17
17
  _limit: 10
18
18
  }
19
+ },
20
+ unenrolledMfaUsersTable: {
21
+ users: [],
22
+ usersPageOffset: 0,
23
+ totalUsersItems: 0,
24
+ totalUsersPages: 0,
25
+ queryParams: {
26
+ _offset: 0,
27
+ _limit: 10
28
+ }
29
+ },
30
+ inactiveUsersTable: {
31
+ users: [],
32
+ usersPageOffset: 0,
33
+ totalUsersItems: 0,
34
+ totalUsersPages: 0,
35
+ queryParams: {
36
+ _offset: 0,
37
+ _limit: 10
38
+ }
19
39
  }
20
40
  };
21
41
  const reducers = {
@@ -34,6 +54,12 @@ const actions = {
34
54
  })),
35
55
  loadBreachedPasswordUsers: createAction(`${authStoreName}/loadBreachedPasswordUsers`, payload => ({
36
56
  payload
57
+ })),
58
+ loadUnenrolledMfaUsers: createAction(`${authStoreName}/loadUnenrolledMfaUsers`, payload => ({
59
+ payload
60
+ })),
61
+ loadInactiveUsers: createAction(`${authStoreName}/loadInactiveUsers`, payload => ({
62
+ payload
37
63
  }))
38
64
  };
39
65
 
@@ -8,4 +8,6 @@ export interface SecurityCenterState {
8
8
  insights?: Insight[];
9
9
  score: number;
10
10
  breachedPasswordUsersTable: ISecurityCenterTable;
11
+ unenrolledMfaUsersTable: ISecurityCenterTable;
12
+ inactiveUsersTable: ISecurityCenterTable;
11
13
  }
@@ -1,5 +1,5 @@
1
1
  import { GetRecommendationsResponse, GetInsightsResponse, ISearchUserQueryParamsV3, FronteggPaginationWrapper, IRole, GetUserRolesResponse, IBaseGetUserResponse } from '@frontegg/rest-api';
2
- import { ISecurityCenterTable, TUser } from './types';
2
+ import { ISecurityCenterTable, LoadUsersTableSecurityCenter, TUser } from './types';
3
3
  import { PayloadAction, WithCallback } from '../../../index';
4
4
  /**
5
5
  * This function is used to wrap sagas of the security page.
@@ -47,13 +47,47 @@ export declare function sendResetBreachedPasswordEmails({ payload: { callback }
47
47
  * @param users - array of users
48
48
  */
49
49
  export declare function getUsersWithRoles(users: IBaseGetUserResponse[]): Generator<import("redux-saga/effects").CallEffect<IRole[]> | import("redux-saga/effects").CallEffect<GetUserRolesResponse[]>, TUser[], IRole[] & GetUserRolesResponse[]>;
50
- export declare function loadBreachedPasswordUsers({ payload }: PayloadAction<ISearchUserQueryParamsV3>): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").PutEffect<{
50
+ /**
51
+ * This function is doing the logic needed in order to display a table in a generic way.
52
+ * It calls getUsersV3 based on the params, combined the response of users with roles,
53
+ * and load it to the correct state by the updateStateKey.
54
+ * @param key - key for loaders / errors
55
+ * @param tableState - the state of the specific table
56
+ * @param updateStateKey - the key of the specific table to be updated in the state
57
+ * @param _offset - page offset
58
+ * @param _limit - limit per page
59
+ * @param _preset - preset to be send according to the table type
60
+ * @param _email - email input as searched
61
+ *
62
+ */
63
+ export declare function loadUsersTableSecurityCenter({ key, tableState, updateStateKey, _offset: offset, _limit: limit, _preset, _email, }: LoadUsersTableSecurityCenter): Generator<import("redux-saga/effects").PutEffect<{
64
+ payload: import("./types").SecurityCenterStateIndicator;
65
+ type: string;
66
+ }> | import("redux-saga/effects").PutEffect<{
67
+ payload: Partial<import("./interfaces").SecurityCenterState>;
68
+ type: string;
69
+ }> | Generator<import("redux-saga/effects").CallEffect<IRole[]> | import("redux-saga/effects").CallEffect<GetUserRolesResponse[]>, TUser[], IRole[] & GetUserRolesResponse[]> | import("redux-saga/effects").CallEffect<FronteggPaginationWrapper<IBaseGetUserResponse>>, void, FronteggPaginationWrapper<IBaseGetUserResponse> & TUser[]>;
70
+ export declare function loadBreachedPasswordUsers({ payload }: PayloadAction<ISearchUserQueryParamsV3>): Generator<import("redux-saga/effects").SelectEffect | Generator<import("redux-saga/effects").PutEffect<{
71
+ payload: import("./types").SecurityCenterStateIndicator;
72
+ type: string;
73
+ }> | import("redux-saga/effects").PutEffect<{
74
+ payload: Partial<import("./interfaces").SecurityCenterState>;
75
+ type: string;
76
+ }> | Generator<import("redux-saga/effects").CallEffect<IRole[]> | import("redux-saga/effects").CallEffect<GetUserRolesResponse[]>, TUser[], IRole[] & GetUserRolesResponse[]> | import("redux-saga/effects").CallEffect<FronteggPaginationWrapper<IBaseGetUserResponse>>, void, FronteggPaginationWrapper<IBaseGetUserResponse> & TUser[]>, void, ISecurityCenterTable>;
77
+ export declare function loadUnenrolledMfaUsers({ payload }: PayloadAction<ISearchUserQueryParamsV3>): Generator<import("redux-saga/effects").SelectEffect | Generator<import("redux-saga/effects").PutEffect<{
78
+ payload: import("./types").SecurityCenterStateIndicator;
79
+ type: string;
80
+ }> | import("redux-saga/effects").PutEffect<{
81
+ payload: Partial<import("./interfaces").SecurityCenterState>;
82
+ type: string;
83
+ }> | Generator<import("redux-saga/effects").CallEffect<IRole[]> | import("redux-saga/effects").CallEffect<GetUserRolesResponse[]>, TUser[], IRole[] & GetUserRolesResponse[]> | import("redux-saga/effects").CallEffect<FronteggPaginationWrapper<IBaseGetUserResponse>>, void, FronteggPaginationWrapper<IBaseGetUserResponse> & TUser[]>, void, ISecurityCenterTable>;
84
+ export declare function loadInactiveUsers({ payload }: PayloadAction<ISearchUserQueryParamsV3>): Generator<import("redux-saga/effects").SelectEffect | Generator<import("redux-saga/effects").PutEffect<{
51
85
  payload: import("./types").SecurityCenterStateIndicator;
52
86
  type: string;
53
87
  }> | import("redux-saga/effects").PutEffect<{
54
88
  payload: Partial<import("./interfaces").SecurityCenterState>;
55
89
  type: string;
56
- }> | Generator<import("redux-saga/effects").CallEffect<IRole[]> | import("redux-saga/effects").CallEffect<GetUserRolesResponse[]>, TUser[], IRole[] & GetUserRolesResponse[]> | import("redux-saga/effects").CallEffect<FronteggPaginationWrapper<IBaseGetUserResponse>>, void, ISecurityCenterTable & FronteggPaginationWrapper<IBaseGetUserResponse> & TUser[]>;
90
+ }> | Generator<import("redux-saga/effects").CallEffect<IRole[]> | import("redux-saga/effects").CallEffect<GetUserRolesResponse[]>, TUser[], IRole[] & GetUserRolesResponse[]> | import("redux-saga/effects").CallEffect<FronteggPaginationWrapper<IBaseGetUserResponse>>, void, FronteggPaginationWrapper<IBaseGetUserResponse> & TUser[]>, void, ISecurityCenterTable>;
57
91
  export declare function securityCenterSagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
58
92
  export declare function loadRecommendationsMock(): Generator<import("redux-saga/effects").PutEffect<{
59
93
  payload: import("./types").SecurityCenterStateIndicator;
@@ -133,11 +133,30 @@ export function* getUsersWithRoles(users) {
133
133
  });
134
134
  return usersWithRoles;
135
135
  }
136
- export function* loadBreachedPasswordUsers({
137
- payload
136
+
137
+ /**
138
+ * This function is doing the logic needed in order to display a table in a generic way.
139
+ * It calls getUsersV3 based on the params, combined the response of users with roles,
140
+ * and load it to the correct state by the updateStateKey.
141
+ * @param key - key for loaders / errors
142
+ * @param tableState - the state of the specific table
143
+ * @param updateStateKey - the key of the specific table to be updated in the state
144
+ * @param _offset - page offset
145
+ * @param _limit - limit per page
146
+ * @param _preset - preset to be send according to the table type
147
+ * @param _email - email input as searched
148
+ *
149
+ */
150
+ export function* loadUsersTableSecurityCenter({
151
+ key,
152
+ tableState,
153
+ updateStateKey,
154
+ _offset: offset,
155
+ _limit: limit,
156
+ _preset,
157
+ _email
138
158
  }) {
139
- var _select, _ref2, _payload$_offset, _breachedPasswordUser, _ref3, _payload$_limit, _breachedPasswordUser2;
140
- const key = SecurityCenterStateKeys.BREACHED_PASSWORD_USERS_TABLE;
159
+ var _ref2, _tableState$queryPara, _ref3, _tableState$queryPara2;
141
160
  yield put(actions.setSecurityCenterStateError({
142
161
  key,
143
162
  value: false
@@ -146,20 +165,13 @@ export function* loadBreachedPasswordUsers({
146
165
  key,
147
166
  value: true
148
167
  }));
149
- const breachedPasswordUsersTable = yield (_select = select(state => {
150
- var _state$auth$securityC;
151
- return (_state$auth$securityC = state.auth.securityCenterState) == null ? void 0 : _state$auth$securityC.breachedPasswordUsersTable;
152
- })) != null ? _select : {};
153
- const _offset = (_ref2 = (_payload$_offset = payload == null ? void 0 : payload._offset) != null ? _payload$_offset : breachedPasswordUsersTable == null ? void 0 : (_breachedPasswordUser = breachedPasswordUsersTable.queryParams) == null ? void 0 : _breachedPasswordUser._offset) != null ? _ref2 : 0;
154
- const _limit = (_ref3 = (_payload$_limit = payload == null ? void 0 : payload._limit) != null ? _payload$_limit : breachedPasswordUsersTable == null ? void 0 : (_breachedPasswordUser2 = breachedPasswordUsersTable.queryParams) == null ? void 0 : _breachedPasswordUser2._limit) != null ? _ref3 : 10;
155
- const {
156
- _email
157
- } = payload;
158
- const breachedPasswordUsersQueryParams = _extends({
168
+ const _offset = (_ref2 = offset != null ? offset : tableState == null ? void 0 : (_tableState$queryPara = tableState.queryParams) == null ? void 0 : _tableState$queryPara._offset) != null ? _ref2 : 0;
169
+ const _limit = (_ref3 = limit != null ? limit : tableState == null ? void 0 : (_tableState$queryPara2 = tableState.queryParams) == null ? void 0 : _tableState$queryPara2._limit) != null ? _ref3 : 10;
170
+ const tableStateQueryParams = _extends({
159
171
  _offset,
160
172
  _limit,
161
173
  _includeSubTenants: false,
162
- _preset: GetUsersFilterPreset.BREACHED_PASSWORDS
174
+ _preset
163
175
  }, !!_email && {
164
176
  _email
165
177
  });
@@ -170,8 +182,8 @@ export function* loadBreachedPasswordUsers({
170
182
  totalItems,
171
183
  totalPages
172
184
  }
173
- } = yield call(api.users.getUsersV3, breachedPasswordUsersQueryParams);
174
- const breachedPasswordUsersTableStateObj = {
185
+ } = yield call(api.users.getUsersV3, tableStateQueryParams);
186
+ const partialTableObj = {
175
187
  totalUsersItems: totalItems,
176
188
  totalUsersPages: totalPages,
177
189
  usersPageOffset: _offset,
@@ -185,15 +197,15 @@ export function* loadBreachedPasswordUsers({
185
197
  if (usersItems.length) {
186
198
  const usersWithRoles = yield getUsersWithRoles(usersItems);
187
199
  yield put(actions.setSecurityCenterState({
188
- breachedPasswordUsersTable: _extends({
200
+ [updateStateKey]: _extends({
189
201
  users: usersWithRoles
190
- }, breachedPasswordUsersTableStateObj)
202
+ }, partialTableObj)
191
203
  }));
192
204
  } else {
193
205
  yield put(actions.setSecurityCenterState({
194
- breachedPasswordUsersTable: _extends({
206
+ [updateStateKey]: _extends({
195
207
  users: []
196
- }, breachedPasswordUsersTableStateObj)
208
+ }, partialTableObj)
197
209
  }));
198
210
  }
199
211
  } catch (e) {
@@ -208,11 +220,62 @@ export function* loadBreachedPasswordUsers({
208
220
  }));
209
221
  }
210
222
  }
223
+ export function* loadBreachedPasswordUsers({
224
+ payload
225
+ }) {
226
+ var _select;
227
+ const key = SecurityCenterStateKeys.BREACHED_PASSWORD_USERS_TABLE;
228
+ const breachedPasswordUsersTable = yield (_select = select(state => {
229
+ var _state$auth$securityC;
230
+ return (_state$auth$securityC = state.auth.securityCenterState) == null ? void 0 : _state$auth$securityC.breachedPasswordUsersTable;
231
+ })) != null ? _select : {};
232
+ yield loadUsersTableSecurityCenter(_extends({
233
+ key,
234
+ updateStateKey: 'breachedPasswordUsersTable',
235
+ _preset: GetUsersFilterPreset.BREACHED_PASSWORDS,
236
+ tableState: breachedPasswordUsersTable
237
+ }, payload));
238
+ }
239
+ export function* loadUnenrolledMfaUsers({
240
+ payload
241
+ }) {
242
+ var _select2;
243
+ const key = SecurityCenterStateKeys.UNENROLLED_MFA_USERS_TABLE;
244
+ const unenrolledMfaUsersTable = yield (_select2 = select(state => {
245
+ var _state$auth$securityC2;
246
+ return (_state$auth$securityC2 = state.auth.securityCenterState) == null ? void 0 : _state$auth$securityC2.unenrolledMfaUsersTable;
247
+ })) != null ? _select2 : {};
248
+ yield loadUsersTableSecurityCenter(_extends({
249
+ key,
250
+ updateStateKey: 'unenrolledMfaUsersTable',
251
+ _preset: GetUsersFilterPreset.MFA_UNENROLLED,
252
+ tableState: unenrolledMfaUsersTable
253
+ }, payload));
254
+ }
255
+ export function* loadInactiveUsers({
256
+ payload
257
+ }) {
258
+ var _select3;
259
+ const key = SecurityCenterStateKeys.INACTIVE_USERS_TABLE;
260
+ const inactiveUsersTable = yield (_select3 = select(state => {
261
+ var _state$auth$securityC3;
262
+ return (_state$auth$securityC3 = state.auth.securityCenterState) == null ? void 0 : _state$auth$securityC3.inactiveUsersTable;
263
+ })) != null ? _select3 : {};
264
+
265
+ //TODO: add preset for inactivity and filter by last time activity
266
+ yield loadUsersTableSecurityCenter(_extends({
267
+ key,
268
+ updateStateKey: 'inactiveUsersTable',
269
+ tableState: inactiveUsersTable
270
+ }, payload));
271
+ }
211
272
  export function* securityCenterSagas() {
212
273
  yield takeEvery(actions.loadRecommendations, loadRecommendations);
213
274
  yield takeEvery(actions.loadInsights, loadInsights);
214
275
  yield takeEvery(actions.sendResetBreachedPasswordEmails, sendResetBreachedPasswordEmails);
215
276
  yield takeEvery(actions.loadBreachedPasswordUsers, loadBreachedPasswordUsers);
277
+ yield takeEvery(actions.loadUnenrolledMfaUsers, loadUnenrolledMfaUsers);
278
+ yield takeEvery(actions.loadInactiveUsers, loadInactiveUsers);
216
279
  }
217
280
 
218
281
  //MOCK SAGAS
@@ -3,7 +3,9 @@ export declare enum SecurityCenterStateKeys {
3
3
  RECOMMENDATIONS = "recommendations",
4
4
  INSIGHTS = "insights",
5
5
  SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS = "sendBulkResetBreachedPasswordEmails",
6
- BREACHED_PASSWORD_USERS_TABLE = "breachedPasswordUsersTable"
6
+ BREACHED_PASSWORD_USERS_TABLE = "breachedPasswordUsersTable",
7
+ UNENROLLED_MFA_USERS_TABLE = "unenrolledMfaUsersTable",
8
+ INACTIVE_USERS_TABLE = "inactiveUsersTable"
7
9
  }
8
10
  export declare type SecurityCenterStateIndicator = {
9
11
  key: SecurityCenterStateKeys;
@@ -19,3 +21,9 @@ export interface ISecurityCenterTable {
19
21
  usersPageOffset?: number;
20
22
  queryParams?: ISearchUserQueryParamsV3;
21
23
  }
24
+ export declare type SecurityCenterTablesKeys = 'breachedPasswordUsersTable' | 'unenrolledMfaUsersTable' | 'inactiveUsersTable';
25
+ export declare type LoadUsersTableSecurityCenter = ISearchUserQueryParamsV3 & {
26
+ key: SecurityCenterStateKeys;
27
+ tableState: ISecurityCenterTable;
28
+ updateStateKey: SecurityCenterTablesKeys;
29
+ };
@@ -4,4 +4,6 @@ export let SecurityCenterStateKeys;
4
4
  SecurityCenterStateKeys["INSIGHTS"] = "insights";
5
5
  SecurityCenterStateKeys["SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS"] = "sendBulkResetBreachedPasswordEmails";
6
6
  SecurityCenterStateKeys["BREACHED_PASSWORD_USERS_TABLE"] = "breachedPasswordUsersTable";
7
+ SecurityCenterStateKeys["UNENROLLED_MFA_USERS_TABLE"] = "unenrolledMfaUsersTable";
8
+ SecurityCenterStateKeys["INACTIVE_USERS_TABLE"] = "inactiveUsersTable";
7
9
  })(SecurityCenterStateKeys || (SecurityCenterStateKeys = {}));
package/auth/index.d.ts CHANGED
@@ -78,6 +78,8 @@ declare const _default: {
78
78
  callback?: import("..").CallbackMethod<boolean> | undefined;
79
79
  }, string, never, never>;
80
80
  loadBreachedPasswordUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISearchUserQueryParamsV3], import("@frontegg/rest-api").ISearchUserQueryParamsV3, string, never, never>;
81
+ loadUnenrolledMfaUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISearchUserQueryParamsV3], import("@frontegg/rest-api").ISearchUserQueryParamsV3, string, never, never>;
82
+ loadInactiveUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISearchUserQueryParamsV3], import("@frontegg/rest-api").ISearchUserQueryParamsV3, string, never, never>;
81
83
  loadAccounts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").SearchSubTenantsParams & {
82
84
  _links?: import("@frontegg/rest-api").FronteggPaginationLinks | undefined;
83
85
  } & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").SearchSubTenantsParams & {
package/auth/reducer.d.ts CHANGED
@@ -38,6 +38,8 @@ declare const actions: {
38
38
  callback?: import("..").CallbackMethod<boolean> | undefined;
39
39
  }, string, never, never>;
40
40
  loadBreachedPasswordUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISearchUserQueryParamsV3], import("@frontegg/rest-api").ISearchUserQueryParamsV3, string, never, never>;
41
+ loadUnenrolledMfaUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISearchUserQueryParamsV3], import("@frontegg/rest-api").ISearchUserQueryParamsV3, string, never, never>;
42
+ loadInactiveUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISearchUserQueryParamsV3], import("@frontegg/rest-api").ISearchUserQueryParamsV3, string, never, never>;
41
43
  loadAccounts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").SearchSubTenantsParams & {
42
44
  _links?: import("@frontegg/rest-api").FronteggPaginationLinks | undefined;
43
45
  } & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").SearchSubTenantsParams & {
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.136.0-alpha.9
1
+ /** @license Frontegg v6.136.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -22,6 +22,26 @@ const securityCenterState = {
22
22
  _offset: 0,
23
23
  _limit: 10
24
24
  }
25
+ },
26
+ unenrolledMfaUsersTable: {
27
+ users: [],
28
+ usersPageOffset: 0,
29
+ totalUsersItems: 0,
30
+ totalUsersPages: 0,
31
+ queryParams: {
32
+ _offset: 0,
33
+ _limit: 10
34
+ }
35
+ },
36
+ inactiveUsersTable: {
37
+ users: [],
38
+ usersPageOffset: 0,
39
+ totalUsersItems: 0,
40
+ totalUsersPages: 0,
41
+ queryParams: {
42
+ _offset: 0,
43
+ _limit: 10
44
+ }
25
45
  }
26
46
  };
27
47
  exports.securityCenterState = securityCenterState;
@@ -42,6 +62,12 @@ const actions = {
42
62
  })),
43
63
  loadBreachedPasswordUsers: (0, _toolkit.createAction)(`${_constants.authStoreName}/loadBreachedPasswordUsers`, payload => ({
44
64
  payload
65
+ })),
66
+ loadUnenrolledMfaUsers: (0, _toolkit.createAction)(`${_constants.authStoreName}/loadUnenrolledMfaUsers`, payload => ({
67
+ payload
68
+ })),
69
+ loadInactiveUsers: (0, _toolkit.createAction)(`${_constants.authStoreName}/loadInactiveUsers`, payload => ({
70
+ payload
45
71
  }))
46
72
  };
47
73
 
@@ -6,10 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.getUsersWithRoles = getUsersWithRoles;
8
8
  exports.loadBreachedPasswordUsers = loadBreachedPasswordUsers;
9
+ exports.loadInactiveUsers = loadInactiveUsers;
9
10
  exports.loadInsights = loadInsights;
10
11
  exports.loadInsightsMock = loadInsightsMock;
11
12
  exports.loadRecommendations = loadRecommendations;
12
13
  exports.loadRecommendationsMock = loadRecommendationsMock;
14
+ exports.loadUnenrolledMfaUsers = loadUnenrolledMfaUsers;
15
+ exports.loadUsersTableSecurityCenter = loadUsersTableSecurityCenter;
13
16
  exports.securityCenterSagaWrapper = securityCenterSagaWrapper;
14
17
  exports.securityCenterSagas = securityCenterSagas;
15
18
  exports.securityCenterSagasMock = securityCenterSagasMock;
@@ -148,11 +151,30 @@ function* getUsersWithRoles(users) {
148
151
  });
149
152
  return usersWithRoles;
150
153
  }
151
- function* loadBreachedPasswordUsers({
152
- payload
154
+
155
+ /**
156
+ * This function is doing the logic needed in order to display a table in a generic way.
157
+ * It calls getUsersV3 based on the params, combined the response of users with roles,
158
+ * and load it to the correct state by the updateStateKey.
159
+ * @param key - key for loaders / errors
160
+ * @param tableState - the state of the specific table
161
+ * @param updateStateKey - the key of the specific table to be updated in the state
162
+ * @param _offset - page offset
163
+ * @param _limit - limit per page
164
+ * @param _preset - preset to be send according to the table type
165
+ * @param _email - email input as searched
166
+ *
167
+ */
168
+ function* loadUsersTableSecurityCenter({
169
+ key,
170
+ tableState,
171
+ updateStateKey,
172
+ _offset: offset,
173
+ _limit: limit,
174
+ _preset,
175
+ _email
153
176
  }) {
154
- var _select, _ref2, _payload$_offset, _breachedPasswordUser, _ref3, _payload$_limit, _breachedPasswordUser2;
155
- const key = _types.SecurityCenterStateKeys.BREACHED_PASSWORD_USERS_TABLE;
177
+ var _ref2, _tableState$queryPara, _ref3, _tableState$queryPara2;
156
178
  yield (0, _effects.put)(_reducer.actions.setSecurityCenterStateError({
157
179
  key,
158
180
  value: false
@@ -161,20 +183,13 @@ function* loadBreachedPasswordUsers({
161
183
  key,
162
184
  value: true
163
185
  }));
164
- const breachedPasswordUsersTable = yield (_select = (0, _effects.select)(state => {
165
- var _state$auth$securityC;
166
- return (_state$auth$securityC = state.auth.securityCenterState) == null ? void 0 : _state$auth$securityC.breachedPasswordUsersTable;
167
- })) != null ? _select : {};
168
- const _offset = (_ref2 = (_payload$_offset = payload == null ? void 0 : payload._offset) != null ? _payload$_offset : breachedPasswordUsersTable == null ? void 0 : (_breachedPasswordUser = breachedPasswordUsersTable.queryParams) == null ? void 0 : _breachedPasswordUser._offset) != null ? _ref2 : 0;
169
- const _limit = (_ref3 = (_payload$_limit = payload == null ? void 0 : payload._limit) != null ? _payload$_limit : breachedPasswordUsersTable == null ? void 0 : (_breachedPasswordUser2 = breachedPasswordUsersTable.queryParams) == null ? void 0 : _breachedPasswordUser2._limit) != null ? _ref3 : 10;
170
- const {
171
- _email
172
- } = payload;
173
- const breachedPasswordUsersQueryParams = (0, _extends2.default)({
186
+ const _offset = (_ref2 = offset != null ? offset : tableState == null ? void 0 : (_tableState$queryPara = tableState.queryParams) == null ? void 0 : _tableState$queryPara._offset) != null ? _ref2 : 0;
187
+ const _limit = (_ref3 = limit != null ? limit : tableState == null ? void 0 : (_tableState$queryPara2 = tableState.queryParams) == null ? void 0 : _tableState$queryPara2._limit) != null ? _ref3 : 10;
188
+ const tableStateQueryParams = (0, _extends2.default)({
174
189
  _offset,
175
190
  _limit,
176
191
  _includeSubTenants: false,
177
- _preset: _restApi.GetUsersFilterPreset.BREACHED_PASSWORDS
192
+ _preset
178
193
  }, !!_email && {
179
194
  _email
180
195
  });
@@ -185,8 +200,8 @@ function* loadBreachedPasswordUsers({
185
200
  totalItems,
186
201
  totalPages
187
202
  }
188
- } = yield (0, _effects.call)(_restApi.api.users.getUsersV3, breachedPasswordUsersQueryParams);
189
- const breachedPasswordUsersTableStateObj = {
203
+ } = yield (0, _effects.call)(_restApi.api.users.getUsersV3, tableStateQueryParams);
204
+ const partialTableObj = {
190
205
  totalUsersItems: totalItems,
191
206
  totalUsersPages: totalPages,
192
207
  usersPageOffset: _offset,
@@ -200,15 +215,15 @@ function* loadBreachedPasswordUsers({
200
215
  if (usersItems.length) {
201
216
  const usersWithRoles = yield getUsersWithRoles(usersItems);
202
217
  yield (0, _effects.put)(_reducer.actions.setSecurityCenterState({
203
- breachedPasswordUsersTable: (0, _extends2.default)({
218
+ [updateStateKey]: (0, _extends2.default)({
204
219
  users: usersWithRoles
205
- }, breachedPasswordUsersTableStateObj)
220
+ }, partialTableObj)
206
221
  }));
207
222
  } else {
208
223
  yield (0, _effects.put)(_reducer.actions.setSecurityCenterState({
209
- breachedPasswordUsersTable: (0, _extends2.default)({
224
+ [updateStateKey]: (0, _extends2.default)({
210
225
  users: []
211
- }, breachedPasswordUsersTableStateObj)
226
+ }, partialTableObj)
212
227
  }));
213
228
  }
214
229
  } catch (e) {
@@ -223,11 +238,62 @@ function* loadBreachedPasswordUsers({
223
238
  }));
224
239
  }
225
240
  }
241
+ function* loadBreachedPasswordUsers({
242
+ payload
243
+ }) {
244
+ var _select;
245
+ const key = _types.SecurityCenterStateKeys.BREACHED_PASSWORD_USERS_TABLE;
246
+ const breachedPasswordUsersTable = yield (_select = (0, _effects.select)(state => {
247
+ var _state$auth$securityC;
248
+ return (_state$auth$securityC = state.auth.securityCenterState) == null ? void 0 : _state$auth$securityC.breachedPasswordUsersTable;
249
+ })) != null ? _select : {};
250
+ yield loadUsersTableSecurityCenter((0, _extends2.default)({
251
+ key,
252
+ updateStateKey: 'breachedPasswordUsersTable',
253
+ _preset: _restApi.GetUsersFilterPreset.BREACHED_PASSWORDS,
254
+ tableState: breachedPasswordUsersTable
255
+ }, payload));
256
+ }
257
+ function* loadUnenrolledMfaUsers({
258
+ payload
259
+ }) {
260
+ var _select2;
261
+ const key = _types.SecurityCenterStateKeys.UNENROLLED_MFA_USERS_TABLE;
262
+ const unenrolledMfaUsersTable = yield (_select2 = (0, _effects.select)(state => {
263
+ var _state$auth$securityC2;
264
+ return (_state$auth$securityC2 = state.auth.securityCenterState) == null ? void 0 : _state$auth$securityC2.unenrolledMfaUsersTable;
265
+ })) != null ? _select2 : {};
266
+ yield loadUsersTableSecurityCenter((0, _extends2.default)({
267
+ key,
268
+ updateStateKey: 'unenrolledMfaUsersTable',
269
+ _preset: _restApi.GetUsersFilterPreset.MFA_UNENROLLED,
270
+ tableState: unenrolledMfaUsersTable
271
+ }, payload));
272
+ }
273
+ function* loadInactiveUsers({
274
+ payload
275
+ }) {
276
+ var _select3;
277
+ const key = _types.SecurityCenterStateKeys.INACTIVE_USERS_TABLE;
278
+ const inactiveUsersTable = yield (_select3 = (0, _effects.select)(state => {
279
+ var _state$auth$securityC3;
280
+ return (_state$auth$securityC3 = state.auth.securityCenterState) == null ? void 0 : _state$auth$securityC3.inactiveUsersTable;
281
+ })) != null ? _select3 : {};
282
+
283
+ //TODO: add preset for inactivity and filter by last time activity
284
+ yield loadUsersTableSecurityCenter((0, _extends2.default)({
285
+ key,
286
+ updateStateKey: 'inactiveUsersTable',
287
+ tableState: inactiveUsersTable
288
+ }, payload));
289
+ }
226
290
  function* securityCenterSagas() {
227
291
  yield (0, _effects.takeEvery)(_reducer.actions.loadRecommendations, loadRecommendations);
228
292
  yield (0, _effects.takeEvery)(_reducer.actions.loadInsights, loadInsights);
229
293
  yield (0, _effects.takeEvery)(_reducer.actions.sendResetBreachedPasswordEmails, sendResetBreachedPasswordEmails);
230
294
  yield (0, _effects.takeEvery)(_reducer.actions.loadBreachedPasswordUsers, loadBreachedPasswordUsers);
295
+ yield (0, _effects.takeEvery)(_reducer.actions.loadUnenrolledMfaUsers, loadUnenrolledMfaUsers);
296
+ yield (0, _effects.takeEvery)(_reducer.actions.loadInactiveUsers, loadInactiveUsers);
231
297
  }
232
298
 
233
299
  //MOCK SAGAS
@@ -11,4 +11,6 @@ exports.SecurityCenterStateKeys = SecurityCenterStateKeys;
11
11
  SecurityCenterStateKeys["INSIGHTS"] = "insights";
12
12
  SecurityCenterStateKeys["SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS"] = "sendBulkResetBreachedPasswordEmails";
13
13
  SecurityCenterStateKeys["BREACHED_PASSWORD_USERS_TABLE"] = "breachedPasswordUsersTable";
14
+ SecurityCenterStateKeys["UNENROLLED_MFA_USERS_TABLE"] = "unenrolledMfaUsersTable";
15
+ SecurityCenterStateKeys["INACTIVE_USERS_TABLE"] = "inactiveUsersTable";
14
16
  })(SecurityCenterStateKeys || (exports.SecurityCenterStateKeys = SecurityCenterStateKeys = {}));
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.136.0-alpha.9
1
+ /** @license Frontegg v6.136.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "6.136.0-alpha.9",
3
+ "version": "6.136.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
- "@frontegg/rest-api": "3.1.13",
9
+ "@frontegg/rest-api": "3.1.15",
10
10
  "@reduxjs/toolkit": "1.8.5",
11
11
  "fast-deep-equal": "3.1.3",
12
12
  "redux-saga": "^1.2.1",