@zeniai/client-epic-state 4.19.94 → 4.19.95
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/depositAccount/depositAccount.d.ts +1 -1
- package/lib/entity/depositAccount/depositAccount.js +8 -1
- package/lib/entity/reimbursement/reimbursementPayload.d.ts +2 -0
- package/lib/entity/reimbursement/reimbursementPayload.js +7 -0
- package/lib/entity/reimbursement/reimbursementState.d.ts +2 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/task/taskPayload.d.ts +1 -0
- package/lib/entity/task/taskPayload.js +1 -0
- package/lib/entity/task/taskState.d.ts +1 -0
- package/lib/entity/userGroups/userGroupsPayload.d.ts +7 -0
- package/lib/entity/userGroups/userGroupsPayload.js +10 -0
- package/lib/entity/userGroups/userGroupsReducer.d.ts +8 -0
- package/lib/entity/userGroups/userGroupsReducer.js +29 -0
- package/lib/entity/userGroups/userGroupsSelector.d.ts +4 -0
- package/lib/entity/userGroups/userGroupsSelector.js +12 -0
- package/lib/entity/userGroups/userGroupsState.d.ts +9 -0
- package/lib/entity/userGroups/userGroupsState.js +2 -0
- package/lib/epic.d.ts +12 -1
- package/lib/epic.js +12 -1
- package/lib/esm/entity/account/accountPayload.js +2 -0
- package/lib/esm/entity/depositAccount/depositAccount.js +8 -1
- package/lib/esm/entity/reimbursement/reimbursementPayload.js +7 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/entity/task/taskPayload.js +1 -0
- package/lib/esm/entity/userGroups/userGroupsPayload.js +7 -0
- package/lib/esm/entity/userGroups/userGroupsReducer.js +25 -0
- package/lib/esm/entity/userGroups/userGroupsSelector.js +8 -0
- package/lib/esm/entity/userGroups/userGroupsState.js +1 -0
- package/lib/esm/epic.js +12 -1
- package/lib/esm/index.js +9 -3
- package/lib/esm/reducer.js +6 -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/taskManager/taskDetailView/taskDetailSelector.js +1 -1
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +3 -1
- package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +65 -0
- package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +16 -0
- package/lib/esm/view/userGroupListView/userGroupListViewState.js +1 -0
- package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +11 -0
- package/lib/esm/zeniAPI.js +0 -2
- package/lib/index.d.ts +8 -4
- package/lib/index.js +82 -32
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
- 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/taskManager/taskDetailView/taskDetailSelector.js +1 -1
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +1 -0
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +2 -0
- package/lib/view/taskManager/taskListView/taskListSelector.js +3 -1
- package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +23 -0
- package/lib/view/userGroupListView/userGroupListViewReducer.js +69 -0
- package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +7 -0
- package/lib/view/userGroupListView/userGroupListViewSelector.js +20 -0
- package/lib/view/userGroupListView/userGroupListViewState.d.ts +8 -0
- package/lib/view/userGroupListView/userGroupListViewState.js +2 -0
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +3 -1
- package/lib/view/userListView/fetchUserListByTypeEpic.js +11 -0
- package/lib/view/userListView/userListViewPayload.d.ts +2 -0
- package/lib/zeniAPI.js +0 -2
- package/package.json +2 -2
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearExpenseAutomationMissingReceiptsView = exports.markMissingReceiptAsDone = exports.updateMissingReceiptsUIState = exports.updateMissingReceiptUploadState = exports.uploadMissingReceiptSuccess = exports.fetchMissingReceiptsFailure = exports.fetchMissingReceiptsSuccess = exports.fetchMissingReceipts = exports.initialState = void 0;
|
|
4
|
+
exports.fetchCompletedTransactionsFailure = exports.fetchCompletedTransactionsSuccess = exports.fetchCompletedTransactions = exports.acknowledgeBulkUploadConfirmMatchComplete = exports.clearManualSearchResults = exports.searchTransactionsForManualMatchFailure = exports.searchTransactionsForManualMatchSuccess = exports.searchTransactionsForManualMatch = exports.clearBulkUpload = exports.setBulkUploadSortConfig = exports.setBulkUploadCompletedSubTab = exports.setBulkUploadResultsTab = exports.confirmBulkUploadMatchFailure = exports.confirmBulkUploadMatchSuccess = exports.confirmBulkUploadMatch = exports.fetchBulkUploadBatchesFailure = exports.fetchBulkUploadBatchesSuccess = exports.fetchBulkUploadBatches = exports.fetchMoreBatchDetailsFailure = exports.fetchMoreBatchDetailsComplete = exports.fetchMoreBatchDetails = exports.setInitialBatchDetailsLoading = exports.batchDetailFetchFailed = exports.storeBatchDetails = exports.fetchBulkUploadBatchDetailsFailure = exports.fetchBulkUploadBatchDetailsSuccess = exports.clearMissingReceiptsTabNavigation = exports.requestMissingReceiptsTabNavigation = exports.pusherBatchStatusUpdate = exports.bulkUploadAutomatchingTimedOut = exports.bulkUploadReceiptsFailure = exports.bulkUploadReceiptsSuccess = exports.updateBulkUploadProgress = exports.bulkUploadReceipts = exports.clearExpenseAutomationMissingReceiptsView = exports.markMissingReceiptAsDone = exports.updateMissingReceiptsUIState = exports.updateMissingReceiptUploadState = exports.uploadMissingReceiptSuccess = exports.fetchMissingReceiptsFailure = exports.fetchMissingReceiptsSuccess = exports.fetchMissingReceipts = exports.fetchBulkUploadBatchDetails = exports.initialState = exports.initialBulkUploadState = exports.getCompletedTransactionsCacheKey = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
|
+
const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
|
|
8
|
+
const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => `completed-${subTab}-${sortKey}-${sortOrder === 'ascending' ? 'asc' : 'desc'}-${periodId}`;
|
|
9
|
+
exports.getCompletedTransactionsCacheKey = getCompletedTransactionsCacheKey;
|
|
10
|
+
exports.initialBulkUploadState = {
|
|
11
|
+
batchDetailsById: {},
|
|
12
|
+
batchDetailsPaginationState: { fetchState: 'Not-Started', error: undefined },
|
|
13
|
+
batchListByPeriod: {},
|
|
14
|
+
batchListFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
15
|
+
batchStatusById: {},
|
|
16
|
+
completedSubTab: 'all',
|
|
17
|
+
completedTransactionsByPeriod: {},
|
|
18
|
+
confirmMatchStatus: { fetchState: 'Not-Started', error: undefined },
|
|
19
|
+
currentBatchId: undefined,
|
|
20
|
+
currentResultsTab: 'unmatched',
|
|
21
|
+
failedBatchDetailIds: [],
|
|
22
|
+
manualSearchUiResetKey: 0,
|
|
23
|
+
manualSearch: {
|
|
24
|
+
fetchState: { fetchState: 'Not-Started', error: undefined },
|
|
25
|
+
isLoadingMore: false,
|
|
26
|
+
nextPageToken: null,
|
|
27
|
+
pageSize: 25,
|
|
28
|
+
results: [],
|
|
29
|
+
searchQuery: '',
|
|
30
|
+
totalCount: 0,
|
|
31
|
+
},
|
|
32
|
+
phase: 'idle',
|
|
33
|
+
sortKey: 'date',
|
|
34
|
+
sortOrder: 'descending',
|
|
35
|
+
uploadProgress: 0,
|
|
36
|
+
uploadStatus: { fetchState: 'Not-Started', error: undefined },
|
|
37
|
+
};
|
|
7
38
|
exports.initialState = {
|
|
39
|
+
bulkUpload: exports.initialBulkUploadState,
|
|
40
|
+
pendingMissingReceiptsTabNavigation: null,
|
|
8
41
|
uploadReceiptStatusById: {},
|
|
9
42
|
refreshStatus: {
|
|
10
43
|
fetchState: 'Not-Started',
|
|
@@ -23,6 +56,8 @@ exports.initialState = {
|
|
|
23
56
|
return this.fetchState == 'Completed';
|
|
24
57
|
},
|
|
25
58
|
};
|
|
59
|
+
/** Epic trigger only; batch-details fetch is handled in epics. */
|
|
60
|
+
exports.fetchBulkUploadBatchDetails = (0, toolkit_1.createAction)('expenseAutomationMissingReceiptsView/fetchBulkUploadBatchDetails');
|
|
26
61
|
const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
27
62
|
name: 'expenseAutomationMissingReceiptsView',
|
|
28
63
|
initialState: exports.initialState,
|
|
@@ -124,7 +159,404 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
124
159
|
clearExpenseAutomationMissingReceiptsView(draft) {
|
|
125
160
|
Object.assign(draft, exports.initialState);
|
|
126
161
|
},
|
|
162
|
+
// -- Bulk Upload Actions --
|
|
163
|
+
bulkUploadReceipts: {
|
|
164
|
+
reducer(draft) {
|
|
165
|
+
draft.bulkUpload.phase = 'uploading';
|
|
166
|
+
draft.bulkUpload.uploadProgress = 0;
|
|
167
|
+
draft.bulkUpload.uploadStatus = {
|
|
168
|
+
fetchState: 'In-Progress',
|
|
169
|
+
error: undefined,
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
prepare(files) {
|
|
173
|
+
return { payload: { files } };
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
updateBulkUploadProgress(draft, action) {
|
|
177
|
+
draft.bulkUpload.uploadProgress = action.payload;
|
|
178
|
+
},
|
|
179
|
+
bulkUploadReceiptsSuccess(draft, action) {
|
|
180
|
+
draft.bulkUpload.currentBatchId = action.payload.batchId;
|
|
181
|
+
draft.bulkUpload.uploadProgress = 100;
|
|
182
|
+
draft.bulkUpload.uploadStatus = {
|
|
183
|
+
fetchState: 'Completed',
|
|
184
|
+
error: undefined,
|
|
185
|
+
};
|
|
186
|
+
draft.bulkUpload.phase = 'matching';
|
|
187
|
+
},
|
|
188
|
+
bulkUploadReceiptsFailure(draft, action) {
|
|
189
|
+
draft.bulkUpload.uploadStatus = {
|
|
190
|
+
fetchState: 'Error',
|
|
191
|
+
error: action.payload.error,
|
|
192
|
+
};
|
|
193
|
+
draft.bulkUpload.phase = 'idle';
|
|
194
|
+
},
|
|
195
|
+
bulkUploadAutomatchingTimedOut: {
|
|
196
|
+
reducer(draft, action) {
|
|
197
|
+
if (draft.bulkUpload.phase !== 'matching' ||
|
|
198
|
+
draft.bulkUpload.currentBatchId !== action.payload.batchId) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
draft.bulkUpload.phase = 'completed';
|
|
202
|
+
},
|
|
203
|
+
prepare(batchId) {
|
|
204
|
+
return { payload: { batchId } };
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
pusherBatchStatusUpdate(draft, action) {
|
|
208
|
+
const batchStatus = action.payload;
|
|
209
|
+
draft.bulkUpload.batchStatusById[batchStatus.batchId] = batchStatus;
|
|
210
|
+
/**
|
|
211
|
+
* Auto-matching banner (`phase === 'matching'`) must clear when the server reports this
|
|
212
|
+
* upload batch is done — otherwise the Missing tab keeps MatchingProgressBanner until
|
|
213
|
+
* batch-details APIs run; EmailUploadBanner should show again for the next upload.
|
|
214
|
+
*/
|
|
215
|
+
if (batchStatus.status === 'completed' &&
|
|
216
|
+
draft.bulkUpload.phase === 'matching' &&
|
|
217
|
+
draft.bulkUpload.currentBatchId === batchStatus.batchId) {
|
|
218
|
+
draft.bulkUpload.phase = 'completed';
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
requestMissingReceiptsTabNavigation(draft, action) {
|
|
222
|
+
draft.pendingMissingReceiptsTabNavigation = action.payload.tab;
|
|
223
|
+
},
|
|
224
|
+
clearMissingReceiptsTabNavigation(draft) {
|
|
225
|
+
draft.pendingMissingReceiptsTabNavigation = null;
|
|
226
|
+
},
|
|
227
|
+
fetchBulkUploadBatchDetailsSuccess(draft, action) {
|
|
228
|
+
const details = action.payload;
|
|
229
|
+
draft.bulkUpload.batchDetailsById[details.batchId] = details;
|
|
230
|
+
draft.bulkUpload.phase = 'completed';
|
|
231
|
+
},
|
|
232
|
+
fetchBulkUploadBatchDetailsFailure: {
|
|
233
|
+
reducer(draft) {
|
|
234
|
+
draft.bulkUpload.phase = 'completed';
|
|
235
|
+
},
|
|
236
|
+
prepare(payload) {
|
|
237
|
+
return { payload };
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
storeBatchDetails(draft, action) {
|
|
241
|
+
const details = action.payload;
|
|
242
|
+
draft.bulkUpload.batchDetailsById[details.batchId] = details;
|
|
243
|
+
/**
|
|
244
|
+
* Multi-batch fetch paths use `storeBatchDetails` (not `fetchBulkUploadBatchDetailsSuccess`).
|
|
245
|
+
* Without this, `phase` stays `matching` after upload forever and the Unmatched tab keeps
|
|
246
|
+
* showing the skeleton (`bulkUploadPhase === 'matching'` in web-components).
|
|
247
|
+
*/
|
|
248
|
+
if (draft.bulkUpload.phase === 'matching' &&
|
|
249
|
+
draft.bulkUpload.currentBatchId === details.batchId) {
|
|
250
|
+
draft.bulkUpload.phase = 'completed';
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
batchDetailFetchFailed(draft, action) {
|
|
254
|
+
const { batchId } = action.payload;
|
|
255
|
+
if (!draft.bulkUpload.failedBatchDetailIds.includes(batchId)) {
|
|
256
|
+
draft.bulkUpload.failedBatchDetailIds.push(batchId);
|
|
257
|
+
}
|
|
258
|
+
if (draft.bulkUpload.phase === 'matching' &&
|
|
259
|
+
draft.bulkUpload.currentBatchId === batchId) {
|
|
260
|
+
draft.bulkUpload.phase = 'completed';
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
setInitialBatchDetailsLoading(draft) {
|
|
264
|
+
draft.bulkUpload.batchDetailsPaginationState = {
|
|
265
|
+
fetchState: 'In-Progress',
|
|
266
|
+
error: undefined,
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
fetchMoreBatchDetails(draft) {
|
|
270
|
+
draft.bulkUpload.batchDetailsPaginationState = {
|
|
271
|
+
fetchState: 'In-Progress',
|
|
272
|
+
error: undefined,
|
|
273
|
+
};
|
|
274
|
+
},
|
|
275
|
+
fetchMoreBatchDetailsComplete(draft) {
|
|
276
|
+
draft.bulkUpload.batchDetailsPaginationState = {
|
|
277
|
+
fetchState: 'Completed',
|
|
278
|
+
error: undefined,
|
|
279
|
+
};
|
|
280
|
+
const currentId = draft.bulkUpload.currentBatchId;
|
|
281
|
+
const currentDetails = currentId != null
|
|
282
|
+
? draft.bulkUpload.batchDetailsById[currentId]
|
|
283
|
+
: undefined;
|
|
284
|
+
if (draft.bulkUpload.phase === 'matching' &&
|
|
285
|
+
currentId != null &&
|
|
286
|
+
currentDetails?.status === 'completed') {
|
|
287
|
+
draft.bulkUpload.phase = 'completed';
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
fetchMoreBatchDetailsFailure(draft, action) {
|
|
291
|
+
draft.bulkUpload.batchDetailsPaginationState = {
|
|
292
|
+
fetchState: 'Error',
|
|
293
|
+
error: action.payload.error,
|
|
294
|
+
};
|
|
295
|
+
},
|
|
296
|
+
fetchBulkUploadBatches: {
|
|
297
|
+
reducer(draft, action) {
|
|
298
|
+
if (action.payload.invalidateBatchDetailsCache === true) {
|
|
299
|
+
draft.bulkUpload.batchDetailsById = {};
|
|
300
|
+
draft.bulkUpload.failedBatchDetailIds = [];
|
|
301
|
+
}
|
|
302
|
+
draft.bulkUpload.batchListFetchState = {
|
|
303
|
+
fetchState: 'In-Progress',
|
|
304
|
+
error: undefined,
|
|
305
|
+
};
|
|
306
|
+
},
|
|
307
|
+
prepare(input) {
|
|
308
|
+
const fetchOptions = input ?? {};
|
|
309
|
+
return {
|
|
310
|
+
payload: {
|
|
311
|
+
cacheOverride: fetchOptions.cacheOverride === true,
|
|
312
|
+
invalidateBatchDetailsCache: fetchOptions.invalidateBatchDetailsCache === true,
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
fetchBulkUploadBatchesSuccess(draft, action) {
|
|
318
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod);
|
|
319
|
+
draft.bulkUpload.batchListByPeriod[periodId] = action.payload.batchList;
|
|
320
|
+
draft.bulkUpload.batchListFetchState = {
|
|
321
|
+
fetchState: 'Completed',
|
|
322
|
+
error: undefined,
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* When the multi-batch-details epic has nothing to fetch (e.g. list rows not `completed`
|
|
326
|
+
* yet, or details already present), `phase` can stay `matching` even though we already
|
|
327
|
+
* have completed details for `currentBatchId` (from polling / Pusher). Sync so the UI can
|
|
328
|
+
* dismiss the Unmatched skeleton.
|
|
329
|
+
*/
|
|
330
|
+
const currentId = draft.bulkUpload.currentBatchId;
|
|
331
|
+
if (draft.bulkUpload.phase === 'matching' && currentId != null) {
|
|
332
|
+
const existing = draft.bulkUpload.batchDetailsById[currentId];
|
|
333
|
+
if (existing?.status === 'completed') {
|
|
334
|
+
draft.bulkUpload.phase = 'completed';
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
fetchBulkUploadBatchesFailure(draft, action) {
|
|
339
|
+
draft.bulkUpload.batchListFetchState = {
|
|
340
|
+
fetchState: 'Error',
|
|
341
|
+
error: action.payload.error,
|
|
342
|
+
};
|
|
343
|
+
},
|
|
344
|
+
confirmBulkUploadMatch: {
|
|
345
|
+
reducer(draft) {
|
|
346
|
+
draft.bulkUpload.confirmMatchStatus = {
|
|
347
|
+
fetchState: 'In-Progress',
|
|
348
|
+
error: undefined,
|
|
349
|
+
};
|
|
350
|
+
},
|
|
351
|
+
prepare(batchId, attachmentId, transactionId, transactionType, fileName) {
|
|
352
|
+
return {
|
|
353
|
+
payload: {
|
|
354
|
+
batchId,
|
|
355
|
+
attachmentId,
|
|
356
|
+
transactionId,
|
|
357
|
+
transactionType,
|
|
358
|
+
fileName,
|
|
359
|
+
},
|
|
360
|
+
};
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
confirmBulkUploadMatchSuccess(draft, action) {
|
|
364
|
+
const { batchId, attachmentId, transactionId } = action.payload;
|
|
365
|
+
draft.bulkUpload.confirmMatchStatus = {
|
|
366
|
+
fetchState: 'Completed',
|
|
367
|
+
error: undefined,
|
|
368
|
+
};
|
|
369
|
+
const details = draft.bulkUpload.batchDetailsById[batchId];
|
|
370
|
+
if (details != null) {
|
|
371
|
+
const file = details.files.find((batchFile) => batchFile.attachmentId === attachmentId);
|
|
372
|
+
if (file != null) {
|
|
373
|
+
const originalStatus = file.status;
|
|
374
|
+
file.status = 'exact_match';
|
|
375
|
+
file.matchedTransactionId = transactionId;
|
|
376
|
+
file.candidates = undefined;
|
|
377
|
+
details.summary.matched += 1;
|
|
378
|
+
if (originalStatus === 'no_match') {
|
|
379
|
+
details.summary.noMatch = Math.max(0, details.summary.noMatch - 1);
|
|
380
|
+
}
|
|
381
|
+
else if (originalStatus === 'possible_matches') {
|
|
382
|
+
details.summary.possibleMatches = Math.max(0, details.summary.possibleMatches - 1);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
draft.bulkUpload.manualSearch = exports.initialBulkUploadState.manualSearch;
|
|
387
|
+
draft.bulkUpload.manualSearchUiResetKey += 1;
|
|
388
|
+
},
|
|
389
|
+
confirmBulkUploadMatchFailure(draft, action) {
|
|
390
|
+
draft.bulkUpload.confirmMatchStatus = {
|
|
391
|
+
fetchState: 'Error',
|
|
392
|
+
error: action.payload.error,
|
|
393
|
+
};
|
|
394
|
+
},
|
|
395
|
+
setBulkUploadResultsTab(draft, action) {
|
|
396
|
+
draft.bulkUpload.currentResultsTab = action.payload;
|
|
397
|
+
},
|
|
398
|
+
setBulkUploadCompletedSubTab(draft, action) {
|
|
399
|
+
draft.bulkUpload.completedSubTab = action.payload;
|
|
400
|
+
},
|
|
401
|
+
setBulkUploadSortConfig(draft, action) {
|
|
402
|
+
draft.bulkUpload.sortKey = action.payload.sortKey;
|
|
403
|
+
draft.bulkUpload.sortOrder = action.payload.sortOrder;
|
|
404
|
+
},
|
|
405
|
+
clearBulkUpload(draft) {
|
|
406
|
+
Object.assign(draft.bulkUpload, exports.initialBulkUploadState);
|
|
407
|
+
draft.pendingMissingReceiptsTabNavigation = null;
|
|
408
|
+
},
|
|
409
|
+
searchTransactionsForManualMatch: {
|
|
410
|
+
reducer(draft, action) {
|
|
411
|
+
const { query, pageToken } = action.payload;
|
|
412
|
+
const isLoadMore = pageToken != null;
|
|
413
|
+
const trimmed = query.trim();
|
|
414
|
+
/**
|
|
415
|
+
* Cleared or too-short query: no API (see epic). Reset fully (no In-Progress).
|
|
416
|
+
* Only bump `manualSearchUiResetKey` when clearing a real search — not when the UI
|
|
417
|
+
* dispatches `""` on every keystroke while length is below MIN (web-components always sends
|
|
418
|
+
* `onSearch("")` in that case), or ReceiptCard remounts and the input loses focus.
|
|
419
|
+
*/
|
|
420
|
+
if (!isLoadMore &&
|
|
421
|
+
trimmed.length < missingReceiptsViewState_1.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH) {
|
|
422
|
+
const hadActiveSearch = draft.bulkUpload.manualSearch.searchQuery.trim().length >=
|
|
423
|
+
missingReceiptsViewState_1.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH ||
|
|
424
|
+
draft.bulkUpload.manualSearch.results.length > 0;
|
|
425
|
+
draft.bulkUpload.manualSearch = exports.initialBulkUploadState.manualSearch;
|
|
426
|
+
if (hadActiveSearch) {
|
|
427
|
+
draft.bulkUpload.manualSearchUiResetKey += 1;
|
|
428
|
+
}
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
draft.bulkUpload.manualSearch.searchQuery = query;
|
|
432
|
+
if (isLoadMore) {
|
|
433
|
+
draft.bulkUpload.manualSearch.isLoadingMore = true;
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
draft.bulkUpload.manualSearch.isLoadingMore = false;
|
|
437
|
+
draft.bulkUpload.manualSearch.results = [];
|
|
438
|
+
draft.bulkUpload.manualSearch.nextPageToken = null;
|
|
439
|
+
draft.bulkUpload.manualSearch.totalCount = 0;
|
|
440
|
+
draft.bulkUpload.manualSearch.fetchState = {
|
|
441
|
+
fetchState: 'In-Progress',
|
|
442
|
+
error: undefined,
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
prepare(query, pageToken) {
|
|
447
|
+
return { payload: { query, pageToken: pageToken ?? undefined } };
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
searchTransactionsForManualMatchSuccess(draft, action) {
|
|
451
|
+
const { append, nextPageToken, results, totalCount } = action.payload;
|
|
452
|
+
if (append) {
|
|
453
|
+
const merged = [...draft.bulkUpload.manualSearch.results, ...results];
|
|
454
|
+
const byId = new Map(merged.map((result) => [result.transactionId, result]));
|
|
455
|
+
draft.bulkUpload.manualSearch.results = Array.from(byId.values());
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
draft.bulkUpload.manualSearch.results = results;
|
|
459
|
+
}
|
|
460
|
+
draft.bulkUpload.manualSearch.nextPageToken = nextPageToken;
|
|
461
|
+
draft.bulkUpload.manualSearch.totalCount = totalCount;
|
|
462
|
+
draft.bulkUpload.manualSearch.isLoadingMore = false;
|
|
463
|
+
draft.bulkUpload.manualSearch.fetchState = {
|
|
464
|
+
fetchState: 'Completed',
|
|
465
|
+
error: undefined,
|
|
466
|
+
};
|
|
467
|
+
},
|
|
468
|
+
searchTransactionsForManualMatchFailure(draft, action) {
|
|
469
|
+
draft.bulkUpload.manualSearch.isLoadingMore = false;
|
|
470
|
+
draft.bulkUpload.manualSearch.fetchState = {
|
|
471
|
+
fetchState: 'Error',
|
|
472
|
+
error: action.payload.error,
|
|
473
|
+
};
|
|
474
|
+
},
|
|
475
|
+
clearManualSearchResults(draft) {
|
|
476
|
+
draft.bulkUpload.manualSearch = exports.initialBulkUploadState.manualSearch;
|
|
477
|
+
draft.bulkUpload.manualSearchUiResetKey += 1;
|
|
478
|
+
},
|
|
479
|
+
acknowledgeBulkUploadConfirmMatchComplete(draft) {
|
|
480
|
+
draft.bulkUpload.confirmMatchStatus = {
|
|
481
|
+
fetchState: 'Not-Started',
|
|
482
|
+
error: undefined,
|
|
483
|
+
};
|
|
484
|
+
},
|
|
485
|
+
// -- Completed Transactions Actions --
|
|
486
|
+
fetchCompletedTransactions: {
|
|
487
|
+
reducer(draft, action) {
|
|
488
|
+
const { pageToken } = action.payload;
|
|
489
|
+
if (pageToken != null) {
|
|
490
|
+
const periods = draft.bulkUpload.completedTransactionsByPeriod;
|
|
491
|
+
for (const entry of Object.values(periods)) {
|
|
492
|
+
if (entry.nextPageToken === pageToken) {
|
|
493
|
+
entry.fetchState = {
|
|
494
|
+
fetchState: 'In-Progress',
|
|
495
|
+
error: undefined,
|
|
496
|
+
};
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
prepare(pageToken, cacheOverride) {
|
|
503
|
+
return { payload: { pageToken, cacheOverride } };
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
fetchCompletedTransactionsSuccess(draft, action) {
|
|
507
|
+
const { transactionIds, nextPageToken, totalCount, selectedPeriod, isInitialLoad, } = action.payload;
|
|
508
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
509
|
+
const cacheKey = (0, exports.getCompletedTransactionsCacheKey)(periodId, draft.bulkUpload.sortKey, draft.bulkUpload.sortOrder, draft.bulkUpload.completedSubTab);
|
|
510
|
+
if (isInitialLoad) {
|
|
511
|
+
draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
|
|
512
|
+
transactionIds,
|
|
513
|
+
nextPageToken,
|
|
514
|
+
totalCount,
|
|
515
|
+
fetchState: { fetchState: 'Completed', error: undefined },
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
const existing = draft.bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
520
|
+
if (existing != null) {
|
|
521
|
+
existing.transactionIds.push(...transactionIds);
|
|
522
|
+
existing.nextPageToken = nextPageToken;
|
|
523
|
+
existing.totalCount = totalCount;
|
|
524
|
+
existing.fetchState = { fetchState: 'Completed', error: undefined };
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
|
|
528
|
+
transactionIds,
|
|
529
|
+
nextPageToken,
|
|
530
|
+
totalCount,
|
|
531
|
+
fetchState: { fetchState: 'Completed', error: undefined },
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
fetchCompletedTransactionsFailure(draft, action) {
|
|
537
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod);
|
|
538
|
+
const cacheKey = (0, exports.getCompletedTransactionsCacheKey)(periodId, draft.bulkUpload.sortKey, draft.bulkUpload.sortOrder, draft.bulkUpload.completedSubTab);
|
|
539
|
+
const existing = draft.bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
540
|
+
if (existing != null) {
|
|
541
|
+
existing.fetchState = {
|
|
542
|
+
fetchState: 'Error',
|
|
543
|
+
error: action.payload.error,
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
|
|
548
|
+
fetchState: { fetchState: 'Error', error: action.payload.error },
|
|
549
|
+
nextPageToken: null,
|
|
550
|
+
totalCount: 0,
|
|
551
|
+
transactionIds: [],
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
},
|
|
127
555
|
},
|
|
128
556
|
});
|
|
129
|
-
_a = expenseAutomationMissingReceiptsView.actions, exports.fetchMissingReceipts = _a.fetchMissingReceipts, exports.fetchMissingReceiptsSuccess = _a.fetchMissingReceiptsSuccess, exports.fetchMissingReceiptsFailure = _a.fetchMissingReceiptsFailure, exports.uploadMissingReceiptSuccess = _a.uploadMissingReceiptSuccess, exports.updateMissingReceiptUploadState = _a.updateMissingReceiptUploadState, exports.updateMissingReceiptsUIState = _a.updateMissingReceiptsUIState, exports.markMissingReceiptAsDone = _a.markMissingReceiptAsDone, exports.clearExpenseAutomationMissingReceiptsView = _a.clearExpenseAutomationMissingReceiptsView
|
|
557
|
+
_a = expenseAutomationMissingReceiptsView.actions, exports.fetchMissingReceipts = _a.fetchMissingReceipts, exports.fetchMissingReceiptsSuccess = _a.fetchMissingReceiptsSuccess, exports.fetchMissingReceiptsFailure = _a.fetchMissingReceiptsFailure, exports.uploadMissingReceiptSuccess = _a.uploadMissingReceiptSuccess, exports.updateMissingReceiptUploadState = _a.updateMissingReceiptUploadState, exports.updateMissingReceiptsUIState = _a.updateMissingReceiptsUIState, exports.markMissingReceiptAsDone = _a.markMissingReceiptAsDone, exports.clearExpenseAutomationMissingReceiptsView = _a.clearExpenseAutomationMissingReceiptsView,
|
|
558
|
+
// Bulk Upload
|
|
559
|
+
exports.bulkUploadReceipts = _a.bulkUploadReceipts, exports.updateBulkUploadProgress = _a.updateBulkUploadProgress, exports.bulkUploadReceiptsSuccess = _a.bulkUploadReceiptsSuccess, exports.bulkUploadReceiptsFailure = _a.bulkUploadReceiptsFailure, exports.bulkUploadAutomatchingTimedOut = _a.bulkUploadAutomatchingTimedOut, exports.pusherBatchStatusUpdate = _a.pusherBatchStatusUpdate, exports.requestMissingReceiptsTabNavigation = _a.requestMissingReceiptsTabNavigation, exports.clearMissingReceiptsTabNavigation = _a.clearMissingReceiptsTabNavigation, exports.fetchBulkUploadBatchDetailsSuccess = _a.fetchBulkUploadBatchDetailsSuccess, exports.fetchBulkUploadBatchDetailsFailure = _a.fetchBulkUploadBatchDetailsFailure, exports.storeBatchDetails = _a.storeBatchDetails, exports.batchDetailFetchFailed = _a.batchDetailFetchFailed, exports.setInitialBatchDetailsLoading = _a.setInitialBatchDetailsLoading, exports.fetchMoreBatchDetails = _a.fetchMoreBatchDetails, exports.fetchMoreBatchDetailsComplete = _a.fetchMoreBatchDetailsComplete, exports.fetchMoreBatchDetailsFailure = _a.fetchMoreBatchDetailsFailure, exports.fetchBulkUploadBatches = _a.fetchBulkUploadBatches, exports.fetchBulkUploadBatchesSuccess = _a.fetchBulkUploadBatchesSuccess, exports.fetchBulkUploadBatchesFailure = _a.fetchBulkUploadBatchesFailure, exports.confirmBulkUploadMatch = _a.confirmBulkUploadMatch, exports.confirmBulkUploadMatchSuccess = _a.confirmBulkUploadMatchSuccess, exports.confirmBulkUploadMatchFailure = _a.confirmBulkUploadMatchFailure, exports.setBulkUploadResultsTab = _a.setBulkUploadResultsTab, exports.setBulkUploadCompletedSubTab = _a.setBulkUploadCompletedSubTab, exports.setBulkUploadSortConfig = _a.setBulkUploadSortConfig, exports.clearBulkUpload = _a.clearBulkUpload, exports.searchTransactionsForManualMatch = _a.searchTransactionsForManualMatch, exports.searchTransactionsForManualMatchSuccess = _a.searchTransactionsForManualMatchSuccess, exports.searchTransactionsForManualMatchFailure = _a.searchTransactionsForManualMatchFailure, exports.clearManualSearchResults = _a.clearManualSearchResults, exports.acknowledgeBulkUploadConfirmMatchComplete = _a.acknowledgeBulkUploadConfirmMatchComplete,
|
|
560
|
+
// Completed Transactions
|
|
561
|
+
exports.fetchCompletedTransactions = _a.fetchCompletedTransactions, exports.fetchCompletedTransactionsSuccess = _a.fetchCompletedTransactionsSuccess, exports.fetchCompletedTransactionsFailure = _a.fetchCompletedTransactionsFailure;
|
|
130
562
|
exports.default = expenseAutomationMissingReceiptsView.reducer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchState, ID } from '../../../commonStateTypes/common';
|
|
1
|
+
import { FetchState, FetchStateAndError, ID, UpdateType } from '../../../commonStateTypes/common';
|
|
2
2
|
import { COTTransactionTrackingByTransactionId, RecommendationWithCOT } from '../../../commonStateTypes/recommendationBase';
|
|
3
3
|
import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePeriod';
|
|
4
4
|
import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
@@ -7,7 +7,7 @@ import { ClassBase } from '../../../entity/class/classState';
|
|
|
7
7
|
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
8
8
|
import { Entity } from '../../../entity/genericEntity/entity';
|
|
9
9
|
import { RecommendationWithCOTByLineId, TransactionID } from '../../../entity/transaction/stateTypes/transaction';
|
|
10
|
-
import { SupportedTransaction, SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
10
|
+
import { SupportedTransaction, SupportedTransactionPayload, SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
11
11
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
12
12
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
13
13
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
@@ -158,6 +158,14 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
158
158
|
}, "expenseAutomationTransactionsView/syncTransactionCategorizationFromDetailSave", never, never>, backgroundRefetchReviewTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, isUncategorizedExpenseCategoryEnabled?: boolean | undefined], {
|
|
159
159
|
period: TimePeriod;
|
|
160
160
|
isUncategorizedExpenseCategoryEnabled: boolean | undefined;
|
|
161
|
-
}, "expenseAutomationTransactionsView/backgroundRefetchReviewTab", never, never
|
|
161
|
+
}, "expenseAutomationTransactionsView/backgroundRefetchReviewTab", never, never>, updateTransactionCategorizationUploadReceiptState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: string, fetchStatus: FetchStateAndError], {
|
|
162
|
+
selectedTab: "review" | "autoCategorized";
|
|
163
|
+
transactionId: string;
|
|
164
|
+
fetchStatus: FetchStateAndError;
|
|
165
|
+
}, "expenseAutomationTransactionsView/updateTransactionCategorizationUploadReceiptState", never, never>, uploadTransactionCategorizationReceiptSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionPayload: SupportedTransactionPayload, updateType?: UpdateType | undefined], {
|
|
166
|
+
selectedTab: "review" | "autoCategorized";
|
|
167
|
+
transactionPayload: SupportedTransactionPayload;
|
|
168
|
+
updateType: UpdateType;
|
|
169
|
+
}, "expenseAutomationTransactionsView/uploadTransactionCategorizationReceiptSuccess", never, never>;
|
|
162
170
|
declare const _default: import("redux").Reducer<TransactionsViewState>;
|
|
163
171
|
export default _default;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
|
|
7
|
+
exports.uploadTransactionCategorizationReceiptSuccess = exports.updateTransactionCategorizationUploadReceiptState = exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
@@ -43,6 +43,7 @@ exports.initialTransactionTabViewState = {
|
|
|
43
43
|
transactionIdsBySelectedPeriod: {},
|
|
44
44
|
selectedCheckBoxTransactionIds: [],
|
|
45
45
|
transactionIdsWithUnsavedData: [],
|
|
46
|
+
uploadReceiptStatusById: {},
|
|
46
47
|
selectedTransactionId: undefined,
|
|
47
48
|
selectedTransactionLineId: undefined,
|
|
48
49
|
};
|
|
@@ -706,6 +707,27 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
706
707
|
clearExpenseAutomationTransactionsView(draft) {
|
|
707
708
|
Object.assign(draft, exports.initialState);
|
|
708
709
|
},
|
|
710
|
+
updateTransactionCategorizationUploadReceiptState: {
|
|
711
|
+
reducer(draft, action) {
|
|
712
|
+
const { transactionId, fetchStatus, selectedTab } = action.payload;
|
|
713
|
+
draft.transactionCategorizationView[selectedTab].uploadReceiptStatusById[transactionId] = fetchStatus;
|
|
714
|
+
},
|
|
715
|
+
prepare(selectedTab, transactionId, fetchStatus) {
|
|
716
|
+
return { payload: { selectedTab, transactionId, fetchStatus } };
|
|
717
|
+
},
|
|
718
|
+
},
|
|
719
|
+
uploadTransactionCategorizationReceiptSuccess: {
|
|
720
|
+
reducer(draft, action) {
|
|
721
|
+
const { transactionPayload, selectedTab } = action.payload;
|
|
722
|
+
draft.transactionCategorizationView[selectedTab].uploadReceiptStatusById[transactionPayload.transaction_id] = {
|
|
723
|
+
fetchState: 'Completed',
|
|
724
|
+
error: undefined,
|
|
725
|
+
};
|
|
726
|
+
},
|
|
727
|
+
prepare(selectedTab, transactionPayload, updateType = 'merge') {
|
|
728
|
+
return { payload: { selectedTab, transactionPayload, updateType } };
|
|
729
|
+
},
|
|
730
|
+
},
|
|
709
731
|
syncTransactionCategorizationFromDetailSave: {
|
|
710
732
|
prepare(transactionId, updatedTransaction, pendingReviewLineIds, uncategorizedIncomeExpense, isUncategorizedExpenseCategoryEnabled) {
|
|
711
733
|
return {
|
|
@@ -777,5 +799,5 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
777
799
|
},
|
|
778
800
|
},
|
|
779
801
|
});
|
|
780
|
-
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.syncTransactionCategorizationFromDetailSave = _a.syncTransactionCategorizationFromDetailSave, exports.backgroundRefetchReviewTab = _a.backgroundRefetchReviewTab;
|
|
802
|
+
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.syncTransactionCategorizationFromDetailSave = _a.syncTransactionCategorizationFromDetailSave, exports.backgroundRefetchReviewTab = _a.backgroundRefetchReviewTab, exports.updateTransactionCategorizationUploadReceiptState = _a.updateTransactionCategorizationUploadReceiptState, exports.uploadTransactionCategorizationReceiptSuccess = _a.uploadTransactionCategorizationReceiptSuccess;
|
|
781
803
|
exports.default = expenseAutomationTransactionsView.reducer;
|
|
@@ -1,9 +1,77 @@
|
|
|
1
1
|
import { CompletionStatusType, FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
|
+
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
2
3
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
4
|
import { SupportedTransaction } from '../../../entity/transaction/transactionState';
|
|
4
|
-
import { MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
5
|
+
import type { BatchFileStatus, BatchListItem, BatchStatus, BulkUploadPhase, BulkUploadResultsTab, BulkUploadSortKey, CompletedSubTab, ManualSearchState, MatchSource, MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
6
|
+
export interface CompletedTransactionsSelectorData {
|
|
7
|
+
fetchState: FetchStateAndError;
|
|
8
|
+
nextPageToken: string | null;
|
|
9
|
+
totalCount: number;
|
|
10
|
+
transactions: SupportedTransaction[];
|
|
11
|
+
}
|
|
12
|
+
export interface ResolvedCandidate {
|
|
13
|
+
matchScore: number;
|
|
14
|
+
transaction: SupportedTransaction;
|
|
15
|
+
}
|
|
16
|
+
export interface ResolvedBatchFile {
|
|
17
|
+
attachmentId: ID;
|
|
18
|
+
batchId: ID;
|
|
19
|
+
fileDownloadUrl: string | null;
|
|
20
|
+
fileId: ID;
|
|
21
|
+
filename: string;
|
|
22
|
+
filePreviewUrl: string | null;
|
|
23
|
+
status: BatchFileStatus;
|
|
24
|
+
candidates?: ResolvedCandidate[];
|
|
25
|
+
matchedTransaction?: SupportedTransaction;
|
|
26
|
+
matchSource?: MatchSource;
|
|
27
|
+
}
|
|
28
|
+
export interface BulkUploadSelectorData {
|
|
29
|
+
batchDetails: ResolvedBatchDetails | undefined;
|
|
30
|
+
batchDetailsPaginationState: FetchStateAndError;
|
|
31
|
+
batchList: BatchListItem[];
|
|
32
|
+
batchListFetchState: FetchStateAndError;
|
|
33
|
+
batchStatus: BatchStatus | undefined;
|
|
34
|
+
completedSubTab: CompletedSubTab;
|
|
35
|
+
completedTransactions: CompletedTransactionsSelectorData;
|
|
36
|
+
confirmMatchStatus: FetchStateAndError;
|
|
37
|
+
currentResultsTab: BulkUploadResultsTab;
|
|
38
|
+
hasMoreBatchDetails: boolean;
|
|
39
|
+
manualSearch: ManualSearchState;
|
|
40
|
+
/** Bumps when manual search state is cleared — remount manual search inputs. */
|
|
41
|
+
manualSearchUiResetKey: number;
|
|
42
|
+
matchedFiles: ResolvedBatchFile[];
|
|
43
|
+
pastBatches: BatchListItem[];
|
|
44
|
+
pastUnmatchedFiles: ResolvedBatchFile[];
|
|
45
|
+
phase: BulkUploadPhase;
|
|
46
|
+
progress: {
|
|
47
|
+
percentage: number;
|
|
48
|
+
processed: number;
|
|
49
|
+
total: number;
|
|
50
|
+
};
|
|
51
|
+
sortKey: BulkUploadSortKey;
|
|
52
|
+
sortOrder: SortOrder;
|
|
53
|
+
unmatchedFiles: ResolvedBatchFile[];
|
|
54
|
+
uploadProgress: number;
|
|
55
|
+
uploadStatus: FetchStateAndError;
|
|
56
|
+
}
|
|
57
|
+
export interface ResolvedBatchDetails {
|
|
58
|
+
batchId: ID;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
files: ResolvedBatchFile[];
|
|
61
|
+
status: string;
|
|
62
|
+
summary: {
|
|
63
|
+
failed: number;
|
|
64
|
+
matched: number;
|
|
65
|
+
noMatch: number;
|
|
66
|
+
possibleMatches: number;
|
|
67
|
+
total: number;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
5
70
|
export interface ExpenseAutomationMissingReceiptsViewSelector extends SelectorView {
|
|
71
|
+
bulkUpload: BulkUploadSelectorData;
|
|
6
72
|
completionStatus: CompletionStatusType;
|
|
73
|
+
/** When set, UI should switch bulk-upload sub-tab once (e.g. Unmatched on batch completion). */
|
|
74
|
+
pendingMissingReceiptsTabNavigation: BulkUploadResultsTab | null;
|
|
7
75
|
refreshStatus: FetchStateAndError;
|
|
8
76
|
transactions: SupportedTransaction[];
|
|
9
77
|
uiState: MissingReceiptsViewUIState;
|
|
@@ -28,6 +28,7 @@ export interface ExpenseAutomationTransactionViewSelector extends SelectorView {
|
|
|
28
28
|
transactions: SupportedTransactionWithCOT[];
|
|
29
29
|
uiState: TransactionsViewUIState;
|
|
30
30
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
31
|
+
uploadReceiptStatusById: Record<ID, FetchStateAndError>;
|
|
31
32
|
selectedTransactionId?: ID;
|
|
32
33
|
selectedTransactionLineId?: ID;
|
|
33
34
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RootState } from '../../../reducer';
|
|
2
|
-
import { ExpenseAutomationMissingReceiptsViewSelector } from '../selectorTypes/missingReceiptsSelectorTypes';
|
|
2
|
+
import type { ExpenseAutomationMissingReceiptsViewSelector } from '../selectorTypes/missingReceiptsSelectorTypes';
|
|
3
3
|
export declare function getExpenseAutomationMissingReceiptsView(state: RootState): ExpenseAutomationMissingReceiptsViewSelector;
|