@zeniai/client-epic-state 4.19.82 → 4.19.84-betaVR1
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/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/epic.d.ts +12 -1
- package/lib/epic.js +12 -1
- package/lib/esm/entity/account/accountPayload.js +2 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/epic.js +12 -1
- package/lib/esm/index.js +5 -3
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +24 -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 +34 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +57 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +68 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +42 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +24 -0
- package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +147 -1
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +401 -1
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +20 -1
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +224 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
- package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +2 -1
- package/lib/esm/zeniAPI.js +0 -2
- package/lib/index.d.ts +6 -4
- package/lib/index.js +66 -31
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +15 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +28 -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 +38 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +62 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +14 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +72 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +13 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +47 -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 +107 -0
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +158 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +70 -3
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +403 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +11 -3
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +21 -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 +223 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +124 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +2 -1
- package/lib/zeniAPI.js +0 -2
- package/package.json +2 -2
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
|
@@ -9,6 +9,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
11
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
12
|
+
const missingReceiptsPayload_1 = require("../payload/missingReceiptsPayload");
|
|
13
|
+
const missingReceiptsViewReducer_1 = require("../reducers/missingReceiptsViewReducer");
|
|
12
14
|
function getExpenseAutomationMissingReceiptsView(state) {
|
|
13
15
|
const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
|
|
14
16
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
@@ -53,6 +55,110 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
53
55
|
const completionStatus = missingReceiptsCompletionStatus != null
|
|
54
56
|
? missingReceiptsCompletionStatus
|
|
55
57
|
: 'incomplete';
|
|
58
|
+
const { bulkUpload, pendingMissingReceiptsTabNavigation, } = expenseAutomationMissingReceiptsViewState;
|
|
59
|
+
const currentBatchStatus = bulkUpload.currentBatchId != null
|
|
60
|
+
? bulkUpload.batchStatusById[bulkUpload.currentBatchId]
|
|
61
|
+
: undefined;
|
|
62
|
+
const batchList = monthYearPeriodId != null
|
|
63
|
+
? bulkUpload.batchListByPeriod[monthYearPeriodId] ?? []
|
|
64
|
+
: [];
|
|
65
|
+
/**
|
|
66
|
+
* Primary "Unmatched" batch = first completed batch in platform list order, preferring the
|
|
67
|
+
* first batch that still has un_matched/no_match work when any completed batch has such work.
|
|
68
|
+
* Batches without details yet: wait if the list row still reports unmatched work; otherwise skip
|
|
69
|
+
* so we do not block the whole tab while other rows are not fetched yet.
|
|
70
|
+
*/
|
|
71
|
+
const primaryBatchIdFromDetailsOrder = getPrimaryBatchIdFromBatchListOrder(batchList, bulkUpload.batchDetailsById, bulkUpload.failedBatchDetailIds);
|
|
72
|
+
/** During upload/matching, the in-flight batch may not appear in batchList yet — prefer currentBatchId. */
|
|
73
|
+
const unmatchedSectionBatchId = bulkUpload.phase === 'matching' || bulkUpload.phase === 'uploading'
|
|
74
|
+
? bulkUpload.currentBatchId ?? primaryBatchIdFromDetailsOrder
|
|
75
|
+
: primaryBatchIdFromDetailsOrder;
|
|
76
|
+
const completedBatchesInApiOrder = batchList.filter((b) => (0, missingReceiptsPayload_1.isBatchListStatusCompleted)(b.status));
|
|
77
|
+
const currentBatchDetails = unmatchedSectionBatchId != null
|
|
78
|
+
? bulkUpload.batchDetailsById[unmatchedSectionBatchId]
|
|
79
|
+
: undefined;
|
|
80
|
+
const resolvedFiles = currentBatchDetails?.files.map((file) => resolveBatchFile(file, currentBatchDetails.batchId, transactionState));
|
|
81
|
+
const failedIds = new Set(bulkUpload.failedBatchDetailIds);
|
|
82
|
+
const hasMoreBatchDetails = completedBatchesInApiOrder.some((b) => bulkUpload.batchDetailsById[b.batchId] == null &&
|
|
83
|
+
!failedIds.has(b.batchId));
|
|
84
|
+
const getSortValue = (file) => {
|
|
85
|
+
const t = file.matchedTransaction;
|
|
86
|
+
if (t == null) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
switch (bulkUpload.sortKey) {
|
|
90
|
+
case 'vendor':
|
|
91
|
+
return (t.vendorName ?? t.description)?.toLowerCase() ?? null;
|
|
92
|
+
case 'category': {
|
|
93
|
+
const line = t.lines?.[0];
|
|
94
|
+
return line?.account?.accountName?.toLowerCase() ?? null;
|
|
95
|
+
}
|
|
96
|
+
case 'class': {
|
|
97
|
+
const line = t.lines?.[0];
|
|
98
|
+
return line?.class?.className?.toLowerCase() ?? null;
|
|
99
|
+
}
|
|
100
|
+
case 'date':
|
|
101
|
+
return t.date.valueOf();
|
|
102
|
+
case 'amount':
|
|
103
|
+
return t.amount.amount;
|
|
104
|
+
default:
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const bulkUploadSortDirection = bulkUpload.sortOrder === 'ascending' ? 'asc' : 'desc';
|
|
109
|
+
const matchedFiles = (0, orderBy_1.default)(resolvedFiles?.filter((f) => f.status === 'matched') ?? [], getSortValue, bulkUploadSortDirection);
|
|
110
|
+
const unmatchedFiles = (0, orderBy_1.default)(resolvedFiles?.filter((f) => f.status === 'un_matched' || f.status === 'no_match') ?? [], getSortValue, bulkUploadSortDirection);
|
|
111
|
+
const progress = currentBatchStatus != null
|
|
112
|
+
? {
|
|
113
|
+
...currentBatchStatus.progress,
|
|
114
|
+
percentage: currentBatchStatus.progress.total > 0
|
|
115
|
+
? Math.round((currentBatchStatus.progress.processed /
|
|
116
|
+
currentBatchStatus.progress.total) *
|
|
117
|
+
100)
|
|
118
|
+
: 0,
|
|
119
|
+
}
|
|
120
|
+
: { total: 0, processed: 0, percentage: 0 };
|
|
121
|
+
const batchListFetchState = bulkUpload.batchListFetchState;
|
|
122
|
+
/**
|
|
123
|
+
* When primary batch is not resolved yet, still aggregate unmatched files from every batch
|
|
124
|
+
* that has details loaded (otherwise past is empty and receipts vanish from the UI).
|
|
125
|
+
*/
|
|
126
|
+
const pastBatches = unmatchedSectionBatchId != null
|
|
127
|
+
? batchList.filter((b) => b.batchId !== unmatchedSectionBatchId)
|
|
128
|
+
: batchList;
|
|
129
|
+
const pastUnmatchedFiles = pastBatches.flatMap((b) => {
|
|
130
|
+
const details = bulkUpload.batchDetailsById[b.batchId];
|
|
131
|
+
if (details == null) {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
return details.files
|
|
135
|
+
.filter((f) => f.status === 'un_matched' || f.status === 'no_match')
|
|
136
|
+
.map((f) => resolveBatchFile(f, b.batchId, transactionState));
|
|
137
|
+
});
|
|
138
|
+
const completedTransactionsCacheKey = monthYearPeriodId != null
|
|
139
|
+
? (0, missingReceiptsViewReducer_1.getCompletedTransactionsCacheKey)(monthYearPeriodId, bulkUpload.sortKey, bulkUpload.sortOrder, bulkUpload.completedSubTab)
|
|
140
|
+
: undefined;
|
|
141
|
+
const completedTransactionsForPeriod = completedTransactionsCacheKey != null
|
|
142
|
+
? bulkUpload.completedTransactionsByPeriod[completedTransactionsCacheKey]
|
|
143
|
+
: undefined;
|
|
144
|
+
const completedTransactionIds = completedTransactionsForPeriod?.transactionIds ?? [];
|
|
145
|
+
const resolvedCompletedTransactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, completedTransactionIds);
|
|
146
|
+
const resolvedBatchDetails = currentBatchDetails != null && resolvedFiles != null
|
|
147
|
+
? {
|
|
148
|
+
batchId: currentBatchDetails.batchId,
|
|
149
|
+
createdAt: currentBatchDetails.createdAt,
|
|
150
|
+
files: resolvedFiles,
|
|
151
|
+
status: currentBatchDetails.status,
|
|
152
|
+
summary: currentBatchDetails.summary,
|
|
153
|
+
}
|
|
154
|
+
: undefined;
|
|
155
|
+
const manualSearchResults = bulkUpload.manualSearch.results.map((r) => {
|
|
156
|
+
const t = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, r.transactionId);
|
|
157
|
+
return {
|
|
158
|
+
...r,
|
|
159
|
+
vendorLogo: r.vendorLogo ?? t?.logo?.href,
|
|
160
|
+
};
|
|
161
|
+
});
|
|
56
162
|
return {
|
|
57
163
|
fetchState,
|
|
58
164
|
error,
|
|
@@ -61,5 +167,122 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
61
167
|
refreshStatus,
|
|
62
168
|
transactions: sortedTransactions,
|
|
63
169
|
completionStatus,
|
|
170
|
+
pendingMissingReceiptsTabNavigation: pendingMissingReceiptsTabNavigation ?? null,
|
|
171
|
+
bulkUpload: {
|
|
172
|
+
phase: bulkUpload.phase,
|
|
173
|
+
uploadStatus: bulkUpload.uploadStatus,
|
|
174
|
+
batchStatus: currentBatchStatus,
|
|
175
|
+
batchDetails: resolvedBatchDetails,
|
|
176
|
+
completedSubTab: bulkUpload.completedSubTab,
|
|
177
|
+
completedTransactions: {
|
|
178
|
+
fetchState: completedTransactionsForPeriod?.fetchState ?? {
|
|
179
|
+
fetchState: 'Not-Started',
|
|
180
|
+
error: undefined,
|
|
181
|
+
},
|
|
182
|
+
nextPageToken: completedTransactionsForPeriod?.nextPageToken ?? null,
|
|
183
|
+
totalCount: completedTransactionsForPeriod?.totalCount ?? 0,
|
|
184
|
+
transactions: resolvedCompletedTransactions,
|
|
185
|
+
},
|
|
186
|
+
matchedFiles,
|
|
187
|
+
unmatchedFiles,
|
|
188
|
+
progress,
|
|
189
|
+
currentResultsTab: bulkUpload.currentResultsTab,
|
|
190
|
+
sortKey: bulkUpload.sortKey,
|
|
191
|
+
sortOrder: bulkUpload.sortOrder,
|
|
192
|
+
batchList,
|
|
193
|
+
batchListFetchState,
|
|
194
|
+
pastBatches,
|
|
195
|
+
pastUnmatchedFiles,
|
|
196
|
+
confirmMatchStatus: bulkUpload.confirmMatchStatus,
|
|
197
|
+
manualSearchUiResetKey: bulkUpload.manualSearchUiResetKey,
|
|
198
|
+
hasMoreBatchDetails,
|
|
199
|
+
batchDetailsPaginationState: bulkUpload.batchDetailsPaginationState,
|
|
200
|
+
manualSearch: {
|
|
201
|
+
...bulkUpload.manualSearch,
|
|
202
|
+
results: manualSearchResults,
|
|
203
|
+
},
|
|
204
|
+
uploadProgress: bulkUpload.uploadProgress,
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function batchDetailsHasUnmatchedWork(details) {
|
|
209
|
+
return details.files.some((f) => f.status === 'un_matched' || f.status === 'no_match');
|
|
210
|
+
}
|
|
211
|
+
/** List row summary before batch details load — aligns with unmatched / possible-match work. */
|
|
212
|
+
function batchListItemHasUnmatchedWork(batch) {
|
|
213
|
+
return batch.noMatchCount > 0 || batch.possibleMatchesCount > 0;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* `batchList` must match platform order (same sequence as the bulk-upload batches API). Picks the
|
|
217
|
+
* primary batch for the top "Unmatched" section. Skips failed detail fetches.
|
|
218
|
+
*
|
|
219
|
+
* If details are not loaded for an earlier list row but that row reports no unmatched work, we
|
|
220
|
+
* skip it so later rows with loaded details can be primary (avoids an empty tab when the first
|
|
221
|
+
* fetch page only loaded later batches). If the list reports unmatched work but details are still
|
|
222
|
+
* loading, we wait (undefined) so primary order stays correct once details arrive.
|
|
223
|
+
*/
|
|
224
|
+
function getPrimaryBatchIdFromBatchListOrder(batchListInPlatformOrder, batchDetailsById, failedBatchDetailIds) {
|
|
225
|
+
const failedIds = new Set(failedBatchDetailIds);
|
|
226
|
+
const anyCompletedBatchHasUnmatchedWork = batchListInPlatformOrder.some((b) => {
|
|
227
|
+
if (failedIds.has(b.batchId)) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
const d = batchDetailsById[b.batchId];
|
|
231
|
+
if (d != null &&
|
|
232
|
+
d.status === 'completed' &&
|
|
233
|
+
batchDetailsHasUnmatchedWork(d)) {
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
return d == null && batchListItemHasUnmatchedWork(b);
|
|
237
|
+
});
|
|
238
|
+
for (const batch of batchListInPlatformOrder) {
|
|
239
|
+
if (failedIds.has(batch.batchId)) {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
const details = batchDetailsById[batch.batchId];
|
|
243
|
+
if (details == null) {
|
|
244
|
+
if (batchListItemHasUnmatchedWork(batch)) {
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
if (details.status !== 'completed') {
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (anyCompletedBatchHasUnmatchedWork) {
|
|
253
|
+
if (batchDetailsHasUnmatchedWork(details)) {
|
|
254
|
+
return batch.batchId;
|
|
255
|
+
}
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
return batch.batchId;
|
|
259
|
+
}
|
|
260
|
+
return undefined;
|
|
261
|
+
}
|
|
262
|
+
function resolveBatchFile(file, batchId, transactionState) {
|
|
263
|
+
const matchedTransaction = file.matchedTransactionId != null
|
|
264
|
+
? (0, transactionSelector_1.getSupportedTransactionById)(transactionState, file.matchedTransactionId)
|
|
265
|
+
: undefined;
|
|
266
|
+
const candidates = file.candidates
|
|
267
|
+
?.map((ref) => {
|
|
268
|
+
const transaction = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, ref.transactionId);
|
|
269
|
+
return transaction != null
|
|
270
|
+
? { transaction, matchScore: ref.matchScore }
|
|
271
|
+
: undefined;
|
|
272
|
+
})
|
|
273
|
+
.filter((c) => c != null);
|
|
274
|
+
return {
|
|
275
|
+
attachmentId: file.attachmentId,
|
|
276
|
+
batchId,
|
|
277
|
+
fileDownloadUrl: file.fileDownloadUrl,
|
|
278
|
+
fileId: file.fileId,
|
|
279
|
+
filename: file.filename,
|
|
280
|
+
filePreviewUrl: file.filePreviewUrl,
|
|
281
|
+
status: file.status,
|
|
282
|
+
matchedTransaction,
|
|
283
|
+
candidates: candidates != null && candidates.length > 0
|
|
284
|
+
? candidates
|
|
285
|
+
: undefined,
|
|
286
|
+
matchSource: file.matchSource,
|
|
64
287
|
};
|
|
65
288
|
}
|
|
@@ -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
|
};
|
|
@@ -3,6 +3,7 @@ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderType
|
|
|
3
3
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
4
4
|
export declare const toMissingReceiptsSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class";
|
|
5
5
|
export type MissingReceiptsSortKey = ReturnType<typeof toMissingReceiptsSortKey>;
|
|
6
|
+
export type BulkUploadSortKey = 'amount' | 'category' | 'class' | 'date' | 'vendor';
|
|
6
7
|
export interface MissingReceiptsViewUIState {
|
|
7
8
|
scrollPosition: {
|
|
8
9
|
scrollTop: number;
|
|
@@ -12,7 +13,130 @@ export interface MissingReceiptsViewUIState {
|
|
|
12
13
|
sortKey: MissingReceiptsSortKey;
|
|
13
14
|
sortOrder: SortOrder;
|
|
14
15
|
}
|
|
16
|
+
export type BatchStatusValue = 'pending' | 'processing' | 'completed';
|
|
17
|
+
export type BatchFileStatus = 'matched' | 'un_matched' | 'no_match' | 'failed';
|
|
18
|
+
export type BulkUploadPhase = 'idle' | 'uploading' | 'matching' | 'completed';
|
|
19
|
+
export type BulkUploadResultsTab = 'completed' | 'unmatched';
|
|
20
|
+
export type MissingReceiptsTab = 'missing' | BulkUploadResultsTab;
|
|
21
|
+
export type CompletedSubTab = 'all' | 'ai_accountant' | 'manual';
|
|
22
|
+
export type MatchSource = 'ai' | 'manual';
|
|
23
|
+
export interface CandidateRef {
|
|
24
|
+
matchScore: number;
|
|
25
|
+
transactionId: ID;
|
|
26
|
+
}
|
|
27
|
+
export interface MatchCandidate {
|
|
28
|
+
amount: number;
|
|
29
|
+
currencyCode: string;
|
|
30
|
+
matchScore: number;
|
|
31
|
+
transactionDate: string;
|
|
32
|
+
transactionId: ID;
|
|
33
|
+
transactionType: string;
|
|
34
|
+
vendorName: string;
|
|
35
|
+
vendorLogo?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface BatchFile {
|
|
38
|
+
attachmentId: ID;
|
|
39
|
+
fileDownloadUrl: string | null;
|
|
40
|
+
fileId: ID;
|
|
41
|
+
filename: string;
|
|
42
|
+
filePreviewUrl: string | null;
|
|
43
|
+
status: BatchFileStatus;
|
|
44
|
+
candidates?: CandidateRef[];
|
|
45
|
+
matchedTransactionId?: ID;
|
|
46
|
+
matchSource?: MatchSource;
|
|
47
|
+
}
|
|
48
|
+
export interface BatchSummary {
|
|
49
|
+
failed: number;
|
|
50
|
+
matched: number;
|
|
51
|
+
noMatch: number;
|
|
52
|
+
possibleMatches: number;
|
|
53
|
+
total: number;
|
|
54
|
+
}
|
|
55
|
+
export interface BatchStatus {
|
|
56
|
+
batchId: ID;
|
|
57
|
+
progress: {
|
|
58
|
+
processed: number;
|
|
59
|
+
total: number;
|
|
60
|
+
};
|
|
61
|
+
status: BatchStatusValue;
|
|
62
|
+
}
|
|
63
|
+
export interface BatchDetails {
|
|
64
|
+
batchId: ID;
|
|
65
|
+
createdAt: string;
|
|
66
|
+
files: BatchFile[];
|
|
67
|
+
status: BatchStatusValue;
|
|
68
|
+
summary: BatchSummary;
|
|
69
|
+
}
|
|
70
|
+
export interface BatchListItem {
|
|
71
|
+
batchId: ID;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
failedCount: number;
|
|
74
|
+
matchedCount: number;
|
|
75
|
+
noMatchCount: number;
|
|
76
|
+
possibleMatchesCount: number;
|
|
77
|
+
status: string;
|
|
78
|
+
totalFiles: number;
|
|
79
|
+
}
|
|
80
|
+
export interface ManualSearchResult {
|
|
81
|
+
amount: number;
|
|
82
|
+
currencyCode: string;
|
|
83
|
+
entityId: string;
|
|
84
|
+
memo: string;
|
|
85
|
+
transactionDate: string;
|
|
86
|
+
transactionId: ID;
|
|
87
|
+
transactionType: string;
|
|
88
|
+
vendorName: string;
|
|
89
|
+
/** Present when API/merged transaction state supplies a logo URL. */
|
|
90
|
+
vendorLogo?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface ManualSearchState {
|
|
93
|
+
fetchState: FetchStateAndError;
|
|
94
|
+
/** True while appending the next page (initial search uses fetchState only). */
|
|
95
|
+
isLoadingMore: boolean;
|
|
96
|
+
nextPageToken: string | null;
|
|
97
|
+
pageSize: number;
|
|
98
|
+
results: ManualSearchResult[];
|
|
99
|
+
searchQuery: string;
|
|
100
|
+
totalCount: number;
|
|
101
|
+
}
|
|
102
|
+
export type CompletedTransactionsMatchType = 'all' | 'ai_accountant' | 'manual';
|
|
103
|
+
export interface CompletedTransactionsState {
|
|
104
|
+
fetchState: FetchStateAndError;
|
|
105
|
+
nextPageToken: string | null;
|
|
106
|
+
totalCount: number;
|
|
107
|
+
transactionIds: ID[];
|
|
108
|
+
}
|
|
109
|
+
export interface BulkUploadState {
|
|
110
|
+
batchDetailsById: Record<ID, BatchDetails>;
|
|
111
|
+
batchDetailsPaginationState: FetchStateAndError;
|
|
112
|
+
batchListByPeriod: Record<MonthYearPeriodId, BatchListItem[]>;
|
|
113
|
+
batchListFetchState: FetchStateAndError;
|
|
114
|
+
batchStatusById: Record<ID, BatchStatus>;
|
|
115
|
+
completedSubTab: CompletedSubTab;
|
|
116
|
+
completedTransactionsByPeriod: Record<string, CompletedTransactionsState>;
|
|
117
|
+
confirmMatchStatus: FetchStateAndError;
|
|
118
|
+
currentResultsTab: BulkUploadResultsTab;
|
|
119
|
+
failedBatchDetailIds: ID[];
|
|
120
|
+
/**
|
|
121
|
+
* Incremented when manual search Redux state is cleared so Unmatched `ManualSearchInput`
|
|
122
|
+
* instances remount and drop local query text.
|
|
123
|
+
*/
|
|
124
|
+
manualSearch: ManualSearchState;
|
|
125
|
+
manualSearchUiResetKey: number;
|
|
126
|
+
phase: BulkUploadPhase;
|
|
127
|
+
sortKey: BulkUploadSortKey;
|
|
128
|
+
sortOrder: SortOrder;
|
|
129
|
+
uploadProgress: number;
|
|
130
|
+
uploadStatus: FetchStateAndError;
|
|
131
|
+
currentBatchId?: ID;
|
|
132
|
+
}
|
|
15
133
|
export interface MissingReceiptsViewState extends FetchedState {
|
|
134
|
+
bulkUpload: BulkUploadState;
|
|
135
|
+
/**
|
|
136
|
+
* When set, the app shell should switch the Missing Receipts sub-tab (e.g. to Unmatched)
|
|
137
|
+
* once, then clear via `clearMissingReceiptsTabNavigation`.
|
|
138
|
+
*/
|
|
139
|
+
pendingMissingReceiptsTabNavigation: BulkUploadResultsTab | null;
|
|
16
140
|
refreshStatus: FetchStateAndError;
|
|
17
141
|
transactionIdsBySelectedPeriod: Record<MonthYearPeriodId, ID[]>;
|
|
18
142
|
uiState: MissingReceiptsViewUIState;
|
|
@@ -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;
|
package/lib/zeniAPI.js
CHANGED
|
@@ -82,8 +82,6 @@ class ZeniAPIClient {
|
|
|
82
82
|
return (0, rxjs_1.from)(promise);
|
|
83
83
|
}
|
|
84
84
|
postFormData(restEndPoint, formData, signal) {
|
|
85
|
-
// Use apiHeaders for auth headers, then remove Content-Type
|
|
86
|
-
// so the browser sets multipart/form-data with the correct boundary
|
|
87
85
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
88
86
|
const { 'Content-Type': _contentType, ...headers } = this.apiHeaders();
|
|
89
87
|
const promise = (0, cross_fetch_1.fetch)(restEndPoint, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.
|
|
3
|
+
"version": "4.19.84-betaVR1",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"find-dead-code": "ts-prune | grep -v '(used in module)'",
|
|
112
112
|
"find-unused-exports": "ts-unused-exports ./tsconfig.json",
|
|
113
113
|
"circular-dependency": "npx madge --circular --extensions ts ./src",
|
|
114
|
-
"build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\"
|
|
114
|
+
"build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\"",
|
|
115
115
|
"only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
116
116
|
"only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
117
117
|
"format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
|