@zeniai/client-epic-state 5.2.22-betaAM4 → 5.2.22-betaMM1
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 +25 -0
- package/lib/entity/actualMatching/actualMatchingPayload.js +42 -0
- package/lib/entity/actualMatching/actualMatchingReducer.d.ts +8 -0
- package/lib/entity/actualMatching/actualMatchingReducer.js +33 -0
- package/lib/entity/actualMatching/actualMatchingSelector.d.ts +3 -0
- package/lib/entity/actualMatching/actualMatchingSelector.js +6 -0
- package/lib/entity/actualMatching/actualMatchingState.d.ts +22 -0
- package/lib/entity/actualMatching/actualMatchingState.js +2 -0
- package/lib/entity/actualMatching/actualMatchingTypes.d.ts +1 -0
- package/lib/entity/actualMatching/actualMatchingTypes.js +2 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +2 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +2 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
- package/lib/epic.d.ts +3 -1
- package/lib/epic.js +4 -0
- package/lib/esm/entity/actualMatching/actualMatchingPayload.js +39 -0
- package/lib/esm/entity/actualMatching/actualMatchingReducer.js +30 -0
- package/lib/esm/entity/actualMatching/actualMatchingSelector.js +3 -0
- package/lib/esm/entity/actualMatching/actualMatchingState.js +1 -0
- package/lib/esm/entity/actualMatching/actualMatchingTypes.js +1 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +2 -0
- package/lib/esm/epic.js +4 -0
- package/lib/esm/index.js +5 -5
- package/lib/esm/reducer.js +3 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +6 -6
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +35 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +2 -1
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +35 -6
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +51 -0
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +9 -1
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +112 -8
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +145 -98
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +10 -0
- package/lib/index.d.ts +8 -5
- package/lib/index.js +53 -48
- package/lib/reducer.d.ts +1 -0
- package/lib/reducer.js +3 -0
- package/lib/rootStateTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +6 -6
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.d.ts +12 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +39 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +2 -1
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +1 -1
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +35 -6
- package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +55 -0
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +1 -1
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +20 -7
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +9 -0
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +26 -5
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +113 -9
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +16 -2
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +17 -2
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +148 -98
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +20 -2
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +12 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import {
|
|
3
|
+
import { updateActualMatchingMatches } from '../../../../entity/actualMatching/actualMatchingReducer';
|
|
4
4
|
import { clearAll } from '../../../../rootActions';
|
|
5
5
|
import { RootState } from '../../../../rootStateTypes';
|
|
6
6
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
7
7
|
import { fetchActualMatching, fetchActualMatchingFailure, fetchActualMatchingSuccess } from '../../reducers/actualMatchingViewReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof fetchActualMatchingFailure> | ReturnType<typeof fetchActualMatchingSuccess> | ReturnType<typeof
|
|
8
|
+
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof fetchActualMatchingFailure> | ReturnType<typeof fetchActualMatchingSuccess> | ReturnType<typeof updateActualMatchingMatches>;
|
|
9
9
|
export declare const fetchActualMatchingEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fetchActualMatchingEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const actualMatchingReducer_1 = require("../../../../entity/actualMatching/actualMatchingReducer");
|
|
7
7
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
8
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
9
|
const rootActions_1 = require("../../../../rootActions");
|
|
@@ -20,16 +20,16 @@ const fetchActualMatchingEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
|
|
|
20
20
|
};
|
|
21
21
|
const serviceMonth = (0, actualMatchingPayload_1.toServiceMonthFromPeriod)(period);
|
|
22
22
|
return zeniAPI
|
|
23
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals?service_month=${encodeURIComponent(serviceMonth)}
|
|
23
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching?service_month=${encodeURIComponent(serviceMonth)}`)
|
|
24
24
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
25
25
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
26
|
-
const
|
|
26
|
+
const matches = response.data.matches ?? [];
|
|
27
27
|
const updateActions = [];
|
|
28
|
-
if (
|
|
29
|
-
updateActions.push((0,
|
|
28
|
+
if (matches.length > 0) {
|
|
29
|
+
updateActions.push((0, actualMatchingReducer_1.updateActualMatchingMatches)(matches));
|
|
30
30
|
}
|
|
31
31
|
updateActions.push((0, actualMatchingViewReducer_1.fetchActualMatchingSuccess)({
|
|
32
|
-
|
|
32
|
+
matchIds: matches.map((match) => match.match_id),
|
|
33
33
|
selectedPeriod,
|
|
34
34
|
refreshViewInBackground,
|
|
35
35
|
}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ActualMatchingMatchPayload } from '../../../../entity/actualMatching/actualMatchingPayload';
|
|
4
|
+
import { updateActualMatchingMatches } from '../../../../entity/actualMatching/actualMatchingReducer';
|
|
5
|
+
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
6
|
+
import { clearAll } from '../../../../rootActions';
|
|
7
|
+
import { RootState } from '../../../../rootStateTypes';
|
|
8
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
9
|
+
import { fetchActualMatchingMatch, fetchActualMatchingMatchFailure, fetchActualMatchingMatchSuccess } from '../../reducers/actualMatchingViewReducer';
|
|
10
|
+
export type ActualMatchingMatchResponse = ZeniAPIResponse<ActualMatchingMatchPayload>;
|
|
11
|
+
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchActualMatchingMatch> | ReturnType<typeof fetchActualMatchingMatchFailure> | ReturnType<typeof fetchActualMatchingMatchSuccess> | ReturnType<typeof updateActualMatchingMatches>;
|
|
12
|
+
export declare const fetchActualMatchingMatchEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchActualMatchingMatchEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const actualMatchingReducer_1 = require("../../../../entity/actualMatching/actualMatchingReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
+
const rootActions_1 = require("../../../../rootActions");
|
|
9
|
+
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
10
|
+
const fetchActualMatchingMatchEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.fetchActualMatchingMatch.match), (0, operators_1.mergeMap)((action) => {
|
|
11
|
+
const { matchId, refreshViewInBackground } = action.payload;
|
|
12
|
+
return zeniAPI
|
|
13
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching/${encodeURIComponent(matchId)}`)
|
|
14
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
16
|
+
return (0, rxjs_1.from)([
|
|
17
|
+
(0, actualMatchingReducer_1.updateActualMatchingMatches)([response.data]),
|
|
18
|
+
(0, actualMatchingViewReducer_1.fetchActualMatchingMatchSuccess)({
|
|
19
|
+
matchId,
|
|
20
|
+
refreshViewInBackground,
|
|
21
|
+
}),
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
return (0, rxjs_1.from)([
|
|
25
|
+
(0, actualMatchingViewReducer_1.fetchActualMatchingMatchFailure)({
|
|
26
|
+
matchId,
|
|
27
|
+
refreshViewInBackground,
|
|
28
|
+
status: response.status,
|
|
29
|
+
}),
|
|
30
|
+
]);
|
|
31
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
32
|
+
(0, actualMatchingViewReducer_1.fetchActualMatchingMatchFailure)({
|
|
33
|
+
matchId,
|
|
34
|
+
refreshViewInBackground,
|
|
35
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Fetch actual matching match REST API call errored out ${JSON.stringify(error)}`),
|
|
36
|
+
}),
|
|
37
|
+
])), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
38
|
+
}));
|
|
39
|
+
exports.fetchActualMatchingMatchEpic = fetchActualMatchingMatchEpic;
|
|
@@ -23,12 +23,13 @@ function refreshActualMatchingList(state) {
|
|
|
23
23
|
return [(0, actualMatchingViewReducer_1.fetchActualMatching)({ start, end }, true)];
|
|
24
24
|
}
|
|
25
25
|
const matchAndReverseAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.matchAndReverseAccruals.match), (0, operators_1.mergeMap)((action) => {
|
|
26
|
-
const { transactionId, transactionIntegrationId, transactionType, lineId, accrualIds, } = action.payload;
|
|
26
|
+
const { transactionId, transactionIntegrationId, transactionType, lineId, accrualIds, transactionSyncToken, } = action.payload;
|
|
27
27
|
const body = {
|
|
28
28
|
transaction_id: transactionId,
|
|
29
29
|
transaction_integration_id: transactionIntegrationId,
|
|
30
30
|
transaction_type: transactionType,
|
|
31
31
|
line_id: lineId,
|
|
32
|
+
transaction_sync_token: transactionSyncToken,
|
|
32
33
|
accrual_ids: accrualIds,
|
|
33
34
|
};
|
|
34
35
|
return zeniAPI
|
package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ import { RootState } from '../../../../rootStateTypes';
|
|
|
5
5
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
6
|
import { openMatchNewModal, searchMatchAccruals, searchMatchTransactions, searchMatchTransactionsFailure, searchMatchTransactionsSuccess } from '../../reducers/actualMatchingViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof openMatchNewModal> | ReturnType<typeof searchMatchAccruals> | ReturnType<typeof searchMatchTransactions> | ReturnType<typeof searchMatchTransactionsFailure> | ReturnType<typeof searchMatchTransactionsSuccess>;
|
|
8
|
-
export declare const searchMatchTransactionsEpic: (actions$: ActionsObservable<ActionType>,
|
|
8
|
+
export declare const searchMatchTransactionsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,24 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.searchMatchTransactionsEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const actualMatchingSelector_1 = require("../../../../entity/actualMatching/actualMatchingSelector");
|
|
6
7
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
8
|
const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
|
|
8
9
|
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
10
|
+
const actualMatchingViewSelector_1 = require("../../selectors/actualMatchingViewSelector");
|
|
9
11
|
const actualMatchingViewState_1 = require("../../types/actualMatchingViewState");
|
|
10
|
-
const searchMatchTransactionsEpic = (actions$,
|
|
11
|
-
const openModal$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.openMatchNewModal.match), (0, operators_1.mergeMap)(() =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
13
|
+
const openModal$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.openMatchNewModal.match), (0, operators_1.mergeMap)((action) => {
|
|
14
|
+
const matchId = action.payload.matchId;
|
|
15
|
+
if (matchId == null || matchId === '') {
|
|
16
|
+
return (0, rxjs_1.from)([
|
|
17
|
+
(0, actualMatchingViewReducer_1.searchMatchTransactions)({ query: '' }),
|
|
18
|
+
(0, actualMatchingViewReducer_1.searchMatchAccruals)({ query: '' }),
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
const match = (0, actualMatchingSelector_1.getActualMatchingMatchById)(matchId, state$.value.actualMatchingState);
|
|
22
|
+
const parsed = (0, actualMatchingViewSelector_1.parseActualMatchingMatchId)(matchId);
|
|
23
|
+
const transactionType = match?.transactionType != null && match.transactionType !== ''
|
|
24
|
+
? match.transactionType
|
|
25
|
+
: parsed?.transactionType;
|
|
26
|
+
const transactionIntegrationId = match?.transactionIntegrationId != null &&
|
|
27
|
+
match.transactionIntegrationId !== ''
|
|
28
|
+
? match.transactionIntegrationId
|
|
29
|
+
: parsed?.transactionIntegrationId;
|
|
30
|
+
return (0, rxjs_1.from)([
|
|
31
|
+
(0, actualMatchingViewReducer_1.searchMatchTransactions)({
|
|
32
|
+
query: '',
|
|
33
|
+
transactionType,
|
|
34
|
+
transactionIntegrationId,
|
|
35
|
+
}),
|
|
36
|
+
]);
|
|
37
|
+
}));
|
|
15
38
|
const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchTransactions.match));
|
|
16
39
|
const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
|
|
17
40
|
const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null), (0, operators_1.debounceTime)(actualMatchingViewState_1.MATCH_SEARCH_DEBOUNCE_MS));
|
|
18
41
|
const search$ = (0, rxjs_1.merge)(pagination$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
|
|
19
|
-
const { query, pageToken } = action.payload;
|
|
42
|
+
const { query, pageToken, transactionType, transactionIntegrationId } = action.payload;
|
|
20
43
|
const queryParam = {
|
|
21
44
|
search_text: query,
|
|
22
45
|
page_size: actualMatchingViewState_1.MATCH_TRANSACTION_SEARCH_PAGE_SIZE,
|
|
23
46
|
...(pageToken != null ? { page_token: pageToken } : {}),
|
|
47
|
+
...(transactionType != null && transactionType !== ''
|
|
48
|
+
? { transaction_type: transactionType }
|
|
49
|
+
: {}),
|
|
50
|
+
...(transactionIntegrationId != null && transactionIntegrationId !== ''
|
|
51
|
+
? { transaction_integration_id: transactionIntegrationId }
|
|
52
|
+
: {}),
|
|
24
53
|
};
|
|
25
54
|
return zeniAPI
|
|
26
55
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/match-transaction-search?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { clearAll } from '../../../../rootActions';
|
|
4
|
+
import { RootState } from '../../../../rootStateTypes';
|
|
5
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
+
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 declare const undoReversalAccrualsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.undoReversalAccrualsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
+
const rootActions_1 = require("../../../../rootActions");
|
|
10
|
+
const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
|
|
11
|
+
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
12
|
+
function refreshActualMatchingList(state) {
|
|
13
|
+
const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[(0, tenantSelector_1.getCurrentTenant)(state).tenantId];
|
|
14
|
+
if (selectedMonthYear == null) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
const period = (0, timePeriod_1.convertToPeriod)(selectedMonthYear);
|
|
18
|
+
const start = (0, timePeriod_1.toAbsoluteDay)(period.start);
|
|
19
|
+
const end = (0, timePeriod_1.toAbsoluteDay)(period.end);
|
|
20
|
+
if (start == null || end == null) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
return [(0, actualMatchingViewReducer_1.fetchActualMatching)({ start, end }, true)];
|
|
24
|
+
}
|
|
25
|
+
function refreshOpenMatchDetails(state) {
|
|
26
|
+
const detailState = state.expenseAutomationActualMatchingViewState.detailFetchStateByMatchId;
|
|
27
|
+
return Object.keys(detailState)
|
|
28
|
+
.filter((matchId) => detailState[matchId]?.fetchState !== 'Not-Started')
|
|
29
|
+
.map((matchId) => (0, actualMatchingViewReducer_1.fetchActualMatchingMatch)(matchId, true));
|
|
30
|
+
}
|
|
31
|
+
const undoReversalAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.undoReversalAccruals.match), (0, operators_1.mergeMap)((action) => {
|
|
32
|
+
const body = {
|
|
33
|
+
accrual_ids: action.payload.accrualIds,
|
|
34
|
+
};
|
|
35
|
+
return zeniAPI
|
|
36
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/undo-reversal`, body)
|
|
37
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
38
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
39
|
+
const results = (response.data.results ?? []).map(actualMatchingPayload_1.toUndoReversalResult);
|
|
40
|
+
const successActions = [
|
|
41
|
+
(0, actualMatchingViewReducer_1.undoReversalAccrualsSuccess)({ results }),
|
|
42
|
+
];
|
|
43
|
+
const anyUndone = results.some((result) => result.status === 'undone');
|
|
44
|
+
if (anyUndone) {
|
|
45
|
+
successActions.push(...refreshActualMatchingList(state$.value), ...refreshOpenMatchDetails(state$.value));
|
|
46
|
+
}
|
|
47
|
+
return (0, rxjs_1.from)(successActions);
|
|
48
|
+
}
|
|
49
|
+
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({ status: response.status }));
|
|
50
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({
|
|
51
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Undo reversal accruals REST API call errored out' +
|
|
52
|
+
JSON.stringify(error)),
|
|
53
|
+
}))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
54
|
+
}));
|
|
55
|
+
exports.undoReversalAccrualsEpic = undoReversalAccrualsEpic;
|
|
@@ -72,7 +72,7 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
72
72
|
// endpoint and cache slot.
|
|
73
73
|
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
74
74
|
if (selectedPageTab === 'actual_matching') {
|
|
75
|
-
const actualMatchingPeriodKeys = state.expenseAutomationActualMatchingViewState.
|
|
75
|
+
const actualMatchingPeriodKeys = state.expenseAutomationActualMatchingViewState.matchIdsByPeriod[monthYearPeriodId];
|
|
76
76
|
if (state.expenseAutomationActualMatchingViewState.fetchState !==
|
|
77
77
|
'In-Progress' &&
|
|
78
78
|
(!state.expenseAutomationActualMatchingViewState.hasValidState() ||
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { TimePeriod } from '../../../commonStateTypes/timePeriod';
|
|
3
|
+
import { ActualMatchingListResponsePayload } from '../../../entity/actualMatching/actualMatchingPayload';
|
|
3
4
|
import { JEOneTimeAccrualPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
|
|
4
5
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
5
|
-
import { ActualMatchingTransactionSearchResult, MatchAndReverseResult } from '../types/actualMatchingViewState';
|
|
6
|
+
import { ActualMatchingTransactionSearchResult, MatchAndReverseResult, UndoReversalResult } from '../types/actualMatchingViewState';
|
|
6
7
|
export declare function toServiceMonthFromPeriod(period: TimePeriod): string;
|
|
7
|
-
export interface ActualMatchingListResponsePayload {
|
|
8
|
-
accruals: JEOneTimeAccrualPayload[];
|
|
9
|
-
total: number;
|
|
10
|
-
limit?: number | null;
|
|
11
|
-
offset?: number | null;
|
|
12
|
-
}
|
|
13
8
|
export type ActualMatchingListResponse = ZeniAPIResponse<ActualMatchingListResponsePayload>;
|
|
14
9
|
export interface ActualMatchingAccrualSearchResponsePayload {
|
|
15
10
|
accruals: JEOneTimeAccrualPayload[];
|
|
@@ -22,6 +17,8 @@ export interface MatchTransactionSearchQueryPayload {
|
|
|
22
17
|
page_size: number;
|
|
23
18
|
search_text: string;
|
|
24
19
|
page_token?: string | null;
|
|
20
|
+
transaction_integration_id?: string;
|
|
21
|
+
transaction_type?: string;
|
|
25
22
|
}
|
|
26
23
|
export interface MatchTransactionSearchResultPayload {
|
|
27
24
|
line_id: string;
|
|
@@ -37,6 +34,7 @@ export interface MatchTransactionSearchResultPayload {
|
|
|
37
34
|
amount?: number | null;
|
|
38
35
|
currency_code?: string | null;
|
|
39
36
|
currency_symbol?: string | null;
|
|
37
|
+
sync_token?: string | null;
|
|
40
38
|
total_amount?: number | null;
|
|
41
39
|
transaction_description?: string | null;
|
|
42
40
|
transaction_memo?: string | null;
|
|
@@ -55,6 +53,7 @@ export interface MatchAndReverseRequestPayload {
|
|
|
55
53
|
line_id: string;
|
|
56
54
|
transaction_id: ID;
|
|
57
55
|
transaction_integration_id: string;
|
|
56
|
+
transaction_sync_token: string;
|
|
58
57
|
transaction_type: string;
|
|
59
58
|
}
|
|
60
59
|
export interface MatchAndReverseResultPayload {
|
|
@@ -70,3 +69,17 @@ export interface MatchAndReverseResponsePayload {
|
|
|
70
69
|
}
|
|
71
70
|
export type MatchAndReverseResponse = ZeniAPIResponse<MatchAndReverseResponsePayload>;
|
|
72
71
|
export declare function toMatchAndReverseResult(payload: MatchAndReverseResultPayload): MatchAndReverseResult;
|
|
72
|
+
export interface UndoReversalRequestPayload {
|
|
73
|
+
accrual_ids: ID[];
|
|
74
|
+
}
|
|
75
|
+
export interface UndoReversalResultPayload {
|
|
76
|
+
accrual_id: ID;
|
|
77
|
+
status: string;
|
|
78
|
+
reason?: string | null;
|
|
79
|
+
}
|
|
80
|
+
export interface UndoReversalResponsePayload {
|
|
81
|
+
match_batch_id: string;
|
|
82
|
+
results: UndoReversalResultPayload[];
|
|
83
|
+
}
|
|
84
|
+
export type UndoReversalResponse = ZeniAPIResponse<UndoReversalResponsePayload>;
|
|
85
|
+
export declare function toUndoReversalResult(payload: UndoReversalResultPayload): UndoReversalResult;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toServiceMonthFromPeriod = toServiceMonthFromPeriod;
|
|
4
4
|
exports.toActualMatchingTransactionSearchResult = toActualMatchingTransactionSearchResult;
|
|
5
5
|
exports.toMatchAndReverseResult = toMatchAndReverseResult;
|
|
6
|
+
exports.toUndoReversalResult = toUndoReversalResult;
|
|
6
7
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
8
|
const actualMatchingViewState_1 = require("../types/actualMatchingViewState");
|
|
8
9
|
function toServiceMonthFromPeriod(period) {
|
|
@@ -54,6 +55,7 @@ function toActualMatchingTransactionSearchResult(payload) {
|
|
|
54
55
|
transactionMemo: payload.transaction_memo ?? undefined,
|
|
55
56
|
transactionDescription: payload.transaction_description ?? undefined,
|
|
56
57
|
transactionTypeName: payload.transaction_type_name ?? undefined,
|
|
58
|
+
syncToken: payload.sync_token == null ? '' : String(payload.sync_token),
|
|
57
59
|
};
|
|
58
60
|
}
|
|
59
61
|
function toMatchAndReverseResult(payload) {
|
|
@@ -63,3 +65,10 @@ function toMatchAndReverseResult(payload) {
|
|
|
63
65
|
reason: payload.reason ?? undefined,
|
|
64
66
|
};
|
|
65
67
|
}
|
|
68
|
+
function toUndoReversalResult(payload) {
|
|
69
|
+
return {
|
|
70
|
+
accrualId: payload.accrual_id,
|
|
71
|
+
status: (0, actualMatchingViewState_1.toUndoReversalResultStatus)(payload.status),
|
|
72
|
+
reason: payload.reason ?? undefined,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePeriod';
|
|
2
|
+
import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatchingTypes';
|
|
2
3
|
import { JEOneTimeAccrualPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
|
|
3
4
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
4
|
-
import { ActualMatchingAccrualSearchState, ActualMatchingMatchModalState, ActualMatchingTransactionSearchResult, ActualMatchingTransactionSearchState, ActualMatchingViewState, ActualMatchingViewUIState, MatchAndReverseAccrualsParams, MatchAndReverseResult } from '../types/actualMatchingViewState';
|
|
5
|
+
import { ActualMatchingAccrualSearchState, ActualMatchingMatchModalState, ActualMatchingTransactionSearchResult, ActualMatchingTransactionSearchState, ActualMatchingViewState, ActualMatchingViewUIState, MatchAndReverseAccrualsParams, MatchAndReverseResult, UndoReversalAccrualsParams, UndoReversalResult } from '../types/actualMatchingViewState';
|
|
5
6
|
export declare const initialTransactionSearchState: ActualMatchingTransactionSearchState;
|
|
6
7
|
export declare const initialAccrualSearchState: ActualMatchingAccrualSearchState;
|
|
7
8
|
export declare const initialMatchModalState: ActualMatchingMatchModalState;
|
|
@@ -13,18 +14,30 @@ export declare const clearActualMatchingView: import("@reduxjs/toolkit").ActionC
|
|
|
13
14
|
refreshViewInBackground: boolean;
|
|
14
15
|
selectedPeriod: MonthYearPeriod;
|
|
15
16
|
status: ZeniAPIStatus;
|
|
16
|
-
}, "expenseAutomationActualMatchingView/fetchActualMatchingFailure">,
|
|
17
|
+
}, "expenseAutomationActualMatchingView/fetchActualMatchingFailure">, fetchActualMatchingMatch: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[matchId: string, refreshViewInBackground?: any], {
|
|
18
|
+
matchId: string;
|
|
19
|
+
refreshViewInBackground: any;
|
|
20
|
+
}, "expenseAutomationActualMatchingView/fetchActualMatchingMatch", never, never>, fetchActualMatchingMatchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
21
|
+
matchId: ActualMatchingMatchId;
|
|
22
|
+
refreshViewInBackground: boolean;
|
|
23
|
+
status: ZeniAPIStatus;
|
|
24
|
+
}, "expenseAutomationActualMatchingView/fetchActualMatchingMatchFailure">, fetchActualMatchingMatchSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
25
|
+
matchId: ActualMatchingMatchId;
|
|
26
|
+
refreshViewInBackground: boolean;
|
|
27
|
+
}, "expenseAutomationActualMatchingView/fetchActualMatchingMatchSuccess">, fetchActualMatchingPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
|
|
17
28
|
period: TimePeriod;
|
|
18
29
|
refreshViewInBackground: any;
|
|
19
30
|
}, "expenseAutomationActualMatchingView/fetchActualMatchingPage", never, never>, fetchActualMatchingSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
20
|
-
|
|
31
|
+
matchIds: ActualMatchingMatchId[];
|
|
21
32
|
refreshViewInBackground: boolean;
|
|
22
33
|
selectedPeriod: MonthYearPeriod;
|
|
23
34
|
}, "expenseAutomationActualMatchingView/fetchActualMatchingSuccess">, matchAndReverseAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[params: MatchAndReverseAccrualsParams], MatchAndReverseAccrualsParams, "expenseAutomationActualMatchingView/matchAndReverseAccruals", never, never>, matchAndReverseAccrualsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
24
35
|
status: ZeniAPIStatus;
|
|
25
36
|
}, "expenseAutomationActualMatchingView/matchAndReverseAccrualsFailure">, matchAndReverseAccrualsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
26
37
|
results: MatchAndReverseResult[];
|
|
27
|
-
}, "expenseAutomationActualMatchingView/matchAndReverseAccrualsSuccess">, openMatchNewModal: import("@reduxjs/toolkit").
|
|
38
|
+
}, "expenseAutomationActualMatchingView/matchAndReverseAccrualsSuccess">, openMatchNewModal: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[matchId?: string | undefined], {
|
|
39
|
+
matchId: string | undefined;
|
|
40
|
+
}, "expenseAutomationActualMatchingView/openMatchNewModal", never, never>, searchMatchAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
|
|
28
41
|
query: string;
|
|
29
42
|
pageToken?: string | null;
|
|
30
43
|
}], {
|
|
@@ -39,15 +52,23 @@ export declare const clearActualMatchingView: import("@reduxjs/toolkit").ActionC
|
|
|
39
52
|
}, "expenseAutomationActualMatchingView/searchMatchAccrualsSuccess">, searchMatchTransactions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
|
|
40
53
|
query: string;
|
|
41
54
|
pageToken?: string | null;
|
|
55
|
+
transactionIntegrationId?: string;
|
|
56
|
+
transactionType?: string;
|
|
42
57
|
}], {
|
|
43
58
|
query: string;
|
|
44
59
|
pageToken: string | undefined;
|
|
60
|
+
transactionType: string | undefined;
|
|
61
|
+
transactionIntegrationId: string | undefined;
|
|
45
62
|
}, "expenseAutomationActualMatchingView/searchMatchTransactions", never, never>, searchMatchTransactionsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
46
63
|
error: ZeniAPIStatus;
|
|
47
64
|
}, "expenseAutomationActualMatchingView/searchMatchTransactionsFailure">, searchMatchTransactionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
48
65
|
append: boolean;
|
|
49
66
|
nextPageToken: string | null;
|
|
50
67
|
results: ActualMatchingTransactionSearchResult[];
|
|
51
|
-
}, "expenseAutomationActualMatchingView/searchMatchTransactionsSuccess">,
|
|
68
|
+
}, "expenseAutomationActualMatchingView/searchMatchTransactionsSuccess">, undoReversalAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[params: UndoReversalAccrualsParams], UndoReversalAccrualsParams, "expenseAutomationActualMatchingView/undoReversalAccruals", never, never>, undoReversalAccrualsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
69
|
+
status: ZeniAPIStatus;
|
|
70
|
+
}, "expenseAutomationActualMatchingView/undoReversalAccrualsFailure">, undoReversalAccrualsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
71
|
+
results: UndoReversalResult[];
|
|
72
|
+
}, "expenseAutomationActualMatchingView/undoReversalAccrualsSuccess">, updateActualMatchingUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<ActualMatchingViewUIState>, "expenseAutomationActualMatchingView/updateActualMatchingUIState">;
|
|
52
73
|
declare const _default: import("redux").Reducer<ActualMatchingViewState>;
|
|
53
74
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateActualMatchingUIState = exports.searchMatchTransactionsSuccess = exports.searchMatchTransactionsFailure = exports.searchMatchTransactions = exports.searchMatchAccrualsSuccess = exports.searchMatchAccrualsFailure = exports.searchMatchAccruals = exports.openMatchNewModal = exports.matchAndReverseAccrualsSuccess = exports.matchAndReverseAccrualsFailure = exports.matchAndReverseAccruals = exports.fetchActualMatchingSuccess = exports.fetchActualMatchingPage = exports.fetchActualMatchingFailure = exports.fetchActualMatching = exports.closeMatchNewModal = exports.clearMatchNewModal = exports.clearActualMatchingView = exports.initialState = exports.initialMatchModalState = exports.initialAccrualSearchState = exports.initialTransactionSearchState = void 0;
|
|
4
|
+
exports.updateActualMatchingUIState = exports.undoReversalAccrualsSuccess = exports.undoReversalAccrualsFailure = exports.undoReversalAccruals = exports.searchMatchTransactionsSuccess = exports.searchMatchTransactionsFailure = exports.searchMatchTransactions = exports.searchMatchAccrualsSuccess = exports.searchMatchAccrualsFailure = exports.searchMatchAccruals = exports.openMatchNewModal = exports.matchAndReverseAccrualsSuccess = exports.matchAndReverseAccrualsFailure = exports.matchAndReverseAccruals = exports.fetchActualMatchingSuccess = exports.fetchActualMatchingPage = exports.fetchActualMatchingMatchSuccess = exports.fetchActualMatchingMatchFailure = exports.fetchActualMatchingMatch = exports.fetchActualMatchingFailure = exports.fetchActualMatching = exports.closeMatchNewModal = exports.clearMatchNewModal = exports.clearActualMatchingView = exports.initialState = exports.initialMatchModalState = exports.initialAccrualSearchState = exports.initialTransactionSearchState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
7
|
const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper");
|
|
@@ -24,18 +24,22 @@ exports.initialAccrualSearchState = {
|
|
|
24
24
|
};
|
|
25
25
|
exports.initialMatchModalState = {
|
|
26
26
|
isOpen: false,
|
|
27
|
+
openedFromMatchId: undefined,
|
|
28
|
+
pinnedTransactionResults: [],
|
|
27
29
|
transactionSearch: exports.initialTransactionSearchState,
|
|
28
30
|
accrualSearch: exports.initialAccrualSearchState,
|
|
29
31
|
confirmStatus: { fetchState: 'Not-Started', error: undefined },
|
|
30
32
|
};
|
|
31
33
|
exports.initialState = {
|
|
32
|
-
|
|
34
|
+
matchIdsByPeriod: {},
|
|
33
35
|
fetchState: 'Not-Started',
|
|
34
36
|
error: undefined,
|
|
35
37
|
refreshStatus: {
|
|
36
38
|
fetchState: 'Not-Started',
|
|
37
39
|
error: undefined,
|
|
38
40
|
},
|
|
41
|
+
detailFetchStateByMatchId: {},
|
|
42
|
+
detailRefreshStatusByMatchId: {},
|
|
39
43
|
uiState: {
|
|
40
44
|
sortKey: 'date',
|
|
41
45
|
sortOrder: 'descending',
|
|
@@ -43,6 +47,7 @@ exports.initialState = {
|
|
|
43
47
|
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
44
48
|
},
|
|
45
49
|
matchModal: exports.initialMatchModalState,
|
|
50
|
+
undoReversalStatus: { fetchState: 'Not-Started', error: undefined },
|
|
46
51
|
hasValidState() {
|
|
47
52
|
return this.fetchState == 'Completed';
|
|
48
53
|
},
|
|
@@ -55,6 +60,8 @@ function resetMatchModalSearches(draft) {
|
|
|
55
60
|
error: undefined,
|
|
56
61
|
};
|
|
57
62
|
draft.matchModal.lastBatchResults = undefined;
|
|
63
|
+
draft.matchModal.openedFromMatchId = undefined;
|
|
64
|
+
draft.matchModal.pinnedTransactionResults = [];
|
|
58
65
|
}
|
|
59
66
|
const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
60
67
|
name: 'expenseAutomationActualMatchingView',
|
|
@@ -94,9 +101,9 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
94
101
|
},
|
|
95
102
|
},
|
|
96
103
|
fetchActualMatchingSuccess(draft, action) {
|
|
97
|
-
const {
|
|
104
|
+
const { matchIds, selectedPeriod, refreshViewInBackground } = action.payload;
|
|
98
105
|
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
99
|
-
draft.
|
|
106
|
+
draft.matchIdsByPeriod[periodId] = matchIds;
|
|
100
107
|
if (refreshViewInBackground) {
|
|
101
108
|
draft.refreshStatus = { fetchState: 'Completed', error: undefined };
|
|
102
109
|
}
|
|
@@ -115,6 +122,56 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
115
122
|
draft.error = status;
|
|
116
123
|
}
|
|
117
124
|
},
|
|
125
|
+
fetchActualMatchingMatch: {
|
|
126
|
+
prepare(matchId, refreshViewInBackground = false) {
|
|
127
|
+
return { payload: { matchId, refreshViewInBackground } };
|
|
128
|
+
},
|
|
129
|
+
reducer(draft, action) {
|
|
130
|
+
const { matchId, refreshViewInBackground } = action.payload;
|
|
131
|
+
if (refreshViewInBackground) {
|
|
132
|
+
draft.detailRefreshStatusByMatchId[matchId] = {
|
|
133
|
+
fetchState: 'In-Progress',
|
|
134
|
+
error: undefined,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
draft.detailFetchStateByMatchId[matchId] = {
|
|
139
|
+
fetchState: 'In-Progress',
|
|
140
|
+
error: undefined,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
fetchActualMatchingMatchSuccess(draft, action) {
|
|
146
|
+
const { matchId, refreshViewInBackground } = action.payload;
|
|
147
|
+
if (refreshViewInBackground) {
|
|
148
|
+
draft.detailRefreshStatusByMatchId[matchId] = {
|
|
149
|
+
fetchState: 'Completed',
|
|
150
|
+
error: undefined,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
draft.detailFetchStateByMatchId[matchId] = {
|
|
155
|
+
fetchState: 'Completed',
|
|
156
|
+
error: undefined,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
fetchActualMatchingMatchFailure(draft, action) {
|
|
161
|
+
const { matchId, refreshViewInBackground, status } = action.payload;
|
|
162
|
+
if (refreshViewInBackground) {
|
|
163
|
+
draft.detailRefreshStatusByMatchId[matchId] = {
|
|
164
|
+
fetchState: 'Error',
|
|
165
|
+
error: status,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
draft.detailFetchStateByMatchId[matchId] = {
|
|
170
|
+
fetchState: 'Error',
|
|
171
|
+
error: status,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
},
|
|
118
175
|
updateActualMatchingUIState(draft, action) {
|
|
119
176
|
if (action.payload.sortKey != null) {
|
|
120
177
|
draft.uiState.sortKey = action.payload.sortKey;
|
|
@@ -129,8 +186,20 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
129
186
|
draft.uiState.scrollPosition = action.payload.scrollPosition;
|
|
130
187
|
}
|
|
131
188
|
},
|
|
132
|
-
openMatchNewModal
|
|
133
|
-
|
|
189
|
+
openMatchNewModal: {
|
|
190
|
+
prepare(matchId) {
|
|
191
|
+
return { payload: { matchId } };
|
|
192
|
+
},
|
|
193
|
+
reducer(draft, action) {
|
|
194
|
+
resetMatchModalSearches(draft);
|
|
195
|
+
draft.matchModal.isOpen = true;
|
|
196
|
+
const matchId = action.payload.matchId;
|
|
197
|
+
draft.matchModal.openedFromMatchId =
|
|
198
|
+
matchId != null && matchId !== '' ? matchId : undefined;
|
|
199
|
+
if (draft.matchModal.openedFromMatchId != null) {
|
|
200
|
+
draft.matchModal.accrualSearch.fetchState = 'Completed';
|
|
201
|
+
}
|
|
202
|
+
},
|
|
134
203
|
},
|
|
135
204
|
closeMatchNewModal(draft) {
|
|
136
205
|
draft.matchModal.isOpen = false;
|
|
@@ -156,8 +225,15 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
156
225
|
draft.matchModal.transactionSearch.error = undefined;
|
|
157
226
|
}
|
|
158
227
|
},
|
|
159
|
-
prepare({ query, pageToken }) {
|
|
160
|
-
return {
|
|
228
|
+
prepare({ query, pageToken, transactionType, transactionIntegrationId, }) {
|
|
229
|
+
return {
|
|
230
|
+
payload: {
|
|
231
|
+
query,
|
|
232
|
+
pageToken: pageToken ?? undefined,
|
|
233
|
+
transactionType,
|
|
234
|
+
transactionIntegrationId,
|
|
235
|
+
},
|
|
236
|
+
};
|
|
161
237
|
},
|
|
162
238
|
},
|
|
163
239
|
searchMatchTransactionsSuccess(draft, action) {
|
|
@@ -175,6 +251,10 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
175
251
|
}
|
|
176
252
|
else {
|
|
177
253
|
draft.matchModal.transactionSearch.results = results;
|
|
254
|
+
if (draft.matchModal.openedFromMatchId != null &&
|
|
255
|
+
draft.matchModal.pinnedTransactionResults.length === 0) {
|
|
256
|
+
draft.matchModal.pinnedTransactionResults = results;
|
|
257
|
+
}
|
|
178
258
|
}
|
|
179
259
|
draft.matchModal.transactionSearch.nextPageToken = nextPageToken;
|
|
180
260
|
draft.matchModal.transactionSearch.isLoadingMore = false;
|
|
@@ -250,6 +330,30 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
250
330
|
error: action.payload.status,
|
|
251
331
|
};
|
|
252
332
|
},
|
|
333
|
+
undoReversalAccruals: {
|
|
334
|
+
reducer(draft) {
|
|
335
|
+
draft.undoReversalStatus = {
|
|
336
|
+
fetchState: 'In-Progress',
|
|
337
|
+
error: undefined,
|
|
338
|
+
};
|
|
339
|
+
},
|
|
340
|
+
prepare(params) {
|
|
341
|
+
return { payload: params };
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
undoReversalAccrualsSuccess(draft, action) {
|
|
345
|
+
draft.undoReversalStatus = {
|
|
346
|
+
fetchState: 'Completed',
|
|
347
|
+
error: undefined,
|
|
348
|
+
};
|
|
349
|
+
void action;
|
|
350
|
+
},
|
|
351
|
+
undoReversalAccrualsFailure(draft, action) {
|
|
352
|
+
draft.undoReversalStatus = {
|
|
353
|
+
fetchState: 'Error',
|
|
354
|
+
error: action.payload.status,
|
|
355
|
+
};
|
|
356
|
+
},
|
|
253
357
|
clearActualMatchingView(draft) {
|
|
254
358
|
Object.assign(draft, exports.initialState);
|
|
255
359
|
},
|
|
@@ -260,5 +364,5 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
260
364
|
});
|
|
261
365
|
},
|
|
262
366
|
});
|
|
263
|
-
_a = expenseAutomationActualMatchingView.actions, exports.clearActualMatchingView = _a.clearActualMatchingView, exports.clearMatchNewModal = _a.clearMatchNewModal, exports.closeMatchNewModal = _a.closeMatchNewModal, exports.fetchActualMatching = _a.fetchActualMatching, exports.fetchActualMatchingFailure = _a.fetchActualMatchingFailure, exports.fetchActualMatchingPage = _a.fetchActualMatchingPage, exports.fetchActualMatchingSuccess = _a.fetchActualMatchingSuccess, exports.matchAndReverseAccruals = _a.matchAndReverseAccruals, exports.matchAndReverseAccrualsFailure = _a.matchAndReverseAccrualsFailure, exports.matchAndReverseAccrualsSuccess = _a.matchAndReverseAccrualsSuccess, exports.openMatchNewModal = _a.openMatchNewModal, exports.searchMatchAccruals = _a.searchMatchAccruals, exports.searchMatchAccrualsFailure = _a.searchMatchAccrualsFailure, exports.searchMatchAccrualsSuccess = _a.searchMatchAccrualsSuccess, exports.searchMatchTransactions = _a.searchMatchTransactions, exports.searchMatchTransactionsFailure = _a.searchMatchTransactionsFailure, exports.searchMatchTransactionsSuccess = _a.searchMatchTransactionsSuccess, exports.updateActualMatchingUIState = _a.updateActualMatchingUIState;
|
|
367
|
+
_a = expenseAutomationActualMatchingView.actions, exports.clearActualMatchingView = _a.clearActualMatchingView, exports.clearMatchNewModal = _a.clearMatchNewModal, exports.closeMatchNewModal = _a.closeMatchNewModal, exports.fetchActualMatching = _a.fetchActualMatching, exports.fetchActualMatchingFailure = _a.fetchActualMatchingFailure, exports.fetchActualMatchingMatch = _a.fetchActualMatchingMatch, exports.fetchActualMatchingMatchFailure = _a.fetchActualMatchingMatchFailure, exports.fetchActualMatchingMatchSuccess = _a.fetchActualMatchingMatchSuccess, exports.fetchActualMatchingPage = _a.fetchActualMatchingPage, exports.fetchActualMatchingSuccess = _a.fetchActualMatchingSuccess, exports.matchAndReverseAccruals = _a.matchAndReverseAccruals, exports.matchAndReverseAccrualsFailure = _a.matchAndReverseAccrualsFailure, exports.matchAndReverseAccrualsSuccess = _a.matchAndReverseAccrualsSuccess, exports.openMatchNewModal = _a.openMatchNewModal, exports.searchMatchAccruals = _a.searchMatchAccruals, exports.searchMatchAccrualsFailure = _a.searchMatchAccrualsFailure, exports.searchMatchAccrualsSuccess = _a.searchMatchAccrualsSuccess, exports.searchMatchTransactions = _a.searchMatchTransactions, exports.searchMatchTransactionsFailure = _a.searchMatchTransactionsFailure, exports.searchMatchTransactionsSuccess = _a.searchMatchTransactionsSuccess, exports.undoReversalAccruals = _a.undoReversalAccruals, exports.undoReversalAccrualsFailure = _a.undoReversalAccrualsFailure, exports.undoReversalAccrualsSuccess = _a.undoReversalAccrualsSuccess, exports.updateActualMatchingUIState = _a.updateActualMatchingUIState;
|
|
264
368
|
exports.default = expenseAutomationActualMatchingView.reducer;
|