@zeniai/client-epic-state 4.14.1 → 4.14.3
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/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscatgorizedEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscatgorizedEpic.js +14 -10
- package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.d.ts +1 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +0 -13
- package/lib/view/settingsView/settingsViewHelpers.js +4 -8
- package/package.json +1 -1
|
@@ -4,5 +4,6 @@ import { ZeniAPI } from '../../../../zeniAPI';
|
|
|
4
4
|
import { updateStatusForTransactionNotMiscategorizedUpdate, markTransactionAsNotMiscategorized, updateTotalCountForTransactionCategorization } from '../../reducers/transactionsViewReducer';
|
|
5
5
|
import { removeTransactionCategorization } from '../../../../entity/transaction/transactionReducer';
|
|
6
6
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
7
|
-
|
|
7
|
+
import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
|
|
8
|
+
export declare type ActionType = ReturnType<typeof removeTransactionCategorization> | ReturnType<typeof openSnackbar> | ReturnType<typeof markTransactionAsNotMiscategorized> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof updateStatusForTransactionNotMiscategorizedUpdate> | ReturnType<typeof updateTotalCountForTransactionCategorization>;
|
|
8
9
|
export declare const markTransactionAsNotMiscategorizedEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.markTransactionAsNotMiscategorizedEpic = void 0;
|
|
4
4
|
const operators_1 = require("rxjs/operators");
|
|
5
5
|
const rxjs_1 = require("rxjs");
|
|
6
|
-
const operators_2 = require("rxjs/operators");
|
|
7
6
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
7
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
9
8
|
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
10
9
|
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
11
10
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
12
11
|
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
12
|
+
const monthEndCloseChecksViewReducer_1 = require("../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer");
|
|
13
13
|
const TRANSACTION_COUNT_VARIABLE_NAME = '_transactions_count_';
|
|
14
|
-
const markTransactionAsNotMiscategorizedEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.markTransactionAsNotMiscategorized.match), (0,
|
|
14
|
+
const markTransactionAsNotMiscategorizedEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.markTransactionAsNotMiscategorized.match), (0, operators_1.mergeMap)((action) => {
|
|
15
15
|
const { expenseAutomationViewState, expenseAutomationTransactionsViewState, } = state$.value;
|
|
16
16
|
const transactionsInReview = action.payload.transactionsInReview;
|
|
17
17
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
|
|
@@ -21,7 +21,7 @@ const markTransactionAsNotMiscategorizedEpic = (actions$, state$, zeniAPI) => ac
|
|
|
21
21
|
if (transactionsInReview.length > 0) {
|
|
22
22
|
return zeniAPI
|
|
23
23
|
.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/mark-as-reviewed`, { transactions_reviewed: transactionsInReview })
|
|
24
|
-
.pipe((0,
|
|
24
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
25
25
|
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
26
26
|
const transactionIds = transactionsInReview.map((transaction) => transaction.transaction_id);
|
|
27
27
|
const totalCountByPeriod = uiState.totalCount[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)];
|
|
@@ -29,16 +29,13 @@ const markTransactionAsNotMiscategorizedEpic = (actions$, state$, zeniAPI) => ac
|
|
|
29
29
|
? totalCountByPeriod
|
|
30
30
|
: totalCountByPeriod - transactionIds.length;
|
|
31
31
|
const actions = [];
|
|
32
|
-
actions.push((0, transactionsViewReducer_1.updateStatusForTransactionNotMiscategorizedUpdate)(action.payload.selectedTab, transactionIds, selectedPeriod, 'Completed'))
|
|
33
|
-
actions.push((0, transactionReducer_1.removeTransactionCategorization)({
|
|
32
|
+
actions.push((0, transactionsViewReducer_1.updateStatusForTransactionNotMiscategorizedUpdate)(action.payload.selectedTab, transactionIds, selectedPeriod, 'Completed'), (0, transactionReducer_1.removeTransactionCategorization)({
|
|
34
33
|
transactionIds: transactionIds,
|
|
35
|
-
}))
|
|
36
|
-
actions.push((0, transactionsViewReducer_1.updateTotalCountForTransactionCategorization)({
|
|
34
|
+
}), (0, transactionsViewReducer_1.updateTotalCountForTransactionCategorization)({
|
|
37
35
|
selectedPeriod,
|
|
38
36
|
selectedTab,
|
|
39
37
|
totalCount: updatedTotalCount,
|
|
40
|
-
}))
|
|
41
|
-
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
38
|
+
}), (0, snackbarReducer_1.openSnackbar)({
|
|
42
39
|
messageSection: 'transactions_reviewed',
|
|
43
40
|
messageText: 'success',
|
|
44
41
|
type: 'success',
|
|
@@ -55,12 +52,19 @@ const markTransactionAsNotMiscategorizedEpic = (actions$, state$, zeniAPI) => ac
|
|
|
55
52
|
},
|
|
56
53
|
],
|
|
57
54
|
}));
|
|
55
|
+
if (currentTenant != null) {
|
|
56
|
+
actions.push((0, monthEndCloseChecksViewReducer_1.fetchMonthEndCloseChecks)({
|
|
57
|
+
tenantId: currentTenant.tenantId,
|
|
58
|
+
period: selectedPeriod,
|
|
59
|
+
refreshViewInBackground: true,
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
58
62
|
return (0, rxjs_1.from)(actions);
|
|
59
63
|
}
|
|
60
64
|
else {
|
|
61
65
|
return (0, rxjs_1.of)((0, transactionsViewReducer_1.updateStatusForTransactionNotMiscategorizedUpdate)(action.payload.selectedTab, [], selectedPeriod, 'Error', response.status));
|
|
62
66
|
}
|
|
63
|
-
}), (0,
|
|
67
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, transactionsViewReducer_1.updateStatusForTransactionNotMiscategorizedUpdate)(action.payload.selectedTab, [], selectedPeriod, 'Error', (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Transaction mark miscategorized as correct REST API call errored out ${JSON.stringify(error)}`)))));
|
|
64
68
|
}
|
|
65
69
|
else {
|
|
66
70
|
return (0, rxjs_1.from)([]);
|
|
@@ -2,6 +2,5 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { RootState } from '../../../../reducer';
|
|
3
3
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
4
4
|
import { updateTransactionCategorization, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized } from '../../reducers/transactionsViewReducer';
|
|
5
|
-
|
|
6
|
-
export declare type ActionType = ReturnType<typeof updateTransactionCategorization> | ReturnType<typeof updateTransactionCategorizationSaveStatus> | ReturnType<typeof markTransactionAsNotMiscategorized> | ReturnType<typeof fetchMonthEndCloseChecks>;
|
|
5
|
+
export declare type ActionType = ReturnType<typeof updateTransactionCategorization> | ReturnType<typeof updateTransactionCategorizationSaveStatus> | ReturnType<typeof markTransactionAsNotMiscategorized>;
|
|
7
6
|
export declare const updateTransactionCategorizationEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -20,11 +20,8 @@ const transactionSelector_1 = require("../../../../entity/transaction/transactio
|
|
|
20
20
|
const vendorSelector_1 = require("../../../../entity/vendor/vendorSelector");
|
|
21
21
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
22
22
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
23
|
-
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
24
|
-
const monthEndCloseChecksViewReducer_1 = require("../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer");
|
|
25
23
|
const updateTransactionCategorizationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.updateTransactionCategorization.match), (0, operators_1.mergeMap)((action) => {
|
|
26
24
|
const { selectedTab } = action.payload;
|
|
27
|
-
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
|
|
28
25
|
const { transactionState, vendorState, expenseAutomationTransactionsViewState, } = state$.value;
|
|
29
26
|
const payloadArray = preparePayload(selectedTab, transactionState, vendorState, expenseAutomationTransactionsViewState, action.payload.transactionIds, action.payload.transactionSaveUpdates).filter((payload) => payload != null);
|
|
30
27
|
return zeniAPI
|
|
@@ -34,16 +31,6 @@ const updateTransactionCategorizationEpic = (actions$, state$, zeniAPI) => actio
|
|
|
34
31
|
const transactionsInReview = response.data.transactions_update_success;
|
|
35
32
|
const actions = [];
|
|
36
33
|
actions.push((0, transactionsViewReducer_1.markTransactionAsNotMiscategorized)(selectedTab, transactionsInReview), (0, transactionsViewReducer_1.updateTransactionCategorizationSaveStatus)(selectedTab, 'Completed', (0, responsePayload_1.createZeniAPIStatus)('Completed', 'Transaction categorization updated successfully')));
|
|
37
|
-
if (currentTenant != null) {
|
|
38
|
-
const selectedPeriodByTenantId = state$.value.expenseAutomationViewState
|
|
39
|
-
.selectedPeriodByTenantId;
|
|
40
|
-
const monthEndChecksPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
41
|
-
actions.push((0, monthEndCloseChecksViewReducer_1.fetchMonthEndCloseChecks)({
|
|
42
|
-
tenantId: currentTenant.tenantId,
|
|
43
|
-
period: monthEndChecksPeriod,
|
|
44
|
-
refreshViewInBackground: true,
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
34
|
return (0, rxjs_1.from)(actions);
|
|
48
35
|
}
|
|
49
36
|
else {
|
|
@@ -46,12 +46,10 @@ const isBankConnectionsTabVisible = (currentTenant, userRoleMap) => {
|
|
|
46
46
|
return false;
|
|
47
47
|
}
|
|
48
48
|
if ((0, exports.isSettingsVisible)(currentTenant)) {
|
|
49
|
-
return ((
|
|
49
|
+
return ((0, userRoleType_1.hasBillPayAccessible)(currentTenant, userRoleMap) ||
|
|
50
50
|
(0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
|
|
51
51
|
(0, userRoleType_1.hasZeniAccountsAccessible)(currentTenant, userRoleMap) ||
|
|
52
|
-
(0, userRoleType_1.hasChargeCardAccessible)(currentTenant, userRoleMap))
|
|
53
|
-
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false &&
|
|
54
|
-
(0, tenantSelector_1.isTenantCardsOnly)(currentTenant) === false);
|
|
52
|
+
(0, userRoleType_1.hasChargeCardAccessible)(currentTenant, userRoleMap));
|
|
55
53
|
}
|
|
56
54
|
else {
|
|
57
55
|
return false;
|
|
@@ -63,12 +61,10 @@ const isBusinessVerificationTabVisible = (currentTenant, userRoleMap) => {
|
|
|
63
61
|
return false;
|
|
64
62
|
}
|
|
65
63
|
if ((0, exports.isSettingsVisible)(currentTenant)) {
|
|
66
|
-
return ((
|
|
64
|
+
return ((0, userRoleType_1.hasBillPayAccessible)(currentTenant, userRoleMap) ||
|
|
67
65
|
(0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
|
|
68
66
|
(0, userRoleType_1.hasZeniAccountsAccessible)(currentTenant, userRoleMap) ||
|
|
69
|
-
(0, userRoleType_1.hasChargeCardAccessible)(currentTenant, userRoleMap))
|
|
70
|
-
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false &&
|
|
71
|
-
(0, tenantSelector_1.isTenantCardsOnly)(currentTenant) === false);
|
|
67
|
+
(0, userRoleType_1.hasChargeCardAccessible)(currentTenant, userRoleMap));
|
|
72
68
|
}
|
|
73
69
|
else {
|
|
74
70
|
return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.3",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|