@zeniai/client-epic-state 4.19.89 → 4.19.90-beta0AD
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/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/aiCfo/aiCfoSelector.d.ts +1 -2
- package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
- package/lib/entity/depositAccount/depositAccount.js +8 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +11 -0
- package/lib/entity/transaction/stateTypes/transaction.d.ts +3 -0
- package/lib/epic.d.ts +13 -1
- package/lib/epic.js +13 -1
- package/lib/esm/entity/account/accountPayload.js +2 -0
- package/lib/esm/entity/depositAccount/depositAccount.js +8 -1
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +11 -0
- package/lib/esm/epic.js +13 -1
- package/lib/esm/index.js +11 -5
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +83 -1
- package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +8 -2
- package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +26 -0
- package/lib/esm/view/expenseAutomationView/bulkUploadTiming.js +10 -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 +47 -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/searchTransactionsForManualMatchEpic.js +77 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +79 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +24 -0
- package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +189 -1
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +433 -2
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +23 -1
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +244 -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/spendManagement/billPay/billList/billListSelector.js +10 -0
- package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
- package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
- package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +3 -3
- package/lib/esm/zeniAPI.js +0 -2
- package/lib/index.d.ts +12 -7
- package/lib/index.js +88 -32
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
- package/lib/view/aiCfoView/aiCfoViewReducer.js +84 -2
- package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
- package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
- package/lib/view/aiCfoView/aiCfoViewState.d.ts +18 -0
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +30 -0
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/bulkUploadTiming.d.ts +10 -0
- package/lib/view/expenseAutomationView/bulkUploadTiming.js +13 -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 +51 -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/searchTransactionsForManualMatchEpic.d.ts +14 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +81 -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 +85 -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/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +118 -0
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +201 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +76 -3
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +434 -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 +69 -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 +243 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +142 -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/spendManagement/billPay/billList/billListSelector.js +10 -0
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +3 -3
- package/lib/zeniAPI.js +0 -2
- package/package.json +1 -1
|
@@ -8,7 +8,10 @@ const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
|
8
8
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
9
9
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
10
10
|
const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
|
|
11
|
+
const missingReceiptsPayload_1 = require("../payload/missingReceiptsPayload");
|
|
12
|
+
const missingReceiptsViewReducer_1 = require("../reducers/missingReceiptsViewReducer");
|
|
11
13
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
14
|
+
const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
|
|
12
15
|
function getExpenseAutomationMissingReceiptsView(state) {
|
|
13
16
|
const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
|
|
14
17
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
@@ -53,6 +56,131 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
53
56
|
const completionStatus = missingReceiptsCompletionStatus != null
|
|
54
57
|
? missingReceiptsCompletionStatus
|
|
55
58
|
: 'incomplete';
|
|
59
|
+
const { bulkUpload, pendingMissingReceiptsTabNavigation } = expenseAutomationMissingReceiptsViewState;
|
|
60
|
+
const currentBatchStatus = bulkUpload.currentBatchId != null
|
|
61
|
+
? bulkUpload.batchStatusById[bulkUpload.currentBatchId]
|
|
62
|
+
: undefined;
|
|
63
|
+
const batchList = monthYearPeriodId != null
|
|
64
|
+
? (bulkUpload.batchListByPeriod[monthYearPeriodId] ?? [])
|
|
65
|
+
: [];
|
|
66
|
+
/**
|
|
67
|
+
* Primary "Unmatched" batch = first completed batch in platform list order, preferring the
|
|
68
|
+
* first batch that still has possible_matches/no_match work when any completed batch has such work.
|
|
69
|
+
* Batches without details yet: wait if the list row still reports unmatched work; otherwise skip
|
|
70
|
+
* so we do not block the whole tab while other rows are not fetched yet.
|
|
71
|
+
*/
|
|
72
|
+
const primaryBatchIdFromDetailsOrder = getPrimaryBatchIdFromBatchListOrder(batchList, bulkUpload.batchDetailsById, bulkUpload.failedBatchDetailIds);
|
|
73
|
+
/**
|
|
74
|
+
* During upload/matching, prefer `currentBatchId` only when its batch details are loaded,
|
|
75
|
+
* completed, and still have unmatched-tab work. Otherwise keep `primaryBatchIdFromDetailsOrder`.
|
|
76
|
+
*
|
|
77
|
+
* If we pinned to `currentBatchId` as soon as it was absent from the batch list (in-flight
|
|
78
|
+
* upload), details are often not loaded yet — `unmatchedFiles` would empty while older batches
|
|
79
|
+
* moved to "past", so the primary "Unmatched Receipts" section vanished during auto-matching.
|
|
80
|
+
*/
|
|
81
|
+
const unmatchedSectionBatchId = (() => {
|
|
82
|
+
const phase = bulkUpload.phase;
|
|
83
|
+
if (phase !== 'matching' && phase !== 'uploading') {
|
|
84
|
+
return primaryBatchIdFromDetailsOrder;
|
|
85
|
+
}
|
|
86
|
+
const currentId = bulkUpload.currentBatchId;
|
|
87
|
+
if (currentId == null) {
|
|
88
|
+
return primaryBatchIdFromDetailsOrder;
|
|
89
|
+
}
|
|
90
|
+
const currentDetails = bulkUpload.batchDetailsById[currentId];
|
|
91
|
+
if (currentDetails != null &&
|
|
92
|
+
currentDetails.status === 'completed' &&
|
|
93
|
+
batchDetailsHasUnmatchedWork(currentDetails)) {
|
|
94
|
+
return currentId;
|
|
95
|
+
}
|
|
96
|
+
return primaryBatchIdFromDetailsOrder;
|
|
97
|
+
})();
|
|
98
|
+
const completedBatchesInApiOrder = batchList.filter((batchListItem) => (0, missingReceiptsPayload_1.isBatchListStatusCompleted)(batchListItem.status));
|
|
99
|
+
const currentBatchDetails = unmatchedSectionBatchId != null
|
|
100
|
+
? bulkUpload.batchDetailsById[unmatchedSectionBatchId]
|
|
101
|
+
: undefined;
|
|
102
|
+
const resolvedFiles = currentBatchDetails?.files.map((file) => resolveBatchFile(file, currentBatchDetails.batchId, transactionState));
|
|
103
|
+
const failedIds = new Set(bulkUpload.failedBatchDetailIds);
|
|
104
|
+
const hasMoreBatchDetails = completedBatchesInApiOrder.some((batchListItem) => bulkUpload.batchDetailsById[batchListItem.batchId] == null &&
|
|
105
|
+
!failedIds.has(batchListItem.batchId));
|
|
106
|
+
const getSortValue = (file) => {
|
|
107
|
+
const matchedTransaction = file.matchedTransaction;
|
|
108
|
+
if (matchedTransaction == null) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
switch (bulkUpload.sortKey) {
|
|
112
|
+
case 'vendor':
|
|
113
|
+
return ((matchedTransaction.vendorName ?? matchedTransaction.description)?.toLowerCase() ?? null);
|
|
114
|
+
case 'category': {
|
|
115
|
+
const line = matchedTransaction.lines?.[0];
|
|
116
|
+
return line?.account?.accountName?.toLowerCase() ?? null;
|
|
117
|
+
}
|
|
118
|
+
case 'class': {
|
|
119
|
+
const line = matchedTransaction.lines?.[0];
|
|
120
|
+
return line?.class?.className?.toLowerCase() ?? null;
|
|
121
|
+
}
|
|
122
|
+
case 'date':
|
|
123
|
+
return matchedTransaction.date.valueOf();
|
|
124
|
+
case 'amount':
|
|
125
|
+
return matchedTransaction.amount.amount;
|
|
126
|
+
default:
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const bulkUploadSortDirection = bulkUpload.sortOrder === 'ascending' ? 'asc' : 'desc';
|
|
131
|
+
const matchedFiles = (0, orderBy_1.default)(resolvedFiles?.filter((resolvedFile) => resolvedFile.status === 'exact_match') ?? [], getSortValue, bulkUploadSortDirection);
|
|
132
|
+
const unmatchedFiles = (0, orderBy_1.default)(resolvedFiles?.filter((resolvedFile) => (0, missingReceiptsViewState_1.isUnmatchedTabFileStatus)(resolvedFile.status)) ?? [], getSortValue, bulkUploadSortDirection);
|
|
133
|
+
const progress = currentBatchStatus != null
|
|
134
|
+
? {
|
|
135
|
+
...currentBatchStatus.progress,
|
|
136
|
+
percentage: currentBatchStatus.progress.total > 0
|
|
137
|
+
? Math.round((currentBatchStatus.progress.processed /
|
|
138
|
+
currentBatchStatus.progress.total) *
|
|
139
|
+
100)
|
|
140
|
+
: 0,
|
|
141
|
+
}
|
|
142
|
+
: { total: 0, processed: 0, percentage: 0 };
|
|
143
|
+
const batchListFetchState = bulkUpload.batchListFetchState;
|
|
144
|
+
/**
|
|
145
|
+
* When primary batch is not resolved yet, still aggregate unmatched files from every batch
|
|
146
|
+
* that has details loaded (otherwise past is empty and receipts vanish from the UI).
|
|
147
|
+
*/
|
|
148
|
+
const pastBatches = unmatchedSectionBatchId != null
|
|
149
|
+
? batchList.filter((batchListItem) => batchListItem.batchId !== unmatchedSectionBatchId)
|
|
150
|
+
: batchList;
|
|
151
|
+
const pastUnmatchedFiles = pastBatches.flatMap((pastBatch) => {
|
|
152
|
+
const details = bulkUpload.batchDetailsById[pastBatch.batchId];
|
|
153
|
+
if (details == null) {
|
|
154
|
+
return [];
|
|
155
|
+
}
|
|
156
|
+
return details.files
|
|
157
|
+
.filter((batchFile) => (0, missingReceiptsViewState_1.isUnmatchedTabFileStatus)(batchFile.status))
|
|
158
|
+
.map((batchFile) => resolveBatchFile(batchFile, pastBatch.batchId, transactionState));
|
|
159
|
+
});
|
|
160
|
+
const completedTransactionsCacheKey = monthYearPeriodId != null
|
|
161
|
+
? (0, missingReceiptsViewReducer_1.getCompletedTransactionsCacheKey)(monthYearPeriodId, bulkUpload.sortKey, bulkUpload.sortOrder, bulkUpload.completedSubTab)
|
|
162
|
+
: undefined;
|
|
163
|
+
const completedTransactionsForPeriod = completedTransactionsCacheKey != null
|
|
164
|
+
? bulkUpload.completedTransactionsByPeriod[completedTransactionsCacheKey]
|
|
165
|
+
: undefined;
|
|
166
|
+
const completedTransactionIds = completedTransactionsForPeriod?.transactionIds ?? [];
|
|
167
|
+
const resolvedCompletedTransactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, completedTransactionIds);
|
|
168
|
+
const resolvedBatchDetails = currentBatchDetails != null && resolvedFiles != null
|
|
169
|
+
? {
|
|
170
|
+
batchId: currentBatchDetails.batchId,
|
|
171
|
+
createdAt: currentBatchDetails.createdAt,
|
|
172
|
+
files: resolvedFiles,
|
|
173
|
+
status: currentBatchDetails.status,
|
|
174
|
+
summary: currentBatchDetails.summary,
|
|
175
|
+
}
|
|
176
|
+
: undefined;
|
|
177
|
+
const manualSearchResults = bulkUpload.manualSearch.results.map((result) => {
|
|
178
|
+
const transaction = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, result.transactionId);
|
|
179
|
+
return {
|
|
180
|
+
...result,
|
|
181
|
+
vendorLogo: result.vendorLogo ?? transaction?.logo?.href,
|
|
182
|
+
};
|
|
183
|
+
});
|
|
56
184
|
return {
|
|
57
185
|
fetchState,
|
|
58
186
|
error,
|
|
@@ -61,5 +189,120 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
61
189
|
refreshStatus,
|
|
62
190
|
transactions: sortedTransactions,
|
|
63
191
|
completionStatus,
|
|
192
|
+
pendingMissingReceiptsTabNavigation: pendingMissingReceiptsTabNavigation ?? null,
|
|
193
|
+
bulkUpload: {
|
|
194
|
+
phase: bulkUpload.phase,
|
|
195
|
+
uploadStatus: bulkUpload.uploadStatus,
|
|
196
|
+
batchStatus: currentBatchStatus,
|
|
197
|
+
batchDetails: resolvedBatchDetails,
|
|
198
|
+
completedSubTab: bulkUpload.completedSubTab,
|
|
199
|
+
completedTransactions: {
|
|
200
|
+
fetchState: completedTransactionsForPeriod?.fetchState ?? {
|
|
201
|
+
fetchState: 'Not-Started',
|
|
202
|
+
error: undefined,
|
|
203
|
+
},
|
|
204
|
+
nextPageToken: completedTransactionsForPeriod?.nextPageToken ?? null,
|
|
205
|
+
totalCount: completedTransactionsForPeriod?.totalCount ?? 0,
|
|
206
|
+
transactions: resolvedCompletedTransactions,
|
|
207
|
+
},
|
|
208
|
+
matchedFiles,
|
|
209
|
+
unmatchedFiles,
|
|
210
|
+
progress,
|
|
211
|
+
currentResultsTab: bulkUpload.currentResultsTab,
|
|
212
|
+
sortKey: bulkUpload.sortKey,
|
|
213
|
+
sortOrder: bulkUpload.sortOrder,
|
|
214
|
+
batchList,
|
|
215
|
+
batchListFetchState,
|
|
216
|
+
pastBatches,
|
|
217
|
+
pastUnmatchedFiles,
|
|
218
|
+
confirmMatchStatus: bulkUpload.confirmMatchStatus,
|
|
219
|
+
manualSearchUiResetKey: bulkUpload.manualSearchUiResetKey,
|
|
220
|
+
hasMoreBatchDetails,
|
|
221
|
+
batchDetailsPaginationState: bulkUpload.batchDetailsPaginationState,
|
|
222
|
+
manualSearch: {
|
|
223
|
+
...bulkUpload.manualSearch,
|
|
224
|
+
results: manualSearchResults,
|
|
225
|
+
},
|
|
226
|
+
uploadProgress: bulkUpload.uploadProgress,
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function batchDetailsHasUnmatchedWork(details) {
|
|
231
|
+
return details.files.some((file) => (0, missingReceiptsViewState_1.isUnmatchedTabFileStatus)(file.status));
|
|
232
|
+
}
|
|
233
|
+
/** List row summary before batch details load — aligns with unmatched / possible-match work. */
|
|
234
|
+
function batchListItemHasUnmatchedWork(batch) {
|
|
235
|
+
return batch.noMatchCount > 0 || batch.possibleMatchesCount > 0;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* `batchList` must match platform order (same sequence as the bulk-upload batches API). Picks the
|
|
239
|
+
* primary batch for the top "Unmatched" section. Skips failed detail fetches.
|
|
240
|
+
*
|
|
241
|
+
* If details are not loaded for an earlier list row but that row reports no unmatched work, we
|
|
242
|
+
* skip it so later rows with loaded details can be primary (avoids an empty tab when the first
|
|
243
|
+
* fetch page only loaded later batches). If the list reports unmatched work but details are still
|
|
244
|
+
* loading, we wait (undefined) so primary order stays correct once details arrive.
|
|
245
|
+
*/
|
|
246
|
+
function getPrimaryBatchIdFromBatchListOrder(batchListInPlatformOrder, batchDetailsById, failedBatchDetailIds) {
|
|
247
|
+
const failedIds = new Set(failedBatchDetailIds);
|
|
248
|
+
const anyCompletedBatchHasUnmatchedWork = batchListInPlatformOrder.some((batch) => {
|
|
249
|
+
if (failedIds.has(batch.batchId)) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
const details = batchDetailsById[batch.batchId];
|
|
253
|
+
if (details != null &&
|
|
254
|
+
details.status === 'completed' &&
|
|
255
|
+
batchDetailsHasUnmatchedWork(details)) {
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
return details == null && batchListItemHasUnmatchedWork(batch);
|
|
259
|
+
});
|
|
260
|
+
for (const batch of batchListInPlatformOrder) {
|
|
261
|
+
if (failedIds.has(batch.batchId)) {
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
const details = batchDetailsById[batch.batchId];
|
|
265
|
+
if (details == null) {
|
|
266
|
+
if (batchListItemHasUnmatchedWork(batch)) {
|
|
267
|
+
return undefined;
|
|
268
|
+
}
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
if (details.status !== 'completed') {
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (anyCompletedBatchHasUnmatchedWork) {
|
|
275
|
+
if (batchDetailsHasUnmatchedWork(details)) {
|
|
276
|
+
return batch.batchId;
|
|
277
|
+
}
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
return batch.batchId;
|
|
281
|
+
}
|
|
282
|
+
return undefined;
|
|
283
|
+
}
|
|
284
|
+
function resolveBatchFile(file, batchId, transactionState) {
|
|
285
|
+
const matchedTransaction = file.matchedTransactionId != null
|
|
286
|
+
? (0, transactionSelector_1.getSupportedTransactionById)(transactionState, file.matchedTransactionId)
|
|
287
|
+
: undefined;
|
|
288
|
+
const candidates = file.candidates
|
|
289
|
+
?.map((ref) => {
|
|
290
|
+
const transaction = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, ref.transactionId);
|
|
291
|
+
return transaction != null
|
|
292
|
+
? { transaction, matchScore: ref.matchScore }
|
|
293
|
+
: undefined;
|
|
294
|
+
})
|
|
295
|
+
.filter((candidate) => candidate != null);
|
|
296
|
+
return {
|
|
297
|
+
attachmentId: file.attachmentId,
|
|
298
|
+
batchId,
|
|
299
|
+
fileDownloadUrl: file.fileDownloadUrl,
|
|
300
|
+
fileId: file.fileId,
|
|
301
|
+
filename: file.filename,
|
|
302
|
+
filePreviewUrl: file.filePreviewUrl,
|
|
303
|
+
status: file.status,
|
|
304
|
+
matchedTransaction,
|
|
305
|
+
candidates: candidates != null && candidates.length > 0 ? candidates : undefined,
|
|
306
|
+
matchSource: file.matchSource,
|
|
64
307
|
};
|
|
65
308
|
}
|
|
@@ -16,7 +16,7 @@ const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAu
|
|
|
16
16
|
function getExpenseAutomationTransactionView(state) {
|
|
17
17
|
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
|
|
18
18
|
const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
|
|
19
|
-
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
19
|
+
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
20
20
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
|
|
21
21
|
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
22
22
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
@@ -100,6 +100,7 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
100
100
|
completionStatus,
|
|
101
101
|
totalCountByTab,
|
|
102
102
|
fetchStateByTransactionTabs: fetchStateByTab,
|
|
103
|
+
uploadReceiptStatusById,
|
|
103
104
|
selectedTransactionId,
|
|
104
105
|
selectedTransactionLineId,
|
|
105
106
|
};
|
|
@@ -12,7 +12,149 @@ export interface MissingReceiptsViewUIState {
|
|
|
12
12
|
sortKey: MissingReceiptsSortKey;
|
|
13
13
|
sortOrder: SortOrder;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Minimum trimmed query length before manual-match search calls the expense-automation API.
|
|
17
|
+
* Kept in sync with `ManualSearchInput` in web-components (fires search only when length ≥ this).
|
|
18
|
+
*/
|
|
19
|
+
export declare const MIN_MANUAL_TRANSACTION_SEARCH_LENGTH = 2;
|
|
20
|
+
export declare const toBatchStatusValue: (v: string) => "pending" | "processing" | "completed";
|
|
21
|
+
export type BatchStatusValue = ReturnType<typeof toBatchStatusValue>;
|
|
22
|
+
/** Canonical batch file statuses (API ingress may use aliases; see `parseBatchFileStatus`). */
|
|
23
|
+
export declare const BATCH_FILE_STATUSES: readonly ["exact_match", "possible_matches", "no_match", "failed"];
|
|
24
|
+
export declare const toBatchFileStatus: (v: string) => "failed" | "exact_match" | "possible_matches" | "no_match";
|
|
25
|
+
export type BatchFileStatus = ReturnType<typeof toBatchFileStatus>;
|
|
26
|
+
/** True for files that belong in the Unmatched tab (possible matches or no match). */
|
|
27
|
+
export declare function isUnmatchedTabFileStatus(status: BatchFileStatus): boolean;
|
|
28
|
+
export declare const toBulkUploadPhase: (v: string) => "completed" | "idle" | "uploading" | "matching";
|
|
29
|
+
export type BulkUploadPhase = ReturnType<typeof toBulkUploadPhase>;
|
|
30
|
+
export declare const toBulkUploadResultsTab: (v: string) => "completed" | "unmatched";
|
|
31
|
+
export type BulkUploadResultsTab = ReturnType<typeof toBulkUploadResultsTab>;
|
|
32
|
+
export declare const toMissingReceiptsTab: (v: string) => "completed" | "unmatched" | "missing";
|
|
33
|
+
export type MissingReceiptsTab = ReturnType<typeof toMissingReceiptsTab>;
|
|
34
|
+
export declare const toCompletedSubTab: (v: string) => "all" | "manual" | "ai_accountant";
|
|
35
|
+
export type CompletedSubTab = ReturnType<typeof toCompletedSubTab>;
|
|
36
|
+
export declare const toMatchSource: (v: string) => "manual" | "ai";
|
|
37
|
+
export type MatchSource = ReturnType<typeof toMatchSource>;
|
|
38
|
+
export declare const toBulkUploadSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class";
|
|
39
|
+
export type BulkUploadSortKey = ReturnType<typeof toBulkUploadSortKey>;
|
|
40
|
+
export interface CandidateRef {
|
|
41
|
+
matchScore: number;
|
|
42
|
+
transactionId: ID;
|
|
43
|
+
}
|
|
44
|
+
export interface MatchCandidate {
|
|
45
|
+
amount: number;
|
|
46
|
+
currencyCode: string;
|
|
47
|
+
matchScore: number;
|
|
48
|
+
transactionDate: string;
|
|
49
|
+
transactionId: ID;
|
|
50
|
+
transactionType: string;
|
|
51
|
+
vendorName: string;
|
|
52
|
+
vendorLogo?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface BatchFile {
|
|
55
|
+
attachmentId: ID;
|
|
56
|
+
fileDownloadUrl: string | null;
|
|
57
|
+
fileId: ID;
|
|
58
|
+
filename: string;
|
|
59
|
+
filePreviewUrl: string | null;
|
|
60
|
+
status: BatchFileStatus;
|
|
61
|
+
candidates?: CandidateRef[];
|
|
62
|
+
matchedTransactionId?: ID;
|
|
63
|
+
matchSource?: MatchSource;
|
|
64
|
+
}
|
|
65
|
+
export interface BatchSummary {
|
|
66
|
+
failed: number;
|
|
67
|
+
matched: number;
|
|
68
|
+
noMatch: number;
|
|
69
|
+
possibleMatches: number;
|
|
70
|
+
total: number;
|
|
71
|
+
}
|
|
72
|
+
export interface BatchStatus {
|
|
73
|
+
batchId: ID;
|
|
74
|
+
progress: {
|
|
75
|
+
processed: number;
|
|
76
|
+
total: number;
|
|
77
|
+
};
|
|
78
|
+
status: BatchStatusValue;
|
|
79
|
+
}
|
|
80
|
+
export interface BatchDetails {
|
|
81
|
+
batchId: ID;
|
|
82
|
+
createdAt: string;
|
|
83
|
+
files: BatchFile[];
|
|
84
|
+
status: BatchStatusValue;
|
|
85
|
+
summary: BatchSummary;
|
|
86
|
+
}
|
|
87
|
+
export interface BatchListItem {
|
|
88
|
+
batchId: ID;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
failedCount: number;
|
|
91
|
+
matchedCount: number;
|
|
92
|
+
noMatchCount: number;
|
|
93
|
+
possibleMatchesCount: number;
|
|
94
|
+
status: string;
|
|
95
|
+
totalFiles: number;
|
|
96
|
+
}
|
|
97
|
+
export interface ManualSearchResult {
|
|
98
|
+
amount: number;
|
|
99
|
+
currencyCode: string;
|
|
100
|
+
entityId: string;
|
|
101
|
+
memo: string;
|
|
102
|
+
transactionDate: string;
|
|
103
|
+
transactionId: ID;
|
|
104
|
+
transactionType: string;
|
|
105
|
+
vendorName: string;
|
|
106
|
+
/** Present when API/merged transaction state supplies a logo URL. */
|
|
107
|
+
vendorLogo?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface ManualSearchState {
|
|
110
|
+
fetchState: FetchStateAndError;
|
|
111
|
+
/** True while appending the next page (initial search uses fetchState only). */
|
|
112
|
+
isLoadingMore: boolean;
|
|
113
|
+
nextPageToken: string | null;
|
|
114
|
+
pageSize: number;
|
|
115
|
+
results: ManualSearchResult[];
|
|
116
|
+
searchQuery: string;
|
|
117
|
+
totalCount: number;
|
|
118
|
+
}
|
|
119
|
+
/** Same union as {@link CompletedSubTab} — used for completed-transactions API `match_type`. */
|
|
120
|
+
export type CompletedTransactionsMatchType = CompletedSubTab;
|
|
121
|
+
export interface CompletedTransactionsState {
|
|
122
|
+
fetchState: FetchStateAndError;
|
|
123
|
+
nextPageToken: string | null;
|
|
124
|
+
totalCount: number;
|
|
125
|
+
transactionIds: ID[];
|
|
126
|
+
}
|
|
127
|
+
export interface BulkUploadState {
|
|
128
|
+
batchDetailsById: Record<ID, BatchDetails>;
|
|
129
|
+
batchDetailsPaginationState: FetchStateAndError;
|
|
130
|
+
batchListByPeriod: Record<MonthYearPeriodId, BatchListItem[]>;
|
|
131
|
+
batchListFetchState: FetchStateAndError;
|
|
132
|
+
batchStatusById: Record<ID, BatchStatus>;
|
|
133
|
+
completedSubTab: CompletedSubTab;
|
|
134
|
+
completedTransactionsByPeriod: Record<string, CompletedTransactionsState>;
|
|
135
|
+
confirmMatchStatus: FetchStateAndError;
|
|
136
|
+
currentResultsTab: BulkUploadResultsTab;
|
|
137
|
+
failedBatchDetailIds: ID[];
|
|
138
|
+
/**
|
|
139
|
+
* Incremented when manual search Redux state is cleared so Unmatched `ManualSearchInput`
|
|
140
|
+
* instances remount and drop local query text.
|
|
141
|
+
*/
|
|
142
|
+
manualSearch: ManualSearchState;
|
|
143
|
+
manualSearchUiResetKey: number;
|
|
144
|
+
phase: BulkUploadPhase;
|
|
145
|
+
sortKey: BulkUploadSortKey;
|
|
146
|
+
sortOrder: SortOrder;
|
|
147
|
+
uploadProgress: number;
|
|
148
|
+
uploadStatus: FetchStateAndError;
|
|
149
|
+
currentBatchId?: ID;
|
|
150
|
+
}
|
|
15
151
|
export interface MissingReceiptsViewState extends FetchedState {
|
|
152
|
+
bulkUpload: BulkUploadState;
|
|
153
|
+
/**
|
|
154
|
+
* When set, the app shell should switch the Missing Receipts sub-tab (e.g. to Unmatched)
|
|
155
|
+
* once, then clear via `clearMissingReceiptsTabNavigation`.
|
|
156
|
+
*/
|
|
157
|
+
pendingMissingReceiptsTabNavigation: BulkUploadResultsTab | null;
|
|
16
158
|
refreshStatus: FetchStateAndError;
|
|
17
159
|
transactionIdsBySelectedPeriod: Record<MonthYearPeriodId, ID[]>;
|
|
18
160
|
uiState: MissingReceiptsViewUIState;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toMissingReceiptsSortKey = void 0;
|
|
3
|
+
exports.toBulkUploadSortKey = exports.toMatchSource = exports.toCompletedSubTab = exports.toMissingReceiptsTab = exports.toBulkUploadResultsTab = exports.toBulkUploadPhase = exports.toBatchFileStatus = exports.BATCH_FILE_STATUSES = exports.toBatchStatusValue = exports.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH = exports.toMissingReceiptsSortKey = void 0;
|
|
4
|
+
exports.isUnmatchedTabFileStatus = isUnmatchedTabFileStatus;
|
|
4
5
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
6
|
const MISSING_RECEIPTS_SORT_KEYS = [
|
|
6
7
|
'vendor',
|
|
@@ -11,3 +12,55 @@ const MISSING_RECEIPTS_SORT_KEYS = [
|
|
|
11
12
|
];
|
|
12
13
|
const toMissingReceiptsSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, MISSING_RECEIPTS_SORT_KEYS);
|
|
13
14
|
exports.toMissingReceiptsSortKey = toMissingReceiptsSortKey;
|
|
15
|
+
// -- Bulk Receipt Upload Types --
|
|
16
|
+
/**
|
|
17
|
+
* Minimum trimmed query length before manual-match search calls the expense-automation API.
|
|
18
|
+
* Kept in sync with `ManualSearchInput` in web-components (fires search only when length ≥ this).
|
|
19
|
+
*/
|
|
20
|
+
exports.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH = 2;
|
|
21
|
+
const BATCH_STATUS_VALUES = ['pending', 'processing', 'completed'];
|
|
22
|
+
const toBatchStatusValue = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), BATCH_STATUS_VALUES);
|
|
23
|
+
exports.toBatchStatusValue = toBatchStatusValue;
|
|
24
|
+
/** Canonical batch file statuses (API ingress may use aliases; see `parseBatchFileStatus`). */
|
|
25
|
+
exports.BATCH_FILE_STATUSES = [
|
|
26
|
+
'exact_match',
|
|
27
|
+
'possible_matches',
|
|
28
|
+
'no_match',
|
|
29
|
+
'failed',
|
|
30
|
+
];
|
|
31
|
+
const toBatchFileStatus = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase().replace(/-/g, '_'), exports.BATCH_FILE_STATUSES);
|
|
32
|
+
exports.toBatchFileStatus = toBatchFileStatus;
|
|
33
|
+
const UNMATCHED_TAB_FILE_STATUSES = ['possible_matches', 'no_match'];
|
|
34
|
+
/** True for files that belong in the Unmatched tab (possible matches or no match). */
|
|
35
|
+
function isUnmatchedTabFileStatus(status) {
|
|
36
|
+
return UNMATCHED_TAB_FILE_STATUSES.includes(status);
|
|
37
|
+
}
|
|
38
|
+
const BULK_UPLOAD_PHASES = [
|
|
39
|
+
'idle',
|
|
40
|
+
'uploading',
|
|
41
|
+
'matching',
|
|
42
|
+
'completed',
|
|
43
|
+
];
|
|
44
|
+
const toBulkUploadPhase = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), BULK_UPLOAD_PHASES);
|
|
45
|
+
exports.toBulkUploadPhase = toBulkUploadPhase;
|
|
46
|
+
const BULK_UPLOAD_RESULTS_TABS = ['completed', 'unmatched'];
|
|
47
|
+
const toBulkUploadResultsTab = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), BULK_UPLOAD_RESULTS_TABS);
|
|
48
|
+
exports.toBulkUploadResultsTab = toBulkUploadResultsTab;
|
|
49
|
+
const MISSING_RECEIPTS_TABS = ['missing', 'completed', 'unmatched'];
|
|
50
|
+
const toMissingReceiptsTab = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), MISSING_RECEIPTS_TABS);
|
|
51
|
+
exports.toMissingReceiptsTab = toMissingReceiptsTab;
|
|
52
|
+
const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
|
|
53
|
+
const toCompletedSubTab = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
|
|
54
|
+
exports.toCompletedSubTab = toCompletedSubTab;
|
|
55
|
+
const MATCH_SOURCES = ['ai', 'manual'];
|
|
56
|
+
const toMatchSource = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), MATCH_SOURCES);
|
|
57
|
+
exports.toMatchSource = toMatchSource;
|
|
58
|
+
const BULK_UPLOAD_SORT_KEYS = [
|
|
59
|
+
'amount',
|
|
60
|
+
'category',
|
|
61
|
+
'class',
|
|
62
|
+
'date',
|
|
63
|
+
'vendor',
|
|
64
|
+
];
|
|
65
|
+
const toBulkUploadSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), BULK_UPLOAD_SORT_KEYS);
|
|
66
|
+
exports.toBulkUploadSortKey = toBulkUploadSortKey;
|
|
@@ -15,7 +15,7 @@ import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
|
15
15
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
16
16
|
import { EntityRecommendationKey } from '../../recommendation/recommendationState';
|
|
17
17
|
import { TransactionDetailKey } from '../../transactionDetail/transactionDetailState';
|
|
18
|
-
export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class" | "
|
|
18
|
+
export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class" | "payment_account" | "transaction_type" | "memo_and_receipt";
|
|
19
19
|
export type TransactionsSortKey = ReturnType<typeof toTransactionsSortKey>;
|
|
20
20
|
export declare const TRANSACTIONS_TABS: readonly ["review", "autoCategorized"];
|
|
21
21
|
export declare const toTransactionsTabKey: (v: string) => "review" | "autoCategorized";
|
|
@@ -97,6 +97,7 @@ export interface TransactionsTabViewState extends FetchedState {
|
|
|
97
97
|
transactionIdsWithUnsavedData: ID[];
|
|
98
98
|
transactionReviewLocalDataById: Record<ID | TransactionDetailKey, SupportedTransactionCategorization>;
|
|
99
99
|
uiState: TransactionsViewUIState;
|
|
100
|
+
uploadReceiptStatusById: Record<ID, FetchStateAndError>;
|
|
100
101
|
selectedTransactionId?: ID;
|
|
101
102
|
selectedTransactionLineId?: ID;
|
|
102
103
|
}
|
|
@@ -7,10 +7,11 @@ const TRANSACTIONS_SORT_KEYS = [
|
|
|
7
7
|
'vendor',
|
|
8
8
|
'amount',
|
|
9
9
|
'transaction_type',
|
|
10
|
+
'payment_account',
|
|
10
11
|
'date',
|
|
11
12
|
'category',
|
|
12
13
|
'class',
|
|
13
|
-
'
|
|
14
|
+
'memo_and_receipt',
|
|
14
15
|
];
|
|
15
16
|
const toTransactionsSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, TRANSACTIONS_SORT_KEYS);
|
|
16
17
|
exports.toTransactionsSortKey = toTransactionsSortKey;
|
|
@@ -424,6 +424,14 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
|
|
|
424
424
|
transactionsWithNoSortKeyValue.push(transaction);
|
|
425
425
|
}
|
|
426
426
|
break;
|
|
427
|
+
case 'invoiceNumber':
|
|
428
|
+
if (transaction.documentId != null) {
|
|
429
|
+
transactionsWithSortKeyValue.push(transaction);
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
transactionsWithNoSortKeyValue.push(transaction);
|
|
433
|
+
}
|
|
434
|
+
break;
|
|
427
435
|
case 'dueDate':
|
|
428
436
|
if (currentTab === 'draft') {
|
|
429
437
|
if (Boolean(transaction.dueDate) === true) {
|
|
@@ -526,6 +534,8 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
|
|
|
526
534
|
return transaction.totalAmountInUSD?.amount ?? 0;
|
|
527
535
|
case 'paymentMethod':
|
|
528
536
|
return transaction.billPayInfo.billPaymentMethodType.name;
|
|
537
|
+
case 'invoiceNumber':
|
|
538
|
+
return transaction.documentId;
|
|
529
539
|
}
|
|
530
540
|
}, getColumnWiseSortOrder(sortOrder));
|
|
531
541
|
return [
|
|
@@ -37,7 +37,7 @@ declare const toBillTabType: (v: string) => "paid" | "pending_approval" | "sched
|
|
|
37
37
|
export type BillTab = ReturnType<typeof toBillTabType>;
|
|
38
38
|
declare const toBillsSubTabType: (v: string) => "rejected" | "failed" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "all" | "awaiting_approval" | "awaiting_my_approval" | "offline";
|
|
39
39
|
export type BillsSubTabType = ReturnType<typeof toBillsSubTabType>;
|
|
40
|
-
declare const toBillPaySortKeyType: (v: string) => "amount" | "status" | "name" | "dueDate" | "paymentMethod" | "invoiceDate";
|
|
40
|
+
declare const toBillPaySortKeyType: (v: string) => "amount" | "status" | "name" | "dueDate" | "paymentMethod" | "invoiceNumber" | "invoiceDate";
|
|
41
41
|
export declare type BillPayViewSortKey = ReturnType<typeof toBillPaySortKeyType>;
|
|
42
42
|
export interface BillPayFilters {
|
|
43
43
|
categories: BillPayFilterCategory[];
|
|
@@ -47,6 +47,7 @@ const ALL_BILL_PAY_SORT_KEYS = [
|
|
|
47
47
|
'invoiceDate',
|
|
48
48
|
'name',
|
|
49
49
|
'paymentMethod',
|
|
50
|
+
'invoiceNumber',
|
|
50
51
|
];
|
|
51
52
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
52
53
|
const toBillPaySortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_BILL_PAY_SORT_KEYS);
|
|
@@ -61,7 +61,7 @@ export declare const initialCreditAcc: CreditAccount;
|
|
|
61
61
|
export declare const initialDebitCardSummaries: DebitCardSummaries;
|
|
62
62
|
export declare const initialResendRevokeCardInvite: ResendRevokeCardInvite;
|
|
63
63
|
export declare const initialCreditAccountRepayment: CreditAccountRepayment;
|
|
64
|
-
export declare const toChargeCardSortKeyType: (v: string) => "status" | "owner" | "cardName" | "limit" | "department" | "cardType" | "utilisation";
|
|
64
|
+
export declare const toChargeCardSortKeyType: (v: string) => "status" | "accountType" | "owner" | "cardName" | "limit" | "department" | "cardType" | "utilisation";
|
|
65
65
|
export declare type ChargeCardViewSortKey = ReturnType<typeof toChargeCardSortKeyType>;
|
|
66
66
|
export declare const ALL_CASHBACK_SORT_KEYS: readonly ["month", "cashback"];
|
|
67
67
|
export declare const toCashbackSortKeyType: (v: string) => "month" | "cashback";
|
|
@@ -233,6 +233,8 @@ const getCardsBySortKey = (card, sortKey) => {
|
|
|
233
233
|
return card.cardName.toLowerCase();
|
|
234
234
|
case 'cardType':
|
|
235
235
|
return card.type.code;
|
|
236
|
+
case 'accountType':
|
|
237
|
+
return card.type.code.includes('credit') ? 'credit' : 'debit';
|
|
236
238
|
case 'status':
|
|
237
239
|
return card.status.code;
|
|
238
240
|
case 'utilisation':
|
|
@@ -42,6 +42,7 @@ export interface ReimbursementView extends Reimbursement {
|
|
|
42
42
|
approvers: Approvers;
|
|
43
43
|
submittedBy: User | undefined;
|
|
44
44
|
bulkSelectInfo?: RemiBulkSelectInfo;
|
|
45
|
+
createdByUser?: User;
|
|
45
46
|
}
|
|
46
47
|
export declare const getRemiList: (state: RootState, currentTimePeriod: TimePeriod, isBulkActionFeatureEnabled: boolean) => RemiListReport;
|
|
47
48
|
export declare const getApproversOrRejectors: (reimbursement: Reimbursement, entityApprovalStatusState: EntityApprovalStatusState, userState: UserState) => Approvers;
|
|
@@ -51,6 +51,7 @@ const getRemiList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
|
|
|
51
51
|
return {
|
|
52
52
|
...reimbursement,
|
|
53
53
|
submittedBy: (0, userSelector_1.getUserByUserId)(userState, reimbursement.reimburseeUserId),
|
|
54
|
+
createdByUser: (0, userSelector_1.getUserByUserId)(userState, reimbursement.createdBy),
|
|
54
55
|
approvers: approvers,
|
|
55
56
|
};
|
|
56
57
|
});
|
|
@@ -423,6 +424,14 @@ const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements) => {
|
|
|
423
424
|
reimbursementsWithNoSortKeyValue.push(reimbursement);
|
|
424
425
|
}
|
|
425
426
|
break;
|
|
427
|
+
case 'createdBy':
|
|
428
|
+
if (reimbursement.createdByUser != null) {
|
|
429
|
+
reimbursementsWithSortKeyValue.push(reimbursement);
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
reimbursementsWithNoSortKeyValue.push(reimbursement);
|
|
433
|
+
}
|
|
434
|
+
break;
|
|
426
435
|
}
|
|
427
436
|
});
|
|
428
437
|
const getColumnWiseSortOrder = (sortOrder) => {
|
|
@@ -430,6 +439,7 @@ const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements) => {
|
|
|
430
439
|
case 'reportName':
|
|
431
440
|
case 'type':
|
|
432
441
|
case 'status':
|
|
442
|
+
case 'createdBy':
|
|
433
443
|
return sortOrder === 'ascending' ? 'asc' : 'desc';
|
|
434
444
|
default:
|
|
435
445
|
return sortOrder === 'ascending' ? 'desc' : 'asc';
|
|
@@ -449,6 +459,8 @@ const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements) => {
|
|
|
449
459
|
return getStatusPerTab(reimbursement);
|
|
450
460
|
case 'amount':
|
|
451
461
|
return reimbursement.amount.amount ?? 0;
|
|
462
|
+
case 'createdBy':
|
|
463
|
+
return `${reimbursement.createdByUser?.firstName ?? ''} ${reimbursement.createdByUser?.lastName ?? ''}`.toLowerCase();
|
|
452
464
|
}
|
|
453
465
|
}, getColumnWiseSortOrder(sortOrder));
|
|
454
466
|
return [
|
|
@@ -38,7 +38,7 @@ export declare const toRemiSubTabTypeStrict: (v: string) => "rejected" | "failed
|
|
|
38
38
|
export type RemiSubTabType = ReturnType<typeof toRemiSubTabType>;
|
|
39
39
|
export declare const toRemiSubTabUnderScoreType: (v: string) => "rejected" | "failed" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "all" | "awaiting_approval" | "awaiting_my_approval" | "my_drafts" | "awaiting_all_approval";
|
|
40
40
|
export type RemiSubTabUnderScoreType = ReturnType<typeof toRemiSubTabUnderScoreType>;
|
|
41
|
-
declare const toReimbursementSortKeyType: (v: string) => "amount" | "status" | "type" | "submittedOn" | "reportName";
|
|
41
|
+
declare const toReimbursementSortKeyType: (v: string) => "amount" | "status" | "type" | "createdBy" | "submittedOn" | "reportName";
|
|
42
42
|
export type ReimbursementViewSortKey = ReturnType<typeof toReimbursementSortKeyType>;
|
|
43
43
|
export interface ReimbursementFilters {
|
|
44
44
|
categories: ReimbursementFilterCategory[];
|