@frontegg/redux-store 5.61.0 → 6.0.1-alpha.2
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.d.ts +47 -47
- package/audits/AuditLogsState/index.js +28 -0
- package/audits/AuditLogsState/interfaces.d.ts +19 -19
- package/audits/AuditLogsState/interfaces.js +1 -0
- package/audits/AuditLogsState/saga.d.ts +2 -2
- package/audits/AuditLogsState/saga.js +166 -0
- package/audits/AuditsMetadataState/index.d.ts +35 -35
- package/audits/AuditsMetadataState/index.js +18 -0
- package/audits/AuditsMetadataState/interfaces.d.ts +17 -17
- package/audits/AuditsMetadataState/interfaces.js +1 -0
- package/audits/AuditsMetadataState/saga.d.ts +2 -2
- package/audits/AuditsMetadataState/saga.js +56 -0
- package/audits/backward-compatibility/index.d.ts +4 -4
- package/audits/backward-compatibility/index.js +4 -4
- package/audits/backward-compatibility/initialState.d.ts +2 -2
- package/audits/backward-compatibility/initialState.js +20 -0
- package/audits/backward-compatibility/interfaces.d.ts +55 -55
- package/audits/backward-compatibility/interfaces.js +1 -0
- package/audits/backward-compatibility/reducer.d.ts +35 -35
- package/audits/backward-compatibility/reducer.js +129 -0
- package/audits/backward-compatibility/saga.d.ts +1 -1
- package/audits/backward-compatibility/saga.js +187 -0
- package/audits/dummy.d.ts +10 -10
- package/audits/dummy.js +191 -0
- package/audits/index.d.ts +40 -40
- package/audits/index.js +18 -362
- package/audits/initialState.d.ts +2 -2
- package/audits/initialState.js +6 -0
- package/audits/interfaces.d.ts +6 -6
- package/audits/interfaces.js +1 -0
- package/audits/reducer.d.ts +31 -31
- package/audits/reducer.js +23 -0
- package/audits/saga.d.ts +2 -2
- package/audits/saga.js +9 -0
- package/audits/utils.d.ts +14 -14
- package/audits/utils.js +13 -0
- package/auth/AcceptInvitationState/index.d.ts +85 -85
- package/auth/AcceptInvitationState/index.js +20 -0
- package/auth/AcceptInvitationState/interfaces.d.ts +11 -11
- package/auth/AcceptInvitationState/interfaces.js +9 -0
- package/auth/AcceptInvitationState/saga.d.ts +1 -1
- package/auth/AcceptInvitationState/saga.js +41 -0
- package/auth/AccountSettingsState/index.d.ts +92 -92
- package/auth/AccountSettingsState/index.js +22 -0
- package/auth/AccountSettingsState/interfaces.d.ts +10 -10
- package/auth/AccountSettingsState/interfaces.js +1 -0
- package/auth/AccountSettingsState/saga.d.ts +2 -2
- package/auth/AccountSettingsState/saga.js +133 -0
- package/auth/ActivateState/index.d.ts +130 -130
- package/auth/ActivateState/index.js +35 -0
- package/auth/ActivateState/interfaces.d.ts +26 -26
- package/auth/ActivateState/interfaces.js +8 -0
- package/auth/ActivateState/saga.d.ts +1 -1
- package/auth/ActivateState/saga.js +187 -0
- package/auth/ApiTokensState/index.d.ts +119 -119
- package/auth/ApiTokensState/index.js +54 -0
- package/auth/ApiTokensState/interfaces.d.ts +49 -49
- package/auth/ApiTokensState/interfaces.js +7 -0
- package/auth/ApiTokensState/saga.d.ts +2 -2
- package/auth/ApiTokensState/saga.js +410 -0
- package/auth/ForgotPasswordState/index.d.ts +90 -90
- package/auth/ForgotPasswordState/index.js +29 -0
- package/auth/ForgotPasswordState/interfaces.d.ts +18 -18
- package/auth/ForgotPasswordState/interfaces.js +6 -0
- package/auth/ForgotPasswordState/saga.d.ts +8 -8
- package/auth/ForgotPasswordState/saga.js +83 -0
- package/auth/LoginState/index.d.ts +132 -144
- package/auth/LoginState/index.js +64 -0
- package/auth/LoginState/interfaces.d.ts +41 -60
- package/auth/LoginState/interfaces.js +17 -0
- package/auth/LoginState/saga.d.ts +80 -84
- package/auth/LoginState/saga.js +860 -0
- package/auth/MfaState/index.d.ts +92 -92
- package/auth/MfaState/index.js +28 -0
- package/auth/MfaState/interfaces.d.ts +12 -12
- package/auth/MfaState/interfaces.js +6 -0
- package/auth/MfaState/saga.d.ts +2 -2
- package/auth/MfaState/saga.js +252 -0
- package/auth/ProfileState/index.d.ts +90 -90
- package/auth/ProfileState/index.js +24 -0
- package/auth/ProfileState/interfaces.d.ts +9 -9
- package/auth/ProfileState/interfaces.js +1 -0
- package/auth/ProfileState/saga.d.ts +2 -2
- package/auth/ProfileState/saga.js +230 -0
- package/auth/ResetPhoneNumberState/index.d.ts +96 -96
- package/auth/ResetPhoneNumberState/index.js +27 -0
- package/auth/ResetPhoneNumberState/interfaces.d.ts +18 -18
- package/auth/ResetPhoneNumberState/interfaces.js +7 -0
- package/auth/ResetPhoneNumberState/saga.d.ts +17 -17
- package/auth/ResetPhoneNumberState/saga.js +127 -0
- package/auth/RolesState/index.d.ts +100 -100
- package/auth/RolesState/index.js +37 -0
- package/auth/RolesState/interfaces.d.ts +7 -7
- package/auth/RolesState/interfaces.js +1 -0
- package/auth/RolesState/saga.d.ts +1 -1
- package/auth/RolesState/saga.js +197 -0
- package/auth/SSOState/index.d.ts +224 -224
- package/auth/SSOState/index.js +83 -0
- package/auth/SSOState/interfaces.d.ts +92 -92
- package/auth/SSOState/interfaces.js +28 -0
- package/auth/SSOState/saga.d.ts +2 -2
- package/auth/SSOState/saga.js +523 -0
- package/auth/SSOState/saga.v2.d.ts +1 -1
- package/auth/SSOState/saga.v2.js +501 -0
- package/auth/SecurityPolicyState/index.d.ts +456 -502
- package/auth/SecurityPolicyState/index.js +64 -0
- package/auth/SecurityPolicyState/interfaces.d.ts +26 -28
- package/auth/SecurityPolicyState/interfaces.js +1 -0
- package/auth/SecurityPolicyState/saga.d.ts +18 -24
- package/auth/SecurityPolicyState/saga.js +464 -0
- package/auth/SignUp/index.d.ts +86 -86
- package/auth/SignUp/index.js +25 -0
- package/auth/SignUp/interfaces.d.ts +19 -19
- package/auth/SignUp/interfaces.js +6 -0
- package/auth/SignUp/saga.d.ts +49 -49
- package/auth/SignUp/saga.js +147 -0
- package/auth/SocialLogins/index.d.ts +91 -91
- package/auth/SocialLogins/index.js +26 -0
- package/auth/SocialLogins/interfaces.d.ts +13 -13
- package/auth/SocialLogins/interfaces.js +1 -0
- package/auth/SocialLogins/saga.d.ts +10 -10
- package/auth/SocialLogins/saga.js +140 -0
- package/auth/TeamState/index.d.ts +168 -168
- package/auth/TeamState/index.js +111 -0
- package/auth/TeamState/interfaces.d.ts +78 -78
- package/auth/TeamState/interfaces.js +16 -0
- package/auth/TeamState/saga.d.ts +2 -2
- package/auth/TeamState/saga.js +1123 -0
- package/auth/TenantsState/index.d.ts +104 -104
- package/auth/TenantsState/index.js +31 -0
- package/auth/TenantsState/interfaces.d.ts +9 -9
- package/auth/TenantsState/interfaces.js +1 -0
- package/auth/TenantsState/saga.d.ts +2 -2
- package/auth/TenantsState/saga.js +136 -0
- package/auth/dummy.d.ts +28 -28
- package/auth/dummy.js +250 -0
- package/auth/index.d.ts +378 -392
- package/auth/index.js +46 -4078
- package/auth/initialState.d.ts +3 -3
- package/auth/initialState.js +58 -0
- package/auth/interfaces.d.ts +161 -161
- package/auth/interfaces.js +14 -0
- package/auth/reducer.d.ts +356 -370
- package/auth/reducer.js +39 -0
- package/auth/saga.d.ts +2 -2
- package/auth/saga.js +24 -0
- package/auth/utils.d.ts +162 -165
- package/auth/utils.js +74 -0
- package/connectivity/ConnectivityState/index.d.ts +292 -292
- package/connectivity/ConnectivityState/index.js +94 -0
- package/connectivity/consts.d.ts +12 -12
- package/connectivity/consts.js +71 -0
- package/connectivity/index.d.ts +40 -40
- package/connectivity/index.js +12 -454
- package/connectivity/interfaces.d.ts +112 -112
- package/connectivity/interfaces.js +1 -0
- package/connectivity/reducer.d.ts +31 -31
- package/connectivity/reducer.js +25 -0
- package/connectivity/saga.d.ts +1 -1
- package/connectivity/saga.js +546 -0
- package/constants.d.ts +7 -7
- package/constants.js +7 -0
- package/helpers.d.ts +5 -5
- package/helpers.js +37 -0
- package/index.d.ts +28 -28
- package/index.js +17 -15
- package/interfaces.d.ts +15 -15
- package/interfaces.js +1 -0
- package/node/audits/AuditLogsState/index.js +43 -0
- package/node/audits/AuditLogsState/interfaces.js +5 -0
- package/node/audits/AuditLogsState/saga.js +181 -0
- package/node/audits/AuditsMetadataState/index.js +33 -0
- package/node/audits/AuditsMetadataState/interfaces.js +5 -0
- package/node/audits/AuditsMetadataState/saga.js +67 -0
- package/node/audits/backward-compatibility/index.js +52 -12
- package/node/audits/backward-compatibility/initialState.js +27 -0
- package/node/audits/backward-compatibility/interfaces.js +5 -0
- package/node/audits/backward-compatibility/reducer.js +144 -0
- package/node/audits/backward-compatibility/saga.js +199 -0
- package/node/audits/dummy.js +204 -0
- package/node/audits/index.js +124 -364
- package/node/audits/initialState.js +16 -0
- package/node/audits/interfaces.js +5 -0
- package/node/audits/reducer.js +37 -0
- package/node/audits/saga.js +21 -0
- package/node/audits/utils.js +25 -0
- package/node/auth/AcceptInvitationState/index.js +33 -0
- package/node/auth/AcceptInvitationState/interfaces.js +16 -0
- package/node/auth/AcceptInvitationState/saga.js +51 -0
- package/node/auth/AccountSettingsState/index.js +34 -0
- package/node/auth/AccountSettingsState/interfaces.js +5 -0
- package/node/auth/AccountSettingsState/saga.js +145 -0
- package/node/auth/ActivateState/index.js +48 -0
- package/node/auth/ActivateState/interfaces.js +15 -0
- package/node/auth/ActivateState/saga.js +201 -0
- package/node/auth/ApiTokensState/index.js +66 -0
- package/node/auth/ApiTokensState/interfaces.js +14 -0
- package/node/auth/ApiTokensState/saga.js +424 -0
- package/node/auth/ForgotPasswordState/index.js +42 -0
- package/node/auth/ForgotPasswordState/interfaces.js +13 -0
- package/node/auth/ForgotPasswordState/saga.js +98 -0
- package/node/auth/LoginState/index.js +77 -0
- package/node/auth/LoginState/interfaces.js +31 -0
- package/node/auth/LoginState/saga.js +918 -0
- package/node/auth/MfaState/index.js +41 -0
- package/node/auth/MfaState/interfaces.js +13 -0
- package/node/auth/MfaState/saga.js +265 -0
- package/node/auth/ProfileState/index.js +36 -0
- package/node/auth/ProfileState/interfaces.js +5 -0
- package/node/auth/ProfileState/saga.js +245 -0
- package/node/auth/ResetPhoneNumberState/index.js +40 -0
- package/node/auth/ResetPhoneNumberState/interfaces.js +14 -0
- package/node/auth/ResetPhoneNumberState/saga.js +141 -0
- package/node/auth/RolesState/index.js +49 -0
- package/node/auth/RolesState/interfaces.js +5 -0
- package/node/auth/RolesState/saga.js +205 -0
- package/node/auth/SSOState/index.js +95 -0
- package/node/auth/SSOState/interfaces.js +36 -0
- package/node/auth/SSOState/saga.js +535 -0
- package/node/auth/SSOState/saga.v2.js +512 -0
- package/node/auth/SecurityPolicyState/index.js +76 -0
- package/node/auth/SecurityPolicyState/interfaces.js +5 -0
- package/node/auth/SecurityPolicyState/saga.js +472 -0
- package/node/auth/SignUp/index.js +38 -0
- package/node/auth/SignUp/interfaces.js +13 -0
- package/node/auth/SignUp/saga.js +173 -0
- package/node/auth/SocialLogins/index.js +38 -0
- package/node/auth/SocialLogins/interfaces.js +5 -0
- package/node/auth/SocialLogins/saga.js +162 -0
- package/node/auth/TeamState/index.js +123 -0
- package/node/auth/TeamState/interfaces.js +23 -0
- package/node/auth/TeamState/saga.js +1118 -0
- package/node/auth/TenantsState/index.js +43 -0
- package/node/auth/TenantsState/interfaces.js +5 -0
- package/node/auth/TenantsState/saga.js +149 -0
- package/node/auth/dummy.js +284 -0
- package/node/auth/index.js +528 -170
- package/node/auth/initialState.js +86 -0
- package/node/auth/interfaces.js +22 -0
- package/node/auth/reducer.js +68 -0
- package/node/auth/saga.js +51 -0
- package/node/auth/utils.js +104 -0
- package/node/connectivity/ConnectivityState/index.js +107 -0
- package/node/connectivity/consts.js +84 -0
- package/node/connectivity/index.js +64 -455
- package/node/connectivity/interfaces.js +5 -0
- package/node/connectivity/reducer.js +38 -0
- package/node/connectivity/saga.js +560 -0
- package/node/{constants-52e37c08.js → constants.js} +14 -11
- package/node/helpers.js +57 -0
- package/node/index.js +120 -293
- package/node/interfaces.js +5 -0
- package/node/subscriptions/Billing/Information/index.js +42 -0
- package/node/subscriptions/Billing/Information/interfaces.js +5 -0
- package/node/subscriptions/Billing/Information/saga.js +141 -0
- package/node/subscriptions/Billing/Invoices/index.js +55 -0
- package/node/subscriptions/Billing/Invoices/interfaces.js +5 -0
- package/node/subscriptions/Billing/Invoices/saga.js +92 -0
- package/node/subscriptions/Billing/PaymentMethod/index.js +51 -0
- package/node/subscriptions/Billing/PaymentMethod/interfaces.js +13 -0
- package/node/subscriptions/Billing/PaymentMethod/saga.js +98 -0
- package/node/subscriptions/Billing/Subscription/index.js +53 -0
- package/node/subscriptions/Billing/Subscription/interfaces.js +5 -0
- package/node/subscriptions/Billing/Subscription/saga.js +131 -0
- package/node/subscriptions/Billing/index.js +38 -0
- package/node/subscriptions/Billing/interfaces.js +57 -0
- package/node/subscriptions/Billing/saga.js +25 -0
- package/node/subscriptions/Checkout/index.js +47 -0
- package/node/subscriptions/Checkout/interfaces.js +5 -0
- package/node/subscriptions/Checkout/saga.js +129 -0
- package/node/subscriptions/Config/index.js +39 -0
- package/node/subscriptions/Config/interfaces.js +5 -0
- package/node/subscriptions/Config/saga.js +71 -0
- package/node/subscriptions/Plans/index.js +38 -0
- package/node/subscriptions/Plans/interfaces.js +5 -0
- package/node/subscriptions/Plans/saga.js +73 -0
- package/node/subscriptions/Stripe/index.js +39 -0
- package/node/subscriptions/Stripe/interfaces.js +5 -0
- package/node/subscriptions/Stripe/saga.js +44 -0
- package/node/subscriptions/dummy.js +84 -0
- package/node/subscriptions/general.interfaces.js +30 -0
- package/node/subscriptions/index.js +70 -906
- package/node/subscriptions/interfaces.js +83 -0
- package/node/subscriptions/mapper.js +51 -0
- package/node/subscriptions/reducer.js +52 -0
- package/node/subscriptions/saga.js +27 -0
- package/node/subscriptions/utils.js +68 -0
- package/node/toolkit/index.js +163 -99
- package/node/toolkit/redux-saga.js +59 -0
- package/node/toolkit/redux.js +43 -0
- package/node/vendor/VendorState/index.js +26 -0
- package/node/vendor/index.js +66 -13
- package/node/vendor/interfaces.js +5 -0
- package/node/vendor/reducer.js +32 -0
- package/node/vendor/saga.js +48 -0
- package/package.json +12 -11
- package/subscriptions/Billing/Information/index.d.ts +12 -12
- package/subscriptions/Billing/Information/index.js +30 -0
- package/subscriptions/Billing/Information/interfaces.d.ts +14 -14
- package/subscriptions/Billing/Information/interfaces.js +1 -0
- package/subscriptions/Billing/Information/saga.d.ts +52 -52
- package/subscriptions/Billing/Information/saga.js +118 -0
- package/subscriptions/Billing/Invoices/index.d.ts +18 -18
- package/subscriptions/Billing/Invoices/index.js +44 -0
- package/subscriptions/Billing/Invoices/interfaces.d.ts +19 -19
- package/subscriptions/Billing/Invoices/interfaces.js +1 -0
- package/subscriptions/Billing/Invoices/saga.d.ts +13 -13
- package/subscriptions/Billing/Invoices/saga.js +75 -0
- package/subscriptions/Billing/PaymentMethod/index.d.ts +20 -20
- package/subscriptions/Billing/PaymentMethod/index.js +40 -0
- package/subscriptions/Billing/PaymentMethod/interfaces.d.ts +46 -46
- package/subscriptions/Billing/PaymentMethod/interfaces.js +6 -0
- package/subscriptions/Billing/PaymentMethod/saga.d.ts +13 -13
- package/subscriptions/Billing/PaymentMethod/saga.js +81 -0
- package/subscriptions/Billing/Subscription/index.d.ts +16 -16
- package/subscriptions/Billing/Subscription/index.js +42 -0
- package/subscriptions/Billing/Subscription/interfaces.d.ts +18 -18
- package/subscriptions/Billing/Subscription/interfaces.js +1 -0
- package/subscriptions/Billing/Subscription/saga.d.ts +13 -13
- package/subscriptions/Billing/Subscription/saga.js +117 -0
- package/subscriptions/Billing/index.d.ts +54 -54
- package/subscriptions/Billing/index.js +23 -0
- package/subscriptions/Billing/interfaces.d.ts +20 -20
- package/subscriptions/Billing/interfaces.js +5 -0
- package/subscriptions/Billing/saga.d.ts +2 -2
- package/subscriptions/Billing/saga.js +11 -0
- package/subscriptions/Checkout/index.d.ts +14 -14
- package/subscriptions/Checkout/index.js +36 -0
- package/subscriptions/Checkout/interfaces.d.ts +17 -17
- package/subscriptions/Checkout/interfaces.js +1 -0
- package/subscriptions/Checkout/saga.d.ts +5 -5
- package/subscriptions/Checkout/saga.js +110 -0
- package/subscriptions/Config/index.d.ts +10 -10
- package/subscriptions/Config/index.js +28 -0
- package/subscriptions/Config/interfaces.d.ts +16 -16
- package/subscriptions/Config/interfaces.js +1 -0
- package/subscriptions/Config/saga.d.ts +2 -2
- package/subscriptions/Config/saga.js +59 -0
- package/subscriptions/Plans/index.d.ts +10 -10
- package/subscriptions/Plans/index.js +25 -0
- package/subscriptions/Plans/interfaces.d.ts +10 -10
- package/subscriptions/Plans/interfaces.js +1 -0
- package/subscriptions/Plans/saga.d.ts +2 -2
- package/subscriptions/Plans/saga.js +58 -0
- package/subscriptions/Stripe/index.d.ts +11 -11
- package/subscriptions/Stripe/index.js +28 -0
- package/subscriptions/Stripe/interfaces.d.ts +10 -10
- package/subscriptions/Stripe/interfaces.js +1 -0
- package/subscriptions/Stripe/saga.d.ts +1 -1
- package/subscriptions/Stripe/saga.js +34 -0
- package/subscriptions/dummy.d.ts +5 -5
- package/subscriptions/dummy.js +72 -0
- package/subscriptions/general.interfaces.d.ts +49 -49
- package/subscriptions/general.interfaces.js +21 -0
- package/subscriptions/index.d.ts +100 -100
- package/subscriptions/index.js +13 -906
- package/subscriptions/interfaces.d.ts +25 -25
- package/subscriptions/interfaces.js +7 -0
- package/subscriptions/mapper.d.ts +6 -6
- package/subscriptions/mapper.js +36 -0
- package/subscriptions/reducer.d.ts +92 -92
- package/subscriptions/reducer.js +29 -0
- package/subscriptions/saga.d.ts +2 -2
- package/subscriptions/saga.js +12 -0
- package/subscriptions/utils.d.ts +68 -68
- package/subscriptions/utils.js +52 -0
- package/toolkit/index.d.ts +24 -23
- package/toolkit/index.js +106 -94
- package/toolkit/redux-saga.d.ts +4 -4
- package/toolkit/redux-saga.js +3 -0
- package/toolkit/redux.d.ts +3 -2
- package/toolkit/redux.js +1 -0
- package/vendor/VendorState/index.d.ts +20 -20
- package/vendor/VendorState/index.js +13 -0
- package/vendor/index.d.ts +17 -17
- package/vendor/index.js +12 -18
- package/vendor/interfaces.d.ts +3 -3
- package/vendor/interfaces.js +1 -0
- package/vendor/reducer.d.ts +8 -8
- package/vendor/reducer.js +19 -0
- package/vendor/saga.d.ts +8 -8
- package/vendor/saga.js +34 -0
- package/audits/backward-compatibility/package.json +0 -6
- package/constants-4d9682b2.js +0 -9
- package/node/index-5642a636.js +0 -4131
- package/node/index-6906e508.js +0 -151
- package/node/saga-b0d1a607.js +0 -230
- package/saga-7a267fe0.js +0 -223
- package/saga-b6529ffb.js +0 -36
package/node/index-6906e508.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var constants = require('./constants-52e37c08.js');
|
|
4
|
-
var toolkit = require('@reduxjs/toolkit');
|
|
5
|
-
var effects = require('redux-saga/effects');
|
|
6
|
-
var restApi = require('@frontegg/rest-api');
|
|
7
|
-
|
|
8
|
-
const resetStateByKey = (key, initialState) => (state) => (Object.assign(Object.assign({}, state), { [key]: initialState[key] }));
|
|
9
|
-
const typeReducer = (key) => (state, { payload }) => (Object.assign(Object.assign({}, state), { [key]: payload }));
|
|
10
|
-
const typeReducerForKey = (key) => ({
|
|
11
|
-
prepare: (payload) => ({ payload }),
|
|
12
|
-
reducer: (state, { payload }) => {
|
|
13
|
-
return Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), payload) });
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
const typeReducerNestedKey = (key, nestedKey) => ({
|
|
17
|
-
prepare: (payload) => ({ payload }),
|
|
18
|
-
reducer: (state, { payload }) => {
|
|
19
|
-
var _a;
|
|
20
|
-
return Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), { [nestedKey]: Object.assign(Object.assign({}, (_a = state === null || state === void 0 ? void 0 : state[key]) === null || _a === void 0 ? void 0 : _a[nestedKey]), payload) }) });
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
const loadersReducerForKey = (key) => ({
|
|
24
|
-
prepare: (payload) => ({ payload }),
|
|
25
|
-
reducer: (state, { payload }) => {
|
|
26
|
-
var _a;
|
|
27
|
-
return (Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), { loaders: Object.assign(Object.assign({}, state[key].loaders), { [payload.key]: (_a = payload.value) !== null && _a !== void 0 ? _a : true }) }) }));
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
const errorsReducerForKey = (key) => ({
|
|
31
|
-
prepare: (payload) => ({ payload }),
|
|
32
|
-
reducer: (state, { payload }) => {
|
|
33
|
-
var _a;
|
|
34
|
-
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 }) }) }));
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
const delay = (delayTime = 500) => new Promise((resolve) => setTimeout(resolve, delayTime));
|
|
38
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
|
|
39
|
-
const lookup = new Uint8Array(256);
|
|
40
|
-
for (let i = 0; i < chars.length; i++) {
|
|
41
|
-
lookup[chars.charCodeAt(i)] = i;
|
|
42
|
-
}
|
|
43
|
-
const base64urlEncode = (arraybuffer) => {
|
|
44
|
-
const bytes = new Uint8Array(arraybuffer);
|
|
45
|
-
const len = bytes.length;
|
|
46
|
-
let i;
|
|
47
|
-
let base64url = '';
|
|
48
|
-
for (i = 0; i < len; i += 3) {
|
|
49
|
-
base64url += chars[bytes[i] >> 2];
|
|
50
|
-
base64url += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
|
51
|
-
base64url += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
|
52
|
-
base64url += chars[bytes[i + 2] & 63];
|
|
53
|
-
}
|
|
54
|
-
if (len % 3 === 2) {
|
|
55
|
-
base64url = base64url.substring(0, base64url.length - 1);
|
|
56
|
-
}
|
|
57
|
-
else if (len % 3 === 1) {
|
|
58
|
-
base64url = base64url.substring(0, base64url.length - 2);
|
|
59
|
-
}
|
|
60
|
-
return base64url;
|
|
61
|
-
};
|
|
62
|
-
const base64urlDecode = (base64string) => {
|
|
63
|
-
const bufferLength = base64string.length * 0.75;
|
|
64
|
-
let len = base64string.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
|
|
65
|
-
const bytes = new Uint8Array(bufferLength);
|
|
66
|
-
for (i = 0; i < len; i += 4) {
|
|
67
|
-
encoded1 = lookup[base64string.charCodeAt(i)];
|
|
68
|
-
encoded2 = lookup[base64string.charCodeAt(i + 1)];
|
|
69
|
-
encoded3 = lookup[base64string.charCodeAt(i + 2)];
|
|
70
|
-
encoded4 = lookup[base64string.charCodeAt(i + 3)];
|
|
71
|
-
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
|
|
72
|
-
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
|
|
73
|
-
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
|
|
74
|
-
}
|
|
75
|
-
return bytes.buffer;
|
|
76
|
-
};
|
|
77
|
-
const publicKeyCredentialToJSON = (pubKeyCred) => {
|
|
78
|
-
if (pubKeyCred instanceof Array) {
|
|
79
|
-
const arr = [];
|
|
80
|
-
for (const i of pubKeyCred) {
|
|
81
|
-
arr.push(publicKeyCredentialToJSON(i));
|
|
82
|
-
}
|
|
83
|
-
return arr;
|
|
84
|
-
}
|
|
85
|
-
else if (pubKeyCred instanceof ArrayBuffer) {
|
|
86
|
-
return base64urlEncode(pubKeyCred);
|
|
87
|
-
}
|
|
88
|
-
else if (pubKeyCred instanceof Object) {
|
|
89
|
-
const obj = {};
|
|
90
|
-
for (const key in pubKeyCred) {
|
|
91
|
-
obj[key] = publicKeyCredentialToJSON(pubKeyCred[key]);
|
|
92
|
-
}
|
|
93
|
-
return obj;
|
|
94
|
-
}
|
|
95
|
-
return pubKeyCred;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const reducers = {
|
|
99
|
-
setVendorState: (state, { payload }) => (Object.assign(Object.assign({}, state), payload)),
|
|
100
|
-
};
|
|
101
|
-
const actions$1 = {
|
|
102
|
-
loadVendorPublicInfo: toolkit.createAction(`${constants.vendorStoreName}/loadVendorPublicInfo`),
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const initialState = {
|
|
106
|
-
whiteLabelMode: false,
|
|
107
|
-
};
|
|
108
|
-
const { reducer, actions: sliceActions } = toolkit.createSlice({
|
|
109
|
-
name: constants.vendorStoreName,
|
|
110
|
-
initialState,
|
|
111
|
-
reducers: Object.assign({}, reducers)
|
|
112
|
-
});
|
|
113
|
-
const actions = Object.assign(Object.assign({}, sliceActions), actions$1);
|
|
114
|
-
|
|
115
|
-
function* loadVendorPublicInfo() {
|
|
116
|
-
try {
|
|
117
|
-
const { whiteLabelMode = false } = yield restApi.api.vendor.getVendorPublicInfo();
|
|
118
|
-
yield effects.put(actions.setVendorState({ whiteLabelMode }));
|
|
119
|
-
}
|
|
120
|
-
catch (e) {
|
|
121
|
-
console.error('failed to getVendorPublicInfo - ', e);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function* sagas() {
|
|
125
|
-
yield effects.takeEvery(actions.loadVendorPublicInfo, loadVendorPublicInfo);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// export store
|
|
129
|
-
var vendorStore = {
|
|
130
|
-
sagas,
|
|
131
|
-
storeName: constants.vendorStoreName,
|
|
132
|
-
initialState,
|
|
133
|
-
reducer,
|
|
134
|
-
actions,
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
exports.actions = actions;
|
|
138
|
-
exports.base64urlDecode = base64urlDecode;
|
|
139
|
-
exports.delay = delay;
|
|
140
|
-
exports.errorsReducerForKey = errorsReducerForKey;
|
|
141
|
-
exports.initialState = initialState;
|
|
142
|
-
exports.loadVendorPublicInfo = loadVendorPublicInfo;
|
|
143
|
-
exports.loadersReducerForKey = loadersReducerForKey;
|
|
144
|
-
exports.publicKeyCredentialToJSON = publicKeyCredentialToJSON;
|
|
145
|
-
exports.reducer = reducer;
|
|
146
|
-
exports.resetStateByKey = resetStateByKey;
|
|
147
|
-
exports.sagas = sagas;
|
|
148
|
-
exports.typeReducer = typeReducer;
|
|
149
|
-
exports.typeReducerForKey = typeReducerForKey;
|
|
150
|
-
exports.typeReducerNestedKey = typeReducerNestedKey;
|
|
151
|
-
exports.vendorStore = vendorStore;
|
package/node/saga-b0d1a607.js
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var restApi = require('@frontegg/rest-api');
|
|
4
|
-
var toolkit = require('@reduxjs/toolkit');
|
|
5
|
-
var effects = require('redux-saga/effects');
|
|
6
|
-
|
|
7
|
-
const initialState = {
|
|
8
|
-
total: 0,
|
|
9
|
-
offset: 0,
|
|
10
|
-
filter: '',
|
|
11
|
-
sortBy: 'createdAt',
|
|
12
|
-
context: null,
|
|
13
|
-
filters: [],
|
|
14
|
-
rowsData: [],
|
|
15
|
-
lastUpdated: new Date(),
|
|
16
|
-
isLoading: true,
|
|
17
|
-
isFetchMore: false,
|
|
18
|
-
totalToday: 0,
|
|
19
|
-
currentPage: 0,
|
|
20
|
-
headerProps: [],
|
|
21
|
-
sortDirection: 'desc',
|
|
22
|
-
severeThisWeek: 0,
|
|
23
|
-
predefinedFilters: [],
|
|
24
|
-
isDownloadingCsv: false,
|
|
25
|
-
virtualScroll: false,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const defaultItemsPerPage = 20;
|
|
29
|
-
const { name: storeName, actions: lifeCycleActions, reducer } = toolkit.createSlice({
|
|
30
|
-
name: 'audits',
|
|
31
|
-
initialState,
|
|
32
|
-
reducers: {
|
|
33
|
-
setContext: (state, { payload }) => {
|
|
34
|
-
state.context = payload;
|
|
35
|
-
},
|
|
36
|
-
startLoading: (state) => {
|
|
37
|
-
state.isLoading = true;
|
|
38
|
-
},
|
|
39
|
-
setVirtualScroll: (state, { payload }) => {
|
|
40
|
-
state.virtualScroll = payload;
|
|
41
|
-
},
|
|
42
|
-
startRefresh: (state) => {
|
|
43
|
-
state.isLoading = true;
|
|
44
|
-
},
|
|
45
|
-
startFetching: (state) => {
|
|
46
|
-
state.isFetchMore = true;
|
|
47
|
-
},
|
|
48
|
-
finishLoading: (state) => {
|
|
49
|
-
state.isLoading = false;
|
|
50
|
-
},
|
|
51
|
-
startDownloadingCsv: (state) => {
|
|
52
|
-
state.isDownloadingCsv = true;
|
|
53
|
-
},
|
|
54
|
-
stopDownloadingCsv: (state) => {
|
|
55
|
-
state.isDownloadingCsv = false;
|
|
56
|
-
},
|
|
57
|
-
loadStatsSuccess: (state, { payload }) => {
|
|
58
|
-
state.error = undefined;
|
|
59
|
-
state.totalToday = payload.totalToday;
|
|
60
|
-
state.severeThisWeek = payload.severeThisWeek;
|
|
61
|
-
},
|
|
62
|
-
loadItemFailedAction: (state, { payload }) => {
|
|
63
|
-
state.error = Object.assign(Object.assign({}, state.error), { [payload.name]: payload.error });
|
|
64
|
-
},
|
|
65
|
-
loadMetadataSuccess: (state, { payload }) => {
|
|
66
|
-
state.error = {};
|
|
67
|
-
state.headerProps = payload.properties;
|
|
68
|
-
state.themeAudits = payload.theme ? payload.theme.styles : {};
|
|
69
|
-
},
|
|
70
|
-
loadAuditsSuccess: (state, { payload }) => {
|
|
71
|
-
state.error = {};
|
|
72
|
-
state.rowsData = payload.rowsData;
|
|
73
|
-
state.lastUpdated = new Date();
|
|
74
|
-
state.total = payload.total;
|
|
75
|
-
},
|
|
76
|
-
fetchMoreSuccess: (state, { payload }) => {
|
|
77
|
-
state.error = {};
|
|
78
|
-
state.offset = payload.offset;
|
|
79
|
-
state.currentPage = payload.currentPage;
|
|
80
|
-
state.isFetchMore = false;
|
|
81
|
-
},
|
|
82
|
-
setFilterData: (state, { payload }) => {
|
|
83
|
-
state.filters = payload;
|
|
84
|
-
state.currentPage = 0;
|
|
85
|
-
state.offset = 0;
|
|
86
|
-
state.isLoading = true;
|
|
87
|
-
},
|
|
88
|
-
textSearch: (state, { payload }) => {
|
|
89
|
-
state.filter = payload;
|
|
90
|
-
state.currentPage = 0;
|
|
91
|
-
state.offset = 0;
|
|
92
|
-
state.isLoading = true;
|
|
93
|
-
},
|
|
94
|
-
onPageChange: (state, { payload }) => {
|
|
95
|
-
state.currentPage = payload - 1;
|
|
96
|
-
state.offset = state.currentPage * defaultItemsPerPage;
|
|
97
|
-
state.isLoading = true;
|
|
98
|
-
},
|
|
99
|
-
setDataSorting: (state, { payload }) => {
|
|
100
|
-
state.sortBy = payload.sortBy;
|
|
101
|
-
state.currentPage = 0;
|
|
102
|
-
state.sortDirection = payload.sortDirection === 'asc' ? 'desc' : 'asc';
|
|
103
|
-
state.offset = 0;
|
|
104
|
-
state.isLoading = true;
|
|
105
|
-
},
|
|
106
|
-
setPredefinedFilters: (state, { payload }) => {
|
|
107
|
-
state.predefinedFilters = payload;
|
|
108
|
-
state.filters = Object.keys(payload).map((key) => ({ key, value: payload[key] }));
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
const actions = Object.assign(Object.assign({}, lifeCycleActions), { initData: toolkit.createAction(`${storeName}/initData`), loadAudits: toolkit.createAction(`${storeName}/loadAudits`), removeFilter: toolkit.createAction(`${storeName}/removeFilter`), filterData: toolkit.createAction(`${storeName}/filterData`), exportCSV: toolkit.createAction(`${storeName}/exportCSV`), deleteAudits: toolkit.createAction(`${storeName}/deleteAudits`) });
|
|
113
|
-
|
|
114
|
-
const select = () => effects.select((_) => _[storeName]);
|
|
115
|
-
function* loadStats() {
|
|
116
|
-
const { sortBy, sortDirection } = yield select();
|
|
117
|
-
try {
|
|
118
|
-
const stats = yield effects.call(restApi.api.audits.getAuditsStats, {
|
|
119
|
-
sortBy,
|
|
120
|
-
sortDirection,
|
|
121
|
-
count: defaultItemsPerPage,
|
|
122
|
-
});
|
|
123
|
-
yield effects.put(actions.loadStatsSuccess(stats));
|
|
124
|
-
}
|
|
125
|
-
catch (e) {
|
|
126
|
-
const errorMessage = {
|
|
127
|
-
name: 'stats',
|
|
128
|
-
error: e,
|
|
129
|
-
};
|
|
130
|
-
console.error('failed to load stats - ', e);
|
|
131
|
-
yield effects.put(actions.loadItemFailedAction(errorMessage));
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
function* loadMetadata() {
|
|
135
|
-
try {
|
|
136
|
-
const result = yield effects.call(restApi.api.metadata.getAuditsMetadata);
|
|
137
|
-
yield effects.put(actions.loadMetadataSuccess(result));
|
|
138
|
-
}
|
|
139
|
-
catch (e) {
|
|
140
|
-
const errorMessage = {
|
|
141
|
-
name: 'metadata',
|
|
142
|
-
error: e,
|
|
143
|
-
};
|
|
144
|
-
console.error('failed to load metadata - ', e);
|
|
145
|
-
yield effects.put(actions.loadItemFailedAction(errorMessage));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const filterToObject = (arr) => arr.reduce((res, curr) => {
|
|
149
|
-
res[curr.key] = curr.value;
|
|
150
|
-
return res;
|
|
151
|
-
}, {});
|
|
152
|
-
function* loadAuditsFunction({ payload }) {
|
|
153
|
-
const { filters, sortBy, sortDirection, filter, offset, virtualScroll } = yield select();
|
|
154
|
-
const { appendMode = virtualScroll, onlyOneLoad = true, offset: incomeOffset } = payload || {};
|
|
155
|
-
const { rowsData } = appendMode ? yield select() : { rowsData: [] };
|
|
156
|
-
try {
|
|
157
|
-
const f2o = filterToObject(filters);
|
|
158
|
-
const { data, total } = yield effects.call(restApi.api.audits.getAudits, Object.assign(Object.assign(Object.assign(Object.assign({}, (virtualScroll && { paginationMode: 'virtual' })), { sortDirection,
|
|
159
|
-
sortBy,
|
|
160
|
-
filter }), f2o), {
|
|
161
|
-
// TODO: refactor once api become V2 with query field for virtual scroll
|
|
162
|
-
offset: virtualScroll ? rowsData.length + incomeOffset || rowsData.length + offset : incomeOffset || offset, count: defaultItemsPerPage }));
|
|
163
|
-
yield effects.put(actions.loadAuditsSuccess({ rowsData: [...rowsData, ...data], total }));
|
|
164
|
-
onlyOneLoad && (yield effects.put(actions.finishLoading()));
|
|
165
|
-
}
|
|
166
|
-
catch (e) {
|
|
167
|
-
const errorMessage = {
|
|
168
|
-
name: 'audits',
|
|
169
|
-
error: e,
|
|
170
|
-
};
|
|
171
|
-
console.error('failed to load audits - ', e);
|
|
172
|
-
yield effects.put(actions.loadItemFailedAction(errorMessage));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
function* initDataFunction() {
|
|
176
|
-
yield effects.put(actions.startLoading());
|
|
177
|
-
yield effects.all([loadStats(), loadMetadata(), loadAuditsFunction({ payload: { onlyOneLoad: false }, type: '' })]);
|
|
178
|
-
yield effects.put(actions.finishLoading());
|
|
179
|
-
}
|
|
180
|
-
function* removeFilterFunction({ payload }) {
|
|
181
|
-
const { filters: allFilters } = yield select();
|
|
182
|
-
const removedFilterIndex = allFilters.findIndex((item) => item.key === payload.key);
|
|
183
|
-
if (removedFilterIndex < 0) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
const newFilters = [...allFilters.slice(0, removedFilterIndex), ...allFilters.slice(removedFilterIndex + 1)];
|
|
187
|
-
yield effects.put(actions.setFilterData(newFilters));
|
|
188
|
-
}
|
|
189
|
-
function* filterDataFunction({ payload }) {
|
|
190
|
-
const { filters: allFilters } = yield select();
|
|
191
|
-
let filterIndex = allFilters.findIndex((item) => item.key === payload.key);
|
|
192
|
-
if (filterIndex < 0) {
|
|
193
|
-
filterIndex = allFilters.length;
|
|
194
|
-
}
|
|
195
|
-
const newFilters = [...allFilters.slice(0, filterIndex), payload, ...allFilters.slice(filterIndex + 1)];
|
|
196
|
-
yield effects.put(actions.setFilterData(newFilters));
|
|
197
|
-
}
|
|
198
|
-
function* exportCsvFunction() {
|
|
199
|
-
const { filters, sortBy, sortDirection, filter, headerProps } = yield select();
|
|
200
|
-
const f2o = filterToObject(filters);
|
|
201
|
-
yield effects.put(actions.startDownloadingCsv());
|
|
202
|
-
const outputFileName = `audits.csv`;
|
|
203
|
-
try {
|
|
204
|
-
yield restApi.api.audits.exportAudits(Object.assign(Object.assign({ endpoint: 'csv/v2', headerProps,
|
|
205
|
-
sortDirection,
|
|
206
|
-
sortBy,
|
|
207
|
-
filter }, f2o), { offset: 0, outputFileName }));
|
|
208
|
-
}
|
|
209
|
-
catch (e) {
|
|
210
|
-
console.error('failed to export audits - ', e);
|
|
211
|
-
}
|
|
212
|
-
finally {
|
|
213
|
-
yield effects.put(actions.stopDownloadingCsv());
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
function* sagas() {
|
|
217
|
-
yield effects.takeLatest(actions.initData, initDataFunction);
|
|
218
|
-
yield effects.takeLatest(actions.removeFilter, removeFilterFunction);
|
|
219
|
-
yield effects.takeLatest(actions.filterData, filterDataFunction);
|
|
220
|
-
yield effects.takeLatest([actions.loadAudits, actions.textSearch, actions.onPageChange], loadAuditsFunction);
|
|
221
|
-
yield effects.takeLatest([actions.setFilterData, actions.setDataSorting, actions.startRefresh], () => loadAuditsFunction({ payload: { appendMode: false }, type: '' }));
|
|
222
|
-
yield effects.takeLatest(actions.exportCSV, exportCsvFunction);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
exports.actions = actions;
|
|
226
|
-
exports.defaultItemsPerPage = defaultItemsPerPage;
|
|
227
|
-
exports.initialState = initialState;
|
|
228
|
-
exports.reducer = reducer;
|
|
229
|
-
exports.sagas = sagas;
|
|
230
|
-
exports.storeName = storeName;
|
package/saga-7a267fe0.js
DELETED
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { api } from '@frontegg/rest-api';
|
|
2
|
-
import { createSlice, createAction } from '@reduxjs/toolkit';
|
|
3
|
-
import { takeLatest, select as select$1, call, put, all } from 'redux-saga/effects';
|
|
4
|
-
|
|
5
|
-
const initialState = {
|
|
6
|
-
total: 0,
|
|
7
|
-
offset: 0,
|
|
8
|
-
filter: '',
|
|
9
|
-
sortBy: 'createdAt',
|
|
10
|
-
context: null,
|
|
11
|
-
filters: [],
|
|
12
|
-
rowsData: [],
|
|
13
|
-
lastUpdated: new Date(),
|
|
14
|
-
isLoading: true,
|
|
15
|
-
isFetchMore: false,
|
|
16
|
-
totalToday: 0,
|
|
17
|
-
currentPage: 0,
|
|
18
|
-
headerProps: [],
|
|
19
|
-
sortDirection: 'desc',
|
|
20
|
-
severeThisWeek: 0,
|
|
21
|
-
predefinedFilters: [],
|
|
22
|
-
isDownloadingCsv: false,
|
|
23
|
-
virtualScroll: false,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const defaultItemsPerPage = 20;
|
|
27
|
-
const { name: storeName, actions: lifeCycleActions, reducer } = createSlice({
|
|
28
|
-
name: 'audits',
|
|
29
|
-
initialState,
|
|
30
|
-
reducers: {
|
|
31
|
-
setContext: (state, { payload }) => {
|
|
32
|
-
state.context = payload;
|
|
33
|
-
},
|
|
34
|
-
startLoading: (state) => {
|
|
35
|
-
state.isLoading = true;
|
|
36
|
-
},
|
|
37
|
-
setVirtualScroll: (state, { payload }) => {
|
|
38
|
-
state.virtualScroll = payload;
|
|
39
|
-
},
|
|
40
|
-
startRefresh: (state) => {
|
|
41
|
-
state.isLoading = true;
|
|
42
|
-
},
|
|
43
|
-
startFetching: (state) => {
|
|
44
|
-
state.isFetchMore = true;
|
|
45
|
-
},
|
|
46
|
-
finishLoading: (state) => {
|
|
47
|
-
state.isLoading = false;
|
|
48
|
-
},
|
|
49
|
-
startDownloadingCsv: (state) => {
|
|
50
|
-
state.isDownloadingCsv = true;
|
|
51
|
-
},
|
|
52
|
-
stopDownloadingCsv: (state) => {
|
|
53
|
-
state.isDownloadingCsv = false;
|
|
54
|
-
},
|
|
55
|
-
loadStatsSuccess: (state, { payload }) => {
|
|
56
|
-
state.error = undefined;
|
|
57
|
-
state.totalToday = payload.totalToday;
|
|
58
|
-
state.severeThisWeek = payload.severeThisWeek;
|
|
59
|
-
},
|
|
60
|
-
loadItemFailedAction: (state, { payload }) => {
|
|
61
|
-
state.error = Object.assign(Object.assign({}, state.error), { [payload.name]: payload.error });
|
|
62
|
-
},
|
|
63
|
-
loadMetadataSuccess: (state, { payload }) => {
|
|
64
|
-
state.error = {};
|
|
65
|
-
state.headerProps = payload.properties;
|
|
66
|
-
state.themeAudits = payload.theme ? payload.theme.styles : {};
|
|
67
|
-
},
|
|
68
|
-
loadAuditsSuccess: (state, { payload }) => {
|
|
69
|
-
state.error = {};
|
|
70
|
-
state.rowsData = payload.rowsData;
|
|
71
|
-
state.lastUpdated = new Date();
|
|
72
|
-
state.total = payload.total;
|
|
73
|
-
},
|
|
74
|
-
fetchMoreSuccess: (state, { payload }) => {
|
|
75
|
-
state.error = {};
|
|
76
|
-
state.offset = payload.offset;
|
|
77
|
-
state.currentPage = payload.currentPage;
|
|
78
|
-
state.isFetchMore = false;
|
|
79
|
-
},
|
|
80
|
-
setFilterData: (state, { payload }) => {
|
|
81
|
-
state.filters = payload;
|
|
82
|
-
state.currentPage = 0;
|
|
83
|
-
state.offset = 0;
|
|
84
|
-
state.isLoading = true;
|
|
85
|
-
},
|
|
86
|
-
textSearch: (state, { payload }) => {
|
|
87
|
-
state.filter = payload;
|
|
88
|
-
state.currentPage = 0;
|
|
89
|
-
state.offset = 0;
|
|
90
|
-
state.isLoading = true;
|
|
91
|
-
},
|
|
92
|
-
onPageChange: (state, { payload }) => {
|
|
93
|
-
state.currentPage = payload - 1;
|
|
94
|
-
state.offset = state.currentPage * defaultItemsPerPage;
|
|
95
|
-
state.isLoading = true;
|
|
96
|
-
},
|
|
97
|
-
setDataSorting: (state, { payload }) => {
|
|
98
|
-
state.sortBy = payload.sortBy;
|
|
99
|
-
state.currentPage = 0;
|
|
100
|
-
state.sortDirection = payload.sortDirection === 'asc' ? 'desc' : 'asc';
|
|
101
|
-
state.offset = 0;
|
|
102
|
-
state.isLoading = true;
|
|
103
|
-
},
|
|
104
|
-
setPredefinedFilters: (state, { payload }) => {
|
|
105
|
-
state.predefinedFilters = payload;
|
|
106
|
-
state.filters = Object.keys(payload).map((key) => ({ key, value: payload[key] }));
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
const actions = Object.assign(Object.assign({}, lifeCycleActions), { initData: createAction(`${storeName}/initData`), loadAudits: createAction(`${storeName}/loadAudits`), removeFilter: createAction(`${storeName}/removeFilter`), filterData: createAction(`${storeName}/filterData`), exportCSV: createAction(`${storeName}/exportCSV`), deleteAudits: createAction(`${storeName}/deleteAudits`) });
|
|
111
|
-
|
|
112
|
-
const select = () => select$1((_) => _[storeName]);
|
|
113
|
-
function* loadStats() {
|
|
114
|
-
const { sortBy, sortDirection } = yield select();
|
|
115
|
-
try {
|
|
116
|
-
const stats = yield call(api.audits.getAuditsStats, {
|
|
117
|
-
sortBy,
|
|
118
|
-
sortDirection,
|
|
119
|
-
count: defaultItemsPerPage,
|
|
120
|
-
});
|
|
121
|
-
yield put(actions.loadStatsSuccess(stats));
|
|
122
|
-
}
|
|
123
|
-
catch (e) {
|
|
124
|
-
const errorMessage = {
|
|
125
|
-
name: 'stats',
|
|
126
|
-
error: e,
|
|
127
|
-
};
|
|
128
|
-
console.error('failed to load stats - ', e);
|
|
129
|
-
yield put(actions.loadItemFailedAction(errorMessage));
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
function* loadMetadata() {
|
|
133
|
-
try {
|
|
134
|
-
const result = yield call(api.metadata.getAuditsMetadata);
|
|
135
|
-
yield put(actions.loadMetadataSuccess(result));
|
|
136
|
-
}
|
|
137
|
-
catch (e) {
|
|
138
|
-
const errorMessage = {
|
|
139
|
-
name: 'metadata',
|
|
140
|
-
error: e,
|
|
141
|
-
};
|
|
142
|
-
console.error('failed to load metadata - ', e);
|
|
143
|
-
yield put(actions.loadItemFailedAction(errorMessage));
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
const filterToObject = (arr) => arr.reduce((res, curr) => {
|
|
147
|
-
res[curr.key] = curr.value;
|
|
148
|
-
return res;
|
|
149
|
-
}, {});
|
|
150
|
-
function* loadAuditsFunction({ payload }) {
|
|
151
|
-
const { filters, sortBy, sortDirection, filter, offset, virtualScroll } = yield select();
|
|
152
|
-
const { appendMode = virtualScroll, onlyOneLoad = true, offset: incomeOffset } = payload || {};
|
|
153
|
-
const { rowsData } = appendMode ? yield select() : { rowsData: [] };
|
|
154
|
-
try {
|
|
155
|
-
const f2o = filterToObject(filters);
|
|
156
|
-
const { data, total } = yield call(api.audits.getAudits, Object.assign(Object.assign(Object.assign(Object.assign({}, (virtualScroll && { paginationMode: 'virtual' })), { sortDirection,
|
|
157
|
-
sortBy,
|
|
158
|
-
filter }), f2o), {
|
|
159
|
-
// TODO: refactor once api become V2 with query field for virtual scroll
|
|
160
|
-
offset: virtualScroll ? rowsData.length + incomeOffset || rowsData.length + offset : incomeOffset || offset, count: defaultItemsPerPage }));
|
|
161
|
-
yield put(actions.loadAuditsSuccess({ rowsData: [...rowsData, ...data], total }));
|
|
162
|
-
onlyOneLoad && (yield put(actions.finishLoading()));
|
|
163
|
-
}
|
|
164
|
-
catch (e) {
|
|
165
|
-
const errorMessage = {
|
|
166
|
-
name: 'audits',
|
|
167
|
-
error: e,
|
|
168
|
-
};
|
|
169
|
-
console.error('failed to load audits - ', e);
|
|
170
|
-
yield put(actions.loadItemFailedAction(errorMessage));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
function* initDataFunction() {
|
|
174
|
-
yield put(actions.startLoading());
|
|
175
|
-
yield all([loadStats(), loadMetadata(), loadAuditsFunction({ payload: { onlyOneLoad: false }, type: '' })]);
|
|
176
|
-
yield put(actions.finishLoading());
|
|
177
|
-
}
|
|
178
|
-
function* removeFilterFunction({ payload }) {
|
|
179
|
-
const { filters: allFilters } = yield select();
|
|
180
|
-
const removedFilterIndex = allFilters.findIndex((item) => item.key === payload.key);
|
|
181
|
-
if (removedFilterIndex < 0) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
const newFilters = [...allFilters.slice(0, removedFilterIndex), ...allFilters.slice(removedFilterIndex + 1)];
|
|
185
|
-
yield put(actions.setFilterData(newFilters));
|
|
186
|
-
}
|
|
187
|
-
function* filterDataFunction({ payload }) {
|
|
188
|
-
const { filters: allFilters } = yield select();
|
|
189
|
-
let filterIndex = allFilters.findIndex((item) => item.key === payload.key);
|
|
190
|
-
if (filterIndex < 0) {
|
|
191
|
-
filterIndex = allFilters.length;
|
|
192
|
-
}
|
|
193
|
-
const newFilters = [...allFilters.slice(0, filterIndex), payload, ...allFilters.slice(filterIndex + 1)];
|
|
194
|
-
yield put(actions.setFilterData(newFilters));
|
|
195
|
-
}
|
|
196
|
-
function* exportCsvFunction() {
|
|
197
|
-
const { filters, sortBy, sortDirection, filter, headerProps } = yield select();
|
|
198
|
-
const f2o = filterToObject(filters);
|
|
199
|
-
yield put(actions.startDownloadingCsv());
|
|
200
|
-
const outputFileName = `audits.csv`;
|
|
201
|
-
try {
|
|
202
|
-
yield api.audits.exportAudits(Object.assign(Object.assign({ endpoint: 'csv/v2', headerProps,
|
|
203
|
-
sortDirection,
|
|
204
|
-
sortBy,
|
|
205
|
-
filter }, f2o), { offset: 0, outputFileName }));
|
|
206
|
-
}
|
|
207
|
-
catch (e) {
|
|
208
|
-
console.error('failed to export audits - ', e);
|
|
209
|
-
}
|
|
210
|
-
finally {
|
|
211
|
-
yield put(actions.stopDownloadingCsv());
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
function* sagas() {
|
|
215
|
-
yield takeLatest(actions.initData, initDataFunction);
|
|
216
|
-
yield takeLatest(actions.removeFilter, removeFilterFunction);
|
|
217
|
-
yield takeLatest(actions.filterData, filterDataFunction);
|
|
218
|
-
yield takeLatest([actions.loadAudits, actions.textSearch, actions.onPageChange], loadAuditsFunction);
|
|
219
|
-
yield takeLatest([actions.setFilterData, actions.setDataSorting, actions.startRefresh], () => loadAuditsFunction({ payload: { appendMode: false }, type: '' }));
|
|
220
|
-
yield takeLatest(actions.exportCSV, exportCsvFunction);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export { actions as a, sagas as b, defaultItemsPerPage as d, initialState as i, reducer as r, storeName as s };
|
package/saga-b6529ffb.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { takeEvery, put } from 'redux-saga/effects';
|
|
2
|
-
import { api } from '@frontegg/rest-api';
|
|
3
|
-
import { v as vendorStoreName } from './constants-4d9682b2.js';
|
|
4
|
-
import { createAction, createSlice } from '@reduxjs/toolkit';
|
|
5
|
-
|
|
6
|
-
const reducers = {
|
|
7
|
-
setVendorState: (state, { payload }) => (Object.assign(Object.assign({}, state), payload)),
|
|
8
|
-
};
|
|
9
|
-
const actions$1 = {
|
|
10
|
-
loadVendorPublicInfo: createAction(`${vendorStoreName}/loadVendorPublicInfo`),
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const initialState = {
|
|
14
|
-
whiteLabelMode: false,
|
|
15
|
-
};
|
|
16
|
-
const { reducer, actions: sliceActions } = createSlice({
|
|
17
|
-
name: vendorStoreName,
|
|
18
|
-
initialState,
|
|
19
|
-
reducers: Object.assign({}, reducers)
|
|
20
|
-
});
|
|
21
|
-
const actions = Object.assign(Object.assign({}, sliceActions), actions$1);
|
|
22
|
-
|
|
23
|
-
function* loadVendorPublicInfo() {
|
|
24
|
-
try {
|
|
25
|
-
const { whiteLabelMode = false } = yield api.vendor.getVendorPublicInfo();
|
|
26
|
-
yield put(actions.setVendorState({ whiteLabelMode }));
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
console.error('failed to getVendorPublicInfo - ', e);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function* sagas() {
|
|
33
|
-
yield takeEvery(actions.loadVendorPublicInfo, loadVendorPublicInfo);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { actions as a, initialState as i, loadVendorPublicInfo as l, reducer as r, sagas as s };
|