@zeniai/client-epic-state 4.20.6 → 4.20.8
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/commonStateTypes/coaBalance/additionalBalances/getSummationBalance.d.ts +1 -1
- package/lib/commonStateTypes/coaBalance/coaBalanceType.d.ts +2 -0
- package/lib/commonStateTypes/coaBalance/coaBalanceType.js +6 -0
- package/lib/commonStateTypes/currencyHelper.d.ts +3 -0
- package/lib/commonStateTypes/currencyHelper.js +6 -1
- package/lib/commonStateTypes/reduceFetchState.d.ts +9 -0
- package/lib/commonStateTypes/reduceFetchState.js +26 -0
- package/lib/entity/account/accountPayload.d.ts +2 -0
- package/lib/entity/account/accountPayload.js +2 -0
- package/lib/entity/account/accountState.d.ts +2 -0
- package/lib/entity/customer/customerState.d.ts +0 -2
- package/lib/entity/customer/customerState.js +0 -5
- package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
- package/lib/entity/depositAccount/depositAccount.js +8 -1
- package/lib/entity/reimbursement/reimbursementPayload.d.ts +2 -0
- package/lib/entity/reimbursement/reimbursementPayload.js +7 -0
- package/lib/entity/reimbursement/reimbursementState.d.ts +2 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/entity/task/taskPayload.d.ts +1 -0
- package/lib/entity/task/taskPayload.js +1 -0
- package/lib/entity/task/taskState.d.ts +1 -0
- package/lib/entity/userGroups/userGroupsPayload.d.ts +7 -0
- package/lib/entity/userGroups/userGroupsPayload.js +10 -0
- package/lib/entity/userGroups/userGroupsReducer.d.ts +8 -0
- package/lib/entity/userGroups/userGroupsReducer.js +29 -0
- package/lib/entity/userGroups/userGroupsSelector.d.ts +4 -0
- package/lib/entity/userGroups/userGroupsSelector.js +12 -0
- package/lib/entity/userGroups/userGroupsState.d.ts +9 -0
- package/lib/entity/userGroups/userGroupsState.js +2 -0
- package/lib/epic.d.ts +15 -1
- package/lib/epic.js +15 -1
- package/lib/esm/commonStateTypes/coaBalance/coaBalanceType.js +5 -0
- package/lib/esm/commonStateTypes/currencyHelper.js +5 -0
- package/lib/esm/commonStateTypes/reduceFetchState.js +25 -0
- package/lib/esm/entity/account/accountPayload.js +2 -0
- package/lib/esm/entity/customer/customerState.js +1 -4
- package/lib/esm/entity/depositAccount/depositAccount.js +8 -1
- package/lib/esm/entity/reimbursement/reimbursementPayload.js +7 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/esm/entity/task/taskPayload.js +1 -0
- package/lib/esm/entity/userGroups/userGroupsPayload.js +7 -0
- package/lib/esm/entity/userGroups/userGroupsReducer.js +25 -0
- package/lib/esm/entity/userGroups/userGroupsSelector.js +8 -0
- package/lib/esm/entity/userGroups/userGroupsState.js +1 -0
- package/lib/esm/epic.js +15 -1
- package/lib/esm/index.js +19 -10
- package/lib/esm/reducer.js +6 -0
- package/lib/esm/view/arAgingView/arAgingReport/arAgingReducer.js +1 -1
- package/lib/esm/view/arAgingView/arAgingReport/arAgingSelector.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +33 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +29 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +49 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +40 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +49 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +61 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +33 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +56 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +12 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +98 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +71 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +86 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +24 -0
- package/lib/esm/view/expenseAutomationView/helpers/bulkUploadTiming.js +16 -0
- package/lib/esm/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +13 -0
- package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +198 -1
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +456 -2
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +23 -1
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +245 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +44 -0
- package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +2 -1
- package/lib/esm/view/financeStatement/financeStatementReducer.js +11 -8
- package/lib/esm/view/financeStatement/financeStatementSelector.js +24 -9
- package/lib/esm/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +17 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +331 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +9 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
- package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +262 -0
- package/lib/esm/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +9 -7
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +3 -1
- package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +65 -0
- package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +16 -0
- package/lib/esm/view/userGroupListView/userGroupListViewState.js +1 -0
- package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +11 -0
- package/lib/esm/zeniAPI.js +0 -2
- package/lib/index.d.ts +20 -12
- package/lib/index.js +97 -34
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
- package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +2 -2
- package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +5 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.d.ts +13 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +37 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +18 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +33 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +53 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +44 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +53 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +65 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +37 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +61 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.d.ts +10 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +16 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.d.ts +18 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +102 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +14 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +75 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +25 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +92 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +28 -0
- package/lib/view/expenseAutomationView/helpers/bulkUploadTiming.d.ts +16 -0
- package/lib/view/expenseAutomationView/helpers/bulkUploadTiming.js +19 -0
- package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.d.ts +7 -0
- package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +16 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +123 -0
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +211 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +86 -3
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +457 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +11 -3
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +24 -2
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +70 -1
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +244 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +146 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +54 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +2 -1
- package/lib/view/financeStatement/financeStatementReducer.js +11 -8
- package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
- package/lib/view/financeStatement/financeStatementSelector.js +24 -9
- package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.d.ts +9 -0
- package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +20 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +15 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +335 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +111 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +13 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +4 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +7 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +4 -0
- package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +6 -0
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +265 -0
- package/lib/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +8 -6
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +1 -0
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +2 -0
- package/lib/view/taskManager/taskListView/taskListSelector.js +3 -1
- package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +23 -0
- package/lib/view/userGroupListView/userGroupListViewReducer.js +69 -0
- package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +7 -0
- package/lib/view/userGroupListView/userGroupListViewSelector.js +20 -0
- package/lib/view/userGroupListView/userGroupListViewState.d.ts +8 -0
- package/lib/view/userGroupListView/userGroupListViewState.js +2 -0
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +3 -1
- package/lib/view/userListView/fetchUserListByTypeEpic.js +11 -0
- package/lib/view/userListView/userListViewPayload.d.ts +2 -0
- package/lib/zeniAPI.js +0 -2
- package/package.json +3 -3
|
@@ -1,2 +1,213 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseBatchFileStatus = parseBatchFileStatus;
|
|
4
|
+
exports.toBatchFile = toBatchFile;
|
|
5
|
+
exports.extractTransactionPayloadsFromBatchFiles = extractTransactionPayloadsFromBatchFiles;
|
|
6
|
+
exports.toBatchSummary = toBatchSummary;
|
|
7
|
+
exports.toBatchDetails = toBatchDetails;
|
|
8
|
+
exports.isBatchDetailsStatusPendingOrProcessing = isBatchDetailsStatusPendingOrProcessing;
|
|
9
|
+
exports.isBatchListStatusCompleted = isBatchListStatusCompleted;
|
|
10
|
+
exports.filterBatchListItemsForBatchDetailsFetch = filterBatchListItemsForBatchDetailsFetch;
|
|
11
|
+
exports.isBatchDetailsApiStatusCompleted = isBatchDetailsApiStatusCompleted;
|
|
12
|
+
exports.findBatchListItemForBatchId = findBatchListItemForBatchId;
|
|
13
|
+
exports.shouldFetchBatchDetailsForBatchId = shouldFetchBatchDetailsForBatchId;
|
|
14
|
+
exports.toBatchListItem = toBatchListItem;
|
|
15
|
+
exports.supportedTransactionPayloadToManualSearchResult = supportedTransactionPayloadToManualSearchResult;
|
|
16
|
+
const urlPayload_1 = require("../../../commonPayloadTypes/urlPayload");
|
|
17
|
+
const amount_1 = require("../../../commonStateTypes/amount");
|
|
18
|
+
const transactionPayload_1 = require("../../../entity/transaction/payloadTypes/transactionPayload");
|
|
19
|
+
const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
|
|
20
|
+
// -- Converter functions --
|
|
21
|
+
/**
|
|
22
|
+
* Maps batch-details API `files[].status` strings to canonical {@link BatchFileStatus}.
|
|
23
|
+
* Legacy aliases are supported during rollout; unknown strings map to `failed` so Redux never
|
|
24
|
+
* holds untyped status values.
|
|
25
|
+
*/
|
|
26
|
+
function parseBatchFileStatus(raw) {
|
|
27
|
+
const normalizedStatus = raw.trim().toLowerCase().replace(/-/g, '_');
|
|
28
|
+
switch (normalizedStatus) {
|
|
29
|
+
case 'exact_match':
|
|
30
|
+
case 'matched':
|
|
31
|
+
return 'exact_match';
|
|
32
|
+
case 'possible_matches':
|
|
33
|
+
case 'possible_match':
|
|
34
|
+
case 'possiblematch':
|
|
35
|
+
case 'un_matched':
|
|
36
|
+
case 'unmatched':
|
|
37
|
+
return 'possible_matches';
|
|
38
|
+
case 'no_match':
|
|
39
|
+
case 'nomatch':
|
|
40
|
+
return 'no_match';
|
|
41
|
+
case 'failed':
|
|
42
|
+
return 'failed';
|
|
43
|
+
default:
|
|
44
|
+
return 'failed';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function toBatchFile(payload, filesEndPoint) {
|
|
48
|
+
return {
|
|
49
|
+
attachmentId: payload.attachment_id,
|
|
50
|
+
candidates: payload.candidates?.map((candidate) => ({
|
|
51
|
+
transactionId: candidate.transaction_id,
|
|
52
|
+
matchScore: candidate.match_score,
|
|
53
|
+
})),
|
|
54
|
+
fileDownloadUrl: payload.file_id != null && filesEndPoint != null
|
|
55
|
+
? `${filesEndPoint}/1.0/files/${payload.file_id}?query=${encodeURIComponent(JSON.stringify({ download_file: true }))}`
|
|
56
|
+
: null,
|
|
57
|
+
fileId: payload.file_id,
|
|
58
|
+
filePreviewUrl: payload.file_preview_url,
|
|
59
|
+
filename: payload.filename,
|
|
60
|
+
matchSource: payload.match_source != null
|
|
61
|
+
? (0, missingReceiptsViewState_1.toMatchSource)(payload.match_source)
|
|
62
|
+
: undefined,
|
|
63
|
+
matchedTransactionId: payload.matched_transaction?.transaction_id,
|
|
64
|
+
status: (0, missingReceiptsViewState_1.toBatchFileStatus)(payload.status),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function extractTransactionPayloadsFromBatchFiles(files) {
|
|
68
|
+
const seen = new Set();
|
|
69
|
+
const payloads = [];
|
|
70
|
+
for (const file of files) {
|
|
71
|
+
if (file.matched_transaction != null) {
|
|
72
|
+
const id = file.matched_transaction.transaction_id;
|
|
73
|
+
if (!seen.has(id)) {
|
|
74
|
+
seen.add(id);
|
|
75
|
+
payloads.push(matchedTransactionPayloadToSupportedTransactionPayload(file.matched_transaction));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (file.candidates != null) {
|
|
79
|
+
for (const candidate of file.candidates) {
|
|
80
|
+
const id = candidate.transaction_id;
|
|
81
|
+
if (!seen.has(id)) {
|
|
82
|
+
seen.add(id);
|
|
83
|
+
payloads.push(matchedTransactionPayloadToSupportedTransactionPayload(candidate));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return payloads;
|
|
89
|
+
}
|
|
90
|
+
function matchedTransactionPayloadToSupportedTransactionPayload(payload) {
|
|
91
|
+
return {
|
|
92
|
+
transaction_id: payload.transaction_id,
|
|
93
|
+
transaction_type: payload.transaction_type ?? 'expense',
|
|
94
|
+
transaction_date: payload.transaction_date ?? '',
|
|
95
|
+
currency_code: payload.currency_code,
|
|
96
|
+
total_amount: payload.amount,
|
|
97
|
+
vendor_name: payload.vendor_name,
|
|
98
|
+
logo: payload.vendor_logo == null ? undefined : (0, urlPayload_1.toURL)(payload.vendor_logo),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function toBatchSummary(payload) {
|
|
102
|
+
return {
|
|
103
|
+
failed: payload.failed,
|
|
104
|
+
matched: payload.matched,
|
|
105
|
+
noMatch: payload.no_match,
|
|
106
|
+
possibleMatches: payload.possible_matches,
|
|
107
|
+
total: payload.total,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function toBatchDetails(payload, filesEndPoint) {
|
|
111
|
+
return {
|
|
112
|
+
batchId: payload.batch_id,
|
|
113
|
+
createdAt: payload.created_at,
|
|
114
|
+
files: payload.files.map((file) => toBatchFile(file, filesEndPoint)),
|
|
115
|
+
status: (0, missingReceiptsViewState_1.toBatchStatusValue)(payload.status),
|
|
116
|
+
summary: toBatchSummary(payload.summary),
|
|
117
|
+
...(payload.user_id != null && payload.user_id !== ''
|
|
118
|
+
? { userId: payload.user_id }
|
|
119
|
+
: {}),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/** Batch is still in-flight for automatching (GET /batches/:id while not completed). */
|
|
123
|
+
function isBatchDetailsStatusPendingOrProcessing(status) {
|
|
124
|
+
const s = status.toLowerCase();
|
|
125
|
+
return s === 'processing' || s === 'pending';
|
|
126
|
+
}
|
|
127
|
+
/** Batch list `status` is a string from the API — compare case-insensitively. */
|
|
128
|
+
function isBatchListStatusCompleted(status) {
|
|
129
|
+
return status.toLowerCase() === 'completed';
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Subset of the get-all-batches (`/batches?query=...`) list that is eligible for
|
|
133
|
+
* `GET /batches/:batchId` details fetches. The stored list may include pending, failed, or other
|
|
134
|
+
* statuses for UI; only `completed` rows should trigger batch-details requests.
|
|
135
|
+
*/
|
|
136
|
+
function filterBatchListItemsForBatchDetailsFetch(batches) {
|
|
137
|
+
return batches.filter((batch) => isBatchListStatusCompleted(batch.status));
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Batch details API response `status` field — only completed payloads should be stored from
|
|
141
|
+
* multi-batch fetch paths (list can be briefly stale vs. live processing state).
|
|
142
|
+
*/
|
|
143
|
+
function isBatchDetailsApiStatusCompleted(status) {
|
|
144
|
+
return status.toLowerCase() === 'completed';
|
|
145
|
+
}
|
|
146
|
+
function findBatchListItemForBatchId(batchListByPeriod, batchId) {
|
|
147
|
+
for (const list of Object.values(batchListByPeriod)) {
|
|
148
|
+
const found = list.find((batch) => batch.batchId === batchId);
|
|
149
|
+
if (found != null) {
|
|
150
|
+
return found;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Whether it is appropriate to call `GET .../batches/:id` for details.
|
|
157
|
+
* Skips when live batch status or batch list row indicates the batch is not completed yet.
|
|
158
|
+
* When status is unknown in both sources, allows the request (e.g. dispatch before list refresh).
|
|
159
|
+
*/
|
|
160
|
+
function shouldFetchBatchDetailsForBatchId(batchStatusById, batchListByPeriod, batchId) {
|
|
161
|
+
const live = batchStatusById[batchId]?.status;
|
|
162
|
+
if (live === 'completed') {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
if (live === 'pending' || live === 'processing') {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
const listItem = findBatchListItemForBatchId(batchListByPeriod, batchId);
|
|
169
|
+
if (listItem != null && !isBatchListStatusCompleted(listItem.status)) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
function toBatchListItem(payload) {
|
|
175
|
+
return {
|
|
176
|
+
batchId: payload.batch_id,
|
|
177
|
+
createdAt: payload.created_at,
|
|
178
|
+
failedCount: payload.failed_count,
|
|
179
|
+
matchedCount: payload.matched_count,
|
|
180
|
+
noMatchCount: payload.no_match_count,
|
|
181
|
+
possibleMatchesCount: payload.possible_matches_count,
|
|
182
|
+
status: payload.status,
|
|
183
|
+
totalFiles: payload.total_files,
|
|
184
|
+
userId: payload.user_id,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Amount shown in the Unmatched tab manual-search list: **first line only** when `lines` exist.
|
|
189
|
+
* Falls back to transaction-level totals via {@link getTransactionPayloadAmount} when there is
|
|
190
|
+
* no line or no line amount (same currency fields as the rest of the transaction payload).
|
|
191
|
+
*/
|
|
192
|
+
function getManualSearchListAmountFromPayload(payload) {
|
|
193
|
+
const lineAmount = payload.lines?.[0]?.amount;
|
|
194
|
+
if (lineAmount != null) {
|
|
195
|
+
return (0, amount_1.toAmount)(lineAmount, payload.currency_code, payload.currency_symbol);
|
|
196
|
+
}
|
|
197
|
+
return (0, transactionPayload_1.getTransactionPayloadAmount)(payload);
|
|
198
|
+
}
|
|
199
|
+
/** Maps expense-automation transaction rows to manual-search list rows (Unmatched tab). */
|
|
200
|
+
function supportedTransactionPayloadToManualSearchResult(payload) {
|
|
201
|
+
const amountPayload = getManualSearchListAmountFromPayload(payload);
|
|
202
|
+
return {
|
|
203
|
+
amount: amountPayload.amount,
|
|
204
|
+
currencyCode: amountPayload.currencyCode,
|
|
205
|
+
entityId: payload.vendor_id ?? payload.customer_id ?? '',
|
|
206
|
+
memo: payload.transaction_memo ?? '',
|
|
207
|
+
transactionDate: payload.transaction_date,
|
|
208
|
+
transactionId: payload.transaction_id,
|
|
209
|
+
transactionType: payload.transaction_type,
|
|
210
|
+
vendorName: payload.vendor_name ?? '',
|
|
211
|
+
vendorLogo: (0, urlPayload_1.toURL)(payload.logo)?.href,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
|
-
import { FetchStateAndError, UpdateType } from '../../../commonStateTypes/common';
|
|
2
|
+
import { FetchStateAndError, ID, UpdateType } from '../../../commonStateTypes/common';
|
|
3
|
+
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
4
|
import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePeriod';
|
|
5
|
+
import type { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
4
6
|
import { TransactionPayload } from '../../../entity/transaction/payloadTypes/transactionPayload';
|
|
5
7
|
import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
|
|
6
8
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
7
|
-
import { MissingReceiptsViewState, MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
9
|
+
import { type BatchDetails, type BatchListItem, type BatchStatus, type BulkUploadResultsTab, type BulkUploadSortKey, type BulkUploadState, type CompletedSubTab, type ManualSearchResult, type MissingReceiptsViewState, type MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
10
|
+
export declare const getCompletedTransactionsCacheKey: (periodId: MonthYearPeriodId, sortKey: BulkUploadSortKey, sortOrder: SortOrder, subTab: CompletedSubTab) => string;
|
|
11
|
+
export declare const initialBulkUploadState: BulkUploadState;
|
|
8
12
|
export declare const initialState: MissingReceiptsViewState;
|
|
13
|
+
/** Epic trigger only; batch-details fetch is handled in epics. */
|
|
14
|
+
export declare const fetchBulkUploadBatchDetails: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/fetchBulkUploadBatchDetails">;
|
|
15
|
+
/**
|
|
16
|
+
* Epic trigger only. Dispatched from the screen on missing-receipts entry / period switch so the
|
|
17
|
+
* automatching banner is restored for the logged-in user even when they sit on the Missing tab
|
|
18
|
+
* after a hard refresh. The epic owns the list + details API calls end-to-end.
|
|
19
|
+
*/
|
|
20
|
+
export declare const restoreBulkUploadAutomatchingOnMount: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/restoreBulkUploadAutomatchingOnMount">;
|
|
9
21
|
export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, minimumTransactionAmount: Amount, cacheOverride?: any, refreshViewInBackground?: any], {
|
|
10
22
|
period: TimePeriod;
|
|
11
23
|
minimumTransactionAmount: Amount;
|
|
@@ -26,6 +38,77 @@ export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCrea
|
|
|
26
38
|
}, "expenseAutomationMissingReceiptsView/updateMissingReceiptUploadState", never, never>, updateMissingReceiptsUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<MissingReceiptsViewUIState>, "expenseAutomationMissingReceiptsView/updateMissingReceiptsUIState">, markMissingReceiptAsDone: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionPayload: SupportedTransactionPayload, selectedPeriod: MonthYearPeriod], {
|
|
27
39
|
transactionPayload: SupportedTransactionPayload;
|
|
28
40
|
selectedPeriod: MonthYearPeriod;
|
|
29
|
-
}, "expenseAutomationMissingReceiptsView/markMissingReceiptAsDone", never, never>, clearExpenseAutomationMissingReceiptsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearExpenseAutomationMissingReceiptsView"
|
|
41
|
+
}, "expenseAutomationMissingReceiptsView/markMissingReceiptAsDone", never, never>, clearExpenseAutomationMissingReceiptsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearExpenseAutomationMissingReceiptsView">, bulkUploadReceipts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[files: File[]], {
|
|
42
|
+
files: File[];
|
|
43
|
+
fileCount: number;
|
|
44
|
+
}, "expenseAutomationMissingReceiptsView/bulkUploadReceipts", never, never>, updateBulkUploadProgress: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "expenseAutomationMissingReceiptsView/updateBulkUploadProgress">, setBulkUploadUploadedFileCount: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "expenseAutomationMissingReceiptsView/setBulkUploadUploadedFileCount">, bulkUploadReceiptsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
45
|
+
batchId: ID;
|
|
46
|
+
}, "expenseAutomationMissingReceiptsView/bulkUploadReceiptsSuccess">, bulkUploadReceiptsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
47
|
+
error: ZeniAPIStatus;
|
|
48
|
+
}, "expenseAutomationMissingReceiptsView/bulkUploadReceiptsFailure">, restoreBulkUploadMatchingState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
49
|
+
batchId: ID;
|
|
50
|
+
totalFiles: number;
|
|
51
|
+
}, "expenseAutomationMissingReceiptsView/restoreBulkUploadMatchingState">, bulkUploadAutomatchingTimedOut: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[batchId: string], {
|
|
52
|
+
batchId: string;
|
|
53
|
+
}, "expenseAutomationMissingReceiptsView/bulkUploadAutomatchingTimedOut", never, never>, pusherBatchStatusUpdate: import("@reduxjs/toolkit").ActionCreatorWithPayload<BatchStatus, "expenseAutomationMissingReceiptsView/pusherBatchStatusUpdate">, requestMissingReceiptsTabNavigation: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
54
|
+
tab: BulkUploadResultsTab;
|
|
55
|
+
}, "expenseAutomationMissingReceiptsView/requestMissingReceiptsTabNavigation">, clearMissingReceiptsTabNavigation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearMissingReceiptsTabNavigation">, fetchBulkUploadBatchDetailsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<BatchDetails, "expenseAutomationMissingReceiptsView/fetchBulkUploadBatchDetailsSuccess">, fetchBulkUploadBatchDetailsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
|
|
56
|
+
error: ZeniAPIStatus;
|
|
57
|
+
}], {
|
|
58
|
+
error: ZeniAPIStatus;
|
|
59
|
+
}, "expenseAutomationMissingReceiptsView/fetchBulkUploadBatchDetailsFailure", never, never>, storeBatchDetails: import("@reduxjs/toolkit").ActionCreatorWithPayload<BatchDetails, "expenseAutomationMissingReceiptsView/storeBatchDetails">, batchDetailFetchFailed: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
60
|
+
batchId: ID;
|
|
61
|
+
}, "expenseAutomationMissingReceiptsView/batchDetailFetchFailed">, setInitialBatchDetailsLoading: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/setInitialBatchDetailsLoading">, fetchMoreBatchDetails: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/fetchMoreBatchDetails">, fetchMoreBatchDetailsComplete: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/fetchMoreBatchDetailsComplete">, fetchMoreBatchDetailsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
62
|
+
error: ZeniAPIStatus;
|
|
63
|
+
}, "expenseAutomationMissingReceiptsView/fetchMoreBatchDetailsFailure">, fetchBulkUploadBatches: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[input?: {
|
|
64
|
+
cacheOverride?: boolean;
|
|
65
|
+
invalidateBatchDetailsCache?: boolean;
|
|
66
|
+
} | undefined], {
|
|
67
|
+
cacheOverride: boolean;
|
|
68
|
+
invalidateBatchDetailsCache: boolean;
|
|
69
|
+
}, "expenseAutomationMissingReceiptsView/fetchBulkUploadBatches", never, never>, fetchBulkUploadBatchesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
70
|
+
batchList: BatchListItem[];
|
|
71
|
+
selectedPeriod: MonthYearPeriod;
|
|
72
|
+
}, "expenseAutomationMissingReceiptsView/fetchBulkUploadBatchesSuccess">, fetchBulkUploadBatchesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
73
|
+
error: ZeniAPIStatus;
|
|
74
|
+
selectedPeriod: MonthYearPeriod;
|
|
75
|
+
}, "expenseAutomationMissingReceiptsView/fetchBulkUploadBatchesFailure">, confirmBulkUploadMatch: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[batchId: string, attachmentId: string, transactionId: string, transactionType: string, fileName: string], {
|
|
76
|
+
batchId: string;
|
|
77
|
+
attachmentId: string;
|
|
78
|
+
transactionId: string;
|
|
79
|
+
transactionType: string;
|
|
80
|
+
fileName: string;
|
|
81
|
+
}, "expenseAutomationMissingReceiptsView/confirmBulkUploadMatch", never, never>, confirmBulkUploadMatchSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
82
|
+
attachmentId: ID;
|
|
83
|
+
batchId: ID;
|
|
84
|
+
transactionId: ID;
|
|
85
|
+
}, "expenseAutomationMissingReceiptsView/confirmBulkUploadMatchSuccess">, confirmBulkUploadMatchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
86
|
+
error: ZeniAPIStatus;
|
|
87
|
+
}, "expenseAutomationMissingReceiptsView/confirmBulkUploadMatchFailure">, setBulkUploadResultsTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"completed" | "unmatched", "expenseAutomationMissingReceiptsView/setBulkUploadResultsTab">, setBulkUploadCompletedSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"all" | "manual" | "ai_accountant", "expenseAutomationMissingReceiptsView/setBulkUploadCompletedSubTab">, setBulkUploadSortConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
88
|
+
sortKey: BulkUploadSortKey;
|
|
89
|
+
sortOrder: SortOrder;
|
|
90
|
+
}, "expenseAutomationMissingReceiptsView/setBulkUploadSortConfig">, clearBulkUpload: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearBulkUpload">, searchTransactionsForManualMatch: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[query: string, pageToken?: string | null | undefined], {
|
|
91
|
+
query: string;
|
|
92
|
+
pageToken: string | undefined;
|
|
93
|
+
}, "expenseAutomationMissingReceiptsView/searchTransactionsForManualMatch", never, never>, searchTransactionsForManualMatchSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
94
|
+
append: boolean;
|
|
95
|
+
nextPageToken: string | null;
|
|
96
|
+
results: ManualSearchResult[];
|
|
97
|
+
totalCount: number;
|
|
98
|
+
}, "expenseAutomationMissingReceiptsView/searchTransactionsForManualMatchSuccess">, searchTransactionsForManualMatchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
99
|
+
error: ZeniAPIStatus;
|
|
100
|
+
}, "expenseAutomationMissingReceiptsView/searchTransactionsForManualMatchFailure">, clearManualSearchResults: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearManualSearchResults">, acknowledgeBulkUploadConfirmMatchComplete: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/acknowledgeBulkUploadConfirmMatchComplete">, fetchCompletedTransactions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[pageToken?: string | undefined, cacheOverride?: boolean | undefined], {
|
|
101
|
+
pageToken: string | undefined;
|
|
102
|
+
cacheOverride: boolean | undefined;
|
|
103
|
+
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactions", never, never>, fetchCompletedTransactionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
104
|
+
isInitialLoad: boolean;
|
|
105
|
+
nextPageToken: string | null;
|
|
106
|
+
selectedPeriod: MonthYearPeriod;
|
|
107
|
+
totalCount: number;
|
|
108
|
+
transactionIds: ID[];
|
|
109
|
+
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactionsSuccess">, fetchCompletedTransactionsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
110
|
+
error: ZeniAPIStatus;
|
|
111
|
+
selectedPeriod: MonthYearPeriod;
|
|
112
|
+
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactionsFailure">;
|
|
30
113
|
declare const _default: import("redux").Reducer<MissingReceiptsViewState>;
|
|
31
114
|
export default _default;
|