@zeniai/client-epic-state 5.2.62-beta0KB → 5.2.62-beta0MM
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/actualMatchingReducer.d.ts +3 -1
- package/lib/entity/actualMatching/actualMatchingReducer.js +11 -2
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +1 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -1
- package/lib/entity/transaction/stateTypes/paymentType.d.ts +2 -2
- package/lib/entity/transaction/stateTypes/paymentType.js +1 -9
- package/lib/epic.d.ts +2 -4
- package/lib/epic.js +2 -6
- package/lib/esm/entity/actualMatching/actualMatchingReducer.js +9 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -1
- package/lib/esm/entity/transaction/stateTypes/paymentType.js +1 -9
- package/lib/esm/epic.js +2 -6
- package/lib/esm/index.js +7 -10
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +50 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +7 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +2 -23
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +66 -35
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +60 -64
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +15 -0
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +30 -4
- package/lib/esm/view/transactionDetail/transactionDetailReducer.js +1 -174
- package/lib/index.d.ts +8 -12
- package/lib/index.js +57 -70
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.d.ts +10 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +54 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +7 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +1 -22
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +12 -1
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +16 -8
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +67 -36
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +20 -8
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +7 -4
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +63 -64
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +20 -4
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +18 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +30 -4
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +1 -37
- package/lib/view/transactionDetail/transactionDetailReducer.js +2 -176
- package/lib/view/transactionDetail/transactionDetailState.d.ts +0 -12
- package/package.json +1 -1
- package/lib/entity/transaction/stateTypes/printStatus.d.ts +0 -4
- package/lib/entity/transaction/stateTypes/printStatus.js +0 -15
- package/lib/esm/entity/transaction/stateTypes/printStatus.js +0 -11
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.js +0 -133
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionPayload.js +0 -114
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionSelector.js +0 -41
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionState.js +0 -11
- package/lib/esm/view/transactionDetail/createTransaction/epics/createTransactionEpic.js +0 -58
- package/lib/esm/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.js +0 -55
- package/lib/esm/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.js +0 -14
- package/lib/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.d.ts +0 -51
- package/lib/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.js +0 -148
- package/lib/view/transactionDetail/createTransaction/createTransactionPayload.d.ts +0 -82
- package/lib/view/transactionDetail/createTransaction/createTransactionPayload.js +0 -118
- package/lib/view/transactionDetail/createTransaction/createTransactionSelector.d.ts +0 -40
- package/lib/view/transactionDetail/createTransaction/createTransactionSelector.js +0 -48
- package/lib/view/transactionDetail/createTransaction/createTransactionState.d.ts +0 -81
- package/lib/view/transactionDetail/createTransaction/createTransactionState.js +0 -14
- package/lib/view/transactionDetail/createTransaction/epics/createTransactionEpic.d.ts +0 -9
- package/lib/view/transactionDetail/createTransaction/epics/createTransactionEpic.js +0 -62
- package/lib/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.d.ts +0 -20
- package/lib/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.js +0 -59
- package/lib/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.d.ts +0 -12
- package/lib/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.js +0 -18
|
@@ -16,15 +16,18 @@ exports.getActualMatchingReversalDate = getActualMatchingReversalDate;
|
|
|
16
16
|
exports.buildActualMatchingKpiSummary = buildActualMatchingKpiSummary;
|
|
17
17
|
exports.getExpenseAutomationActualMatchingMatchView = getExpenseAutomationActualMatchingMatchView;
|
|
18
18
|
exports.getCloseMatchAfterUndo = getCloseMatchAfterUndo;
|
|
19
|
+
exports.getCloseMatchAfterUndoMatchId = getCloseMatchAfterUndoMatchId;
|
|
20
|
+
exports.getCloseMatchAfterIgnoreMatchId = getCloseMatchAfterIgnoreMatchId;
|
|
21
|
+
exports.getActualMatchingMatchModalConfirmStatus = getActualMatchingMatchModalConfirmStatus;
|
|
19
22
|
exports.getExpenseAutomationActualMatchingView = getExpenseAutomationActualMatchingView;
|
|
20
23
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
24
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
21
25
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
22
26
|
const actualMatchingSelector_1 = require("../../../entity/actualMatching/actualMatchingSelector");
|
|
23
27
|
const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper");
|
|
24
28
|
const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
|
|
25
29
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
26
30
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
27
|
-
const actualMatchingViewState_1 = require("../types/actualMatchingViewState");
|
|
28
31
|
function getSelectedMonthYearForCurrentTenant(state) {
|
|
29
32
|
const tenantId = (0, tenantSelector_1.getCurrentTenant)(state)?.tenantId;
|
|
30
33
|
if (tenantId == null) {
|
|
@@ -53,27 +56,6 @@ function toMatchModalAccrual(member) {
|
|
|
53
56
|
jeOneTimeAccrualKey: (0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(member.accrualId),
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
|
-
function uniqueMatchModalAccruals(pinned, searched) {
|
|
57
|
-
const byId = new Map();
|
|
58
|
-
pinned.forEach((row) => byId.set(row.accrualId, row));
|
|
59
|
-
searched.forEach((row) => {
|
|
60
|
-
if (!byId.has(row.accrualId)) {
|
|
61
|
-
byId.set(row.accrualId, row);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
return Array.from(byId.values());
|
|
65
|
-
}
|
|
66
|
-
function uniqueTransactionSearchResults(pinned, searched) {
|
|
67
|
-
const byKey = new Map();
|
|
68
|
-
pinned.forEach((row) => byKey.set((0, actualMatchingViewState_1.actualMatchingTransactionLineKey)(row.transactionType, row.transactionIntegrationId, row.lineId), row));
|
|
69
|
-
searched.forEach((row) => {
|
|
70
|
-
const key = (0, actualMatchingViewState_1.actualMatchingTransactionLineKey)(row.transactionType, row.transactionIntegrationId, row.lineId);
|
|
71
|
-
if (!byKey.has(key)) {
|
|
72
|
-
byKey.set(key, row);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return Array.from(byKey.values());
|
|
76
|
-
}
|
|
77
59
|
function parseActualMatchingMatchId(matchId) {
|
|
78
60
|
const separator = matchId.indexOf(':');
|
|
79
61
|
if (separator <= 0 || separator === matchId.length - 1) {
|
|
@@ -246,6 +228,7 @@ function emptyKpiSummary() {
|
|
|
246
228
|
actualsReceived: { count: 0, expectedCount: 0, vendorsPending: 0 },
|
|
247
229
|
autoReversed: { count: 0, percent: 0, clearedAmount: 0 },
|
|
248
230
|
pendingReview: { count: 0, amount: 0, estimatedMinutesToClear: 0 },
|
|
231
|
+
reversed: { count: 0 },
|
|
249
232
|
variance: { percent: 0, averagePercentPerMatch: 0, netAmount: 0 },
|
|
250
233
|
};
|
|
251
234
|
}
|
|
@@ -301,6 +284,7 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
|
|
|
301
284
|
}
|
|
302
285
|
const autoReversed = kpiRows.filter((row) => row.kind === 'auto_reversed');
|
|
303
286
|
const pendingReview = kpiRows.filter((row) => row.kind === 'pending_review');
|
|
287
|
+
const reversed = kpiRows.filter((row) => isReversedMatchKind(row.kind));
|
|
304
288
|
const receivedCount = kpiRows.length;
|
|
305
289
|
const rowsWithActual = kpiRows.filter((row) => row.actualAmount?.amount != null);
|
|
306
290
|
const accruedTotal = rowsWithActual.reduce((sum, row) => sum + (row.accruedAmount?.amount ?? row.estimatedAmount.amount), 0);
|
|
@@ -326,6 +310,9 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
|
|
|
326
310
|
amount: sumRowAmounts(pendingReview, displayCurrencyCode),
|
|
327
311
|
estimatedMinutesToClear: pendingReview.length * ESTIMATED_MINUTES_PER_PENDING_MATCH,
|
|
328
312
|
},
|
|
313
|
+
reversed: {
|
|
314
|
+
count: reversed.length,
|
|
315
|
+
},
|
|
329
316
|
variance: {
|
|
330
317
|
percent: accruedTotal === 0
|
|
331
318
|
? 0
|
|
@@ -338,23 +325,55 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
|
|
|
338
325
|
},
|
|
339
326
|
};
|
|
340
327
|
}
|
|
341
|
-
function
|
|
342
|
-
const view = state.expenseAutomationActualMatchingViewState;
|
|
328
|
+
function toActualMatchingMatchView(match) {
|
|
343
329
|
return {
|
|
344
|
-
match
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
lastUndoResults: view.lastUndoResultsByMatchId?.[matchId],
|
|
330
|
+
...match,
|
|
331
|
+
members: match.members.map(toMatchModalAccrual),
|
|
332
|
+
leftovers: match.leftovers == null
|
|
333
|
+
? undefined
|
|
334
|
+
: match.leftovers.map(toMatchModalAccrual),
|
|
350
335
|
};
|
|
351
336
|
}
|
|
337
|
+
const EMPTY_ACTUAL_MATCHING_ROWS = [];
|
|
338
|
+
const matchViewSelectorById = new Map();
|
|
339
|
+
function getExpenseAutomationActualMatchingMatchView(state, matchId) {
|
|
340
|
+
let selector = matchViewSelectorById.get(matchId);
|
|
341
|
+
if (selector == null) {
|
|
342
|
+
selector = (0, toolkit_1.createSelector)([
|
|
343
|
+
(root) => root.expenseAutomationActualMatchingViewState,
|
|
344
|
+
(root) => (0, actualMatchingSelector_1.getActualMatchingMatchById)(root.actualMatchingState, matchId),
|
|
345
|
+
], (view, match) => ({
|
|
346
|
+
detailFetchState: view.detailFetchStateByMatchId[matchId] ?? NOT_STARTED,
|
|
347
|
+
ignoreStatus: view.ignoreStatusByMatchId[matchId] ?? NOT_STARTED,
|
|
348
|
+
lastMatchResults: view.lastMatchResultsByMatchId?.[matchId],
|
|
349
|
+
lastUndoResults: view.lastUndoResultsByMatchId?.[matchId],
|
|
350
|
+
match: match == null ? undefined : toActualMatchingMatchView(match),
|
|
351
|
+
refreshStatus: view.detailRefreshStatusByMatchId[matchId] ?? NOT_STARTED,
|
|
352
|
+
undoReversalStatus: view.undoReversalStatusByMatchId[matchId] ?? NOT_STARTED,
|
|
353
|
+
}));
|
|
354
|
+
matchViewSelectorById.set(matchId, selector);
|
|
355
|
+
}
|
|
356
|
+
return selector(state);
|
|
357
|
+
}
|
|
352
358
|
function getCloseMatchAfterUndo(state) {
|
|
353
|
-
return state.expenseAutomationActualMatchingViewState.
|
|
359
|
+
return state.expenseAutomationActualMatchingViewState.closeMatchAfterUndoMatchId;
|
|
360
|
+
}
|
|
361
|
+
function getCloseMatchAfterUndoMatchId(state) {
|
|
362
|
+
return getCloseMatchAfterUndo(state);
|
|
363
|
+
}
|
|
364
|
+
function getCloseMatchAfterIgnoreMatchId(state) {
|
|
365
|
+
return state.expenseAutomationActualMatchingViewState
|
|
366
|
+
.closeMatchAfterIgnoreMatchId;
|
|
367
|
+
}
|
|
368
|
+
function getActualMatchingMatchModalConfirmStatus(state, matchId) {
|
|
369
|
+
if (matchId != null && matchId !== '') {
|
|
370
|
+
return (state.expenseAutomationActualMatchingViewState.confirmStatusByMatchId[matchId] ?? NOT_STARTED);
|
|
371
|
+
}
|
|
372
|
+
return state.expenseAutomationActualMatchingViewState.matchModal.confirmStatus;
|
|
354
373
|
}
|
|
355
374
|
function getExpenseAutomationActualMatchingView(state) {
|
|
356
375
|
const { expenseAutomationActualMatchingViewState } = state;
|
|
357
|
-
const { matchIdsByPeriod, fetchState, error, refreshStatus, uiState, matchModal, } = expenseAutomationActualMatchingViewState;
|
|
376
|
+
const { matchIdsByPeriod, fetchState, error, refreshStatus, uiState, matchModal, ignoreStatusByMatchId, undoReversalStatusByMatchId, } = expenseAutomationActualMatchingViewState;
|
|
358
377
|
const selectedPeriod = getSelectedMonthYearForCurrentTenant(state);
|
|
359
378
|
const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : undefined;
|
|
360
379
|
const matchIds = monthYearPeriodId != null ? matchIdsByPeriod[monthYearPeriodId] : undefined;
|
|
@@ -364,38 +383,18 @@ function getExpenseAutomationActualMatchingView(state) {
|
|
|
364
383
|
.filter((match) => match.members.length > 0)
|
|
365
384
|
.map(toActualMatchingRow);
|
|
366
385
|
const rows = allRows.filter((row) => matchesSearch(row, uiState.searchString));
|
|
367
|
-
const
|
|
368
|
-
const
|
|
386
|
+
const includePendingReview = uiState.statusFilter !== 'reversed';
|
|
387
|
+
const includeReversed = uiState.statusFilter !== 'pending_review';
|
|
388
|
+
const reversed = includeReversed
|
|
389
|
+
? sortActualMatchingRows(rows.filter((row) => isReversedMatchKind(row.kind)), uiState)
|
|
390
|
+
: EMPTY_ACTUAL_MATCHING_ROWS;
|
|
391
|
+
const pendingReview = includePendingReview
|
|
392
|
+
? sortActualMatchingRows(rows.filter((row) => row.kind === 'pending_review'), uiState)
|
|
393
|
+
: EMPTY_ACTUAL_MATCHING_ROWS;
|
|
369
394
|
const kpiSummary = buildActualMatchingKpiSummary(allRows, getTenantDisplayCurrency(state)?.currencyCode);
|
|
370
395
|
const searchedAccruals = matchModal.accrualSearch.results
|
|
371
396
|
.map((key) => (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(key, state.jeSchedulesState))
|
|
372
397
|
.filter((accrual) => accrual != null);
|
|
373
|
-
const openedMatch = matchModal.openedFromMatchId != null
|
|
374
|
-
? (0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchModal.openedFromMatchId)
|
|
375
|
-
: undefined;
|
|
376
|
-
const pinnedAccruals = [
|
|
377
|
-
...(openedMatch?.members ?? []),
|
|
378
|
-
...(openedMatch?.leftovers ?? []),
|
|
379
|
-
].map(toMatchModalAccrual);
|
|
380
|
-
const firstMember = openedMatch?.members[0];
|
|
381
|
-
const cleared = firstMember?.cleared;
|
|
382
|
-
const suggestion = firstMember?.matchSuggestion;
|
|
383
|
-
const stamp = cleared ?? suggestion;
|
|
384
|
-
const consumedLineIds = cleared?.consumedLineIds;
|
|
385
|
-
const prefill = openedMatch == null
|
|
386
|
-
? undefined
|
|
387
|
-
: {
|
|
388
|
-
selectedAccrualIds: [
|
|
389
|
-
...openedMatch.members.map((member) => member.accrualId),
|
|
390
|
-
...(openedMatch.leftovers ?? []).map((leftover) => leftover.accrualId),
|
|
391
|
-
],
|
|
392
|
-
actualAmount: openedMatch.actualAmount.amount,
|
|
393
|
-
matchedTransactionId: stamp?.matchedTransactionId,
|
|
394
|
-
matchedLineId: cleared == null ? suggestion?.matchedLineId : undefined,
|
|
395
|
-
...(consumedLineIds != null && consumedLineIds.length > 0
|
|
396
|
-
? { consumedLineIds }
|
|
397
|
-
: {}),
|
|
398
|
-
};
|
|
399
398
|
// `fetchState` is a flat slice field that survives a period switch. Until this
|
|
400
399
|
// month's ids land, leftover Completed/Error is the previous month. Report
|
|
401
400
|
// Not-Started so chrome matches Review's "cache slot missing" skeleton, not
|
|
@@ -413,16 +412,16 @@ function getExpenseAutomationActualMatchingView(state) {
|
|
|
413
412
|
kpiSummary,
|
|
414
413
|
uiState,
|
|
415
414
|
refreshStatus,
|
|
415
|
+
ignoreStatusByMatchId,
|
|
416
|
+
undoReversalStatusByMatchId,
|
|
416
417
|
hasLoadedForSelectedPeriod: matchIds != null,
|
|
417
418
|
matchModal: {
|
|
418
419
|
isOpen: matchModal.isOpen,
|
|
419
|
-
openedFromMatchId: matchModal.openedFromMatchId,
|
|
420
|
-
prefill,
|
|
421
420
|
confirmStatus: matchModal.confirmStatus,
|
|
422
421
|
lastBatchResults: matchModal.lastBatchResults,
|
|
423
422
|
transactionSearch: {
|
|
424
423
|
query: matchModal.transactionSearch.query,
|
|
425
|
-
results:
|
|
424
|
+
results: matchModal.transactionSearch.results,
|
|
426
425
|
fetchState: {
|
|
427
426
|
fetchState: matchModal.transactionSearch.fetchState,
|
|
428
427
|
error: matchModal.transactionSearch.error,
|
|
@@ -432,7 +431,7 @@ function getExpenseAutomationActualMatchingView(state) {
|
|
|
432
431
|
},
|
|
433
432
|
accrualSearch: {
|
|
434
433
|
query: matchModal.accrualSearch.query,
|
|
435
|
-
results:
|
|
434
|
+
results: searchedAccruals,
|
|
436
435
|
fetchState: {
|
|
437
436
|
fetchState: matchModal.accrualSearch.fetchState,
|
|
438
437
|
error: matchModal.accrualSearch.error,
|
|
@@ -5,6 +5,8 @@ import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatc
|
|
|
5
5
|
import { JEOneTimeAccrualKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
6
6
|
export declare const toActualMatchingSortKey: (v: string) => "type" | "date" | "vendor" | "category" | "class" | "amount" | "variance" | "lifecycle" | "service" | "accrued" | "actual";
|
|
7
7
|
export type ActualMatchingSortKey = ReturnType<typeof toActualMatchingSortKey>;
|
|
8
|
+
export declare const toActualMatchingStatusFilter: (v: string) => "pending_review" | "reversed" | "all";
|
|
9
|
+
export type ActualMatchingStatusFilter = ReturnType<typeof toActualMatchingStatusFilter>;
|
|
8
10
|
export declare const MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 50;
|
|
9
11
|
export declare const MATCH_ACCRUAL_SEARCH_LIMIT = 50;
|
|
10
12
|
export declare const MATCH_SEARCH_DEBOUNCE_MS = 300;
|
|
@@ -18,6 +20,12 @@ export interface ActualMatchingViewUIState {
|
|
|
18
20
|
searchString: string;
|
|
19
21
|
sortKey: ActualMatchingSortKey;
|
|
20
22
|
sortOrder: SortOrder;
|
|
23
|
+
/**
|
|
24
|
+
* List-only filter. `all` shows both groups; `pending_review` / `reversed`
|
|
25
|
+
* empty the other group (`reversed` includes auto and manual). KPI summary
|
|
26
|
+
* stays on the unfiltered period.
|
|
27
|
+
*/
|
|
28
|
+
statusFilter: ActualMatchingStatusFilter;
|
|
21
29
|
}
|
|
22
30
|
/**
|
|
23
31
|
* Sibling of Missing Receipts `MatchCandidate`. Confirm needs `lineId` and
|
|
@@ -69,6 +77,14 @@ export interface UndoReversalAccrualsParams {
|
|
|
69
77
|
accrualIds: ID[];
|
|
70
78
|
matchId: ActualMatchingMatchId;
|
|
71
79
|
}
|
|
80
|
+
export declare const toActualMatchingIgnoreReasonType: (v: string) => "other_ignore" | "already_handled" | "amount_off" | "wrong_period" | "wrong_bill";
|
|
81
|
+
export type ActualMatchingIgnoreReasonType = ReturnType<typeof toActualMatchingIgnoreReasonType>;
|
|
82
|
+
export declare const ALL_ACTUAL_MATCHING_IGNORE_REASONS: readonly ActualMatchingIgnoreReasonType[];
|
|
83
|
+
export interface IgnoreActualMatchingSuggestionParams {
|
|
84
|
+
matchId: ActualMatchingMatchId;
|
|
85
|
+
reason: ActualMatchingIgnoreReasonType;
|
|
86
|
+
note?: string;
|
|
87
|
+
}
|
|
72
88
|
export interface ActualMatchingTransactionSearchState extends FetchStateAndError {
|
|
73
89
|
isLoadingMore: boolean;
|
|
74
90
|
nextPageToken: string | null;
|
|
@@ -84,18 +100,16 @@ export interface ActualMatchingAccrualSearchState extends FetchStateAndError {
|
|
|
84
100
|
export interface ActualMatchingMatchModalState {
|
|
85
101
|
accrualSearch: ActualMatchingAccrualSearchState;
|
|
86
102
|
confirmStatus: FetchStateAndError;
|
|
87
|
-
didPinPrefillTransactions: boolean;
|
|
88
103
|
isOpen: boolean;
|
|
89
|
-
pinnedTransactionResults: ActualMatchingTransactionSearchResult[];
|
|
90
104
|
transactionSearch: ActualMatchingTransactionSearchState;
|
|
91
105
|
lastBatchResults?: MatchAndReverseResult[];
|
|
92
|
-
openedFromMatchId?: ActualMatchingMatchId;
|
|
93
106
|
}
|
|
94
107
|
export declare function actualMatchingTransactionLineKey(transactionType: string, transactionIntegrationId: string, lineId: string): string;
|
|
95
108
|
export interface ActualMatchingViewState extends FetchedState {
|
|
96
|
-
|
|
109
|
+
confirmStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
|
|
97
110
|
detailFetchStateByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
|
|
98
111
|
detailRefreshStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
|
|
112
|
+
ignoreStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
|
|
99
113
|
lastMatchResultsByMatchId: Record<ActualMatchingMatchId, MatchAndReverseResult[]>;
|
|
100
114
|
lastUndoResultsByMatchId: Record<ActualMatchingMatchId, UndoReversalResult[]>;
|
|
101
115
|
matchIdsByPeriod: Record<MonthYearPeriodId, ActualMatchingMatchId[]>;
|
|
@@ -103,4 +117,6 @@ export interface ActualMatchingViewState extends FetchedState {
|
|
|
103
117
|
refreshStatus: FetchStateAndError;
|
|
104
118
|
uiState: ActualMatchingViewUIState;
|
|
105
119
|
undoReversalStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
|
|
120
|
+
closeMatchAfterIgnoreMatchId?: ActualMatchingMatchId;
|
|
121
|
+
closeMatchAfterUndoMatchId?: ActualMatchingMatchId;
|
|
106
122
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
3
|
+
exports.ALL_ACTUAL_MATCHING_IGNORE_REASONS = exports.toActualMatchingIgnoreReasonType = exports.toUndoReversalResultStatus = exports.toMatchAndReverseResultStatus = exports.MATCH_SEARCH_DEBOUNCE_MS = exports.MATCH_ACCRUAL_SEARCH_LIMIT = exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = exports.toActualMatchingStatusFilter = exports.toActualMatchingSortKey = void 0;
|
|
4
4
|
exports.isMatchAndReverseCompleteStatus = isMatchAndReverseCompleteStatus;
|
|
5
5
|
exports.actualMatchingTransactionLineKey = actualMatchingTransactionLineKey;
|
|
6
6
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
@@ -19,6 +19,13 @@ const ACTUAL_MATCHING_SORT_KEYS = [
|
|
|
19
19
|
];
|
|
20
20
|
const toActualMatchingSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, ACTUAL_MATCHING_SORT_KEYS);
|
|
21
21
|
exports.toActualMatchingSortKey = toActualMatchingSortKey;
|
|
22
|
+
const ACTUAL_MATCHING_STATUS_FILTERS = [
|
|
23
|
+
'all',
|
|
24
|
+
'pending_review',
|
|
25
|
+
'reversed',
|
|
26
|
+
];
|
|
27
|
+
const toActualMatchingStatusFilter = (v) => (0, stringToUnion_1.stringToUnion)(v, ACTUAL_MATCHING_STATUS_FILTERS);
|
|
28
|
+
exports.toActualMatchingStatusFilter = toActualMatchingStatusFilter;
|
|
22
29
|
exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 50;
|
|
23
30
|
exports.MATCH_ACCRUAL_SEARCH_LIMIT = 50;
|
|
24
31
|
exports.MATCH_SEARCH_DEBOUNCE_MS = 300;
|
|
@@ -41,6 +48,16 @@ const UNDO_REVERSAL_RESULT_STATUSES = [
|
|
|
41
48
|
];
|
|
42
49
|
const toUndoReversalResultStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, UNDO_REVERSAL_RESULT_STATUSES);
|
|
43
50
|
exports.toUndoReversalResultStatus = toUndoReversalResultStatus;
|
|
51
|
+
const ACTUAL_MATCHING_IGNORE_REASONS = [
|
|
52
|
+
'wrong_bill',
|
|
53
|
+
'wrong_period',
|
|
54
|
+
'amount_off',
|
|
55
|
+
'already_handled',
|
|
56
|
+
'other_ignore',
|
|
57
|
+
];
|
|
58
|
+
const toActualMatchingIgnoreReasonType = (v) => (0, stringToUnion_1.stringToUnion)(v, ACTUAL_MATCHING_IGNORE_REASONS);
|
|
59
|
+
exports.toActualMatchingIgnoreReasonType = toActualMatchingIgnoreReasonType;
|
|
60
|
+
exports.ALL_ACTUAL_MATCHING_IGNORE_REASONS = ACTUAL_MATCHING_IGNORE_REASONS;
|
|
44
61
|
function actualMatchingTransactionLineKey(transactionType, transactionIntegrationId, lineId) {
|
|
45
62
|
return `${transactionType}:${transactionIntegrationId}:${lineId}`;
|
|
46
63
|
}
|
|
@@ -141,7 +141,7 @@ export declare const getWithdrawFrom: (state: RootState, fromAccountId?: ID, fro
|
|
|
141
141
|
accountId: ID;
|
|
142
142
|
accountType: AccountTypeSubConfigCodeKeyType;
|
|
143
143
|
}) => FundingAccount | undefined;
|
|
144
|
-
export declare const getDefaultWithdrawFromAccount: (state: RootState, companyId: ID, lastSelectedFromAccount?: {
|
|
144
|
+
export declare const getDefaultWithdrawFromAccount: (state: RootState, depositAccounts: ID[], companyId: ID, lastSelectedFromAccount?: {
|
|
145
145
|
accountId: ID;
|
|
146
146
|
accountType: AccountTypeSubConfigCodeKeyType;
|
|
147
147
|
}) => FundingAccount | undefined;
|
|
@@ -640,7 +640,7 @@ const getDueDate = (billStageCode, dueDate, invoiceDate, bookCloseDate) => {
|
|
|
640
640
|
};
|
|
641
641
|
exports.getDueDate = getDueDate;
|
|
642
642
|
const getWithdrawFrom = (state, fromAccountId, fromAccountType, companyId, lastSelectedFromAccount) => {
|
|
643
|
-
const { paymentAccountState, depositAccountState, paymentAccountListState } = state;
|
|
643
|
+
const { paymentAccountState, depositAccountState, depositAccountListState, paymentAccountListState, } = state;
|
|
644
644
|
if (fromAccountId != null) {
|
|
645
645
|
const withdrawFromAsDepositAcc = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, fromAccountId);
|
|
646
646
|
const withdrawFromAsPaymentAcc = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, fromAccountId);
|
|
@@ -654,16 +654,42 @@ const getWithdrawFrom = (state, fromAccountId, fromAccountType, companyId, lastS
|
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
656
|
else {
|
|
657
|
-
return (0, exports.getDefaultWithdrawFromAccount)(state, companyId ?? '', lastSelectedFromAccount);
|
|
657
|
+
return (0, exports.getDefaultWithdrawFromAccount)(state, depositAccountListState.accountIds, companyId ?? '', lastSelectedFromAccount);
|
|
658
658
|
}
|
|
659
659
|
return undefined;
|
|
660
660
|
};
|
|
661
661
|
exports.getWithdrawFrom = getWithdrawFrom;
|
|
662
|
-
const getDefaultWithdrawFromAccount = (state, companyId, lastSelectedFromAccount) => {
|
|
662
|
+
const getDefaultWithdrawFromAccount = (state, depositAccounts, companyId, lastSelectedFromAccount) => {
|
|
663
663
|
const { depositAccountState, paymentAccountState, paymentAccountListState } = state;
|
|
664
664
|
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
665
665
|
const primaryAccount = companyView?.company.company.companyBillPayInfo.primaryFundingAccount;
|
|
666
|
-
|
|
666
|
+
let defaultAccount = undefined;
|
|
667
|
+
// User paying bill for first time or previously paid with external account
|
|
668
|
+
if (lastSelectedFromAccount == null ||
|
|
669
|
+
lastSelectedFromAccount?.accountType === 'paymentAccount') {
|
|
670
|
+
if (depositAccounts.length === 0) {
|
|
671
|
+
defaultAccount = primaryAccount;
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
if (primaryAccount?.accountType === 'depositAccount') {
|
|
675
|
+
defaultAccount = primaryAccount;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
// User paid with Zeni account previously
|
|
681
|
+
if (depositAccounts.length === 1) {
|
|
682
|
+
defaultAccount = lastSelectedFromAccount;
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
if (primaryAccount?.accountType === 'depositAccount') {
|
|
686
|
+
defaultAccount = primaryAccount;
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
defaultAccount = lastSelectedFromAccount;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
667
693
|
if (defaultAccount != null) {
|
|
668
694
|
const defaultAccAsDepositAcc = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, defaultAccount?.accountId);
|
|
669
695
|
const defaultAccAsPaymentAcc = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, defaultAccount?.accountId);
|
|
@@ -9,7 +9,6 @@ import { TransactionID } from '../../entity/transaction/stateTypes/transactionID
|
|
|
9
9
|
import { SupportedTransaction, SupportedTransactionPayload } from '../../entity/transaction/transactionState';
|
|
10
10
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
11
11
|
import { UncategorizedAccounts } from '../accountList/accountListSelector';
|
|
12
|
-
import { CreateTransactionLineLocalData, CreateTransactionLocalData } from './createTransaction/createTransactionState';
|
|
13
12
|
import { TransactionDetailState, TransactionSaveUpdates } from './transactionDetailState';
|
|
14
13
|
import { TransactionDetailLineItemData, TransactionDetailLocalData, TransactionVendorUpdates } from './transactionDetailTypes';
|
|
15
14
|
export declare const initialState: TransactionDetailState;
|
|
@@ -177,41 +176,6 @@ export declare const downloadAccountingProviderAttachment: import("@reduxjs/tool
|
|
|
177
176
|
}, "transactionDetail/deleteSplitLine", never, never>, toggleSplitEditMode: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, editMode: boolean], {
|
|
178
177
|
transactionId: TransactionID;
|
|
179
178
|
editMode: boolean;
|
|
180
|
-
}, "transactionDetail/toggleSplitEditMode", never, never
|
|
181
|
-
transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry";
|
|
182
|
-
}, "transactionDetail/initializeCreateTransactionLocalData", never, never>, updateCreateTransactionLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry", localData: Partial<CreateTransactionLocalData>], {
|
|
183
|
-
transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry";
|
|
184
|
-
localData: Partial<CreateTransactionLocalData>;
|
|
185
|
-
}, "transactionDetail/updateCreateTransactionLocalData", never, never>, updateCreateTransactionLineLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry", lineId: string, lineUpdates: Partial<CreateTransactionLineLocalData>], {
|
|
186
|
-
transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry";
|
|
187
|
-
lineId: string;
|
|
188
|
-
lineUpdates: Partial<CreateTransactionLineLocalData>;
|
|
189
|
-
}, "transactionDetail/updateCreateTransactionLineLocalData", never, never>, addCreateTransactionLine: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry", line?: Partial<CreateTransactionLineLocalData> | undefined], {
|
|
190
|
-
transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry";
|
|
191
|
-
line: Partial<CreateTransactionLineLocalData> | undefined;
|
|
192
|
-
}, "transactionDetail/addCreateTransactionLine", never, never>, removeCreateTransactionLine: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry", lineId: string], {
|
|
193
|
-
transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry";
|
|
194
|
-
lineId: string;
|
|
195
|
-
}, "transactionDetail/removeCreateTransactionLine", never, never>, resetCreateTransactionLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry"], {
|
|
196
|
-
transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry";
|
|
197
|
-
}, "transactionDetail/resetCreateTransactionLocalData", never, never>, createTransaction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry"], {
|
|
198
|
-
transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry";
|
|
199
|
-
}, "transactionDetail/createTransaction", never, never>, createTransactionSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchState: FetchState, createdTransactionId?: TransactionID | undefined, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
|
|
200
|
-
fetchState: FetchState;
|
|
201
|
-
createdTransactionId: TransactionID | undefined;
|
|
202
|
-
error: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
203
|
-
}, "transactionDetail/createTransactionSuccessOrFailure", never, never>, setRecommendationsForCreateTransactionLines: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry", lineIds: string[], recommendations: Recommendation[], isAccountingClassesEnabled: boolean], {
|
|
204
|
-
transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry";
|
|
205
|
-
lineIds: string[];
|
|
206
|
-
recommendations: Recommendation[];
|
|
207
|
-
isAccountingClassesEnabled: boolean;
|
|
208
|
-
}, "transactionDetail/setRecommendationsForCreateTransactionLines", never, never>, clearRecommendationsForCreateTransactionLines: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry", lineIds: string[]], {
|
|
209
|
-
transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry";
|
|
210
|
-
lineIds: string[];
|
|
211
|
-
}, "transactionDetail/clearRecommendationsForCreateTransactionLines", never, never>, fetchVendorRecommendationsForCreateTransaction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry", lineIds: string[], entity?: Entity | undefined], {
|
|
212
|
-
transactionType: "expense" | "check" | "credit_card_credit" | "transfer" | "journal_entry";
|
|
213
|
-
lineIds: string[];
|
|
214
|
-
entity: Entity | undefined;
|
|
215
|
-
}, "transactionDetail/fetchVendorRecommendationsForCreateTransaction", never, never>;
|
|
179
|
+
}, "transactionDetail/toggleSplitEditMode", never, never>;
|
|
216
180
|
declare const _default: import("redux").Reducer<TransactionDetailState>;
|
|
217
181
|
export default _default;
|