@zeniai/client-epic-state 4.19.88-betaVR3 → 4.19.89

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.
Files changed (113) hide show
  1. package/lib/entity/account/accountPayload.d.ts +0 -2
  2. package/lib/entity/account/accountPayload.js +0 -2
  3. package/lib/entity/account/accountState.d.ts +0 -2
  4. package/lib/entity/aiCfo/aiCfoSelector.d.ts +2 -1
  5. package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
  6. package/lib/entity/depositAccount/depositAccount.js +1 -8
  7. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  8. package/lib/entity/snackbar/snackbarTypes.js +0 -1
  9. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -3
  10. package/lib/entity/transaction/payloadTypes/transactionPayload.js +0 -11
  11. package/lib/entity/transaction/stateTypes/transaction.d.ts +0 -3
  12. package/lib/epic.d.ts +1 -13
  13. package/lib/epic.js +1 -13
  14. package/lib/esm/entity/account/accountPayload.js +0 -2
  15. package/lib/esm/entity/depositAccount/depositAccount.js +1 -8
  16. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
  17. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +0 -11
  18. package/lib/esm/epic.js +1 -13
  19. package/lib/esm/index.js +5 -11
  20. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +1 -82
  21. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +2 -8
  22. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +5 -7
  23. package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +1 -189
  24. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -433
  25. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -23
  26. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +1 -244
  27. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -2
  28. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -44
  29. package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +1 -2
  30. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +0 -10
  31. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +0 -1
  32. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
  33. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
  34. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
  35. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
  36. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +3 -3
  37. package/lib/esm/zeniAPI.js +2 -0
  38. package/lib/index.d.ts +7 -12
  39. package/lib/index.js +32 -88
  40. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  41. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +0 -7
  42. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +1 -15
  43. package/lib/view/aiCfoView/aiCfoViewReducer.js +2 -83
  44. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +1 -4
  45. package/lib/view/aiCfoView/aiCfoViewSelector.js +2 -9
  46. package/lib/view/aiCfoView/aiCfoViewState.d.ts +1 -18
  47. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  48. package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +5 -7
  49. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  50. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +0 -118
  51. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +0 -201
  52. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +3 -76
  53. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -434
  54. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +3 -11
  55. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -24
  56. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -69
  57. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -1
  58. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
  59. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -243
  60. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -2
  61. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +0 -142
  62. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -54
  63. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -2
  64. package/lib/view/expenseAutomationView/types/transactionsViewState.js +1 -2
  65. package/lib/view/spendManagement/billPay/billList/billListSelector.js +0 -10
  66. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  67. package/lib/view/spendManagement/billPay/billList/billListState.js +0 -1
  68. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  69. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
  70. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
  71. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +0 -1
  72. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
  73. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  74. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
  75. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +3 -3
  76. package/lib/zeniAPI.js +2 -0
  77. package/package.json +1 -1
  78. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +0 -29
  79. package/lib/esm/view/expenseAutomationView/bulkUploadTiming.js +0 -10
  80. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +0 -29
  81. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +0 -49
  82. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +0 -40
  83. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +0 -47
  84. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +0 -61
  85. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +0 -33
  86. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +0 -56
  87. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -77
  88. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +0 -79
  89. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +0 -24
  90. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +0 -8
  91. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +0 -33
  92. package/lib/view/expenseAutomationView/bulkUploadTiming.d.ts +0 -10
  93. package/lib/view/expenseAutomationView/bulkUploadTiming.js +0 -13
  94. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +0 -18
  95. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +0 -33
  96. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +0 -7
  97. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +0 -53
  98. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +0 -8
  99. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +0 -44
  100. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +0 -7
  101. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +0 -51
  102. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +0 -8
  103. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +0 -65
  104. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +0 -8
  105. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +0 -37
  106. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +0 -9
  107. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +0 -61
  108. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +0 -14
  109. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -81
  110. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +0 -25
  111. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +0 -85
  112. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +0 -7
  113. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +0 -28
@@ -8,10 +8,7 @@ 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");
13
11
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
14
- const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
15
12
  function getExpenseAutomationMissingReceiptsView(state) {
16
13
  const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
17
14
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
@@ -56,131 +53,6 @@ function getExpenseAutomationMissingReceiptsView(state) {
56
53
  const completionStatus = missingReceiptsCompletionStatus != null
57
54
  ? missingReceiptsCompletionStatus
58
55
  : '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
- });
184
56
  return {
185
57
  fetchState,
186
58
  error,
@@ -189,120 +61,5 @@ function getExpenseAutomationMissingReceiptsView(state) {
189
61
  refreshStatus,
190
62
  transactions: sortedTransactions,
191
63
  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,
307
64
  };
308
65
  }
@@ -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, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
19
+ const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, 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,7 +100,6 @@ function getExpenseAutomationTransactionView(state) {
100
100
  completionStatus,
101
101
  totalCountByTab,
102
102
  fetchStateByTransactionTabs: fetchStateByTab,
103
- uploadReceiptStatusById,
104
103
  selectedTransactionId,
105
104
  selectedTransactionLineId,
106
105
  };
@@ -12,149 +12,7 @@ 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
- }
151
15
  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;
158
16
  refreshStatus: FetchStateAndError;
159
17
  transactionIdsBySelectedPeriod: Record<MonthYearPeriodId, ID[]>;
160
18
  uiState: MissingReceiptsViewUIState;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.toMissingReceiptsSortKey = void 0;
