@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,6 +1,6 @@
|
|
|
1
1
|
import { from, of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
|
|
3
|
-
import {
|
|
3
|
+
import { updateActualMatchingMatches } from '../../../../entity/actualMatching/actualMatchingReducer';
|
|
4
4
|
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
5
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
6
|
import { clearAll } from '../../../../rootActions';
|
|
@@ -17,16 +17,16 @@ export const fetchActualMatchingEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
17
17
|
};
|
|
18
18
|
const serviceMonth = toServiceMonthFromPeriod(period);
|
|
19
19
|
return zeniAPI
|
|
20
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals?service_month=${encodeURIComponent(serviceMonth)}
|
|
20
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching?service_month=${encodeURIComponent(serviceMonth)}`)
|
|
21
21
|
.pipe(mergeMap((response) => {
|
|
22
22
|
if (isSuccessResponse(response) && response.data != null) {
|
|
23
|
-
const
|
|
23
|
+
const matches = response.data.matches ?? [];
|
|
24
24
|
const updateActions = [];
|
|
25
|
-
if (
|
|
26
|
-
updateActions.push(
|
|
25
|
+
if (matches.length > 0) {
|
|
26
|
+
updateActions.push(updateActualMatchingMatches(matches));
|
|
27
27
|
}
|
|
28
28
|
updateActions.push(fetchActualMatchingSuccess({
|
|
29
|
-
|
|
29
|
+
matchIds: matches.map((match) => match.match_id),
|
|
30
30
|
selectedPeriod,
|
|
31
31
|
refreshViewInBackground,
|
|
32
32
|
}));
|
package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
|
|
3
|
+
import { updateActualMatchingMatches } from '../../../../entity/actualMatching/actualMatchingReducer';
|
|
4
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
|
+
import { clearAll } from '../../../../rootActions';
|
|
6
|
+
import { fetchActualMatchingMatch, fetchActualMatchingMatchFailure, fetchActualMatchingMatchSuccess, } from '../../reducers/actualMatchingViewReducer';
|
|
7
|
+
export const fetchActualMatchingMatchEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchActualMatchingMatch.match), mergeMap((action) => {
|
|
8
|
+
const { matchId, refreshViewInBackground } = action.payload;
|
|
9
|
+
return zeniAPI
|
|
10
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching/${encodeURIComponent(matchId)}`)
|
|
11
|
+
.pipe(mergeMap((response) => {
|
|
12
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
13
|
+
return from([
|
|
14
|
+
updateActualMatchingMatches([response.data]),
|
|
15
|
+
fetchActualMatchingMatchSuccess({
|
|
16
|
+
matchId,
|
|
17
|
+
refreshViewInBackground,
|
|
18
|
+
}),
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
return from([
|
|
22
|
+
fetchActualMatchingMatchFailure({
|
|
23
|
+
matchId,
|
|
24
|
+
refreshViewInBackground,
|
|
25
|
+
status: response.status,
|
|
26
|
+
}),
|
|
27
|
+
]);
|
|
28
|
+
}), catchError((error) => from([
|
|
29
|
+
fetchActualMatchingMatchFailure({
|
|
30
|
+
matchId,
|
|
31
|
+
refreshViewInBackground,
|
|
32
|
+
status: createZeniAPIStatus('Unexpected Error', `Fetch actual matching match REST API call errored out ${JSON.stringify(error)}`),
|
|
33
|
+
}),
|
|
34
|
+
])), takeUntil(actions$.pipe(filter(clearAll.match))));
|
|
35
|
+
}));
|
package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js
CHANGED
|
@@ -20,12 +20,13 @@ function refreshActualMatchingList(state) {
|
|
|
20
20
|
return [fetchActualMatching({ start, end }, true)];
|
|
21
21
|
}
|
|
22
22
|
export const matchAndReverseAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(matchAndReverseAccruals.match), mergeMap((action) => {
|
|
23
|
-
const { transactionId, transactionIntegrationId, transactionType, lineId, accrualIds, } = action.payload;
|
|
23
|
+
const { transactionId, transactionIntegrationId, transactionType, lineId, accrualIds, transactionSyncToken, } = action.payload;
|
|
24
24
|
const body = {
|
|
25
25
|
transaction_id: transactionId,
|
|
26
26
|
transaction_integration_id: transactionIntegrationId,
|
|
27
27
|
transaction_type: transactionType,
|
|
28
28
|
line_id: lineId,
|
|
29
|
+
transaction_sync_token: transactionSyncToken,
|
|
29
30
|
accrual_ids: accrualIds,
|
|
30
31
|
};
|
|
31
32
|
return zeniAPI
|
package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js
CHANGED
|
@@ -1,23 +1,52 @@
|
|
|
1
1
|
import { from, merge, of } from 'rxjs';
|
|
2
2
|
import { catchError, debounceTime, filter, mergeMap, switchMap, } from 'rxjs/operators';
|
|
3
|
+
import { getActualMatchingMatchById } from '../../../../entity/actualMatching/actualMatchingSelector';
|
|
3
4
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
5
|
import { toActualMatchingTransactionSearchResult, } from '../../payload/actualMatchingPayload';
|
|
5
6
|
import { openMatchNewModal, searchMatchAccruals, searchMatchTransactions, searchMatchTransactionsFailure, searchMatchTransactionsSuccess, } from '../../reducers/actualMatchingViewReducer';
|
|
7
|
+
import { parseActualMatchingMatchId } from '../../selectors/actualMatchingViewSelector';
|
|
6
8
|
import { MATCH_SEARCH_DEBOUNCE_MS, MATCH_TRANSACTION_SEARCH_PAGE_SIZE, } from '../../types/actualMatchingViewState';
|
|
7
|
-
export const searchMatchTransactionsEpic = (actions$,
|
|
8
|
-
const openModal$ = actions$.pipe(filter(openMatchNewModal.match), mergeMap(() =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
10
|
+
const openModal$ = actions$.pipe(filter(openMatchNewModal.match), mergeMap((action) => {
|
|
11
|
+
const matchId = action.payload.matchId;
|
|
12
|
+
if (matchId == null || matchId === '') {
|
|
13
|
+
return from([
|
|
14
|
+
searchMatchTransactions({ query: '' }),
|
|
15
|
+
searchMatchAccruals({ query: '' }),
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
const match = getActualMatchingMatchById(matchId, state$.value.actualMatchingState);
|
|
19
|
+
const parsed = parseActualMatchingMatchId(matchId);
|
|
20
|
+
const transactionType = match?.transactionType != null && match.transactionType !== ''
|
|
21
|
+
? match.transactionType
|
|
22
|
+
: parsed?.transactionType;
|
|
23
|
+
const transactionIntegrationId = match?.transactionIntegrationId != null &&
|
|
24
|
+
match.transactionIntegrationId !== ''
|
|
25
|
+
? match.transactionIntegrationId
|
|
26
|
+
: parsed?.transactionIntegrationId;
|
|
27
|
+
return from([
|
|
28
|
+
searchMatchTransactions({
|
|
29
|
+
query: '',
|
|
30
|
+
transactionType,
|
|
31
|
+
transactionIntegrationId,
|
|
32
|
+
}),
|
|
33
|
+
]);
|
|
34
|
+
}));
|
|
12
35
|
const searchActions$ = actions$.pipe(filter(searchMatchTransactions.match));
|
|
13
36
|
const pagination$ = searchActions$.pipe(filter((action) => action.payload.pageToken != null));
|
|
14
37
|
const newSearchDebounced$ = searchActions$.pipe(filter((action) => action.payload.pageToken == null), debounceTime(MATCH_SEARCH_DEBOUNCE_MS));
|
|
15
38
|
const search$ = merge(pagination$, newSearchDebounced$).pipe(switchMap((action) => {
|
|
16
|
-
const { query, pageToken } = action.payload;
|
|
39
|
+
const { query, pageToken, transactionType, transactionIntegrationId } = action.payload;
|
|
17
40
|
const queryParam = {
|
|
18
41
|
search_text: query,
|
|
19
42
|
page_size: MATCH_TRANSACTION_SEARCH_PAGE_SIZE,
|
|
20
43
|
...(pageToken != null ? { page_token: pageToken } : {}),
|
|
44
|
+
...(transactionType != null && transactionType !== ''
|
|
45
|
+
? { transaction_type: transactionType }
|
|
46
|
+
: {}),
|
|
47
|
+
...(transactionIntegrationId != null && transactionIntegrationId !== ''
|
|
48
|
+
? { transaction_integration_id: transactionIntegrationId }
|
|
49
|
+
: {}),
|
|
21
50
|
};
|
|
22
51
|
return zeniAPI
|
|
23
52
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/match-transaction-search?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { from, of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
|
|
3
|
+
import { convertToPeriod, toAbsoluteDay, } from '../../../../commonStateTypes/timePeriod';
|
|
4
|
+
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
|
+
import { clearAll } from '../../../../rootActions';
|
|
7
|
+
import { toUndoReversalResult, } from '../../payload/actualMatchingPayload';
|
|
8
|
+
import { fetchActualMatching, fetchActualMatchingMatch, undoReversalAccruals, undoReversalAccrualsFailure, undoReversalAccrualsSuccess, } from '../../reducers/actualMatchingViewReducer';
|
|
9
|
+
function refreshActualMatchingList(state) {
|
|
10
|
+
const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[getCurrentTenant(state).tenantId];
|
|
11
|
+
if (selectedMonthYear == null) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const period = convertToPeriod(selectedMonthYear);
|
|
15
|
+
const start = toAbsoluteDay(period.start);
|
|
16
|
+
const end = toAbsoluteDay(period.end);
|
|
17
|
+
if (start == null || end == null) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
return [fetchActualMatching({ start, end }, true)];
|
|
21
|
+
}
|
|
22
|
+
function refreshOpenMatchDetails(state) {
|
|
23
|
+
const detailState = state.expenseAutomationActualMatchingViewState.detailFetchStateByMatchId;
|
|
24
|
+
return Object.keys(detailState)
|
|
25
|
+
.filter((matchId) => detailState[matchId]?.fetchState !== 'Not-Started')
|
|
26
|
+
.map((matchId) => fetchActualMatchingMatch(matchId, true));
|
|
27
|
+
}
|
|
28
|
+
export const undoReversalAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(undoReversalAccruals.match), mergeMap((action) => {
|
|
29
|
+
const body = {
|
|
30
|
+
accrual_ids: action.payload.accrualIds,
|
|
31
|
+
};
|
|
32
|
+
return zeniAPI
|
|
33
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/undo-reversal`, body)
|
|
34
|
+
.pipe(mergeMap((response) => {
|
|
35
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
36
|
+
const results = (response.data.results ?? []).map(toUndoReversalResult);
|
|
37
|
+
const successActions = [
|
|
38
|
+
undoReversalAccrualsSuccess({ results }),
|
|
39
|
+
];
|
|
40
|
+
const anyUndone = results.some((result) => result.status === 'undone');
|
|
41
|
+
if (anyUndone) {
|
|
42
|
+
successActions.push(...refreshActualMatchingList(state$.value), ...refreshOpenMatchDetails(state$.value));
|
|
43
|
+
}
|
|
44
|
+
return from(successActions);
|
|
45
|
+
}
|
|
46
|
+
return of(undoReversalAccrualsFailure({ status: response.status }));
|
|
47
|
+
}), catchError((error) => of(undoReversalAccrualsFailure({
|
|
48
|
+
status: createZeniAPIStatus('Unexpected Error', 'Undo reversal accruals REST API call errored out' +
|
|
49
|
+
JSON.stringify(error)),
|
|
50
|
+
}))), takeUntil(actions$.pipe(filter(clearAll.match))));
|
|
51
|
+
}));
|
package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js
CHANGED
|
@@ -69,7 +69,7 @@ export const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.
|
|
|
69
69
|
// endpoint and cache slot.
|
|
70
70
|
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
71
71
|
if (selectedPageTab === 'actual_matching') {
|
|
72
|
-
const actualMatchingPeriodKeys = state.expenseAutomationActualMatchingViewState.
|
|
72
|
+
const actualMatchingPeriodKeys = state.expenseAutomationActualMatchingViewState.matchIdsByPeriod[monthYearPeriodId];
|
|
73
73
|
if (state.expenseAutomationActualMatchingViewState.fetchState !==
|
|
74
74
|
'In-Progress' &&
|
|
75
75
|
(!state.expenseAutomationActualMatchingViewState.hasValidState() ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toString } from '../../../commonStateTypes/timePeriod';
|
|
2
|
-
import { toMatchAndReverseResultStatus, } from '../types/actualMatchingViewState';
|
|
2
|
+
import { toMatchAndReverseResultStatus, toUndoReversalResultStatus, } from '../types/actualMatchingViewState';
|
|
3
3
|
export function toServiceMonthFromPeriod(period) {
|
|
4
4
|
return toString(period.start).slice(0, 7);
|
|
5
5
|
}
|
|
@@ -49,6 +49,7 @@ export function toActualMatchingTransactionSearchResult(payload) {
|
|
|
49
49
|
transactionMemo: payload.transaction_memo ?? undefined,
|
|
50
50
|
transactionDescription: payload.transaction_description ?? undefined,
|
|
51
51
|
transactionTypeName: payload.transaction_type_name ?? undefined,
|
|
52
|
+
syncToken: payload.sync_token == null ? '' : String(payload.sync_token),
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
export function toMatchAndReverseResult(payload) {
|
|
@@ -58,3 +59,10 @@ export function toMatchAndReverseResult(payload) {
|
|
|
58
59
|
reason: payload.reason ?? undefined,
|
|
59
60
|
};
|
|
60
61
|
}
|
|
62
|
+
export function toUndoReversalResult(payload) {
|
|
63
|
+
return {
|
|
64
|
+
accrualId: payload.accrual_id,
|
|
65
|
+
status: toUndoReversalResultStatus(payload.status),
|
|
66
|
+
reason: payload.reason ?? undefined,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -20,18 +20,22 @@ export const initialAccrualSearchState = {
|
|
|
20
20
|
};
|
|
21
21
|
export const initialMatchModalState = {
|
|
22
22
|
isOpen: false,
|
|
23
|
+
openedFromMatchId: undefined,
|
|
24
|
+
pinnedTransactionResults: [],
|
|
23
25
|
transactionSearch: initialTransactionSearchState,
|
|
24
26
|
accrualSearch: initialAccrualSearchState,
|
|
25
27
|
confirmStatus: { fetchState: 'Not-Started', error: undefined },
|
|
26
28
|
};
|
|
27
29
|
export const initialState = {
|
|
28
|
-
|
|
30
|
+
matchIdsByPeriod: {},
|
|
29
31
|
fetchState: 'Not-Started',
|
|
30
32
|
error: undefined,
|
|
31
33
|
refreshStatus: {
|
|
32
34
|
fetchState: 'Not-Started',
|
|
33
35
|
error: undefined,
|
|
34
36
|
},
|
|
37
|
+
detailFetchStateByMatchId: {},
|
|
38
|
+
detailRefreshStatusByMatchId: {},
|
|
35
39
|
uiState: {
|
|
36
40
|
sortKey: 'date',
|
|
37
41
|
sortOrder: 'descending',
|
|
@@ -39,6 +43,7 @@ export const initialState = {
|
|
|
39
43
|
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
40
44
|
},
|
|
41
45
|
matchModal: initialMatchModalState,
|
|
46
|
+
undoReversalStatus: { fetchState: 'Not-Started', error: undefined },
|
|
42
47
|
hasValidState() {
|
|
43
48
|
return this.fetchState == 'Completed';
|
|
44
49
|
},
|
|
@@ -51,6 +56,8 @@ function resetMatchModalSearches(draft) {
|
|
|
51
56
|
error: undefined,
|
|
52
57
|
};
|
|
53
58
|
draft.matchModal.lastBatchResults = undefined;
|
|
59
|
+
draft.matchModal.openedFromMatchId = undefined;
|
|
60
|
+
draft.matchModal.pinnedTransactionResults = [];
|
|
54
61
|
}
|
|
55
62
|
const expenseAutomationActualMatchingView = createSlice({
|
|
56
63
|
name: 'expenseAutomationActualMatchingView',
|
|
@@ -90,9 +97,9 @@ const expenseAutomationActualMatchingView = createSlice({
|
|
|
90
97
|
},
|
|
91
98
|
},
|
|
92
99
|
fetchActualMatchingSuccess(draft, action) {
|
|
93
|
-
const {
|
|
100
|
+
const { matchIds, selectedPeriod, refreshViewInBackground } = action.payload;
|
|
94
101
|
const periodId = toMonthYearPeriodId(selectedPeriod);
|
|
95
|
-
draft.
|
|
102
|
+
draft.matchIdsByPeriod[periodId] = matchIds;
|
|
96
103
|
if (refreshViewInBackground) {
|
|
97
104
|
draft.refreshStatus = { fetchState: 'Completed', error: undefined };
|
|
98
105
|
}
|
|
@@ -111,6 +118,56 @@ const expenseAutomationActualMatchingView = createSlice({
|
|
|
111
118
|
draft.error = status;
|
|
112
119
|
}
|
|
113
120
|
},
|
|
121
|
+
fetchActualMatchingMatch: {
|
|
122
|
+
prepare(matchId, refreshViewInBackground = false) {
|
|
123
|
+
return { payload: { matchId, refreshViewInBackground } };
|
|
124
|
+
},
|
|
125
|
+
reducer(draft, action) {
|
|
126
|
+
const { matchId, refreshViewInBackground } = action.payload;
|
|
127
|
+
if (refreshViewInBackground) {
|
|
128
|
+
draft.detailRefreshStatusByMatchId[matchId] = {
|
|
129
|
+
fetchState: 'In-Progress',
|
|
130
|
+
error: undefined,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
draft.detailFetchStateByMatchId[matchId] = {
|
|
135
|
+
fetchState: 'In-Progress',
|
|
136
|
+
error: undefined,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
fetchActualMatchingMatchSuccess(draft, action) {
|
|
142
|
+
const { matchId, refreshViewInBackground } = action.payload;
|
|
143
|
+
if (refreshViewInBackground) {
|
|
144
|
+
draft.detailRefreshStatusByMatchId[matchId] = {
|
|
145
|
+
fetchState: 'Completed',
|
|
146
|
+
error: undefined,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
draft.detailFetchStateByMatchId[matchId] = {
|
|
151
|
+
fetchState: 'Completed',
|
|
152
|
+
error: undefined,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
fetchActualMatchingMatchFailure(draft, action) {
|
|
157
|
+
const { matchId, refreshViewInBackground, status } = action.payload;
|
|
158
|
+
if (refreshViewInBackground) {
|
|
159
|
+
draft.detailRefreshStatusByMatchId[matchId] = {
|
|
160
|
+
fetchState: 'Error',
|
|
161
|
+
error: status,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
draft.detailFetchStateByMatchId[matchId] = {
|
|
166
|
+
fetchState: 'Error',
|
|
167
|
+
error: status,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
},
|
|
114
171
|
updateActualMatchingUIState(draft, action) {
|
|
115
172
|
if (action.payload.sortKey != null) {
|
|
116
173
|
draft.uiState.sortKey = action.payload.sortKey;
|
|
@@ -125,8 +182,20 @@ const expenseAutomationActualMatchingView = createSlice({
|
|
|
125
182
|
draft.uiState.scrollPosition = action.payload.scrollPosition;
|
|
126
183
|
}
|
|
127
184
|
},
|
|
128
|
-
openMatchNewModal
|
|
129
|
-
|
|
185
|
+
openMatchNewModal: {
|
|
186
|
+
prepare(matchId) {
|
|
187
|
+
return { payload: { matchId } };
|
|
188
|
+
},
|
|
189
|
+
reducer(draft, action) {
|
|
190
|
+
resetMatchModalSearches(draft);
|
|
191
|
+
draft.matchModal.isOpen = true;
|
|
192
|
+
const matchId = action.payload.matchId;
|
|
193
|
+
draft.matchModal.openedFromMatchId =
|
|
194
|
+
matchId != null && matchId !== '' ? matchId : undefined;
|
|
195
|
+
if (draft.matchModal.openedFromMatchId != null) {
|
|
196
|
+
draft.matchModal.accrualSearch.fetchState = 'Completed';
|
|
197
|
+
}
|
|
198
|
+
},
|
|
130
199
|
},
|
|
131
200
|
closeMatchNewModal(draft) {
|
|
132
201
|
draft.matchModal.isOpen = false;
|
|
@@ -152,8 +221,15 @@ const expenseAutomationActualMatchingView = createSlice({
|
|
|
152
221
|
draft.matchModal.transactionSearch.error = undefined;
|
|
153
222
|
}
|
|
154
223
|
},
|
|
155
|
-
prepare({ query, pageToken }) {
|
|
156
|
-
return {
|
|
224
|
+
prepare({ query, pageToken, transactionType, transactionIntegrationId, }) {
|
|
225
|
+
return {
|
|
226
|
+
payload: {
|
|
227
|
+
query,
|
|
228
|
+
pageToken: pageToken ?? undefined,
|
|
229
|
+
transactionType,
|
|
230
|
+
transactionIntegrationId,
|
|
231
|
+
},
|
|
232
|
+
};
|
|
157
233
|
},
|
|
158
234
|
},
|
|
159
235
|
searchMatchTransactionsSuccess(draft, action) {
|
|
@@ -171,6 +247,10 @@ const expenseAutomationActualMatchingView = createSlice({
|
|
|
171
247
|
}
|
|
172
248
|
else {
|
|
173
249
|
draft.matchModal.transactionSearch.results = results;
|
|
250
|
+
if (draft.matchModal.openedFromMatchId != null &&
|
|
251
|
+
draft.matchModal.pinnedTransactionResults.length === 0) {
|
|
252
|
+
draft.matchModal.pinnedTransactionResults = results;
|
|
253
|
+
}
|
|
174
254
|
}
|
|
175
255
|
draft.matchModal.transactionSearch.nextPageToken = nextPageToken;
|
|
176
256
|
draft.matchModal.transactionSearch.isLoadingMore = false;
|
|
@@ -246,6 +326,30 @@ const expenseAutomationActualMatchingView = createSlice({
|
|
|
246
326
|
error: action.payload.status,
|
|
247
327
|
};
|
|
248
328
|
},
|
|
329
|
+
undoReversalAccruals: {
|
|
330
|
+
reducer(draft) {
|
|
331
|
+
draft.undoReversalStatus = {
|
|
332
|
+
fetchState: 'In-Progress',
|
|
333
|
+
error: undefined,
|
|
334
|
+
};
|
|
335
|
+
},
|
|
336
|
+
prepare(params) {
|
|
337
|
+
return { payload: params };
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
undoReversalAccrualsSuccess(draft, action) {
|
|
341
|
+
draft.undoReversalStatus = {
|
|
342
|
+
fetchState: 'Completed',
|
|
343
|
+
error: undefined,
|
|
344
|
+
};
|
|
345
|
+
void action;
|
|
346
|
+
},
|
|
347
|
+
undoReversalAccrualsFailure(draft, action) {
|
|
348
|
+
draft.undoReversalStatus = {
|
|
349
|
+
fetchState: 'Error',
|
|
350
|
+
error: action.payload.status,
|
|
351
|
+
};
|
|
352
|
+
},
|
|
249
353
|
clearActualMatchingView(draft) {
|
|
250
354
|
Object.assign(draft, initialState);
|
|
251
355
|
},
|
|
@@ -256,5 +360,5 @@ const expenseAutomationActualMatchingView = createSlice({
|
|
|
256
360
|
});
|
|
257
361
|
},
|
|
258
362
|
});
|
|
259
|
-
export const { clearActualMatchingView, clearMatchNewModal, closeMatchNewModal, fetchActualMatching, fetchActualMatchingFailure, fetchActualMatchingPage, fetchActualMatchingSuccess, matchAndReverseAccruals, matchAndReverseAccrualsFailure, matchAndReverseAccrualsSuccess, openMatchNewModal, searchMatchAccruals, searchMatchAccrualsFailure, searchMatchAccrualsSuccess, searchMatchTransactions, searchMatchTransactionsFailure, searchMatchTransactionsSuccess, updateActualMatchingUIState, } = expenseAutomationActualMatchingView.actions;
|
|
363
|
+
export const { clearActualMatchingView, clearMatchNewModal, closeMatchNewModal, fetchActualMatching, fetchActualMatchingFailure, fetchActualMatchingMatch, fetchActualMatchingMatchFailure, fetchActualMatchingMatchSuccess, fetchActualMatchingPage, fetchActualMatchingSuccess, matchAndReverseAccruals, matchAndReverseAccrualsFailure, matchAndReverseAccrualsSuccess, openMatchNewModal, searchMatchAccruals, searchMatchAccrualsFailure, searchMatchAccrualsSuccess, searchMatchTransactions, searchMatchTransactionsFailure, searchMatchTransactionsSuccess, undoReversalAccruals, undoReversalAccrualsFailure, undoReversalAccrualsSuccess, updateActualMatchingUIState, } = expenseAutomationActualMatchingView.actions;
|
|
260
364
|
export default expenseAutomationActualMatchingView.reducer;
|