@frontegg/redux-store 6.69.0 → 6.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/audits/AuditLogsState/index.js +1 -1
- package/audits/AuditLogsState/saga.js +1 -18
- package/audits/AuditsMetadataState/index.js +1 -1
- package/audits/AuditsMetadataState/saga.js +1 -5
- package/audits/backward-compatibility/saga.js +0 -18
- package/audits/dummy.js +0 -16
- package/audits/index.js +4 -2
- package/audits/reducer.js +0 -2
- package/auth/AcceptInvitationState/index.d.ts +2 -0
- package/auth/AcceptInvitationState/index.js +1 -1
- package/auth/AcceptInvitationState/interfaces.js +0 -1
- package/auth/AcceptInvitationState/saga.js +0 -3
- package/auth/AccountSettingsState/index.d.ts +2 -0
- package/auth/AccountSettingsState/index.js +1 -1
- package/auth/AccountSettingsState/interfaces.d.ts +2 -0
- package/auth/AccountSettingsState/saga.js +1 -11
- package/auth/ActivateState/index.d.ts +3 -0
- package/auth/ActivateState/index.js +1 -1
- package/auth/ActivateState/interfaces.js +0 -1
- package/auth/ActivateState/saga.js +14 -34
- package/auth/ApiTokensState/index.d.ts +2 -0
- package/auth/ApiTokensState/index.js +1 -1
- package/auth/ApiTokensState/interfaces.d.ts +1 -0
- package/auth/ApiTokensState/interfaces.js +0 -1
- package/auth/ApiTokensState/saga.js +1 -44
- package/auth/ForgotPasswordState/index.d.ts +2 -0
- package/auth/ForgotPasswordState/index.js +1 -1
- package/auth/ForgotPasswordState/interfaces.js +0 -1
- package/auth/ForgotPasswordState/saga.js +5 -12
- package/auth/ImpersonationState/index.d.ts +2 -0
- package/auth/ImpersonationState/index.js +1 -1
- package/auth/ImpersonationState/interfaces.js +0 -1
- package/auth/ImpersonationState/saga.js +5 -9
- package/auth/LoginState/index.d.ts +2 -0
- package/auth/LoginState/index.js +1 -1
- package/auth/LoginState/interfaces.js +0 -6
- package/auth/LoginState/saga.d.ts +2 -38
- package/auth/LoginState/saga.js +132 -292
- package/auth/MfaState/index.d.ts +4 -2
- package/auth/MfaState/index.js +1 -1
- package/auth/MfaState/interfaces.d.ts +2 -2
- package/auth/MfaState/interfaces.js +0 -1
- package/auth/MfaState/saga.js +64 -143
- package/auth/ProfileState/index.d.ts +2 -0
- package/auth/ProfileState/index.js +1 -1
- package/auth/ProfileState/saga.js +22 -50
- package/auth/Provisioning/index.d.ts +2 -0
- package/auth/Provisioning/index.js +1 -1
- package/auth/Provisioning/saga.js +11 -23
- package/auth/ResetPhoneNumberState/index.d.ts +2 -0
- package/auth/ResetPhoneNumberState/index.js +1 -1
- package/auth/ResetPhoneNumberState/interfaces.js +0 -1
- package/auth/ResetPhoneNumberState/saga.js +17 -26
- package/auth/RestrictionsState/index.d.ts +3 -0
- package/auth/RestrictionsState/index.js +1 -1
- package/auth/RestrictionsState/saga.js +52 -105
- package/auth/RolesState/index.d.ts +2 -0
- package/auth/RolesState/index.js +1 -1
- package/auth/RolesState/saga.js +30 -51
- package/auth/SSOState/index.d.ts +2 -0
- package/auth/SSOState/index.js +1 -1
- package/auth/SSOState/interfaces.js +0 -3
- package/auth/SSOState/saga.js +10 -58
- package/auth/SSOState/saga.v2.js +13 -49
- package/auth/SecurityPolicyState/index.d.ts +13 -0
- package/auth/SecurityPolicyState/index.js +1 -1
- package/auth/SecurityPolicyState/saga.js +36 -90
- package/auth/SessionsPolicyState/index.d.ts +2 -0
- package/auth/SessionsPolicyState/index.js +1 -1
- package/auth/SessionsPolicyState/saga.js +7 -19
- package/auth/SessionsState/index.d.ts +2 -0
- package/auth/SessionsState/index.js +1 -1
- package/auth/SessionsState/saga.js +1 -15
- package/auth/SignUp/index.d.ts +2 -0
- package/auth/SignUp/index.js +1 -1
- package/auth/SignUp/interfaces.js +0 -1
- package/auth/SignUp/saga.js +6 -15
- package/auth/SocialLogins/index.d.ts +2 -0
- package/auth/SocialLogins/index.js +1 -1
- package/auth/SocialLogins/saga.js +10 -20
- package/auth/TeamState/index.d.ts +2 -0
- package/auth/TeamState/index.js +1 -1
- package/auth/TeamState/interfaces.js +0 -1
- package/auth/TeamState/saga.js +85 -205
- package/auth/TenantsState/index.d.ts +2 -0
- package/auth/TenantsState/index.js +1 -1
- package/auth/TenantsState/saga.js +1 -17
- package/auth/index.d.ts +2 -2
- package/auth/index.js +4 -3
- package/auth/interfaces.d.ts +2 -1
- package/auth/interfaces.js +0 -6
- package/auth/reducer.d.ts +2 -2
- package/auth/reducer.js +0 -2
- package/auth/saga.js +2 -1
- package/auth/utils.d.ts +4 -0
- package/auth/utils.js +7 -21
- package/connectivity/ConnectivityState/index.d.ts +9 -0
- package/connectivity/ConnectivityState/index.js +1 -1
- package/connectivity/consts.js +0 -5
- package/connectivity/index.js +4 -2
- package/connectivity/interfaces.d.ts +1 -0
- package/connectivity/reducer.js +0 -2
- package/connectivity/saga.js +48 -85
- package/helpers.js +4 -7
- package/index.js +1 -1
- package/node/audits/AuditLogsState/index.js +1 -8
- package/node/audits/AuditLogsState/saga.js +1 -26
- package/node/audits/AuditsMetadataState/index.js +1 -8
- package/node/audits/AuditsMetadataState/saga.js +1 -10
- package/node/audits/backward-compatibility/index.js +0 -8
- package/node/audits/backward-compatibility/reducer.js +0 -5
- package/node/audits/backward-compatibility/saga.js +0 -23
- package/node/audits/dummy.js +0 -19
- package/node/audits/index.js +0 -14
- package/node/audits/initialState.js +0 -3
- package/node/audits/reducer.js +0 -8
- package/node/audits/saga.js +0 -5
- package/node/audits/utils.js +0 -4
- package/node/auth/AcceptInvitationState/index.js +1 -7
- package/node/auth/AcceptInvitationState/interfaces.js +0 -1
- package/node/auth/AcceptInvitationState/saga.js +0 -7
- package/node/auth/AccountSettingsState/index.js +1 -6
- package/node/auth/AccountSettingsState/saga.js +1 -16
- package/node/auth/ActivateState/index.js +1 -7
- package/node/auth/ActivateState/interfaces.js +0 -1
- package/node/auth/ActivateState/saga.js +14 -41
- package/node/auth/ApiTokensState/index.js +1 -6
- package/node/auth/ApiTokensState/interfaces.js +0 -1
- package/node/auth/ApiTokensState/saga.js +1 -51
- package/node/auth/ForgotPasswordState/index.js +1 -7
- package/node/auth/ForgotPasswordState/interfaces.js +0 -1
- package/node/auth/ForgotPasswordState/saga.js +5 -19
- package/node/auth/ImpersonationState/index.js +1 -7
- package/node/auth/ImpersonationState/interfaces.js +0 -1
- package/node/auth/ImpersonationState/saga.js +5 -15
- package/node/auth/LoginState/index.js +1 -7
- package/node/auth/LoginState/interfaces.js +0 -7
- package/node/auth/LoginState/saga.js +132 -322
- package/node/auth/MfaState/index.js +1 -7
- package/node/auth/MfaState/interfaces.js +0 -1
- package/node/auth/MfaState/saga.js +64 -137
- package/node/auth/ProfileState/index.js +1 -6
- package/node/auth/ProfileState/saga.js +22 -58
- package/node/auth/Provisioning/index.js +1 -6
- package/node/auth/Provisioning/saga.js +11 -28
- package/node/auth/ResetPhoneNumberState/index.js +1 -7
- package/node/auth/ResetPhoneNumberState/interfaces.js +0 -1
- package/node/auth/ResetPhoneNumberState/saga.js +17 -32
- package/node/auth/RestrictionsState/index.js +1 -7
- package/node/auth/RestrictionsState/saga.js +52 -109
- package/node/auth/RolesState/index.js +1 -6
- package/node/auth/RolesState/saga.js +30 -54
- package/node/auth/SSOState/index.js +1 -6
- package/node/auth/SSOState/interfaces.js +0 -3
- package/node/auth/SSOState/saga.js +10 -63
- package/node/auth/SSOState/saga.v2.js +13 -53
- package/node/auth/SecurityPolicyState/index.js +1 -6
- package/node/auth/SecurityPolicyState/saga.js +36 -89
- package/node/auth/SessionsPolicyState/index.js +1 -6
- package/node/auth/SessionsPolicyState/saga.js +7 -24
- package/node/auth/SessionsState/index.js +1 -6
- package/node/auth/SessionsState/saga.js +1 -22
- package/node/auth/SignUp/index.js +1 -7
- package/node/auth/SignUp/interfaces.js +0 -1
- package/node/auth/SignUp/saga.js +6 -30
- package/node/auth/SocialLogins/index.js +1 -6
- package/node/auth/SocialLogins/saga.js +10 -33
- package/node/auth/TeamState/index.js +1 -6
- package/node/auth/TeamState/interfaces.js +0 -1
- package/node/auth/TeamState/saga.js +86 -190
- package/node/auth/TenantsState/index.js +1 -6
- package/node/auth/TenantsState/saga.js +1 -24
- package/node/auth/dummy.js +0 -5
- package/node/auth/index.js +0 -90
- package/node/auth/initialState.js +0 -23
- package/node/auth/interfaces.js +0 -6
- package/node/auth/reducer.js +0 -28
- package/node/auth/saga.js +2 -26
- package/node/auth/utils.js +7 -42
- package/node/connectivity/ConnectivityState/index.js +1 -7
- package/node/connectivity/consts.js +1 -7
- package/node/connectivity/index.js +0 -5
- package/node/connectivity/reducer.js +0 -6
- package/node/connectivity/saga.js +47 -91
- package/node/helpers.js +2 -14
- package/node/index.js +1 -17
- package/node/subscriptions/Billing/Information/index.js +0 -7
- package/node/subscriptions/Billing/Information/saga.js +1 -25
- package/node/subscriptions/Billing/Invoices/index.js +0 -6
- package/node/subscriptions/Billing/Invoices/saga.js +1 -13
- package/node/subscriptions/Billing/PaymentMethod/index.js +2 -8
- package/node/subscriptions/Billing/PaymentMethod/interfaces.js +0 -1
- package/node/subscriptions/Billing/PaymentMethod/saga.js +1 -17
- package/node/subscriptions/Billing/Subscription/index.js +0 -6
- package/node/subscriptions/Billing/Subscription/saga.js +3 -23
- package/node/subscriptions/Billing/index.js +0 -6
- package/node/subscriptions/Billing/interfaces.js +0 -8
- package/node/subscriptions/Billing/saga.js +0 -7
- package/node/subscriptions/Checkout/index.js +0 -6
- package/node/subscriptions/Checkout/saga.js +2 -22
- package/node/subscriptions/Config/index.js +0 -6
- package/node/subscriptions/Config/saga.js +1 -12
- package/node/subscriptions/Plans/index.js +0 -6
- package/node/subscriptions/Plans/saga.js +1 -13
- package/node/subscriptions/Stripe/index.js +0 -6
- package/node/subscriptions/Stripe/saga.js +0 -8
- package/node/subscriptions/VendorPublicConfig/index.js +0 -6
- package/node/subscriptions/VendorPublicConfig/saga.js +1 -9
- package/node/subscriptions/dummy.js +2 -4
- package/node/subscriptions/general.interfaces.js +0 -5
- package/node/subscriptions/index.js +0 -5
- package/node/subscriptions/interfaces.js +0 -14
- package/node/subscriptions/mapper.js +0 -11
- package/node/subscriptions/reducer.js +0 -9
- package/node/subscriptions/saga.js +0 -9
- package/node/subscriptions/utils.js +0 -6
- package/node/toolkit/index.js +0 -31
- package/node/toolkit/redux-saga.js +0 -3
- package/node/toolkit/redux.js +0 -1
- package/node/vendor/VendorState/index.js +1 -7
- package/node/vendor/index.js +0 -5
- package/node/vendor/reducer.js +0 -6
- package/node/vendor/saga.js +1 -9
- package/package.json +1 -1
- package/subscriptions/Billing/Information/index.js +0 -4
- package/subscriptions/Billing/Information/saga.js +1 -12
- package/subscriptions/Billing/Invoices/index.js +0 -4
- package/subscriptions/Billing/Invoices/saga.js +1 -5
- package/subscriptions/Billing/PaymentMethod/index.js +2 -6
- package/subscriptions/Billing/PaymentMethod/interfaces.js +1 -1
- package/subscriptions/Billing/PaymentMethod/saga.js +1 -9
- package/subscriptions/Billing/Subscription/index.js +0 -4
- package/subscriptions/Billing/Subscription/saga.js +3 -17
- package/subscriptions/Billing/interfaces.js +1 -0
- package/subscriptions/Checkout/index.js +0 -4
- package/subscriptions/Checkout/saga.js +2 -12
- package/subscriptions/Config/index.js +0 -4
- package/subscriptions/Config/saga.js +1 -7
- package/subscriptions/Plans/index.js +0 -2
- package/subscriptions/Plans/saga.js +1 -6
- package/subscriptions/Stripe/index.js +0 -4
- package/subscriptions/Stripe/saga.js +0 -4
- package/subscriptions/VendorPublicConfig/index.js +0 -2
- package/subscriptions/VendorPublicConfig/saga.js +1 -4
- package/subscriptions/dummy.js +3 -2
- package/subscriptions/general.interfaces.js +0 -5
- package/subscriptions/index.js +3 -1
- package/subscriptions/mapper.js +0 -5
- package/toolkit/index.d.ts +1 -1
- package/toolkit/index.js +0 -9
- package/vendor/VendorState/index.js +1 -0
- package/vendor/index.js +4 -2
- package/vendor/reducer.js +0 -2
- package/vendor/saga.js +1 -2
|
@@ -24,13 +24,13 @@ const actions = {
|
|
|
24
24
|
payload
|
|
25
25
|
}))
|
|
26
26
|
};
|
|
27
|
+
|
|
27
28
|
/**
|
|
28
29
|
* To be used for actions types after dispatch, and should contains
|
|
29
30
|
* the reducers and actions as standalone function
|
|
30
31
|
*/
|
|
31
32
|
|
|
32
33
|
// noinspection JSUnusedLocalSymbols
|
|
33
|
-
|
|
34
34
|
/**
|
|
35
35
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
36
36
|
* contains the same functions in reducers and actions
|
|
@@ -4,17 +4,13 @@ import { api } from '@frontegg/rest-api';
|
|
|
4
4
|
import { actions } from '../reducer';
|
|
5
5
|
import { auditsStoreName } from '../../constants';
|
|
6
6
|
import { auditsLogsFilterAndSort } from '../dummy';
|
|
7
|
-
|
|
8
7
|
const select = () => sagaSelect(_ => _[auditsStoreName].auditLogsState);
|
|
9
|
-
|
|
10
8
|
const selectMetadata = () => sagaSelect(_ => _[auditsStoreName].auditsMetadataState);
|
|
11
|
-
|
|
12
9
|
function* exportAuditsCsv() {
|
|
13
10
|
const state = yield select();
|
|
14
11
|
const {
|
|
15
12
|
columns
|
|
16
13
|
} = yield selectMetadata();
|
|
17
|
-
|
|
18
14
|
try {
|
|
19
15
|
const filter = state.filter;
|
|
20
16
|
const sort = state.sort;
|
|
@@ -38,12 +34,10 @@ function* exportAuditsCsv() {
|
|
|
38
34
|
} catch (e) {
|
|
39
35
|
console.error('failed to export audits - ', e);
|
|
40
36
|
}
|
|
41
|
-
|
|
42
37
|
yield put(actions.setAuditLogsState({
|
|
43
38
|
isDownloadingCsv: false
|
|
44
39
|
}));
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
function* loadAuditLogs({
|
|
48
42
|
payload
|
|
49
43
|
}) {
|
|
@@ -55,10 +49,8 @@ function* loadAuditLogs({
|
|
|
55
49
|
const {
|
|
56
50
|
columns
|
|
57
51
|
} = yield selectMetadata();
|
|
58
|
-
|
|
59
52
|
try {
|
|
60
53
|
var _payload$pageSize, _payload$pageOffset, _payload$filter, _payload$sort, _payload$callback;
|
|
61
|
-
|
|
62
54
|
const pageSize = (_payload$pageSize = payload.pageSize) != null ? _payload$pageSize : state.pageSize;
|
|
63
55
|
const pageOffset = (_payload$pageOffset = payload.pageOffset) != null ? _payload$pageOffset : state.pageOffset;
|
|
64
56
|
const filter = (_payload$filter = payload.filter) != null ? _payload$filter : state.filter;
|
|
@@ -76,11 +68,9 @@ function* loadAuditLogs({
|
|
|
76
68
|
const filterParams = filter.reduce((p, n) => _extends({}, p, {
|
|
77
69
|
[n.id]: n.value
|
|
78
70
|
}), {});
|
|
79
|
-
|
|
80
71
|
if (!columns) {
|
|
81
72
|
yield put(actions.loadAuditsMetadata());
|
|
82
73
|
}
|
|
83
|
-
|
|
84
74
|
const {
|
|
85
75
|
data,
|
|
86
76
|
total
|
|
@@ -96,7 +86,6 @@ function* loadAuditLogs({
|
|
|
96
86
|
payload == null ? void 0 : (_payload$callback = payload.callback) == null ? void 0 : _payload$callback.call(payload, true);
|
|
97
87
|
} catch (e) {
|
|
98
88
|
var _payload$callback2;
|
|
99
|
-
|
|
100
89
|
yield put(actions.setAuditLogsState({
|
|
101
90
|
loading: false,
|
|
102
91
|
error: e.message
|
|
@@ -104,11 +93,11 @@ function* loadAuditLogs({
|
|
|
104
93
|
payload == null ? void 0 : (_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, null, e);
|
|
105
94
|
}
|
|
106
95
|
}
|
|
107
|
-
|
|
108
96
|
export function* auditLogsSagas() {
|
|
109
97
|
yield takeEvery(actions.exportAuditsCsv, exportAuditsCsv);
|
|
110
98
|
yield takeEvery(actions.loadAuditLogs, loadAuditLogs);
|
|
111
99
|
}
|
|
100
|
+
|
|
112
101
|
/*********************************
|
|
113
102
|
* Preview Sagas
|
|
114
103
|
*********************************/
|
|
@@ -124,10 +113,8 @@ function* loadAuditLogsMock({
|
|
|
124
113
|
const {
|
|
125
114
|
columns
|
|
126
115
|
} = yield selectMetadata();
|
|
127
|
-
|
|
128
116
|
try {
|
|
129
117
|
var _payload$pageSize2, _payload$pageOffset2, _payload$filter2, _payload$sort2, _payload$callback3;
|
|
130
|
-
|
|
131
118
|
const pageSize = (_payload$pageSize2 = payload.pageSize) != null ? _payload$pageSize2 : state.pageSize;
|
|
132
119
|
const pageOffset = (_payload$pageOffset2 = payload.pageOffset) != null ? _payload$pageOffset2 : state.pageOffset;
|
|
133
120
|
const filter = (_payload$filter2 = payload.filter) != null ? _payload$filter2 : state.filter;
|
|
@@ -138,11 +125,9 @@ function* loadAuditLogsMock({
|
|
|
138
125
|
filter,
|
|
139
126
|
sort
|
|
140
127
|
}));
|
|
141
|
-
|
|
142
128
|
if (!columns) {
|
|
143
129
|
yield put(actions.loadAuditsMetadata());
|
|
144
130
|
}
|
|
145
|
-
|
|
146
131
|
const {
|
|
147
132
|
data,
|
|
148
133
|
total
|
|
@@ -155,7 +140,6 @@ function* loadAuditLogsMock({
|
|
|
155
140
|
payload == null ? void 0 : (_payload$callback3 = payload.callback) == null ? void 0 : _payload$callback3.call(payload, true);
|
|
156
141
|
} catch (e) {
|
|
157
142
|
var _payload$callback4;
|
|
158
|
-
|
|
159
143
|
yield put(actions.setAuditLogsState({
|
|
160
144
|
loading: false,
|
|
161
145
|
error: e.message
|
|
@@ -163,7 +147,6 @@ function* loadAuditLogsMock({
|
|
|
163
147
|
payload == null ? void 0 : (_payload$callback4 = payload.callback) == null ? void 0 : _payload$callback4.call(payload, null, e);
|
|
164
148
|
}
|
|
165
149
|
}
|
|
166
|
-
|
|
167
150
|
export function* auditLogsSagasMock() {
|
|
168
151
|
yield takeEvery(actions.loadAuditLogs, loadAuditLogsMock);
|
|
169
152
|
}
|
|
@@ -14,13 +14,13 @@ const reducers = {
|
|
|
14
14
|
const actions = {
|
|
15
15
|
loadAuditsMetadata: createAction(`${auditsStoreName}/loadAuditsMetadata`)
|
|
16
16
|
};
|
|
17
|
+
|
|
17
18
|
/**
|
|
18
19
|
* To be used for actions types after dispatch, and should contains
|
|
19
20
|
* the reducers and actions as standalone function
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
23
|
// noinspection JSUnusedLocalSymbols
|
|
23
|
-
|
|
24
24
|
/**
|
|
25
25
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
26
26
|
* contains the same functions in reducers and actions
|
|
@@ -2,13 +2,11 @@ import { put, call, takeEvery } from 'redux-saga/effects';
|
|
|
2
2
|
import { api } from '@frontegg/rest-api';
|
|
3
3
|
import { actions } from '../reducer';
|
|
4
4
|
import { auditLogsMetadataDemo } from '../dummy';
|
|
5
|
-
|
|
6
5
|
function* loadAuditsMetadata() {
|
|
7
6
|
yield put(actions.setAuditsMetadataState({
|
|
8
7
|
loading: true,
|
|
9
8
|
error: null
|
|
10
9
|
}));
|
|
11
|
-
|
|
12
10
|
try {
|
|
13
11
|
const {
|
|
14
12
|
properties
|
|
@@ -24,10 +22,10 @@ function* loadAuditsMetadata() {
|
|
|
24
22
|
}));
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
export function* auditsMetadataSagas() {
|
|
29
26
|
yield takeEvery(actions.loadAuditsMetadata, loadAuditsMetadata);
|
|
30
27
|
}
|
|
28
|
+
|
|
31
29
|
/*********************************
|
|
32
30
|
* Preview Sagas
|
|
33
31
|
*********************************/
|
|
@@ -37,7 +35,6 @@ function* loadAuditsMetadataMock() {
|
|
|
37
35
|
loading: true,
|
|
38
36
|
error: null
|
|
39
37
|
}));
|
|
40
|
-
|
|
41
38
|
try {
|
|
42
39
|
const {
|
|
43
40
|
properties
|
|
@@ -53,7 +50,6 @@ function* loadAuditsMetadataMock() {
|
|
|
53
50
|
}));
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
|
-
|
|
57
53
|
export function* auditsMetadataSagasMock() {
|
|
58
54
|
yield takeEvery(actions.loadAuditsMetadata, loadAuditsMetadataMock);
|
|
59
55
|
}
|
|
@@ -2,15 +2,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { api } from '@frontegg/rest-api';
|
|
3
3
|
import { defaultItemsPerPage, actions, storeName } from './reducer';
|
|
4
4
|
import { all, call, put, takeLatest, select as sagaSelect } from 'redux-saga/effects';
|
|
5
|
-
|
|
6
5
|
const select = () => sagaSelect(_ => _[storeName]);
|
|
7
|
-
|
|
8
6
|
function* loadStats() {
|
|
9
7
|
const {
|
|
10
8
|
sortBy,
|
|
11
9
|
sortDirection
|
|
12
10
|
} = yield select();
|
|
13
|
-
|
|
14
11
|
try {
|
|
15
12
|
const stats = yield call(api.audits.getAuditsStats, {
|
|
16
13
|
sortBy,
|
|
@@ -27,7 +24,6 @@ function* loadStats() {
|
|
|
27
24
|
yield put(actions.loadItemFailedAction(errorMessage));
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
function* loadMetadata() {
|
|
32
28
|
try {
|
|
33
29
|
const result = yield call(api.metadata.getAuditsMetadata);
|
|
@@ -41,12 +37,10 @@ function* loadMetadata() {
|
|
|
41
37
|
yield put(actions.loadItemFailedAction(errorMessage));
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
|
-
|
|
45
40
|
const filterToObject = arr => arr.reduce((res, curr) => {
|
|
46
41
|
res[curr.key] = curr.value;
|
|
47
42
|
return res;
|
|
48
43
|
}, {});
|
|
49
|
-
|
|
50
44
|
function* loadAuditsFunction({
|
|
51
45
|
payload
|
|
52
46
|
}) {
|
|
@@ -68,7 +62,6 @@ function* loadAuditsFunction({
|
|
|
68
62
|
} = appendMode ? yield select() : {
|
|
69
63
|
rowsData: []
|
|
70
64
|
};
|
|
71
|
-
|
|
72
65
|
try {
|
|
73
66
|
const f2o = filterToObject(filters);
|
|
74
67
|
const {
|
|
@@ -89,7 +82,6 @@ function* loadAuditsFunction({
|
|
|
89
82
|
rowsData: [...rowsData, ...data],
|
|
90
83
|
total
|
|
91
84
|
}));
|
|
92
|
-
|
|
93
85
|
if (onlyOneLoad) {
|
|
94
86
|
yield put(actions.finishLoading());
|
|
95
87
|
}
|
|
@@ -102,7 +94,6 @@ function* loadAuditsFunction({
|
|
|
102
94
|
yield put(actions.loadItemFailedAction(errorMessage));
|
|
103
95
|
}
|
|
104
96
|
}
|
|
105
|
-
|
|
106
97
|
function* initDataFunction() {
|
|
107
98
|
yield put(actions.startLoading());
|
|
108
99
|
yield all([loadStats(), loadMetadata(), loadAuditsFunction({
|
|
@@ -113,7 +104,6 @@ function* initDataFunction() {
|
|
|
113
104
|
})]);
|
|
114
105
|
yield put(actions.finishLoading());
|
|
115
106
|
}
|
|
116
|
-
|
|
117
107
|
function* removeFilterFunction({
|
|
118
108
|
payload
|
|
119
109
|
}) {
|
|
@@ -121,15 +111,12 @@ function* removeFilterFunction({
|
|
|
121
111
|
filters: allFilters
|
|
122
112
|
} = yield select();
|
|
123
113
|
const removedFilterIndex = allFilters.findIndex(item => item.key === payload.key);
|
|
124
|
-
|
|
125
114
|
if (removedFilterIndex < 0) {
|
|
126
115
|
return;
|
|
127
116
|
}
|
|
128
|
-
|
|
129
117
|
const newFilters = [...allFilters.slice(0, removedFilterIndex), ...allFilters.slice(removedFilterIndex + 1)];
|
|
130
118
|
yield put(actions.setFilterData(newFilters));
|
|
131
119
|
}
|
|
132
|
-
|
|
133
120
|
function* filterDataFunction({
|
|
134
121
|
payload
|
|
135
122
|
}) {
|
|
@@ -137,15 +124,12 @@ function* filterDataFunction({
|
|
|
137
124
|
filters: allFilters
|
|
138
125
|
} = yield select();
|
|
139
126
|
let filterIndex = allFilters.findIndex(item => item.key === payload.key);
|
|
140
|
-
|
|
141
127
|
if (filterIndex < 0) {
|
|
142
128
|
filterIndex = allFilters.length;
|
|
143
129
|
}
|
|
144
|
-
|
|
145
130
|
const newFilters = [...allFilters.slice(0, filterIndex), payload, ...allFilters.slice(filterIndex + 1)];
|
|
146
131
|
yield put(actions.setFilterData(newFilters));
|
|
147
132
|
}
|
|
148
|
-
|
|
149
133
|
function* exportCsvFunction() {
|
|
150
134
|
const {
|
|
151
135
|
filters,
|
|
@@ -157,7 +141,6 @@ function* exportCsvFunction() {
|
|
|
157
141
|
const f2o = filterToObject(filters);
|
|
158
142
|
yield put(actions.startDownloadingCsv());
|
|
159
143
|
const outputFileName = `audits.csv`;
|
|
160
|
-
|
|
161
144
|
try {
|
|
162
145
|
yield api.audits.exportAudits(_extends({
|
|
163
146
|
endpoint: 'csv/v2',
|
|
@@ -175,7 +158,6 @@ function* exportCsvFunction() {
|
|
|
175
158
|
yield put(actions.stopDownloadingCsv());
|
|
176
159
|
}
|
|
177
160
|
}
|
|
178
|
-
|
|
179
161
|
export function* sagas() {
|
|
180
162
|
yield takeLatest(actions.initData, initDataFunction);
|
|
181
163
|
yield takeLatest(actions.removeFilter, removeFilterFunction);
|
package/audits/dummy.js
CHANGED
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
|
|
3
2
|
const sortMethodBasedOnOrder = (sortBy, desc) => (a, b) => {
|
|
4
3
|
if (a[sortBy] > b[sortBy]) {
|
|
5
4
|
return desc ? -1 : 1;
|
|
6
5
|
}
|
|
7
|
-
|
|
8
6
|
if (b[sortBy] > a[sortBy]) {
|
|
9
7
|
return desc ? 1 : -1;
|
|
10
8
|
}
|
|
11
|
-
|
|
12
9
|
return 0;
|
|
13
10
|
};
|
|
14
|
-
|
|
15
11
|
const filterAuditsByQuery = filterOptions => log => filterOptions.filter(filterOutTimeFilterForDummyMode).every(filterItem => log[filterItem.id].includes(filterItem.value));
|
|
16
|
-
|
|
17
12
|
const filterOutTimeFilterForDummyMode = filterItem => filterItem.id !== 'createdAt';
|
|
18
|
-
|
|
19
13
|
export const auditsLogsFilterAndSort = (filterOptions, sortOptions) => {
|
|
20
14
|
const {
|
|
21
15
|
data
|
|
22
16
|
} = auditLogsDataDemo;
|
|
23
17
|
let dataByQuery = data.filter(filterAuditsByQuery(filterOptions));
|
|
24
|
-
|
|
25
18
|
if (sortOptions.length) {
|
|
26
19
|
const {
|
|
27
20
|
id,
|
|
@@ -29,16 +22,13 @@ export const auditsLogsFilterAndSort = (filterOptions, sortOptions) => {
|
|
|
29
22
|
} = sortOptions[0];
|
|
30
23
|
dataByQuery = dataByQuery.sort(sortMethodBasedOnOrder(id, desc));
|
|
31
24
|
}
|
|
32
|
-
|
|
33
25
|
return {
|
|
34
26
|
data: dataByQuery,
|
|
35
27
|
total: dataByQuery.length
|
|
36
28
|
};
|
|
37
29
|
};
|
|
38
|
-
|
|
39
30
|
const randomAction = () => {
|
|
40
31
|
const random = Math.floor(Math.random() * 6);
|
|
41
|
-
|
|
42
32
|
switch (random) {
|
|
43
33
|
case 0:
|
|
44
34
|
return {
|
|
@@ -46,35 +36,30 @@ const randomAction = () => {
|
|
|
46
36
|
description: 'User updated profile details',
|
|
47
37
|
severity: 'Info'
|
|
48
38
|
};
|
|
49
|
-
|
|
50
39
|
case 1:
|
|
51
40
|
return {
|
|
52
41
|
action: 'User logged in',
|
|
53
42
|
severity: 'Info',
|
|
54
43
|
description: 'User logged in to the product'
|
|
55
44
|
};
|
|
56
|
-
|
|
57
45
|
case 2:
|
|
58
46
|
return {
|
|
59
47
|
action: 'User failed to login',
|
|
60
48
|
severity: 'High',
|
|
61
49
|
description: 'User failed to login with password'
|
|
62
50
|
};
|
|
63
|
-
|
|
64
51
|
case 3:
|
|
65
52
|
return {
|
|
66
53
|
action: 'Added user',
|
|
67
54
|
severity: 'Info',
|
|
68
55
|
description: 'Added user david+535@frontegg.com to tenant'
|
|
69
56
|
};
|
|
70
|
-
|
|
71
57
|
case 4:
|
|
72
58
|
return {
|
|
73
59
|
action: 'Assigned roles',
|
|
74
60
|
severity: 'Info',
|
|
75
61
|
description: 'Assigned 0 roles for user'
|
|
76
62
|
};
|
|
77
|
-
|
|
78
63
|
case 5:
|
|
79
64
|
return {
|
|
80
65
|
action: 'Removed user david+108@frontegg.com from account',
|
|
@@ -83,7 +68,6 @@ const randomAction = () => {
|
|
|
83
68
|
};
|
|
84
69
|
}
|
|
85
70
|
};
|
|
86
|
-
|
|
87
71
|
export const auditLogsDataDemo = {
|
|
88
72
|
total: 20,
|
|
89
73
|
data: Array.from(Array(5).keys()).map(i => _extends({
|
package/audits/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { reducer, actions } from './reducer';
|
|
2
2
|
import { sagas, mockSagas } from './saga';
|
|
3
3
|
import { auditsStoreName as storeName } from '../constants';
|
|
4
|
-
import { initialState } from './initialState';
|
|
4
|
+
import { initialState } from './initialState';
|
|
5
5
|
|
|
6
|
+
// export types
|
|
6
7
|
export * from './interfaces';
|
|
7
8
|
export * from './AuditLogsState/interfaces';
|
|
8
9
|
export * from './AuditLogsState';
|
|
9
10
|
export * from './AuditsMetadataState/interfaces';
|
|
10
11
|
export * from './AuditsMetadataState';
|
|
11
|
-
export { sagas as auditsSagas, mockSagas as auditsMockSagas, reducer as auditsReducers, actions as auditsActions, initialState as auditsInitialState, storeName as auditsStoreName };
|
|
12
|
+
export { sagas as auditsSagas, mockSagas as auditsMockSagas, reducer as auditsReducers, actions as auditsActions, initialState as auditsInitialState, storeName as auditsStoreName };
|
|
12
13
|
|
|
14
|
+
// export store
|
|
13
15
|
export default {
|
|
14
16
|
sagas,
|
|
15
17
|
mockSagas,
|
package/audits/reducer.js
CHANGED
|
@@ -19,6 +19,7 @@ declare const reducers: {
|
|
|
19
19
|
user?: import("..").User | null | undefined;
|
|
20
20
|
isSSOAuth: boolean;
|
|
21
21
|
ssoACS?: string | undefined;
|
|
22
|
+
includeQueryParam?: boolean | undefined;
|
|
22
23
|
loginState: import("..").LoginState;
|
|
23
24
|
activateState: import("..").ActivateAccountState;
|
|
24
25
|
acceptInvitationState: AcceptInvitationState;
|
|
@@ -57,6 +58,7 @@ declare const reducers: {
|
|
|
57
58
|
user?: import("..").User | null | undefined;
|
|
58
59
|
isSSOAuth: boolean;
|
|
59
60
|
ssoACS?: string | undefined;
|
|
61
|
+
includeQueryParam?: boolean | undefined;
|
|
60
62
|
loginState: import("..").LoginState;
|
|
61
63
|
activateState: import("..").ActivateAccountState;
|
|
62
64
|
acceptInvitationState: AcceptInvitationState;
|
|
@@ -16,13 +16,13 @@ const actions = {
|
|
|
16
16
|
payload
|
|
17
17
|
}))
|
|
18
18
|
};
|
|
19
|
+
|
|
19
20
|
/**
|
|
20
21
|
* To be used for actions types after dispatch, and should contains
|
|
21
22
|
* the reducers and actions as standalone function
|
|
22
23
|
*/
|
|
23
24
|
|
|
24
25
|
// noinspection JSUnusedLocalSymbols
|
|
25
|
-
|
|
26
26
|
/**
|
|
27
27
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
28
28
|
* contains the same functions in reducers and actions
|
|
@@ -2,7 +2,6 @@ import { call, put, takeLeading } from 'redux-saga/effects';
|
|
|
2
2
|
import { actions } from '../reducer';
|
|
3
3
|
import { api } from '@frontegg/rest-api';
|
|
4
4
|
import { AcceptInvitationStep } from './interfaces';
|
|
5
|
-
|
|
6
5
|
function* acceptInvitation({
|
|
7
6
|
payload
|
|
8
7
|
}) {
|
|
@@ -13,7 +12,6 @@ function* acceptInvitation({
|
|
|
13
12
|
}));
|
|
14
13
|
return;
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
try {
|
|
18
16
|
yield put(actions.setAcceptInvitationState({
|
|
19
17
|
error: undefined,
|
|
@@ -35,7 +33,6 @@ function* acceptInvitation({
|
|
|
35
33
|
}));
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
export function* acceptInvitationSagas() {
|
|
40
37
|
yield takeLeading(actions.acceptInvitation, acceptInvitation);
|
|
41
38
|
}
|
|
@@ -20,6 +20,7 @@ declare const reducers: {
|
|
|
20
20
|
user?: import("..").User | null | undefined;
|
|
21
21
|
isSSOAuth: boolean;
|
|
22
22
|
ssoACS?: string | undefined;
|
|
23
|
+
includeQueryParam?: boolean | undefined;
|
|
23
24
|
loginState: import("..").LoginState;
|
|
24
25
|
activateState: import("..").ActivateAccountState;
|
|
25
26
|
acceptInvitationState: import("..").AcceptInvitationState;
|
|
@@ -58,6 +59,7 @@ declare const reducers: {
|
|
|
58
59
|
user?: import("..").User | null | undefined;
|
|
59
60
|
isSSOAuth: boolean;
|
|
60
61
|
ssoACS?: string | undefined;
|
|
62
|
+
includeQueryParam?: boolean | undefined;
|
|
61
63
|
loginState: import("..").LoginState;
|
|
62
64
|
activateState: import("..").ActivateAccountState;
|
|
63
65
|
acceptInvitationState: import("..").AcceptInvitationState;
|
|
@@ -18,13 +18,13 @@ const actions = {
|
|
|
18
18
|
payload
|
|
19
19
|
}))
|
|
20
20
|
};
|
|
21
|
+
|
|
21
22
|
/**
|
|
22
23
|
* To be used for actions types after dispatch, and should contains
|
|
23
24
|
* the reducers and actions as standalone function
|
|
24
25
|
*/
|
|
25
26
|
|
|
26
27
|
// noinspection JSUnusedLocalSymbols
|
|
27
|
-
|
|
28
28
|
/**
|
|
29
29
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
30
30
|
* contains the same functions in reducers and actions
|
|
@@ -3,13 +3,11 @@ import { call, put, select, takeLeading } from 'redux-saga/effects';
|
|
|
3
3
|
import { actions } from '../reducer';
|
|
4
4
|
import { api } from '@frontegg/rest-api';
|
|
5
5
|
import { delay } from '../utils';
|
|
6
|
-
|
|
7
6
|
function* saveAccountSettings({
|
|
8
7
|
payload
|
|
9
8
|
}) {
|
|
10
9
|
try {
|
|
11
10
|
var _payload$callback;
|
|
12
|
-
|
|
13
11
|
yield put(actions.setAccountSettingsState({
|
|
14
12
|
loading: true
|
|
15
13
|
}));
|
|
@@ -38,7 +36,6 @@ function* saveAccountSettings({
|
|
|
38
36
|
(_payload$callback = payload.callback) == null ? void 0 : _payload$callback.call(payload, body);
|
|
39
37
|
} catch (e) {
|
|
40
38
|
var _payload$callback2;
|
|
41
|
-
|
|
42
39
|
yield put(actions.setAccountSettingsState({
|
|
43
40
|
loading: false,
|
|
44
41
|
error: e.message
|
|
@@ -46,7 +43,6 @@ function* saveAccountSettings({
|
|
|
46
43
|
(_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, null, e);
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
|
-
|
|
50
46
|
function* loadAccountSettings({
|
|
51
47
|
payload
|
|
52
48
|
}) {
|
|
@@ -54,7 +50,6 @@ function* loadAccountSettings({
|
|
|
54
50
|
loading: !(payload != null && payload.silentLoading),
|
|
55
51
|
error: null
|
|
56
52
|
}));
|
|
57
|
-
|
|
58
53
|
try {
|
|
59
54
|
const body = yield call(api.accountSettings.getSettings);
|
|
60
55
|
yield put(actions.setAccountSettingsState(_extends({}, body, {
|
|
@@ -67,11 +62,11 @@ function* loadAccountSettings({
|
|
|
67
62
|
}));
|
|
68
63
|
}
|
|
69
64
|
}
|
|
70
|
-
|
|
71
65
|
export function* accountSettingsSaga() {
|
|
72
66
|
yield takeLeading(actions.saveAccountSettings, saveAccountSettings);
|
|
73
67
|
yield takeLeading(actions.loadAccountSettings, loadAccountSettings);
|
|
74
68
|
}
|
|
69
|
+
|
|
75
70
|
/*********************************
|
|
76
71
|
* Preview Sagas
|
|
77
72
|
*********************************/
|
|
@@ -80,7 +75,6 @@ function* saveAccountSettingsMock({
|
|
|
80
75
|
payload
|
|
81
76
|
}) {
|
|
82
77
|
var _payload$callback3;
|
|
83
|
-
|
|
84
78
|
yield put(actions.setAccountSettingsState({
|
|
85
79
|
loading: true
|
|
86
80
|
}));
|
|
@@ -96,7 +90,6 @@ function* saveAccountSettingsMock({
|
|
|
96
90
|
currency,
|
|
97
91
|
logo
|
|
98
92
|
} = accountSettingsState;
|
|
99
|
-
|
|
100
93
|
const body = _extends({
|
|
101
94
|
address,
|
|
102
95
|
timezone,
|
|
@@ -105,13 +98,11 @@ function* saveAccountSettingsMock({
|
|
|
105
98
|
currency,
|
|
106
99
|
logo
|
|
107
100
|
}, payload);
|
|
108
|
-
|
|
109
101
|
yield put(actions.setAccountSettingsState(_extends({}, body, {
|
|
110
102
|
loading: false
|
|
111
103
|
})));
|
|
112
104
|
(_payload$callback3 = payload.callback) == null ? void 0 : _payload$callback3.call(payload, body);
|
|
113
105
|
}
|
|
114
|
-
|
|
115
106
|
function* loadAccountSettingsMock({
|
|
116
107
|
payload
|
|
117
108
|
}) {
|
|
@@ -129,7 +120,6 @@ function* loadAccountSettingsMock({
|
|
|
129
120
|
loading: false
|
|
130
121
|
}));
|
|
131
122
|
}
|
|
132
|
-
|
|
133
123
|
export function* accountSettingsSagaMock() {
|
|
134
124
|
yield takeLeading(actions.saveAccountSettings, saveAccountSettingsMock);
|
|
135
125
|
yield takeLeading(actions.loadAccountSettings, loadAccountSettingsMock);
|
|
@@ -20,6 +20,7 @@ declare const reducers: {
|
|
|
20
20
|
user?: import("..").User | null | undefined;
|
|
21
21
|
isSSOAuth: boolean;
|
|
22
22
|
ssoACS?: string | undefined;
|
|
23
|
+
includeQueryParam?: boolean | undefined;
|
|
23
24
|
loginState: import("..").LoginState;
|
|
24
25
|
activateState: ActivateAccountState;
|
|
25
26
|
acceptInvitationState: import("..").AcceptInvitationState;
|
|
@@ -58,6 +59,7 @@ declare const reducers: {
|
|
|
58
59
|
user?: import("..").User | null | undefined;
|
|
59
60
|
isSSOAuth: boolean;
|
|
60
61
|
ssoACS?: string | undefined;
|
|
62
|
+
includeQueryParam?: boolean | undefined;
|
|
61
63
|
loginState: import("..").LoginState;
|
|
62
64
|
activateState: ActivateAccountState;
|
|
63
65
|
acceptInvitationState: import("..").AcceptInvitationState;
|
|
@@ -102,6 +104,7 @@ declare const reducers: {
|
|
|
102
104
|
user?: import("..").User | null | undefined;
|
|
103
105
|
isSSOAuth: boolean;
|
|
104
106
|
ssoACS?: string | undefined;
|
|
107
|
+
includeQueryParam?: boolean | undefined;
|
|
105
108
|
loginState: import("..").LoginState;
|
|
106
109
|
activateState: ActivateAccountState;
|
|
107
110
|
acceptInvitationState: import("..").AcceptInvitationState;
|
|
@@ -31,13 +31,13 @@ const actions = {
|
|
|
31
31
|
payload
|
|
32
32
|
}))
|
|
33
33
|
};
|
|
34
|
+
|
|
34
35
|
/**
|
|
35
36
|
* To be used for actions types after dispatch, and should contains
|
|
36
37
|
* the reducers and actions as standalone function
|
|
37
38
|
*/
|
|
38
39
|
|
|
39
40
|
// noinspection JSUnusedLocalSymbols
|
|
40
|
-
|
|
41
41
|
/**
|
|
42
42
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
43
43
|
* contains the same functions in reducers and actions
|