@zeniai/client-epic-state 5.2.22-betaAM5 → 5.2.22-betaMM2
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.js +4 -3
- package/lib/entity/actualMatching/actualMatchingReducer.js +1 -1
- package/lib/entity/actualMatching/actualMatchingSelector.d.ts +1 -1
- package/lib/entity/actualMatching/actualMatchingSelector.js +1 -1
- 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 +2 -1
- package/lib/epic.js +2 -0
- package/lib/esm/entity/actualMatching/actualMatchingPayload.js +5 -4
- package/lib/esm/entity/actualMatching/actualMatchingReducer.js +1 -1
- package/lib/esm/entity/actualMatching/actualMatchingSelector.js +1 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +2 -0
- package/lib/esm/epic.js +2 -0
- package/lib/esm/index.js +4 -4
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +4 -4
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +5 -3
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +52 -0
- package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +9 -1
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +26 -1
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +9 -9
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +6 -0
- package/lib/index.d.ts +4 -4
- package/lib/index.js +50 -48
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +3 -3
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +5 -3
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +56 -0
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +17 -1
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +9 -0
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +6 -2
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +27 -2
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +5 -1
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +9 -9
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +13 -0
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +8 -1
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
|
18
18
|
(0, actualMatchingViewReducer_1.searchMatchAccruals)({ query: '' }),
|
|
19
19
|
]);
|
|
20
20
|
}
|
|
21
|
-
const match = (0, actualMatchingSelector_1.getActualMatchingMatchById)(
|
|
21
|
+
const match = (0, actualMatchingSelector_1.getActualMatchingMatchById)(state$.value.actualMatchingState, matchId);
|
|
22
22
|
const parsed = (0, actualMatchingViewSelector_1.parseActualMatchingMatchId)(matchId);
|
|
23
23
|
const transactionType = match?.transactionType != null && match.transactionType !== ''
|
|
24
24
|
? match.transactionType
|
|
@@ -57,7 +57,7 @@ const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
|
57
57
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
58
58
|
const { transactions, next_page_token } = response.data;
|
|
59
59
|
const append = pageToken != null;
|
|
60
|
-
const results =
|
|
60
|
+
const results = transactions.map(actualMatchingPayload_1.toActualMatchingTransactionSearchResult);
|
|
61
61
|
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsSuccess)({
|
|
62
62
|
append,
|
|
63
63
|
nextPageToken: next_page_token ?? null,
|
|
@@ -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,56 @@
|
|
|
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 currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
14
|
+
const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant?.tenantId ?? ''];
|
|
15
|
+
if (selectedMonthYear == null) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const period = (0, timePeriod_1.convertToPeriod)(selectedMonthYear);
|
|
19
|
+
const start = (0, timePeriod_1.toAbsoluteDay)(period.start);
|
|
20
|
+
const end = (0, timePeriod_1.toAbsoluteDay)(period.end);
|
|
21
|
+
if (start == null || end == null) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
return [(0, actualMatchingViewReducer_1.fetchActualMatching)({ start, end }, true)];
|
|
25
|
+
}
|
|
26
|
+
function refreshOpenMatchDetails(state) {
|
|
27
|
+
const detailState = state.expenseAutomationActualMatchingViewState.detailFetchStateByMatchId;
|
|
28
|
+
return Object.keys(detailState)
|
|
29
|
+
.filter((matchId) => detailState[matchId]?.fetchState !== 'Not-Started')
|
|
30
|
+
.map((matchId) => (0, actualMatchingViewReducer_1.fetchActualMatchingMatch)(matchId, true));
|
|
31
|
+
}
|
|
32
|
+
const undoReversalAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.undoReversalAccruals.match), (0, operators_1.mergeMap)((action) => {
|
|
33
|
+
const body = {
|
|
34
|
+
accrual_ids: action.payload.accrualIds,
|
|
35
|
+
};
|
|
36
|
+
return zeniAPI
|
|
37
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/undo-reversal`, body)
|
|
38
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
39
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
40
|
+
const results = response.data.results.map(actualMatchingPayload_1.toUndoReversalResult);
|
|
41
|
+
const successActions = [
|
|
42
|
+
(0, actualMatchingViewReducer_1.undoReversalAccrualsSuccess)({ results }),
|
|
43
|
+
];
|
|
44
|
+
const anyUndone = results.some((result) => result.status === 'undone');
|
|
45
|
+
if (anyUndone) {
|
|
46
|
+
successActions.push(...refreshActualMatchingList(state$.value), ...refreshOpenMatchDetails(state$.value));
|
|
47
|
+
}
|
|
48
|
+
return (0, rxjs_1.from)(successActions);
|
|
49
|
+
}
|
|
50
|
+
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({ status: response.status }));
|
|
51
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({
|
|
52
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Undo reversal accruals REST API call errored out' +
|
|
53
|
+
JSON.stringify(error)),
|
|
54
|
+
}))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
55
|
+
}));
|
|
56
|
+
exports.undoReversalAccrualsEpic = undoReversalAccrualsEpic;
|
|
@@ -3,7 +3,7 @@ import { TimePeriod } from '../../../commonStateTypes/timePeriod';
|
|
|
3
3
|
import { ActualMatchingListResponsePayload } from '../../../entity/actualMatching/actualMatchingPayload';
|
|
4
4
|
import { JEOneTimeAccrualPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
|
|
5
5
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
6
|
-
import { ActualMatchingTransactionSearchResult, MatchAndReverseResult } from '../types/actualMatchingViewState';
|
|
6
|
+
import { ActualMatchingTransactionSearchResult, MatchAndReverseResult, UndoReversalResult } from '../types/actualMatchingViewState';
|
|
7
7
|
export declare function toServiceMonthFromPeriod(period: TimePeriod): string;
|
|
8
8
|
export type ActualMatchingListResponse = ZeniAPIResponse<ActualMatchingListResponsePayload>;
|
|
9
9
|
export interface ActualMatchingAccrualSearchResponsePayload {
|
|
@@ -34,6 +34,7 @@ export interface MatchTransactionSearchResultPayload {
|
|
|
34
34
|
amount?: number | null;
|
|
35
35
|
currency_code?: string | null;
|
|
36
36
|
currency_symbol?: string | null;
|
|
37
|
+
sync_token?: string | null;
|
|
37
38
|
total_amount?: number | null;
|
|
38
39
|
transaction_description?: string | null;
|
|
39
40
|
transaction_memo?: string | null;
|
|
@@ -52,6 +53,7 @@ export interface MatchAndReverseRequestPayload {
|
|
|
52
53
|
line_id: string;
|
|
53
54
|
transaction_id: ID;
|
|
54
55
|
transaction_integration_id: string;
|
|
56
|
+
transaction_sync_token: string;
|
|
55
57
|
transaction_type: string;
|
|
56
58
|
}
|
|
57
59
|
export interface MatchAndReverseResultPayload {
|
|
@@ -67,3 +69,17 @@ export interface MatchAndReverseResponsePayload {
|
|
|
67
69
|
}
|
|
68
70
|
export type MatchAndReverseResponse = ZeniAPIResponse<MatchAndReverseResponsePayload>;
|
|
69
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
|
+
}
|
|
@@ -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, MatchAndReverseAccrualsParams, MatchAndReverseResult } from '../types/actualMatchingViewState';
|
|
5
|
+
import { ActualMatchingAccrualSearchState, ActualMatchingMatchModalState, ActualMatchingTransactionSearchResult, ActualMatchingTransactionSearchState, ActualMatchingViewState, ActualMatchingViewUIState, MatchAndReverseAccrualsParams, MatchAndReverseResult, UndoReversalAccrualsParams, 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;
|
|
@@ -65,6 +65,10 @@ export declare const clearActualMatchingView: import("@reduxjs/toolkit").ActionC
|
|
|
65
65
|
append: boolean;
|
|
66
66
|
nextPageToken: string | null;
|
|
67
67
|
results: ActualMatchingTransactionSearchResult[];
|
|
68
|
-
}, "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">;
|
|
69
73
|
declare const _default: import("redux").Reducer<ActualMatchingViewState>;
|
|
70
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.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;
|
|
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");
|
|
@@ -47,6 +47,7 @@ exports.initialState = {
|
|
|
47
47
|
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
48
48
|
},
|
|
49
49
|
matchModal: exports.initialMatchModalState,
|
|
50
|
+
undoReversalStatus: { fetchState: 'Not-Started', error: undefined },
|
|
50
51
|
hasValidState() {
|
|
51
52
|
return this.fetchState == 'Completed';
|
|
52
53
|
},
|
|
@@ -329,6 +330,30 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
329
330
|
error: action.payload.status,
|
|
330
331
|
};
|
|
331
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
|
+
},
|
|
332
357
|
clearActualMatchingView(draft) {
|
|
333
358
|
Object.assign(draft, exports.initialState);
|
|
334
359
|
},
|
|
@@ -339,5 +364,5 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
|
|
|
339
364
|
});
|
|
340
365
|
},
|
|
341
366
|
});
|
|
342
|
-
_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.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;
|
|
343
368
|
exports.default = expenseAutomationActualMatchingView.reducer;
|
|
@@ -2,6 +2,7 @@ import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
|
2
2
|
import { ActualMatchingMatch } from '../../../entity/actualMatching/actualMatchingState';
|
|
3
3
|
import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatchingTypes';
|
|
4
4
|
import { JEOneTimeAccrual } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
5
|
+
import { JEOneTimeAccrualMatchSuggestion } from '../../../entity/jeSchedules/jeSchedulesState';
|
|
5
6
|
import { RootState } from '../../../rootStateTypes';
|
|
6
7
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
7
8
|
import { ActualMatchingRow, ActualMatchingRowKind, ExpenseAutomationActualMatchingViewSelector } from '../selectorTypes/actualMatchingViewSelectorTypes';
|
|
@@ -11,7 +12,9 @@ export declare function parseActualMatchingMatchId(matchId: string): {
|
|
|
11
12
|
} | null;
|
|
12
13
|
export declare function isAutoReversedAccrual(accrual: JEOneTimeAccrual): boolean;
|
|
13
14
|
export declare function isManuallyReversedAccrual(accrual: JEOneTimeAccrual): boolean;
|
|
14
|
-
export declare function isPendingReviewAccrual(accrual: JEOneTimeAccrual):
|
|
15
|
+
export declare function isPendingReviewAccrual(accrual: JEOneTimeAccrual): accrual is JEOneTimeAccrual & {
|
|
16
|
+
matchSuggestion: JEOneTimeAccrualMatchSuggestion;
|
|
17
|
+
};
|
|
15
18
|
export declare function isReversedMatchKind(kind: ActualMatchingRowKind): boolean;
|
|
16
19
|
export declare function getClearedMatchedAmount(accrual: JEOneTimeAccrual): number | undefined;
|
|
17
20
|
export declare function getActualMatchingAmount(row: ActualMatchingRow): number;
|
|
@@ -19,6 +22,7 @@ export declare function getActualMatchingReversalDate(accrual: JEOneTimeAccrual)
|
|
|
19
22
|
export interface ExpenseAutomationActualMatchingMatchView {
|
|
20
23
|
detailFetchState: FetchStateAndError;
|
|
21
24
|
refreshStatus: FetchStateAndError;
|
|
25
|
+
undoReversalStatus: FetchStateAndError;
|
|
22
26
|
match?: ActualMatchingMatch;
|
|
23
27
|
}
|
|
24
28
|
export declare function getExpenseAutomationActualMatchingMatchView(state: RootState, matchId: ActualMatchingMatchId): ExpenseAutomationActualMatchingMatchView;
|
|
@@ -89,7 +89,7 @@ function getActualMatchingAmount(row) {
|
|
|
89
89
|
}
|
|
90
90
|
function getActualMatchingReversalDate(accrual) {
|
|
91
91
|
if (isPendingReviewAccrual(accrual)) {
|
|
92
|
-
return accrual.matchSuggestion
|
|
92
|
+
return accrual.matchSuggestion.matchedTransactionDate;
|
|
93
93
|
}
|
|
94
94
|
return accrual.cleared?.matchedTransactionDate;
|
|
95
95
|
}
|
|
@@ -194,22 +194,21 @@ function sumRowAmounts(rows) {
|
|
|
194
194
|
function getExpenseAutomationActualMatchingMatchView(state, matchId) {
|
|
195
195
|
const view = state.expenseAutomationActualMatchingViewState;
|
|
196
196
|
return {
|
|
197
|
-
match: (0, actualMatchingSelector_1.getActualMatchingMatchById)(
|
|
197
|
+
match: (0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchId),
|
|
198
198
|
detailFetchState: view.detailFetchStateByMatchId[matchId] ?? NOT_STARTED,
|
|
199
199
|
refreshStatus: view.detailRefreshStatusByMatchId[matchId] ?? NOT_STARTED,
|
|
200
|
+
undoReversalStatus: view.undoReversalStatus ?? NOT_STARTED,
|
|
200
201
|
};
|
|
201
202
|
}
|
|
202
203
|
function getExpenseAutomationActualMatchingView(state) {
|
|
203
204
|
const { expenseAutomationActualMatchingViewState, expenseAutomationViewState } = state;
|
|
204
|
-
const { matchIdsByPeriod, fetchState, error, refreshStatus, uiState, matchModal, } = expenseAutomationActualMatchingViewState;
|
|
205
|
+
const { matchIdsByPeriod, fetchState, error, refreshStatus, uiState, matchModal, undoReversalStatus, } = expenseAutomationActualMatchingViewState;
|
|
205
206
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
206
|
-
const selectedPeriod = expenseAutomationViewState.selectedPeriodByTenantId[currentTenant
|
|
207
|
+
const selectedPeriod = expenseAutomationViewState.selectedPeriodByTenantId[currentTenant?.tenantId ?? ''];
|
|
207
208
|
const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : undefined;
|
|
208
|
-
const matchIds = monthYearPeriodId != null
|
|
209
|
-
? matchIdsByPeriod[monthYearPeriodId]
|
|
210
|
-
: undefined;
|
|
209
|
+
const matchIds = monthYearPeriodId != null ? matchIdsByPeriod[monthYearPeriodId] : undefined;
|
|
211
210
|
const rows = (matchIds ?? [])
|
|
212
|
-
.map((matchId) => (0, actualMatchingSelector_1.getActualMatchingMatchById)(
|
|
211
|
+
.map((matchId) => (0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchId))
|
|
213
212
|
.filter((match) => match != null)
|
|
214
213
|
.filter((match) => match.members.length > 0)
|
|
215
214
|
.map(toActualMatchingRow)
|
|
@@ -244,7 +243,7 @@ function getExpenseAutomationActualMatchingView(state) {
|
|
|
244
243
|
.map((key) => (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(key, state.jeSchedulesState))
|
|
245
244
|
.filter((accrual) => accrual != null);
|
|
246
245
|
const openedMatch = matchModal.openedFromMatchId != null
|
|
247
|
-
? (0, actualMatchingSelector_1.getActualMatchingMatchById)(
|
|
246
|
+
? (0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchModal.openedFromMatchId)
|
|
248
247
|
: undefined;
|
|
249
248
|
const pinnedAccruals = (openedMatch?.members ?? []).map(toMatchModalAccrual);
|
|
250
249
|
const firstSuggestion = openedMatch?.members[0]?.matchSuggestion;
|
|
@@ -265,6 +264,7 @@ function getExpenseAutomationActualMatchingView(state) {
|
|
|
265
264
|
uiState,
|
|
266
265
|
refreshStatus,
|
|
267
266
|
hasLoadedForSelectedPeriod: matchIds != null,
|
|
267
|
+
undoReversalStatus,
|
|
268
268
|
matchModal: {
|
|
269
269
|
isOpen: matchModal.isOpen,
|
|
270
270
|
openedFromMatchId: matchModal.openedFromMatchId,
|
|
@@ -28,6 +28,7 @@ export interface ActualMatchingTransactionSearchResult {
|
|
|
28
28
|
currencyCode: string;
|
|
29
29
|
currencySymbol: string;
|
|
30
30
|
lineId: string;
|
|
31
|
+
syncToken: string;
|
|
31
32
|
transactionDate: string;
|
|
32
33
|
transactionId: ID;
|
|
33
34
|
transactionIntegrationId: string;
|
|
@@ -53,8 +54,19 @@ export interface MatchAndReverseAccrualsParams {
|
|
|
53
54
|
lineId: string;
|
|
54
55
|
transactionId: ID;
|
|
55
56
|
transactionIntegrationId: string;
|
|
57
|
+
transactionSyncToken: string;
|
|
56
58
|
transactionType: string;
|
|
57
59
|
}
|
|
60
|
+
export declare const toUndoReversalResultStatus: (v: string) => "error" | "claim_lost" | "undone";
|
|
61
|
+
export type UndoReversalResultStatus = ReturnType<typeof toUndoReversalResultStatus>;
|
|
62
|
+
export interface UndoReversalResult {
|
|
63
|
+
accrualId: ID;
|
|
64
|
+
status: UndoReversalResultStatus;
|
|
65
|
+
reason?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface UndoReversalAccrualsParams {
|
|
68
|
+
accrualIds: ID[];
|
|
69
|
+
}
|
|
58
70
|
export interface ActualMatchingTransactionSearchState extends FetchStateAndError {
|
|
59
71
|
isLoadingMore: boolean;
|
|
60
72
|
nextPageToken: string | null;
|
|
@@ -83,4 +95,5 @@ export interface ActualMatchingViewState extends FetchedState {
|
|
|
83
95
|
matchModal: ActualMatchingMatchModalState;
|
|
84
96
|
refreshStatus: FetchStateAndError;
|
|
85
97
|
uiState: ActualMatchingViewUIState;
|
|
98
|
+
undoReversalStatus: FetchStateAndError;
|
|
86
99
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toMatchAndReverseResultStatus = exports.MATCH_SEARCH_DEBOUNCE_MS = exports.MATCH_ACCRUAL_SEARCH_LIMIT = exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = exports.toActualMatchingSortKey = void 0;
|
|
3
|
+
exports.toUndoReversalResultStatus = exports.toMatchAndReverseResultStatus = exports.MATCH_SEARCH_DEBOUNCE_MS = exports.MATCH_ACCRUAL_SEARCH_LIMIT = exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = exports.toActualMatchingSortKey = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
5
|
const ACTUAL_MATCHING_SORT_KEYS = [
|
|
6
6
|
'vendor',
|
|
@@ -29,3 +29,10 @@ const MATCH_AND_REVERSE_RESULT_STATUSES = [
|
|
|
29
29
|
];
|
|
30
30
|
const toMatchAndReverseResultStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, MATCH_AND_REVERSE_RESULT_STATUSES);
|
|
31
31
|
exports.toMatchAndReverseResultStatus = toMatchAndReverseResultStatus;
|
|
32
|
+
const UNDO_REVERSAL_RESULT_STATUSES = [
|
|
33
|
+
'undone',
|
|
34
|
+
'claim_lost',
|
|
35
|
+
'error',
|
|
36
|
+
];
|
|
37
|
+
const toUndoReversalResultStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, UNDO_REVERSAL_RESULT_STATUSES);
|
|
38
|
+
exports.toUndoReversalResultStatus = toUndoReversalResultStatus;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.22-
|
|
3
|
+
"version": "5.2.22-betaMM2",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|