5
4
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
6
5
  const MISSING_RECEIPTS_SORT_KEYS = [
7
6
  'vendor',
@@ -12,55 +11,3 @@ const MISSING_RECEIPTS_SORT_KEYS = [
12
11
  ];
13
12
  const toMissingReceiptsSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, MISSING_RECEIPTS_SORT_KEYS);
14
13
  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" | "payment_account" | "transaction_type" | "memo_and_receipt";
18
+ export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class" | "memo" | "transaction_type";
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,7 +97,6 @@ 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>;
101
100
  selectedTransactionId?: ID;
102
101
  selectedTransactionLineId?: ID;
103
102
  }
@@ -7,11 +7,10 @@ const TRANSACTIONS_SORT_KEYS = [
7
7
  'vendor',
8
8
  'amount',
9
9
  'transaction_type',
10
- 'payment_account',
11
10
  'date',
12
11
  'category',
13
12
  'class',
14
- 'memo_and_receipt',
13
+ 'memo',
15
14
  ];
16
15
  const toTransactionsSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, TRANSACTIONS_SORT_KEYS);
17
16
  exports.toTransactionsSortKey = toTransactionsSortKey;
@@ -424,14 +424,6 @@ 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;
435
427
  case 'dueDate':
436
428
  if (currentTab === 'draft') {
437
429
  if (Boolean(transaction.dueDate) === true) {
@@ -534,8 +526,6 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
534
526
  return transaction.totalAmountInUSD?.amount ?? 0;
535
527
  case 'paymentMethod':
536
528
  return transaction.billPayInfo.billPaymentMethodType.name;
537
- case 'invoiceNumber':
538
- return transaction.documentId;
539
529
  }
540
530
  }, getColumnWiseSortOrder(sortOrder));
541
531
  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" | "invoiceNumber" | "invoiceDate";
40
+ declare const toBillPaySortKeyType: (v: string) => "amount" | "status" | "name" | "dueDate" | "paymentMethod" | "invoiceDate";
41
41
  export declare type BillPayViewSortKey = ReturnType<typeof toBillPaySortKeyType>;
42
42
  export interface BillPayFilters {
43
43
  categories: BillPayFilterCategory[];
@@ -47,7 +47,6 @@ const ALL_BILL_PAY_SORT_KEYS = [
47
47
  'invoiceDate',
48
48
  'name',
49
49
  'paymentMethod',
50
- 'invoiceNumber',
51
50
  ];
52
51
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
53
52
  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" | "accountType" | "owner" | "cardName" | "limit" | "department" | "cardType" | "utilisation";
64
+ export declare const toChargeCardSortKeyType: (v: string) => "status" | "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";
@@ -78,7 +78,6 @@ const ALL_CHARGE_CARD_SORT_KEYS = [
78
78
  'cardName',
79
79
  'department',
80
80
  'cardType',
81
- 'accountType',
82
81
  'status',
83
82
  'utilisation',
84
83
  'limit',
@@ -233,8 +233,6 @@ 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';
238
236
  case 'status':
239
237
  return card.status.code;
240
238
  case 'utilisation':
@@ -42,7 +42,6 @@ export interface ReimbursementView extends Reimbursement {
42
42
  approvers: Approvers;
43
43
  submittedBy: User | undefined;
44
44
  bulkSelectInfo?: RemiBulkSelectInfo;
45
- createdByUser?: User;
46
45
  }
47
46
  export declare const getRemiList: (state: RootState, currentTimePeriod: TimePeriod, isBulkActionFeatureEnabled: boolean) => RemiListReport;
48
47
  export declare const getApproversOrRejectors: (reimbursement: Reimbursement, entityApprovalStatusState: EntityApprovalStatusState, userState: UserState) => Approvers;
@@ -51,7 +51,6 @@ 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),
55
54
  approvers: approvers,
56
55
  };
57
56
  });
@@ -424,14 +423,6 @@ const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements) => {
424
423
  reimbursementsWithNoSortKeyValue.push(reimbursement);
425
424
  }
426
425
  break;
427
- case 'createdBy':
428
- if (reimbursement.createdByUser != null) {
429
- reimbursementsWithSortKeyValue.push(reimbursement);
430
- }
431
- else {
432
- reimbursementsWithNoSortKeyValue.push(reimbursement);
433
- }
434
- break;
435
426
  }
436
427
  });
437
428
  const getColumnWiseSortOrder = (sortOrder) => {
@@ -439,7 +430,6 @@ const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements) => {
439
430
  case 'reportName':
440
431
  case 'type':
441
432
  case 'status':
442
- case 'createdBy':
443
433
  return sortOrder === 'ascending' ? 'asc' : 'desc';
444
434
  default:
445
435
  return sortOrder === 'ascending' ? 'desc' : 'asc';
@@ -459,8 +449,6 @@ const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements) => {
459
449
  return getStatusPerTab(reimbursement);
460
450
  case 'amount':
461
451
  return reimbursement.amount.amount ?? 0;
462
- case 'createdBy':
463
- return `${reimbursement.createdByUser?.firstName ?? ''} ${reimbursement.createdByUser?.lastName ?? ''}`.toLowerCase();
464
452
  }
465
453
  }, getColumnWiseSortOrder(sortOrder));
466
454
  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" | "createdBy" | "submittedOn" | "reportName";
41
+ declare const toReimbursementSortKeyType: (v: string) => "amount" | "status" | "type" | "submittedOn" | "reportName";
42
42
  export type ReimbursementViewSortKey = ReturnType<typeof toReimbursementSortKeyType>;
43
43
  export interface ReimbursementFilters {
44
44
  categories: ReimbursementFilterCategory[];