@zeniai/client-epic-state 5.2.35-beta0MM → 5.2.35-beta10MM
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/entity/actualMatching/actualMatchingPayload.d.ts +7 -1
- package/lib/entity/actualMatching/actualMatchingPayload.js +19 -12
- package/lib/entity/actualMatching/actualMatchingReducer.d.ts +3 -2
- package/lib/entity/actualMatching/actualMatchingReducer.js +3 -3
- package/lib/entity/actualMatching/actualMatchingState.d.ts +3 -2
- package/lib/entity/aiCfo/aiCfoReducer.js +78 -4
- package/lib/entity/aiCfo/aiCfoState.d.ts +16 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +2 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +4 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/esm/entity/actualMatching/actualMatchingPayload.js +18 -12
- package/lib/esm/entity/actualMatching/actualMatchingReducer.js +3 -3
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +79 -5
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +4 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/esm/index.js +6 -6
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +3 -5
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +3 -2
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +80 -25
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/refreshActualMatchingList.js +16 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +16 -6
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +12 -11
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +50 -26
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +5 -9
- package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +1 -9
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +13 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +34 -16
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +8 -8
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewReducer.js +2 -1
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +5 -2
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewState.js +4 -2
- package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +10 -10
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +90 -20
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -1
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +206 -61
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +1 -0
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +3 -0
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +3 -0
- package/lib/esm/view/financeStatement/financeStatementReducer.js +17 -27
- package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +3 -3
- package/lib/index.d.ts +7 -6
- package/lib/index.js +52 -48
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +3 -5
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.d.ts +1 -1
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +3 -2
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +77 -22
- package/lib/view/expenseAutomationView/epics/actualMatching/refreshActualMatchingList.d.ts +3 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/refreshActualMatchingList.js +19 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +3 -2
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +15 -5
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +10 -9
- package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +48 -24
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +1 -2
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +5 -9
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +1 -2
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +1 -9
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +13 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.d.ts +5 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +33 -15
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +1 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +8 -8
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +2 -1
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +5 -2
- package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -1
- package/lib/view/expenseAutomationView/expenseAutomationViewState.js +6 -3
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +3 -3
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +10 -10
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +21 -16
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +90 -20
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -1
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +13 -9
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +9 -0
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +11 -2
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +209 -60
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +1 -0
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +8 -2
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +4 -0
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +3 -0
- package/lib/view/financeStatement/financeStatementReducer.js +17 -27
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +2 -2
- package/package.json +1 -1
|
@@ -7,14 +7,15 @@ const actualMatchingReducer_1 = require("../../../../entity/actualMatching/actua
|
|
|
7
7
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
8
|
const rootActions_1 = require("../../../../rootActions");
|
|
9
9
|
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
10
|
-
const
|
|
10
|
+
const actualMatchingViewSelector_1 = require("../../selectors/actualMatchingViewSelector");
|
|
11
|
+
const fetchActualMatchingMatchEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.fetchActualMatchingMatch.match), (0, operators_1.mergeMap)((action) => {
|
|
11
12
|
const { matchId, refreshViewInBackground } = action.payload;
|
|
12
13
|
return zeniAPI
|
|
13
14
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching/${encodeURIComponent(matchId)}`)
|
|
14
15
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
16
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
16
17
|
return (0, rxjs_1.from)([
|
|
17
|
-
(0, actualMatchingReducer_1.updateActualMatchingMatches)([response.data]),
|
|
18
|
+
(0, actualMatchingReducer_1.updateActualMatchingMatches)([response.data], (0, actualMatchingViewSelector_1.getTenantDisplayCurrency)(state$.value)),
|
|
18
19
|
(0, actualMatchingViewReducer_1.fetchActualMatchingMatchSuccess)({
|
|
19
20
|
matchId,
|
|
20
21
|
refreshViewInBackground,
|
package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
3
4
|
import { clearAll } from '../../../../rootActions';
|
|
4
5
|
import { RootState } from '../../../../rootStateTypes';
|
|
5
6
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
7
|
import { clearMatchNewModal, fetchActualMatching, matchAndReverseAccruals, matchAndReverseAccrualsFailure, matchAndReverseAccrualsSuccess } from '../../reducers/actualMatchingViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof clearMatchNewModal> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof matchAndReverseAccruals> | ReturnType<typeof matchAndReverseAccrualsFailure> | ReturnType<typeof matchAndReverseAccrualsSuccess>;
|
|
8
|
+
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof clearMatchNewModal> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof matchAndReverseAccruals> | ReturnType<typeof matchAndReverseAccrualsFailure> | ReturnType<typeof matchAndReverseAccrualsSuccess> | ReturnType<typeof openSnackbar>;
|
|
8
9
|
export declare const matchAndReverseAccrualsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,54 +3,109 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.matchAndReverseAccrualsEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const actualMatchingSelector_1 = require("../../../../entity/actualMatching/actualMatchingSelector");
|
|
7
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
9
|
const rootActions_1 = require("../../../../rootActions");
|
|
10
10
|
const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
|
|
11
11
|
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const refreshActualMatchingList_1 = require("./refreshActualMatchingList");
|
|
13
|
+
function isMatchCompleteStatus(status) {
|
|
14
|
+
return status === 'reversed' || status === 'noop';
|
|
15
|
+
}
|
|
16
|
+
function isMatchFailedStatus(status) {
|
|
17
|
+
return (status === 'conflict' || status === 'claim_lost' || status === 'error');
|
|
18
|
+
}
|
|
19
|
+
function matchAndReverseSnackbar(results, vendorName) {
|
|
20
|
+
const reversedCount = results.filter((result) => result.status === 'reversed').length;
|
|
21
|
+
const failedCount = results.filter((result) => isMatchFailedStatus(result.status)).length;
|
|
22
|
+
const variables = [
|
|
23
|
+
{ variableName: '_count_', variableValue: String(reversedCount) },
|
|
24
|
+
{ variableName: '_vendor_name_', variableValue: vendorName },
|
|
25
|
+
];
|
|
26
|
+
if (results.length === 0 || (reversedCount === 0 && failedCount > 0)) {
|
|
27
|
+
return (0, snackbarReducer_1.openSnackbar)({
|
|
28
|
+
messageSection: 'actual_matching_match_and_reverse',
|
|
29
|
+
messageText: 'failed',
|
|
30
|
+
type: 'error',
|
|
31
|
+
variables,
|
|
32
|
+
});
|
|
17
33
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
if (reversedCount > 0 && failedCount === 0) {
|
|
35
|
+
return (0, snackbarReducer_1.openSnackbar)({
|
|
36
|
+
messageSection: 'actual_matching_match_and_reverse',
|
|
37
|
+
messageText: 'success',
|
|
38
|
+
type: 'success',
|
|
39
|
+
variables,
|
|
40
|
+
});
|
|
23
41
|
}
|
|
24
|
-
|
|
42
|
+
if (reversedCount > 0 && failedCount > 0) {
|
|
43
|
+
return (0, snackbarReducer_1.openSnackbar)({
|
|
44
|
+
messageSection: 'actual_matching_match_and_reverse',
|
|
45
|
+
messageText: 'notification',
|
|
46
|
+
type: 'warning',
|
|
47
|
+
variables,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function matchAndReverseHttpFailSnackbar(vendorName) {
|
|
53
|
+
return (0, snackbarReducer_1.openSnackbar)({
|
|
54
|
+
messageSection: 'actual_matching_match_and_reverse',
|
|
55
|
+
messageText: 'failed',
|
|
56
|
+
type: 'error',
|
|
57
|
+
variables: [
|
|
58
|
+
{ variableName: '_count_', variableValue: '0' },
|
|
59
|
+
{ variableName: '_vendor_name_', variableValue: vendorName },
|
|
60
|
+
],
|
|
61
|
+
});
|
|
25
62
|
}
|
|
26
|
-
|
|
27
|
-
|
|
63
|
+
function matchVendorName(state, matchId) {
|
|
64
|
+
return (0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchId)?.vendorName ?? '';
|
|
65
|
+
}
|
|
66
|
+
const matchAndReverseAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.matchAndReverseAccruals.match),
|
|
67
|
+
// Posts reversing JEs; drop duplicate clicks while a request is in flight.
|
|
68
|
+
(0, operators_1.exhaustMap)((action) => {
|
|
69
|
+
const { transactionId, transactionIntegrationId, transactionType, lineIds, accrualIds, transactionSyncToken, } = action.payload;
|
|
28
70
|
const body = {
|
|
29
71
|
transaction_id: transactionId,
|
|
30
72
|
transaction_integration_id: transactionIntegrationId,
|
|
31
73
|
transaction_type: transactionType,
|
|
32
|
-
|
|
74
|
+
line_ids: lineIds,
|
|
33
75
|
transaction_sync_token: transactionSyncToken,
|
|
34
76
|
accrual_ids: accrualIds,
|
|
35
77
|
};
|
|
78
|
+
// Key leftover results and snackbar vendor to the confirmed bill, not the
|
|
79
|
+
// row Match New was opened from (user can pick a different txn).
|
|
80
|
+
const matchId = `${transactionType.toLowerCase()}:${transactionIntegrationId}`;
|
|
81
|
+
const vendorName = matchVendorName(state$.value, matchId);
|
|
36
82
|
return zeniAPI
|
|
37
83
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/match-and-reverse`, body)
|
|
38
84
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
39
85
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
40
86
|
const results = response.data.results.map(actualMatchingPayload_1.toMatchAndReverseResult);
|
|
41
87
|
const successActions = [
|
|
42
|
-
(0, actualMatchingViewReducer_1.matchAndReverseAccrualsSuccess)({ results }),
|
|
88
|
+
(0, actualMatchingViewReducer_1.matchAndReverseAccrualsSuccess)({ matchId, results }),
|
|
43
89
|
];
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
90
|
+
const occupancyChanged = results.some((result) => isMatchCompleteStatus(result.status));
|
|
91
|
+
const allComplete = results.length > 0 &&
|
|
92
|
+
results.every((result) => isMatchCompleteStatus(result.status));
|
|
93
|
+
if (occupancyChanged) {
|
|
94
|
+
successActions.push(...(0, refreshActualMatchingList_1.refreshActualMatchingList)(state$.value));
|
|
95
|
+
}
|
|
96
|
+
const snackbar = matchAndReverseSnackbar(results, vendorName);
|
|
97
|
+
if (snackbar != null) {
|
|
98
|
+
successActions.push(snackbar);
|
|
99
|
+
}
|
|
100
|
+
if (allComplete) {
|
|
101
|
+
successActions.push((0, actualMatchingViewReducer_1.clearMatchNewModal)());
|
|
47
102
|
}
|
|
48
103
|
return (0, rxjs_1.from)(successActions);
|
|
49
104
|
}
|
|
50
|
-
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.matchAndReverseAccrualsFailure)({ status: response.status }));
|
|
105
|
+
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.matchAndReverseAccrualsFailure)({ status: response.status }), matchAndReverseHttpFailSnackbar(vendorName));
|
|
51
106
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.matchAndReverseAccrualsFailure)({
|
|
52
107
|
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Match and reverse accruals REST API call errored out' +
|
|
53
108
|
JSON.stringify(error)),
|
|
54
|
-
}))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
109
|
+
}), matchAndReverseHttpFailSnackbar(vendorName))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
55
110
|
}));
|
|
56
111
|
exports.matchAndReverseAccrualsEpic = matchAndReverseAccrualsEpic;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refreshActualMatchingList = refreshActualMatchingList;
|
|
4
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
5
|
+
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
6
|
+
const actualMatchingViewSelector_1 = require("../../selectors/actualMatchingViewSelector");
|
|
7
|
+
function refreshActualMatchingList(state) {
|
|
8
|
+
const selectedMonthYear = (0, actualMatchingViewSelector_1.getSelectedMonthYearForCurrentTenant)(state);
|
|
9
|
+
if (selectedMonthYear == null) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
const period = (0, timePeriod_1.convertToPeriod)(selectedMonthYear);
|
|
13
|
+
const start = (0, timePeriod_1.toAbsoluteDay)(period.start);
|
|
14
|
+
const end = (0, timePeriod_1.toAbsoluteDay)(period.end);
|
|
15
|
+
if (start == null || end == null) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
return [(0, actualMatchingViewReducer_1.fetchActualMatching)({ start, end }, true)];
|
|
19
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateJEOneTimeAccruals } from '../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
4
|
+
import { clearAll } from '../../../../rootActions';
|
|
4
5
|
import { RootState } from '../../../../rootStateTypes';
|
|
5
6
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
7
|
import { searchMatchAccruals, searchMatchAccrualsFailure, searchMatchAccrualsSuccess } from '../../reducers/actualMatchingViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof searchMatchAccruals> | ReturnType<typeof searchMatchAccrualsFailure> | ReturnType<typeof searchMatchAccrualsSuccess> | ReturnType<typeof updateJEOneTimeAccruals>;
|
|
8
|
-
export declare const searchMatchAccrualsEpic: (actions$: ActionsObservable<ActionType>,
|
|
8
|
+
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof searchMatchAccruals> | ReturnType<typeof searchMatchAccrualsFailure> | ReturnType<typeof searchMatchAccrualsSuccess> | ReturnType<typeof updateJEOneTimeAccruals>;
|
|
9
|
+
export declare const searchMatchAccrualsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.searchMatchAccrualsEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const actualMatchingPayload_1 = require("../../../../entity/actualMatching/actualMatchingPayload");
|
|
6
7
|
const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
|
|
7
8
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
+
const rootActions_1 = require("../../../../rootActions");
|
|
8
10
|
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
11
|
+
const actualMatchingViewSelector_1 = require("../../selectors/actualMatchingViewSelector");
|
|
9
12
|
const actualMatchingViewState_1 = require("../../types/actualMatchingViewState");
|
|
10
|
-
const searchMatchAccrualsEpic = (actions$,
|
|
13
|
+
const searchMatchAccrualsEpic = (actions$, state$, zeniAPI) => {
|
|
11
14
|
const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchAccruals.match));
|
|
12
15
|
const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
|
|
13
16
|
const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null), (0, operators_1.debounceTime)(actualMatchingViewState_1.MATCH_SEARCH_DEBOUNCE_MS));
|
|
@@ -25,14 +28,18 @@ const searchMatchAccrualsEpic = (actions$, _state$, zeniAPI) => {
|
|
|
25
28
|
const nextOffset = offset + accruals.length;
|
|
26
29
|
const total = response.data.total ?? nextOffset;
|
|
27
30
|
const nextPageToken = nextOffset < total ? String(nextOffset) : null;
|
|
31
|
+
// toJEOneTimeAccrual still defaults a missing code to USD. Stamp
|
|
32
|
+
// tenant currency first, same as list members.
|
|
33
|
+
const fallbackCurrencyCode = (0, actualMatchingViewSelector_1.getTenantDisplayCurrency)(state$.value)?.currencyCode ?? '';
|
|
34
|
+
const stampedAccruals = accruals.map((accrual) => (0, actualMatchingPayload_1.withInheritedAccrualCurrency)(accrual, fallbackCurrencyCode));
|
|
28
35
|
const actionsOut = [];
|
|
29
|
-
if (
|
|
30
|
-
actionsOut.push((0, jeSchedulesReducer_1.updateJEOneTimeAccruals)(
|
|
36
|
+
if (stampedAccruals.length > 0) {
|
|
37
|
+
actionsOut.push((0, jeSchedulesReducer_1.updateJEOneTimeAccruals)(stampedAccruals));
|
|
31
38
|
}
|
|
32
39
|
actionsOut.push((0, actualMatchingViewReducer_1.searchMatchAccrualsSuccess)({
|
|
33
40
|
append,
|
|
34
41
|
nextPageToken,
|
|
35
|
-
results:
|
|
42
|
+
results: stampedAccruals,
|
|
36
43
|
}));
|
|
37
44
|
return (0, rxjs_1.from)(actionsOut);
|
|
38
45
|
}
|
|
@@ -42,7 +49,10 @@ const searchMatchAccrualsEpic = (actions$, _state$, zeniAPI) => {
|
|
|
42
49
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchAccrualsFailure)({
|
|
43
50
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search match accruals REST API call errored out' +
|
|
44
51
|
JSON.stringify(error)),
|
|
45
|
-
})))
|
|
52
|
+
}))),
|
|
53
|
+
// On the HTTP stream only. Wrapping the outer merge would complete
|
|
54
|
+
// the epic on the first `clearAll` and drop later searches.
|
|
55
|
+
(0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
46
56
|
}));
|
|
47
57
|
};
|
|
48
58
|
exports.searchMatchAccrualsEpic = searchMatchAccrualsEpic;
|
|
@@ -5,6 +5,7 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const actualMatchingSelector_1 = require("../../../../entity/actualMatching/actualMatchingSelector");
|
|
7
7
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
+
const rootActions_1 = require("../../../../rootActions");
|
|
8
9
|
const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
|
|
9
10
|
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
10
11
|
const actualMatchingViewSelector_1 = require("../../selectors/actualMatchingViewSelector");
|
|
@@ -14,8 +15,8 @@ const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
|
14
15
|
const matchId = action.payload.matchId;
|
|
15
16
|
if (matchId == null || matchId === '') {
|
|
16
17
|
return (0, rxjs_1.from)([
|
|
17
|
-
(0, actualMatchingViewReducer_1.searchMatchTransactions)(
|
|
18
|
-
(0, actualMatchingViewReducer_1.searchMatchAccruals)(
|
|
18
|
+
(0, actualMatchingViewReducer_1.searchMatchTransactions)(''),
|
|
19
|
+
(0, actualMatchingViewReducer_1.searchMatchAccruals)(''),
|
|
19
20
|
]);
|
|
20
21
|
}
|
|
21
22
|
const match = (0, actualMatchingSelector_1.getActualMatchingMatchById)(state$.value.actualMatchingState, matchId);
|
|
@@ -28,11 +29,7 @@ const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
|
28
29
|
? match.transactionIntegrationId
|
|
29
30
|
: parsed?.transactionIntegrationId;
|
|
30
31
|
return (0, rxjs_1.from)([
|
|
31
|
-
(0, actualMatchingViewReducer_1.searchMatchTransactions)(
|
|
32
|
-
query: '',
|
|
33
|
-
transactionType,
|
|
34
|
-
transactionIntegrationId,
|
|
35
|
-
}),
|
|
32
|
+
(0, actualMatchingViewReducer_1.searchMatchTransactions)('', undefined, transactionType, transactionIntegrationId),
|
|
36
33
|
]);
|
|
37
34
|
}));
|
|
38
35
|
const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchTransactions.match));
|
|
@@ -57,7 +54,8 @@ const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
|
57
54
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
58
55
|
const { transactions, next_page_token } = response.data;
|
|
59
56
|
const append = pageToken != null;
|
|
60
|
-
const
|
|
57
|
+
const fallbackCurrency = (0, actualMatchingViewSelector_1.getTenantDisplayCurrency)(state$.value);
|
|
58
|
+
const results = transactions.map((transaction) => (0, actualMatchingPayload_1.toActualMatchingTransactionSearchResult)(transaction, fallbackCurrency));
|
|
61
59
|
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsSuccess)({
|
|
62
60
|
append,
|
|
63
61
|
nextPageToken: next_page_token ?? null,
|
|
@@ -70,7 +68,10 @@ const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
|
70
68
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsFailure)({
|
|
71
69
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search match transactions REST API call errored out' +
|
|
72
70
|
JSON.stringify(error)),
|
|
73
|
-
})))
|
|
71
|
+
}))),
|
|
72
|
+
// On the HTTP stream only. Wrapping `merge(openModal$, search$)`
|
|
73
|
+
// would complete the epic on the first `clearAll` and drop later searches.
|
|
74
|
+
(0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
74
75
|
}));
|
|
75
76
|
return (0, rxjs_1.merge)(openModal$, search$);
|
|
76
77
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
3
4
|
import { clearAll } from '../../../../rootActions';
|
|
4
5
|
import { RootState } from '../../../../rootStateTypes';
|
|
5
6
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
7
|
import { fetchActualMatching, fetchActualMatchingMatch, undoReversalAccruals, undoReversalAccrualsFailure, undoReversalAccrualsSuccess } from '../../reducers/actualMatchingViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof fetchActualMatchingMatch> | ReturnType<typeof undoReversalAccruals> | ReturnType<typeof undoReversalAccrualsFailure> | ReturnType<typeof undoReversalAccrualsSuccess>;
|
|
8
|
+
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof fetchActualMatchingMatch> | ReturnType<typeof openSnackbar> | ReturnType<typeof undoReversalAccruals> | ReturnType<typeof undoReversalAccrualsFailure> | ReturnType<typeof undoReversalAccrualsSuccess>;
|
|
8
9
|
export declare const undoReversalAccrualsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,54 +3,78 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.undoReversalAccrualsEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const actualMatchingSelector_1 = require("../../../../entity/actualMatching/actualMatchingSelector");
|
|
7
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
9
|
const rootActions_1 = require("../../../../rootActions");
|
|
10
10
|
const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
|
|
11
11
|
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const refreshActualMatchingList_1 = require("./refreshActualMatchingList");
|
|
13
|
+
function undoReversalSnackbar(results, vendorName) {
|
|
14
|
+
const undoneCount = results.filter((result) => result.status === 'undone').length;
|
|
15
|
+
const failedCount = results.length - undoneCount;
|
|
16
|
+
const variables = [
|
|
17
|
+
{ variableName: '_count_', variableValue: String(undoneCount) },
|
|
18
|
+
{ variableName: '_vendor_name_', variableValue: vendorName },
|
|
19
|
+
];
|
|
20
|
+
if (results.length > 0 && failedCount === 0) {
|
|
21
|
+
return (0, snackbarReducer_1.openSnackbar)({
|
|
22
|
+
messageSection: 'actual_matching_undo_reversal',
|
|
23
|
+
messageText: 'success',
|
|
24
|
+
type: 'success',
|
|
25
|
+
variables,
|
|
26
|
+
});
|
|
17
27
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
if (undoneCount > 0 && failedCount > 0) {
|
|
29
|
+
return (0, snackbarReducer_1.openSnackbar)({
|
|
30
|
+
messageSection: 'actual_matching_undo_reversal',
|
|
31
|
+
messageText: 'notification',
|
|
32
|
+
type: 'warning',
|
|
33
|
+
variables,
|
|
34
|
+
});
|
|
23
35
|
}
|
|
24
|
-
return
|
|
36
|
+
return (0, snackbarReducer_1.openSnackbar)({
|
|
37
|
+
messageSection: 'actual_matching_undo_reversal',
|
|
38
|
+
messageText: 'failed',
|
|
39
|
+
type: 'error',
|
|
40
|
+
variables,
|
|
41
|
+
});
|
|
25
42
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
.filter((matchId) => detailState[matchId]?.fetchState !== 'Not-Started')
|
|
30
|
-
.map((matchId) => (0, actualMatchingViewReducer_1.fetchActualMatchingMatch)(matchId, true));
|
|
43
|
+
function matchVendorName(state, matchId) {
|
|
44
|
+
return ((0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchId)?.vendorName ??
|
|
45
|
+
'');
|
|
31
46
|
}
|
|
32
|
-
const undoReversalAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.undoReversalAccruals.match),
|
|
47
|
+
const undoReversalAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.undoReversalAccruals.match),
|
|
48
|
+
// Posts QBO deletes; drop duplicate clicks while the first request is in flight.
|
|
49
|
+
(0, operators_1.exhaustMap)((action) => {
|
|
50
|
+
const { accrualIds, matchId } = action.payload;
|
|
33
51
|
const body = {
|
|
34
|
-
accrual_ids:
|
|
52
|
+
accrual_ids: accrualIds,
|
|
35
53
|
};
|
|
54
|
+
const vendorName = matchVendorName(state$.value, matchId);
|
|
36
55
|
return zeniAPI
|
|
37
56
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/undo-reversal`, body)
|
|
38
57
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
39
58
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
40
59
|
const results = response.data.results.map(actualMatchingPayload_1.toUndoReversalResult);
|
|
41
60
|
const successActions = [
|
|
42
|
-
(0, actualMatchingViewReducer_1.undoReversalAccrualsSuccess)(
|
|
61
|
+
(0, actualMatchingViewReducer_1.undoReversalAccrualsSuccess)(matchId, results),
|
|
43
62
|
];
|
|
44
63
|
const anyUndone = results.some((result) => result.status === 'undone');
|
|
45
64
|
if (anyUndone) {
|
|
46
|
-
successActions.push(...refreshActualMatchingList(state$.value),
|
|
65
|
+
successActions.push(...(0, refreshActualMatchingList_1.refreshActualMatchingList)(state$.value), (0, actualMatchingViewReducer_1.fetchActualMatchingMatch)(matchId, true));
|
|
47
66
|
}
|
|
67
|
+
successActions.push(undoReversalSnackbar(results, vendorName));
|
|
48
68
|
return (0, rxjs_1.from)(successActions);
|
|
49
69
|
}
|
|
50
|
-
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({
|
|
70
|
+
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({
|
|
71
|
+
matchId,
|
|
72
|
+
status: response.status,
|
|
73
|
+
}), undoReversalSnackbar([], vendorName));
|
|
51
74
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({
|
|
75
|
+
matchId,
|
|
52
76
|
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Undo reversal accruals REST API call errored out' +
|
|
53
77
|
JSON.stringify(error)),
|
|
54
|
-
}))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
78
|
+
}), undoReversalSnackbar([], vendorName))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
55
79
|
}));
|
|
56
80
|
exports.undoReversalAccrualsEpic = undoReversalAccrualsEpic;
|
|
@@ -3,11 +3,10 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
import { RootState } from '../../../../rootStateTypes';
|
|
4
4
|
import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
|
|
5
5
|
import { fetchAllExpenseAutomationTabs } from '../../expenseAutomationViewReducer';
|
|
6
|
-
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
7
6
|
import { fetchFluxAnalysisView } from '../../reducers/fluxAnalysisViewReducer';
|
|
8
7
|
import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
|
|
9
8
|
import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
|
|
10
9
|
import { fetchReconciliation } from '../../reducers/reconciliationViewReducer';
|
|
11
10
|
import { fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
|
|
12
|
-
export type ActionType = ReturnType<typeof fetchAllExpenseAutomationTabs> | ReturnType<typeof
|
|
11
|
+
export type ActionType = ReturnType<typeof fetchAllExpenseAutomationTabs> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchTransactionCategorizationView>;
|
|
13
12
|
export declare const fetchAllExpenseAutomationTabsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -6,7 +6,6 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
7
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
8
|
const expenseAutomationViewReducer_1 = require("../../expenseAutomationViewReducer");
|
|
9
|
-
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
10
9
|
const fluxAnalysisViewReducer_1 = require("../../reducers/fluxAnalysisViewReducer");
|
|
11
10
|
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
12
11
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
@@ -14,7 +13,7 @@ const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewRe
|
|
|
14
13
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
15
14
|
const jeSchedulesViewState_1 = require("../../types/jeSchedulesViewState");
|
|
16
15
|
const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expenseAutomationViewReducer_1.fetchAllExpenseAutomationTabs.match), (0, operators_1.switchMap)((action) => {
|
|
17
|
-
const { cacheOverride, refreshViewInBackground } = action.payload;
|
|
16
|
+
const { cacheOverride, refreshViewInBackground, isAccrualEnabled } = action.payload;
|
|
18
17
|
const state = state$.value;
|
|
19
18
|
const { monthEndCloseChecksState } = state;
|
|
20
19
|
const { monthEndCloseChecksByTenantId } = monthEndCloseChecksState;
|
|
@@ -35,14 +34,11 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
35
34
|
}
|
|
36
35
|
if (cacheOverride === true) {
|
|
37
36
|
const actions = [];
|
|
38
|
-
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
39
37
|
actions.push((0, transactionsViewReducer_1.fetchTransactionCategorizationView)(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, cacheOverride, false, undefined, undefined, refreshViewInBackground, false), (0, missingReceiptsViewReducer_1.fetchMissingReceipts)({ start: timePeriodStart, end: timePeriodEnd }, {
|
|
40
38
|
amount: 75.0,
|
|
41
39
|
currencyCode: 'USD',
|
|
42
40
|
currencySymbol: '$',
|
|
43
|
-
}, cacheOverride, refreshViewInBackground), (0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, cacheOverride, refreshViewInBackground, null),
|
|
44
|
-
? (0, actualMatchingViewReducer_1.fetchActualMatchingPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride)
|
|
45
|
-
: (0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride));
|
|
41
|
+
}, cacheOverride, refreshViewInBackground), (0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, cacheOverride, refreshViewInBackground, null), (0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
46
42
|
if (reconciliationEnabled) {
|
|
47
43
|
actions.push((0, reconciliationViewReducer_1.fetchReconciliation)(selectedPeriod, undefined, cacheOverride, refreshViewInBackground));
|
|
48
44
|
}
|
|
@@ -69,7 +65,7 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
69
65
|
}
|
|
70
66
|
// The two JE tabs cache separately, so only the tab actually being shown decides whether a
|
|
71
67
|
// fetch is still needed. Actual Matching is a third tab on the same page with its own
|
|
72
|
-
// endpoint
|
|
68
|
+
// endpoint; fetchJeSchedulesPage carries isAccrualEnabled so the prefetch epic can warm AM.
|
|
73
69
|
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
74
70
|
if (selectedPageTab === 'actual_matching') {
|
|
75
71
|
const actualMatchingPeriodKeys = state.expenseAutomationActualMatchingViewState.matchIdsByPeriod[monthYearPeriodId];
|
|
@@ -77,7 +73,7 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
77
73
|
'In-Progress' &&
|
|
78
74
|
(!state.expenseAutomationActualMatchingViewState.hasValidState() ||
|
|
79
75
|
actualMatchingPeriodKeys == null)) {
|
|
80
|
-
fetchActions.push((0,
|
|
76
|
+
fetchActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
81
77
|
}
|
|
82
78
|
}
|
|
83
79
|
else {
|
|
@@ -89,7 +85,7 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
89
85
|
.jeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null ||
|
|
90
86
|
state.expenseAutomationJESchedulesViewState
|
|
91
87
|
.failedJeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null)) {
|
|
92
|
-
fetchActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride));
|
|
88
|
+
fetchActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
91
|
if (state.expenseAutomationReconciliationViewState.fetchState !==
|
package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts
CHANGED
|
@@ -4,11 +4,10 @@ import { RootState } from '../../../../rootStateTypes';
|
|
|
4
4
|
import { fetchCompanyMonthEndReportTemplates, fetchCompanyMonthEndReportView } from '../../../companyMonthEndReportView/companyMonthEndReportViewReducer';
|
|
5
5
|
import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
|
|
6
6
|
import { refreshExpenseAutomationCurrentTab } from '../../expenseAutomationViewReducer';
|
|
7
|
-
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
8
7
|
import { fetchFluxAnalysisView } from '../../reducers/fluxAnalysisViewReducer';
|
|
9
8
|
import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
|
|
10
9
|
import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
|
|
11
10
|
import { fetchReconciliation } from '../../reducers/reconciliationViewReducer';
|
|
12
11
|
import { fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
|
|
13
|
-
export type ActionType = ReturnType<typeof refreshExpenseAutomationCurrentTab> | ReturnType<typeof
|
|
12
|
+
export type ActionType = ReturnType<typeof refreshExpenseAutomationCurrentTab> | ReturnType<typeof fetchCompanyMonthEndReportView> | ReturnType<typeof fetchCompanyMonthEndReportTemplates> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof fetchTransactionCategorizationView>;
|
|
14
13
|
export declare const refreshExpenseAutomationCurrentTabEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js
CHANGED
|
@@ -7,7 +7,6 @@ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
|
7
7
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
8
|
const companyMonthEndReportViewReducer_1 = require("../../../companyMonthEndReportView/companyMonthEndReportViewReducer");
|
|
9
9
|
const expenseAutomationViewReducer_1 = require("../../expenseAutomationViewReducer");
|
|
10
|
-
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
11
10
|
const fluxAnalysisViewReducer_1 = require("../../reducers/fluxAnalysisViewReducer");
|
|
12
11
|
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
13
12
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
@@ -42,17 +41,10 @@ const refreshExpenseAutomationCurrentTabEpic = (actions$, state$) => actions$.pi
|
|
|
42
41
|
return (0, rxjs_1.from)([
|
|
43
42
|
(0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, true, true, null),
|
|
44
43
|
]);
|
|
45
|
-
case 'je_schedules':
|
|
46
|
-
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
47
|
-
if (selectedPageTab === 'actual_matching') {
|
|
48
|
-
return (0, rxjs_1.from)([
|
|
49
|
-
(0, actualMatchingViewReducer_1.fetchActualMatchingPage)({ start: timePeriodStart, end: timePeriodEnd }, true),
|
|
50
|
-
]);
|
|
51
|
-
}
|
|
44
|
+
case 'je_schedules':
|
|
52
45
|
return (0, rxjs_1.from)([
|
|
53
46
|
(0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, true),
|
|
54
47
|
]);
|
|
55
|
-
}
|
|
56
48
|
case 'month_end_insights':
|
|
57
49
|
return (0, rxjs_1.from)([
|
|
58
50
|
(0, companyMonthEndReportViewReducer_1.fetchCompanyMonthEndReportView)(true, companyId, currentTenant.tenantId, period.end, true),
|
|
@@ -2,6 +2,7 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../rootStateTypes';
|
|
4
4
|
import { fetchAccountList } from '../../../accountList/accountListReducer';
|
|
5
|
+
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
5
6
|
import { fetchJeSchedules, fetchJeSchedulesPage, initializeAccountSettingsView } from '../../reducers/jeSchedulesViewReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof initializeAccountSettingsView>;
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchActualMatchingPage> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof initializeAccountSettingsView>;
|
|
7
8
|
export declare const fetchJeSchedulesPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -5,24 +5,34 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const accountListReducer_1 = require("../../../accountList/accountListReducer");
|
|
7
7
|
const scheduleListHelper_1 = require("../../../scheduleView/scheduleListView/scheduleListHelper");
|
|
8
|
+
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
8
9
|
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
9
10
|
const fetchJeSchedulesPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchJeSchedulesPage.match), (0, operators_1.mergeMap)((action) => {
|
|
10
11
|
const jeSchedulePageActions = [];
|
|
11
12
|
const { period, refreshViewInBackground } = action.payload;
|
|
13
|
+
const state = state$.value;
|
|
14
|
+
const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
|
|
12
15
|
const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
|
|
13
|
-
const accountListState = state
|
|
16
|
+
const accountListState = state.accountListState;
|
|
14
17
|
if (accountListState.byReportId[accountType.accountListKey].fetchState ===
|
|
15
18
|
'Not-Started') {
|
|
16
19
|
// call this only if the account list for schedules is not fetched already
|
|
17
20
|
jeSchedulePageActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
// AM is chrome on this page but a different endpoint. fetchJeSchedules with
|
|
23
|
+
// selectedPageTab === 'actual_matching' would hit /1.0/schedules and write a bogus cache slot.
|
|
24
|
+
if (selectedPageTab === 'actual_matching') {
|
|
25
|
+
jeSchedulePageActions.push((0, actualMatchingViewReducer_1.fetchActualMatchingPage)(period, refreshViewInBackground));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
jeSchedulePageActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedules)(period, refreshViewInBackground));
|
|
29
|
+
}
|
|
20
30
|
// Only on the first page load. Account settings cannot change from a tab switch or a
|
|
21
31
|
// refresh, and re-initializing puts accountSettingsView back to 'In-Progress' -- which the
|
|
22
32
|
// page reads as "still loading" and answers with a full skeleton over rows it already has.
|
|
23
33
|
// The action also resets localData, so re-dispatching it blindly would empty the settings
|
|
24
34
|
// form until the refetch lands. Saving account settings still re-initializes explicitly.
|
|
25
|
-
if (!state
|
|
35
|
+
if (!state.expenseAutomationJESchedulesViewState.accountSettings
|
|
26
36
|
.hasLoadedAccountSettings) {
|
|
27
37
|
jeSchedulePageActions.push((0, jeSchedulesViewReducer_1.initializeAccountSettingsView)());
|
|
28
38
|
}
|