@zeniai/client-epic-state 5.2.35-beta2MM → 5.2.35-beta4MM
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 +6 -1
- package/lib/entity/actualMatching/actualMatchingPayload.js +8 -13
- 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/esm/entity/actualMatching/actualMatchingPayload.js +9 -14
- package/lib/esm/entity/actualMatching/actualMatchingReducer.js +3 -3
- package/lib/esm/index.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +3 -2
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +21 -24
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/refreshActualMatchingList.js +16 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +6 -9
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +15 -28
- package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +9 -9
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +34 -16
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +65 -21
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +3 -0
- package/lib/index.d.ts +3 -2
- package/lib/index.js +49 -48
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +1 -1
- 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.js +17 -20
- 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/searchMatchTransactionsEpic.js +5 -8
- package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +13 -26
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +2 -2
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +9 -9
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +19 -16
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +33 -15
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +0 -1
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +6 -1
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +66 -21
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +5 -1
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +4 -0
- package/package.json +1 -1
|
@@ -3,26 +3,14 @@ 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 timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
6
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
7
|
const rootActions_1 = require("../../../../rootActions");
|
|
9
8
|
const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
|
|
10
9
|
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
const matchAndReverseAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.matchAndReverseAccruals.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
+
const refreshActualMatchingList_1 = require("./refreshActualMatchingList");
|
|
11
|
+
const matchAndReverseAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.matchAndReverseAccruals.match),
|
|
12
|
+
// Posts reversing JEs; drop duplicate clicks while a request is in flight.
|
|
13
|
+
(0, operators_1.exhaustMap)((action) => {
|
|
26
14
|
const { transactionId, transactionIntegrationId, transactionType, lineId, accrualIds, transactionSyncToken, } = action.payload;
|
|
27
15
|
const body = {
|
|
28
16
|
transaction_id: transactionId,
|
|
@@ -37,12 +25,21 @@ const matchAndReverseAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
37
25
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
38
26
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
39
27
|
const results = response.data.results.map(actualMatchingPayload_1.toMatchAndReverseResult);
|
|
28
|
+
const openedFromMatchId = state$.value.expenseAutomationActualMatchingViewState.matchModal
|
|
29
|
+
.openedFromMatchId;
|
|
30
|
+
const matchId = openedFromMatchId ??
|
|
31
|
+
`${transactionType}:${transactionIntegrationId}`;
|
|
40
32
|
const successActions = [
|
|
41
|
-
(0, actualMatchingViewReducer_1.matchAndReverseAccrualsSuccess)({ results }),
|
|
33
|
+
(0, actualMatchingViewReducer_1.matchAndReverseAccrualsSuccess)({ matchId, results }),
|
|
42
34
|
];
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
const occupancyChanged = results.some((result) => result.status === 'reversed' || result.status === 'noop');
|
|
36
|
+
const allComplete = results.length > 0 &&
|
|
37
|
+
results.every((result) => result.status === 'reversed' || result.status === 'noop');
|
|
38
|
+
if (occupancyChanged) {
|
|
39
|
+
successActions.push(...(0, refreshActualMatchingList_1.refreshActualMatchingList)(state$.value));
|
|
40
|
+
}
|
|
41
|
+
if (allComplete) {
|
|
42
|
+
successActions.push((0, actualMatchingViewReducer_1.clearMatchNewModal)());
|
|
46
43
|
}
|
|
47
44
|
return (0, rxjs_1.from)(successActions);
|
|
48
45
|
}
|
|
@@ -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
|
+
}
|
|
@@ -15,8 +15,8 @@ const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
|
15
15
|
const matchId = action.payload.matchId;
|
|
16
16
|
if (matchId == null || matchId === '') {
|
|
17
17
|
return (0, rxjs_1.from)([
|
|
18
|
-
(0, actualMatchingViewReducer_1.searchMatchTransactions)(
|
|
19
|
-
(0, actualMatchingViewReducer_1.searchMatchAccruals)(
|
|
18
|
+
(0, actualMatchingViewReducer_1.searchMatchTransactions)(''),
|
|
19
|
+
(0, actualMatchingViewReducer_1.searchMatchAccruals)(''),
|
|
20
20
|
]);
|
|
21
21
|
}
|
|
22
22
|
const match = (0, actualMatchingSelector_1.getActualMatchingMatchById)(state$.value.actualMatchingState, matchId);
|
|
@@ -29,11 +29,7 @@ const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
|
29
29
|
? match.transactionIntegrationId
|
|
30
30
|
: parsed?.transactionIntegrationId;
|
|
31
31
|
return (0, rxjs_1.from)([
|
|
32
|
-
(0, actualMatchingViewReducer_1.searchMatchTransactions)(
|
|
33
|
-
query: '',
|
|
34
|
-
transactionType,
|
|
35
|
-
transactionIntegrationId,
|
|
36
|
-
}),
|
|
32
|
+
(0, actualMatchingViewReducer_1.searchMatchTransactions)('', undefined, transactionType, transactionIntegrationId),
|
|
37
33
|
]);
|
|
38
34
|
}));
|
|
39
35
|
const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchTransactions.match));
|
|
@@ -58,7 +54,8 @@ const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
|
58
54
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
59
55
|
const { transactions, next_page_token } = response.data;
|
|
60
56
|
const append = pageToken != null;
|
|
61
|
-
const
|
|
57
|
+
const fallbackCurrency = (0, actualMatchingViewSelector_1.getTenantDisplayCurrency)(state$.value);
|
|
58
|
+
const results = transactions.map((transaction) => (0, actualMatchingPayload_1.toActualMatchingTransactionSearchResult)(transaction, fallbackCurrency));
|
|
62
59
|
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsSuccess)({
|
|
63
60
|
append,
|
|
64
61
|
nextPageToken: next_page_token ?? null,
|
|
@@ -3,34 +3,17 @@ 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 timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
6
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
7
|
const rootActions_1 = require("../../../../rootActions");
|
|
9
8
|
const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
|
|
10
9
|
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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) => {
|
|
10
|
+
const refreshActualMatchingList_1 = require("./refreshActualMatchingList");
|
|
11
|
+
const undoReversalAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.undoReversalAccruals.match),
|
|
12
|
+
// Posts QBO deletes; drop duplicate clicks while a request is in flight.
|
|
13
|
+
(0, operators_1.exhaustMap)((action) => {
|
|
14
|
+
const { accrualIds, matchId } = action.payload;
|
|
32
15
|
const body = {
|
|
33
|
-
accrual_ids:
|
|
16
|
+
accrual_ids: accrualIds,
|
|
34
17
|
};
|
|
35
18
|
return zeniAPI
|
|
36
19
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/undo-reversal`, body)
|
|
@@ -38,16 +21,20 @@ const undoReversalAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0
|
|
|
38
21
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
39
22
|
const results = response.data.results.map(actualMatchingPayload_1.toUndoReversalResult);
|
|
40
23
|
const successActions = [
|
|
41
|
-
(0, actualMatchingViewReducer_1.undoReversalAccrualsSuccess)(
|
|
24
|
+
(0, actualMatchingViewReducer_1.undoReversalAccrualsSuccess)(matchId, results),
|
|
42
25
|
];
|
|
43
26
|
const anyUndone = results.some((result) => result.status === 'undone');
|
|
44
27
|
if (anyUndone) {
|
|
45
|
-
successActions.push(...refreshActualMatchingList(state$.value),
|
|
28
|
+
successActions.push(...(0, refreshActualMatchingList_1.refreshActualMatchingList)(state$.value), (0, actualMatchingViewReducer_1.fetchActualMatchingMatch)(matchId, true));
|
|
46
29
|
}
|
|
47
30
|
return (0, rxjs_1.from)(successActions);
|
|
48
31
|
}
|
|
49
|
-
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({
|
|
32
|
+
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({
|
|
33
|
+
matchId,
|
|
34
|
+
status: response.status,
|
|
35
|
+
}));
|
|
50
36
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({
|
|
37
|
+
matchId,
|
|
51
38
|
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Undo reversal accruals REST API call errored out' +
|
|
52
39
|
JSON.stringify(error)),
|
|
53
40
|
}))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { TimePeriod } from '../../../commonStateTypes/timePeriod';
|
|
3
|
-
import { ActualMatchingListResponsePayload } from '../../../entity/actualMatching/actualMatchingPayload';
|
|
3
|
+
import { ActualMatchingListResponsePayload, DisplayCurrencyFallback } from '../../../entity/actualMatching/actualMatchingPayload';
|
|
4
4
|
import { JEOneTimeAccrualPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
|
|
5
5
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
6
6
|
import { ActualMatchingTransactionSearchResult, MatchAndReverseResult, UndoReversalResult } from '../types/actualMatchingViewState';
|
|
@@ -47,7 +47,7 @@ export interface MatchTransactionSearchResponsePayload {
|
|
|
47
47
|
next_page_token?: string | null;
|
|
48
48
|
}
|
|
49
49
|
export type MatchTransactionSearchResponse = ZeniAPIResponse<MatchTransactionSearchResponsePayload>;
|
|
50
|
-
export declare function toActualMatchingTransactionSearchResult(payload: MatchTransactionSearchResultPayload): ActualMatchingTransactionSearchResult;
|
|
50
|
+
export declare function toActualMatchingTransactionSearchResult(payload: MatchTransactionSearchResultPayload, fallbackCurrency?: DisplayCurrencyFallback): ActualMatchingTransactionSearchResult;
|
|
51
51
|
export interface MatchAndReverseRequestPayload {
|
|
52
52
|
accrual_ids: ID[];
|
|
53
53
|
line_id: string;
|
|
@@ -9,8 +9,6 @@ const actualMatchingViewState_1 = require("../types/actualMatchingViewState");
|
|
|
9
9
|
function toServiceMonthFromPeriod(period) {
|
|
10
10
|
return (0, timePeriod_1.toString)(period.start).slice(0, 7);
|
|
11
11
|
}
|
|
12
|
-
const DEFAULT_CURRENCY_CODE = 'USD';
|
|
13
|
-
const DEFAULT_CURRENCY_SYMBOL = '$';
|
|
14
12
|
function resolveMatchSearchAmount(payload) {
|
|
15
13
|
const raw = payload.total_amount ?? payload.amount;
|
|
16
14
|
if (typeof raw === 'number' && Number.isFinite(raw)) {
|
|
@@ -24,18 +22,20 @@ function resolveMatchSearchAmount(payload) {
|
|
|
24
22
|
}
|
|
25
23
|
return 0;
|
|
26
24
|
}
|
|
27
|
-
function resolveMatchSearchCurrencySymbol(payload, currencyCode) {
|
|
25
|
+
function resolveMatchSearchCurrencySymbol(payload, currencyCode, fallbackCurrency) {
|
|
28
26
|
if (payload.currency_symbol != null && payload.currency_symbol !== '') {
|
|
29
27
|
return payload.currency_symbol;
|
|
30
28
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
if (fallbackCurrency != null &&
|
|
30
|
+
currencyCode === fallbackCurrency.currencyCode) {
|
|
31
|
+
return fallbackCurrency.currencySymbol;
|
|
32
|
+
}
|
|
33
|
+
return currencyCode;
|
|
34
34
|
}
|
|
35
|
-
function toActualMatchingTransactionSearchResult(payload) {
|
|
35
|
+
function toActualMatchingTransactionSearchResult(payload, fallbackCurrency) {
|
|
36
36
|
const currencyCode = payload.currency_code != null && payload.currency_code !== ''
|
|
37
37
|
? payload.currency_code
|
|
38
|
-
:
|
|
38
|
+
: fallbackCurrency?.currencyCode ?? '';
|
|
39
39
|
return {
|
|
40
40
|
transactionId: payload.transaction_id,
|
|
41
41
|
transactionIntegrationId: payload.transaction_integration_id,
|
|
@@ -51,7 +51,7 @@ function toActualMatchingTransactionSearchResult(payload) {
|
|
|
51
51
|
accountingClassId: payload.accounting_class_id ?? undefined,
|
|
52
52
|
accountingClassName: payload.accounting_class_name ?? undefined,
|
|
53
53
|
currencyCode,
|
|
54
|
-
currencySymbol: resolveMatchSearchCurrencySymbol(payload, currencyCode),
|
|
54
|
+
currencySymbol: resolveMatchSearchCurrencySymbol(payload, currencyCode, fallbackCurrency),
|
|
55
55
|
transactionMemo: payload.transaction_memo ?? undefined,
|
|
56
56
|
transactionDescription: payload.transaction_description ?? undefined,
|
|
57
57
|
transactionTypeName: payload.transaction_type_name ?? undefined,
|
|
@@ -2,7 +2,7 @@ import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePerio
|
|
|
2
2
|
import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatchingTypes';
|
|
3
3
|
import { JEOneTimeAccrualPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
|
|
4
4
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
5
|
-
import { ActualMatchingAccrualSearchState, ActualMatchingMatchModalState, ActualMatchingTransactionSearchResult, ActualMatchingTransactionSearchState, ActualMatchingViewState, ActualMatchingViewUIState,
|
|
5
|
+
import { ActualMatchingAccrualSearchState, ActualMatchingMatchModalState, ActualMatchingTransactionSearchResult, ActualMatchingTransactionSearchState, ActualMatchingViewState, ActualMatchingViewUIState, MatchAndReverseResult, UndoReversalResult } from '../types/actualMatchingViewState';
|
|
6
6
|
export declare const initialTransactionSearchState: ActualMatchingTransactionSearchState;
|
|
7
7
|
export declare const initialAccrualSearchState: ActualMatchingAccrualSearchState;
|
|
8
8
|
export declare const initialMatchModalState: ActualMatchingMatchModalState;
|
|
@@ -31,16 +31,21 @@ export declare const clearActualMatchingView: import("@reduxjs/toolkit").ActionC
|
|
|
31
31
|
matchIds: ActualMatchingMatchId[];
|
|
32
32
|
refreshViewInBackground: boolean;
|
|
33
33
|
selectedPeriod: MonthYearPeriod;
|
|
34
|
-
}, "expenseAutomationActualMatchingView/fetchActualMatchingSuccess">, matchAndReverseAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
34
|
+
}, "expenseAutomationActualMatchingView/fetchActualMatchingSuccess">, matchAndReverseAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: string, transactionIntegrationId: string, transactionType: string, lineId: string, transactionSyncToken: string, accrualIds: string[]], {
|
|
35
|
+
transactionId: string;
|
|
36
|
+
transactionIntegrationId: string;
|
|
37
|
+
transactionType: string;
|
|
38
|
+
lineId: string;
|
|
39
|
+
transactionSyncToken: string;
|
|
40
|
+
accrualIds: string[];
|
|
41
|
+
}, "expenseAutomationActualMatchingView/matchAndReverseAccruals", never, never>, matchAndReverseAccrualsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
35
42
|
status: ZeniAPIStatus;
|
|
36
43
|
}, "expenseAutomationActualMatchingView/matchAndReverseAccrualsFailure">, matchAndReverseAccrualsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
37
44
|
results: MatchAndReverseResult[];
|
|
45
|
+
matchId?: ActualMatchingMatchId;
|
|
38
46
|
}, "expenseAutomationActualMatchingView/matchAndReverseAccrualsSuccess">, openMatchNewModal: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[matchId?: string | undefined], {
|
|
39
47
|
matchId: string | undefined;
|
|
40
|
-
}, "expenseAutomationActualMatchingView/openMatchNewModal", never, never>, searchMatchAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
|
|
41
|
-
query: string;
|
|
42
|
-
pageToken?: string | null;
|
|
43
|
-
}], {
|
|
48
|
+
}, "expenseAutomationActualMatchingView/openMatchNewModal", never, never>, searchMatchAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[query: string, pageToken?: string | null | undefined], {
|
|
44
49
|
query: string;
|
|
45
50
|
pageToken: string | undefined;
|
|
46
51
|
}, "expenseAutomationActualMatchingView/searchMatchAccruals", never, never>, searchMatchAccrualsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -49,12 +54,7 @@ export declare const clearActualMatchingView: import("@reduxjs/toolkit").ActionC
|
|
|
49
54
|
append: boolean;
|
|
50
55
|
nextPageToken: string | null;
|
|
51
56
|
results: JEOneTimeAccrualPayload[];
|
|
52
|
-
}, "expenseAutomationActualMatchingView/searchMatchAccrualsSuccess">, searchMatchTransactions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
|
|
53
|
-
query: string;
|
|
54
|
-
pageToken?: string | null;
|
|
55
|
-
transactionIntegrationId?: string;
|
|
56
|
-
transactionType?: string;
|
|
57
|
-
}], {
|
|
57
|
+
}, "expenseAutomationActualMatchingView/searchMatchAccrualsSuccess">, searchMatchTransactions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[query: string, pageToken?: string | null | undefined, transactionType?: string | undefined, transactionIntegrationId?: string | undefined], {
|
|
58
58
|
query: string;
|
|
59
59
|
pageToken: string | undefined;
|
|
60
60
|
transactionType: string | undefined;
|
|
@@ -65,11 +65,14 @@ export declare const clearActualMatchingView: import("@reduxjs/toolkit").ActionC
|
|
|
65
65
|
append: boolean;
|
|
66
66
|
nextPageToken: string | null;
|
|
67
67
|
results: ActualMatchingTransactionSearchResult[];
|
|
68
|
-
}, "expenseAutomationActualMatchingView/searchMatchTransactionsSuccess">, undoReversalAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
68
|
+
}, "expenseAutomationActualMatchingView/searchMatchTransactionsSuccess">, undoReversalAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[matchId: string, accrualIds: string[]], {
|
|
69
|
+
matchId: string;
|
|
70
|
+
accrualIds: string[];
|
|
71
|
+
}, "expenseAutomationActualMatchingView/undoReversalAccruals", never, never>, undoReversalAccrualsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
72
|
+
matchId: ActualMatchingMatchId;
|
|
69
73
|
status: ZeniAPIStatus;
|
|
70
|
-
}, "expenseAutomationActualMatchingView/undoReversalAccrualsFailure">, undoReversalAccrualsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
71
|
-
|
|
72
|
-
}], {
|
|
74
|
+
}, "expenseAutomationActualMatchingView/undoReversalAccrualsFailure">, undoReversalAccrualsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[matchId: string, results: UndoReversalResult[]], {
|
|
75
|
+
matchId: string;
|
|
73
76
|
results: UndoReversalResult[];
|
|
74
77
|
}, "expenseAutomationActualMatchingView/undoReversalAccrualsSuccess", never, never>, updateActualMatchingUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<ActualMatchingViewUIState>, "expenseAutomationActualMatchingView/updateActualMatchingUIState">;
|
|
75
78
|
declare const _default: import("redux").Reducer<ActualMatchingViewState>;
|
|
@@ -6,6 +6,7 @@ const toolkit_1 = require("@reduxjs/toolkit");
|
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
7
|
const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper");
|
|
8
8
|
const rootActions_1 = require("../../../rootActions");
|
|
9
|
+
const actualMatchingViewState_1 = require("../types/actualMatchingViewState");
|
|
9
10
|
exports.initialTransactionSearchState = {
|
|
10
11
|
query: '',
|
|
11
12
|
results: [],
|
|
@@ -47,7 +48,9 @@ exports.initialState = {
|
|
|
47
48
|
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
48
49
|
},
|
|
49
50
|
matchModal: exports.initialMatchModalState,
|
|
50
|
-
|
|
51
|
+
undoReversalStatusByMatchId: {},
|
|
52
|
+
lastUndoResultsByMatchId: {},
|
|
53
|
+
lastMatchResultsByMatchId: {},
|
|
51
54
|
hasValidState() {
|
|
52
55
|
return this.fetchState == 'Completed';
|
|
53
56
|
},
|
|
@@ -228,7 +231,7 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
228
231
|
draft.matchModal.transactionSearch.error = undefined;
|
|
229
232
|
}
|
|
230
233
|
},
|
|
231
|
-
prepare(
|
|
234
|
+
prepare(query, pageToken, transactionType, transactionIntegrationId) {
|
|
232
235
|
return {
|
|
233
236
|
payload: {
|
|
234
237
|
query,
|
|
@@ -247,7 +250,7 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
247
250
|
...results,
|
|
248
251
|
];
|
|
249
252
|
const byKey = new Map(merged.map((result) => [
|
|
250
|
-
|
|
253
|
+
(0, actualMatchingViewState_1.actualMatchingTransactionLineKey)(result.transactionType, result.transactionIntegrationId, result.lineId),
|
|
251
254
|
result,
|
|
252
255
|
]));
|
|
253
256
|
draft.matchModal.transactionSearch.results = Array.from(byKey.values());
|
|
@@ -285,7 +288,7 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
285
288
|
draft.matchModal.accrualSearch.error = undefined;
|
|
286
289
|
}
|
|
287
290
|
},
|
|
288
|
-
prepare(
|
|
291
|
+
prepare(query, pageToken) {
|
|
289
292
|
return { payload: { query, pageToken: pageToken ?? undefined } };
|
|
290
293
|
},
|
|
291
294
|
},
|
|
@@ -316,8 +319,17 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
316
319
|
error: undefined,
|
|
317
320
|
};
|
|
318
321
|
},
|
|
319
|
-
prepare(
|
|
320
|
-
return {
|
|
322
|
+
prepare(transactionId, transactionIntegrationId, transactionType, lineId, transactionSyncToken, accrualIds) {
|
|
323
|
+
return {
|
|
324
|
+
payload: {
|
|
325
|
+
transactionId,
|
|
326
|
+
transactionIntegrationId,
|
|
327
|
+
transactionType,
|
|
328
|
+
lineId,
|
|
329
|
+
transactionSyncToken,
|
|
330
|
+
accrualIds,
|
|
331
|
+
},
|
|
332
|
+
};
|
|
321
333
|
},
|
|
322
334
|
},
|
|
323
335
|
matchAndReverseAccrualsSuccess(draft, action) {
|
|
@@ -326,6 +338,10 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
326
338
|
error: undefined,
|
|
327
339
|
};
|
|
328
340
|
draft.matchModal.lastBatchResults = action.payload.results;
|
|
341
|
+
if (action.payload.matchId != null) {
|
|
342
|
+
draft.lastMatchResultsByMatchId[action.payload.matchId] =
|
|
343
|
+
action.payload.results;
|
|
344
|
+
}
|
|
329
345
|
},
|
|
330
346
|
matchAndReverseAccrualsFailure(draft, action) {
|
|
331
347
|
draft.matchModal.confirmStatus = {
|
|
@@ -334,29 +350,31 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
334
350
|
};
|
|
335
351
|
},
|
|
336
352
|
undoReversalAccruals: {
|
|
337
|
-
reducer(draft) {
|
|
338
|
-
draft.
|
|
353
|
+
reducer(draft, action) {
|
|
354
|
+
draft.undoReversalStatusByMatchId[action.payload.matchId] = {
|
|
339
355
|
fetchState: 'In-Progress',
|
|
340
356
|
error: undefined,
|
|
341
357
|
};
|
|
342
358
|
},
|
|
343
|
-
prepare(
|
|
344
|
-
return { payload:
|
|
359
|
+
prepare(matchId, accrualIds) {
|
|
360
|
+
return { payload: { matchId, accrualIds } };
|
|
345
361
|
},
|
|
346
362
|
},
|
|
347
363
|
undoReversalAccrualsSuccess: {
|
|
348
|
-
reducer(draft) {
|
|
349
|
-
|
|
364
|
+
reducer(draft, action) {
|
|
365
|
+
const { matchId, results } = action.payload;
|
|
366
|
+
draft.undoReversalStatusByMatchId[matchId] = {
|
|
350
367
|
fetchState: 'Completed',
|
|
351
368
|
error: undefined,
|
|
352
369
|
};
|
|
370
|
+
draft.lastUndoResultsByMatchId[matchId] = results;
|
|
353
371
|
},
|
|
354
|
-
prepare(
|
|
355
|
-
return { payload };
|
|
372
|
+
prepare(matchId, results) {
|
|
373
|
+
return { payload: { matchId, results } };
|
|
356
374
|
},
|
|
357
375
|
},
|
|
358
376
|
undoReversalAccrualsFailure(draft, action) {
|
|
359
|
-
draft.
|
|
377
|
+
draft.undoReversalStatusByMatchId[action.payload.matchId] = {
|
|
360
378
|
fetchState: 'Error',
|
|
361
379
|
error: action.payload.status,
|
|
362
380
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
2
|
import { MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
|
|
3
|
+
import { DisplayCurrencyFallback } from '../../../entity/actualMatching/actualMatchingPayload';
|
|
3
4
|
import { ActualMatchingMatch } from '../../../entity/actualMatching/actualMatchingState';
|
|
4
5
|
import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatchingTypes';
|
|
5
6
|
import { JEOneTimeAccrual } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
@@ -7,7 +8,9 @@ import { JEOneTimeAccrualMatchSuggestion } from '../../../entity/jeSchedules/jeS
|
|
|
7
8
|
import { RootState } from '../../../rootStateTypes';
|
|
8
9
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
9
10
|
import { ActualMatchingKpiSummary, ActualMatchingRow, ActualMatchingRowKind, ExpenseAutomationActualMatchingViewSelector } from '../selectorTypes/actualMatchingViewSelectorTypes';
|
|
11
|
+
import { MatchAndReverseResult, UndoReversalResult } from '../types/actualMatchingViewState';
|
|
10
12
|
export declare function getSelectedMonthYearForCurrentTenant(state: RootState): MonthYearPeriod | undefined;
|
|
13
|
+
export declare function getTenantDisplayCurrency(state: RootState): DisplayCurrencyFallback | undefined;
|
|
11
14
|
export declare function parseActualMatchingMatchId(matchId: string): {
|
|
12
15
|
transactionIntegrationId: string;
|
|
13
16
|
transactionType: string;
|
|
@@ -21,11 +24,13 @@ export declare function isReversedMatchKind(kind: ActualMatchingRowKind): boolea
|
|
|
21
24
|
export declare function getClearedMatchedAmount(accrual: JEOneTimeAccrual): number | undefined;
|
|
22
25
|
export declare function getActualMatchingAmount(row: ActualMatchingRow): number;
|
|
23
26
|
export declare function getActualMatchingReversalDate(accrual: JEOneTimeAccrual): ZeniDate | undefined;
|
|
24
|
-
export declare function buildActualMatchingKpiSummary(rows: ActualMatchingRow[]): ActualMatchingKpiSummary;
|
|
27
|
+
export declare function buildActualMatchingKpiSummary(rows: ActualMatchingRow[], displayCurrencyCode?: string): ActualMatchingKpiSummary;
|
|
25
28
|
export interface ExpenseAutomationActualMatchingMatchView {
|
|
26
29
|
detailFetchState: FetchStateAndError;
|
|
27
30
|
refreshStatus: FetchStateAndError;
|
|
28
31
|
undoReversalStatus: FetchStateAndError;
|
|
32
|
+
lastMatchResults?: MatchAndReverseResult[];
|
|
33
|
+
lastUndoResults?: UndoReversalResult[];
|
|
29
34
|
match?: ActualMatchingMatch;
|
|
30
35
|
}
|
|
31
36
|
export declare function getExpenseAutomationActualMatchingMatchView(state: RootState, matchId: ActualMatchingMatchId): ExpenseAutomationActualMatchingMatchView;
|