@zeniai/client-epic-state 4.20.6 → 4.20.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/lib/commonStateTypes/coaBalance/additionalBalances/getSummationBalance.d.ts +1 -1
  2. package/lib/commonStateTypes/coaBalance/coaBalanceType.d.ts +2 -0
  3. package/lib/commonStateTypes/coaBalance/coaBalanceType.js +6 -0
  4. package/lib/commonStateTypes/currencyHelper.d.ts +3 -0
  5. package/lib/commonStateTypes/currencyHelper.js +6 -1
  6. package/lib/commonStateTypes/reduceFetchState.d.ts +9 -0
  7. package/lib/commonStateTypes/reduceFetchState.js +26 -0
  8. package/lib/entity/account/accountPayload.d.ts +2 -0
  9. package/lib/entity/account/accountPayload.js +2 -0
  10. package/lib/entity/account/accountState.d.ts +2 -0
  11. package/lib/entity/customer/customerState.d.ts +0 -2
  12. package/lib/entity/customer/customerState.js +0 -5
  13. package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
  14. package/lib/entity/depositAccount/depositAccount.js +8 -1
  15. package/lib/entity/reimbursement/reimbursementPayload.d.ts +2 -0
  16. package/lib/entity/reimbursement/reimbursementPayload.js +7 -0
  17. package/lib/entity/reimbursement/reimbursementState.d.ts +2 -0
  18. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  19. package/lib/entity/snackbar/snackbarTypes.js +2 -0
  20. package/lib/entity/task/taskPayload.d.ts +1 -0
  21. package/lib/entity/task/taskPayload.js +1 -0
  22. package/lib/entity/task/taskState.d.ts +1 -0
  23. package/lib/entity/userGroups/userGroupsPayload.d.ts +7 -0
  24. package/lib/entity/userGroups/userGroupsPayload.js +10 -0
  25. package/lib/entity/userGroups/userGroupsReducer.d.ts +8 -0
  26. package/lib/entity/userGroups/userGroupsReducer.js +29 -0
  27. package/lib/entity/userGroups/userGroupsSelector.d.ts +4 -0
  28. package/lib/entity/userGroups/userGroupsSelector.js +12 -0
  29. package/lib/entity/userGroups/userGroupsState.d.ts +9 -0
  30. package/lib/entity/userGroups/userGroupsState.js +2 -0
  31. package/lib/epic.d.ts +15 -1
  32. package/lib/epic.js +15 -1
  33. package/lib/esm/commonStateTypes/coaBalance/coaBalanceType.js +5 -0
  34. package/lib/esm/commonStateTypes/currencyHelper.js +5 -0
  35. package/lib/esm/commonStateTypes/reduceFetchState.js +25 -0
  36. package/lib/esm/entity/account/accountPayload.js +2 -0
  37. package/lib/esm/entity/customer/customerState.js +1 -4
  38. package/lib/esm/entity/depositAccount/depositAccount.js +8 -1
  39. package/lib/esm/entity/reimbursement/reimbursementPayload.js +7 -0
  40. package/lib/esm/entity/snackbar/snackbarTypes.js +2 -0
  41. package/lib/esm/entity/task/taskPayload.js +1 -0
  42. package/lib/esm/entity/userGroups/userGroupsPayload.js +7 -0
  43. package/lib/esm/entity/userGroups/userGroupsReducer.js +25 -0
  44. package/lib/esm/entity/userGroups/userGroupsSelector.js +8 -0
  45. package/lib/esm/entity/userGroups/userGroupsState.js +1 -0
  46. package/lib/esm/epic.js +15 -1
  47. package/lib/esm/index.js +19 -10
  48. package/lib/esm/reducer.js +6 -0
  49. package/lib/esm/view/arAgingView/arAgingReport/arAgingReducer.js +1 -1
  50. package/lib/esm/view/arAgingView/arAgingReport/arAgingSelector.js +1 -1
  51. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +33 -0
  52. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +29 -0
  53. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +49 -0
  54. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +40 -0
  55. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +49 -0
  56. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +61 -0
  57. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +33 -0
  58. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +56 -0
  59. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +12 -0
  60. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +98 -0
  61. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +71 -0
  62. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
  63. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +86 -0
  64. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +24 -0
  65. package/lib/esm/view/expenseAutomationView/helpers/bulkUploadTiming.js +16 -0
  66. package/lib/esm/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +13 -0
  67. package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +198 -1
  68. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +456 -2
  69. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +23 -1
  70. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +245 -1
  71. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  72. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +44 -0
  73. package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +2 -1
  74. package/lib/esm/view/financeStatement/financeStatementReducer.js +11 -8
  75. package/lib/esm/view/financeStatement/financeStatementSelector.js +24 -9
  76. package/lib/esm/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +17 -0
  77. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +331 -0
  78. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +9 -0
  79. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
  80. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  81. package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  82. package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +262 -0
  83. package/lib/esm/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +9 -7
  84. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
  85. package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
  86. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +3 -1
  87. package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +65 -0
  88. package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +16 -0
  89. package/lib/esm/view/userGroupListView/userGroupListViewState.js +1 -0
  90. package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +11 -0
  91. package/lib/esm/zeniAPI.js +0 -2
  92. package/lib/index.d.ts +20 -12
  93. package/lib/index.js +97 -34
  94. package/lib/reducer.d.ts +6 -0
  95. package/lib/reducer.js +6 -0
  96. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  97. package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +2 -2
  98. package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +5 -5
  99. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.d.ts +13 -0
  100. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +37 -0
  101. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +18 -0
  102. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +33 -0
  103. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +7 -0
  104. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +53 -0
  105. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +8 -0
  106. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +44 -0
  107. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +7 -0
  108. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +53 -0
  109. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +8 -0
  110. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +65 -0
  111. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +8 -0
  112. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +37 -0
  113. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +9 -0
  114. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +61 -0
  115. package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.d.ts +10 -0
  116. package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +16 -0
  117. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.d.ts +18 -0
  118. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +102 -0
  119. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +14 -0
  120. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +75 -0
  121. package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
  122. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +25 -0
  123. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +92 -0
  124. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +7 -0
  125. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +28 -0
  126. package/lib/view/expenseAutomationView/helpers/bulkUploadTiming.d.ts +16 -0
  127. package/lib/view/expenseAutomationView/helpers/bulkUploadTiming.js +19 -0
  128. package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.d.ts +7 -0
  129. package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +16 -0
  130. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  131. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +123 -0
  132. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +211 -0
  133. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +86 -3
  134. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +457 -2
  135. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +11 -3
  136. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +24 -2
  137. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +70 -1
  138. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +1 -0
  139. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
  140. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +244 -0
  141. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  142. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +146 -0
  143. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +54 -1
  144. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -1
  145. package/lib/view/expenseAutomationView/types/transactionsViewState.js +2 -1
  146. package/lib/view/financeStatement/financeStatementReducer.js +11 -8
  147. package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
  148. package/lib/view/financeStatement/financeStatementSelector.js +24 -9
  149. package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.d.ts +9 -0
  150. package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +20 -0
  151. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +15 -0
  152. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +335 -0
  153. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +111 -0
  154. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +13 -0
  155. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +4 -2
  156. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +7 -2
  157. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  158. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +4 -0
  159. package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  160. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +6 -0
  161. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +265 -0
  162. package/lib/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +8 -6
  163. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
  164. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +1 -0
  165. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
  166. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +2 -0
  167. package/lib/view/taskManager/taskListView/taskListSelector.js +3 -1
  168. package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +23 -0
  169. package/lib/view/userGroupListView/userGroupListViewReducer.js +69 -0
  170. package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +7 -0
  171. package/lib/view/userGroupListView/userGroupListViewSelector.js +20 -0
  172. package/lib/view/userGroupListView/userGroupListViewState.d.ts +8 -0
  173. package/lib/view/userGroupListView/userGroupListViewState.js +2 -0
  174. package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +3 -1
  175. package/lib/view/userListView/fetchUserListByTypeEpic.js +11 -0
  176. package/lib/view/userListView/userListViewPayload.d.ts +2 -0
  177. package/lib/zeniAPI.js +0 -2
  178. package/package.json +3 -3
@@ -1,10 +1,44 @@
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.restoreBulkUploadMatchingState = exports.bulkUploadReceiptsFailure = exports.bulkUploadReceiptsSuccess = exports.setBulkUploadUploadedFileCount = exports.updateBulkUploadProgress = exports.bulkUploadReceipts = exports.clearExpenseAutomationMissingReceiptsView = exports.markMissingReceiptAsDone = exports.updateMissingReceiptsUIState = exports.updateMissingReceiptUploadState = exports.uploadMissingReceiptSuccess = exports.fetchMissingReceiptsFailure = exports.fetchMissingReceiptsSuccess = exports.fetchMissingReceipts = exports.restoreBulkUploadAutomatchingOnMount = 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
+ uploadedFileCount: 0,
36
+ uploadProgress: 0,
37
+ uploadStatus: { fetchState: 'Not-Started', error: undefined },
38
+ };
7
39
  exports.initialState = {
40
+ bulkUpload: exports.initialBulkUploadState,
41
+ pendingMissingReceiptsTabNavigation: null,
8
42
  uploadReceiptStatusById: {},
9
43
  refreshStatus: {
10
44
  fetchState: 'Not-Started',
@@ -23,6 +57,14 @@ exports.initialState = {
23
57
  return this.fetchState == 'Completed';
24
58
  },
25
59
  };
60
+ /** Epic trigger only; batch-details fetch is handled in epics. */
61
+ exports.fetchBulkUploadBatchDetails = (0, toolkit_1.createAction)('expenseAutomationMissingReceiptsView/fetchBulkUploadBatchDetails');
62
+ /**
63
+ * Epic trigger only. Dispatched from the screen on missing-receipts entry / period switch so the
64
+ * automatching banner is restored for the logged-in user even when they sit on the Missing tab
65
+ * after a hard refresh. The epic owns the list + details API calls end-to-end.
66
+ */
67
+ exports.restoreBulkUploadAutomatchingOnMount = (0, toolkit_1.createAction)('expenseAutomationMissingReceiptsView/restoreBulkUploadAutomatchingOnMount');
26
68
  const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
27
69
  name: 'expenseAutomationMissingReceiptsView',
28
70
  initialState: exports.initialState,
@@ -124,7 +166,420 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
124
166
  clearExpenseAutomationMissingReceiptsView(draft) {
125
167
  Object.assign(draft, exports.initialState);
126
168
  },
169
+ // -- Bulk Upload Actions --
170
+ bulkUploadReceipts: {
171
+ reducer(draft, action) {
172
+ draft.bulkUpload.phase = 'uploading';
173
+ draft.bulkUpload.uploadProgress = 0;
174
+ draft.bulkUpload.uploadedFileCount = action.payload.fileCount;
175
+ draft.bulkUpload.uploadStatus = {
176
+ fetchState: 'In-Progress',
177
+ error: undefined,
178
+ };
179
+ },
180
+ prepare(files) {
181
+ return { payload: { files, fileCount: files.length } };
182
+ },
183
+ },
184
+ updateBulkUploadProgress(draft, action) {
185
+ draft.bulkUpload.uploadProgress = action.payload;
186
+ },
187
+ /**
188
+ * Sync file count when bulk upload uses direct HTTP (`bulkUploadReceipts` Redux action is not
189
+ * dispatched, so `bulkUploadReceipts` reducer never runs).
190
+ */
191
+ setBulkUploadUploadedFileCount(draft, action) {
192
+ draft.bulkUpload.uploadedFileCount = action.payload;
193
+ },
194
+ bulkUploadReceiptsSuccess(draft, action) {
195
+ draft.bulkUpload.currentBatchId = action.payload.batchId;
196
+ draft.bulkUpload.uploadProgress = 100;
197
+ draft.bulkUpload.uploadStatus = {
198
+ fetchState: 'Completed',
199
+ error: undefined,
200
+ };
201
+ draft.bulkUpload.phase = 'matching';
202
+ },
203
+ bulkUploadReceiptsFailure(draft, action) {
204
+ draft.bulkUpload.uploadStatus = {
205
+ fetchState: 'Error',
206
+ error: action.payload.error,
207
+ };
208
+ draft.bulkUpload.phase = 'idle';
209
+ },
210
+ restoreBulkUploadMatchingState(draft, action) {
211
+ if (draft.bulkUpload.phase !== 'idle') {
212
+ return;
213
+ }
214
+ draft.bulkUpload.currentBatchId = action.payload.batchId;
215
+ draft.bulkUpload.uploadedFileCount = action.payload.totalFiles;
216
+ draft.bulkUpload.phase = 'matching';
217
+ },
218
+ bulkUploadAutomatchingTimedOut: {
219
+ reducer(draft, action) {
220
+ if (draft.bulkUpload.phase !== 'matching' ||
221
+ draft.bulkUpload.currentBatchId !== action.payload.batchId) {
222
+ return;
223
+ }
224
+ draft.bulkUpload.phase = 'completed';
225
+ },
226
+ prepare(batchId) {
227
+ return { payload: { batchId } };
228
+ },
229
+ },
230
+ pusherBatchStatusUpdate(draft, action) {
231
+ const batchStatus = action.payload;
232
+ draft.bulkUpload.batchStatusById[batchStatus.batchId] = batchStatus;
233
+ /**
234
+ * Auto-matching banner (`phase === 'matching'`) must clear when the server reports this
235
+ * upload batch is done — otherwise the Missing tab keeps MatchingProgressBanner until
236
+ * batch-details APIs run; EmailUploadBanner should show again for the next upload.
237
+ */
238
+ if (batchStatus.status === 'completed' &&
239
+ draft.bulkUpload.phase === 'matching' &&
240
+ draft.bulkUpload.currentBatchId === batchStatus.batchId) {
241
+ draft.bulkUpload.phase = 'completed';
242
+ }
243
+ },
244
+ requestMissingReceiptsTabNavigation(draft, action) {
245
+ draft.pendingMissingReceiptsTabNavigation = action.payload.tab;
246
+ },
247
+ clearMissingReceiptsTabNavigation(draft) {
248
+ draft.pendingMissingReceiptsTabNavigation = null;
249
+ },
250
+ fetchBulkUploadBatchDetailsSuccess(draft, action) {
251
+ const details = action.payload;
252
+ draft.bulkUpload.batchDetailsById[details.batchId] = details;
253
+ draft.bulkUpload.phase = 'completed';
254
+ },
255
+ fetchBulkUploadBatchDetailsFailure: {
256
+ reducer(draft) {
257
+ draft.bulkUpload.phase = 'completed';
258
+ },
259
+ prepare(payload) {
260
+ return { payload };
261
+ },
262
+ },
263
+ storeBatchDetails(draft, action) {
264
+ const details = action.payload;
265
+ draft.bulkUpload.batchDetailsById[details.batchId] = details;
266
+ /**
267
+ * Multi-batch fetch paths use `storeBatchDetails` (not `fetchBulkUploadBatchDetailsSuccess`).
268
+ * Without this, `phase` stays `matching` after upload forever and the Unmatched tab keeps
269
+ * showing the skeleton (`bulkUploadPhase === 'matching'` in web-components).
270
+ */
271
+ if (draft.bulkUpload.phase === 'matching' &&
272
+ draft.bulkUpload.currentBatchId === details.batchId) {
273
+ draft.bulkUpload.phase = 'completed';
274
+ }
275
+ },
276
+ batchDetailFetchFailed(draft, action) {
277
+ const { batchId } = action.payload;
278
+ if (!draft.bulkUpload.failedBatchDetailIds.includes(batchId)) {
279
+ draft.bulkUpload.failedBatchDetailIds.push(batchId);
280
+ }
281
+ if (draft.bulkUpload.phase === 'matching' &&
282
+ draft.bulkUpload.currentBatchId === batchId) {
283
+ draft.bulkUpload.phase = 'completed';
284
+ }
285
+ },
286
+ setInitialBatchDetailsLoading(draft) {
287
+ draft.bulkUpload.batchDetailsPaginationState = {
288
+ fetchState: 'In-Progress',
289
+ error: undefined,
290
+ };
291
+ },
292
+ fetchMoreBatchDetails(draft) {
293
+ draft.bulkUpload.batchDetailsPaginationState = {
294
+ fetchState: 'In-Progress',
295
+ error: undefined,
296
+ };
297
+ },
298
+ fetchMoreBatchDetailsComplete(draft) {
299
+ draft.bulkUpload.batchDetailsPaginationState = {
300
+ fetchState: 'Completed',
301
+ error: undefined,
302
+ };
303
+ const currentId = draft.bulkUpload.currentBatchId;
304
+ const currentDetails = currentId != null
305
+ ? draft.bulkUpload.batchDetailsById[currentId]
306
+ : undefined;
307
+ if (draft.bulkUpload.phase === 'matching' &&
308
+ currentId != null &&
309
+ currentDetails?.status === 'completed') {
310
+ draft.bulkUpload.phase = 'completed';
311
+ }
312
+ },
313
+ fetchMoreBatchDetailsFailure(draft, action) {
314
+ draft.bulkUpload.batchDetailsPaginationState = {
315
+ fetchState: 'Error',
316
+ error: action.payload.error,
317
+ };
318
+ },
319
+ fetchBulkUploadBatches: {
320
+ reducer(draft, action) {
321
+ if (action.payload.invalidateBatchDetailsCache === true) {
322
+ draft.bulkUpload.batchDetailsById = {};
323
+ draft.bulkUpload.failedBatchDetailIds = [];
324
+ }
325
+ draft.bulkUpload.batchListFetchState = {
326
+ fetchState: 'In-Progress',
327
+ error: undefined,
328
+ };
329
+ },
330
+ prepare(input) {
331
+ const fetchOptions = input ?? {};
332
+ return {
333
+ payload: {
334
+ cacheOverride: fetchOptions.cacheOverride === true,
335
+ invalidateBatchDetailsCache: fetchOptions.invalidateBatchDetailsCache === true,
336
+ },
337
+ };
338
+ },
339
+ },
340
+ fetchBulkUploadBatchesSuccess(draft, action) {
341
+ const periodId = (0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod);
342
+ draft.bulkUpload.batchListByPeriod[periodId] = action.payload.batchList;
343
+ draft.bulkUpload.batchListFetchState = {
344
+ fetchState: 'Completed',
345
+ error: undefined,
346
+ };
347
+ /**
348
+ * When the multi-batch-details epic has nothing to fetch (e.g. list rows not `completed`
349
+ * yet, or details already present), `phase` can stay `matching` even though we already
350
+ * have completed details for `currentBatchId` (from polling / Pusher). Sync so the UI can
351
+ * dismiss the Unmatched skeleton.
352
+ */
353
+ const currentId = draft.bulkUpload.currentBatchId;
354
+ if (draft.bulkUpload.phase === 'matching' && currentId != null) {
355
+ const existing = draft.bulkUpload.batchDetailsById[currentId];
356
+ if (existing?.status === 'completed') {
357
+ draft.bulkUpload.phase = 'completed';
358
+ }
359
+ }
360
+ },
361
+ fetchBulkUploadBatchesFailure(draft, action) {
362
+ draft.bulkUpload.batchListFetchState = {
363
+ fetchState: 'Error',
364
+ error: action.payload.error,
365
+ };
366
+ },
367
+ confirmBulkUploadMatch: {
368
+ reducer(draft) {
369
+ draft.bulkUpload.confirmMatchStatus = {
370
+ fetchState: 'In-Progress',
371
+ error: undefined,
372
+ };
373
+ },
374
+ prepare(batchId, attachmentId, transactionId, transactionType, fileName) {
375
+ return {
376
+ payload: {
377
+ batchId,
378
+ attachmentId,
379
+ transactionId,
380
+ transactionType,
381
+ fileName,
382
+ },
383
+ };
384
+ },
385
+ },
386
+ confirmBulkUploadMatchSuccess(draft, action) {
387
+ const { batchId, attachmentId, transactionId } = action.payload;
388
+ draft.bulkUpload.confirmMatchStatus = {
389
+ fetchState: 'Completed',
390
+ error: undefined,
391
+ };
392
+ const details = draft.bulkUpload.batchDetailsById[batchId];
393
+ if (details != null) {
394
+ const file = details.files.find((batchFile) => batchFile.attachmentId === attachmentId);
395
+ if (file != null) {
396
+ const originalStatus = file.status;
397
+ file.status = 'exact_match';
398
+ file.matchedTransactionId = transactionId;
399
+ file.candidates = undefined;
400
+ details.summary.matched += 1;
401
+ if (originalStatus === 'no_match') {
402
+ details.summary.noMatch = Math.max(0, details.summary.noMatch - 1);
403
+ }
404
+ else if (originalStatus === 'possible_matches') {
405
+ details.summary.possibleMatches = Math.max(0, details.summary.possibleMatches - 1);
406
+ }
407
+ }
408
+ }
409
+ draft.bulkUpload.manualSearch = exports.initialBulkUploadState.manualSearch;
410
+ draft.bulkUpload.manualSearchUiResetKey += 1;
411
+ },
412
+ confirmBulkUploadMatchFailure(draft, action) {
413
+ draft.bulkUpload.confirmMatchStatus = {
414
+ fetchState: 'Error',
415
+ error: action.payload.error,
416
+ };
417
+ },
418
+ setBulkUploadResultsTab(draft, action) {
419
+ draft.bulkUpload.currentResultsTab = action.payload;
420
+ },
421
+ setBulkUploadCompletedSubTab(draft, action) {
422
+ draft.bulkUpload.completedSubTab = action.payload;
423
+ },
424
+ setBulkUploadSortConfig(draft, action) {
425
+ draft.bulkUpload.sortKey = action.payload.sortKey;
426
+ draft.bulkUpload.sortOrder = action.payload.sortOrder;
427
+ },
428
+ clearBulkUpload(draft) {
429
+ Object.assign(draft.bulkUpload, exports.initialBulkUploadState);
430
+ draft.pendingMissingReceiptsTabNavigation = null;
431
+ },
432
+ searchTransactionsForManualMatch: {
433
+ reducer(draft, action) {
434
+ const { query, pageToken } = action.payload;
435
+ const isLoadMore = pageToken != null;
436
+ const trimmed = query.trim();
437
+ /**
438
+ * Cleared or too-short query: no API (see epic). Reset fully (no In-Progress).
439
+ * Only bump `manualSearchUiResetKey` when clearing a real search — not when the UI
440
+ * dispatches `""` on every keystroke while length is below MIN (web-components always sends
441
+ * `onSearch("")` in that case), or ReceiptCard remounts and the input loses focus.
442
+ */
443
+ if (!isLoadMore &&
444
+ trimmed.length < missingReceiptsViewState_1.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH) {
445
+ const hadActiveSearch = draft.bulkUpload.manualSearch.searchQuery.trim().length >=
446
+ missingReceiptsViewState_1.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH ||
447
+ draft.bulkUpload.manualSearch.results.length > 0;
448
+ draft.bulkUpload.manualSearch = exports.initialBulkUploadState.manualSearch;
449
+ if (hadActiveSearch) {
450
+ draft.bulkUpload.manualSearchUiResetKey += 1;
451
+ }
452
+ return;
453
+ }
454
+ draft.bulkUpload.manualSearch.searchQuery = query;
455
+ if (isLoadMore) {
456
+ draft.bulkUpload.manualSearch.isLoadingMore = true;
457
+ }
458
+ else {
459
+ draft.bulkUpload.manualSearch.isLoadingMore = false;
460
+ draft.bulkUpload.manualSearch.results = [];
461
+ draft.bulkUpload.manualSearch.nextPageToken = null;
462
+ draft.bulkUpload.manualSearch.totalCount = 0;
463
+ draft.bulkUpload.manualSearch.fetchState = {
464
+ fetchState: 'In-Progress',
465
+ error: undefined,
466
+ };
467
+ }
468
+ },
469
+ prepare(query, pageToken) {
470
+ return { payload: { query, pageToken: pageToken ?? undefined } };
471
+ },
472
+ },
473
+ searchTransactionsForManualMatchSuccess(draft, action) {
474
+ const { append, nextPageToken, results, totalCount } = action.payload;
475
+ if (append) {
476
+ const merged = [...draft.bulkUpload.manualSearch.results, ...results];
477
+ const byId = new Map(merged.map((result) => [result.transactionId, result]));
478
+ draft.bulkUpload.manualSearch.results = Array.from(byId.values());
479
+ }
480
+ else {
481
+ draft.bulkUpload.manualSearch.results = results;
482
+ }
483
+ draft.bulkUpload.manualSearch.nextPageToken = nextPageToken;
484
+ draft.bulkUpload.manualSearch.totalCount = totalCount;
485
+ draft.bulkUpload.manualSearch.isLoadingMore = false;
486
+ draft.bulkUpload.manualSearch.fetchState = {
487
+ fetchState: 'Completed',
488
+ error: undefined,
489
+ };
490
+ },
491
+ searchTransactionsForManualMatchFailure(draft, action) {
492
+ draft.bulkUpload.manualSearch.isLoadingMore = false;
493
+ draft.bulkUpload.manualSearch.fetchState = {
494
+ fetchState: 'Error',
495
+ error: action.payload.error,
496
+ };
497
+ },
498
+ clearManualSearchResults(draft) {
499
+ draft.bulkUpload.manualSearch = exports.initialBulkUploadState.manualSearch;
500
+ draft.bulkUpload.manualSearchUiResetKey += 1;
501
+ },
502
+ acknowledgeBulkUploadConfirmMatchComplete(draft) {
503
+ draft.bulkUpload.confirmMatchStatus = {
504
+ fetchState: 'Not-Started',
505
+ error: undefined,
506
+ };
507
+ },
508
+ // -- Completed Transactions Actions --
509
+ fetchCompletedTransactions: {
510
+ reducer(draft, action) {
511
+ const { pageToken } = action.payload;
512
+ if (pageToken != null) {
513
+ const periods = draft.bulkUpload.completedTransactionsByPeriod;
514
+ for (const entry of Object.values(periods)) {
515
+ if (entry.nextPageToken === pageToken) {
516
+ entry.fetchState = {
517
+ fetchState: 'In-Progress',
518
+ error: undefined,
519
+ };
520
+ break;
521
+ }
522
+ }
523
+ }
524
+ },
525
+ prepare(pageToken, cacheOverride) {
526
+ return { payload: { pageToken, cacheOverride } };
527
+ },
528
+ },
529
+ fetchCompletedTransactionsSuccess(draft, action) {
530
+ const { transactionIds, nextPageToken, totalCount, selectedPeriod, isInitialLoad, } = action.payload;
531
+ const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
532
+ const cacheKey = (0, exports.getCompletedTransactionsCacheKey)(periodId, draft.bulkUpload.sortKey, draft.bulkUpload.sortOrder, draft.bulkUpload.completedSubTab);
533
+ if (isInitialLoad) {
534
+ draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
535
+ transactionIds,
536
+ nextPageToken,
537
+ totalCount,
538
+ fetchState: { fetchState: 'Completed', error: undefined },
539
+ };
540
+ }
541
+ else {
542
+ const existing = draft.bulkUpload.completedTransactionsByPeriod[cacheKey];
543
+ if (existing != null) {
544
+ existing.transactionIds.push(...transactionIds);
545
+ existing.nextPageToken = nextPageToken;
546
+ existing.totalCount = totalCount;
547
+ existing.fetchState = { fetchState: 'Completed', error: undefined };
548
+ }
549
+ else {
550
+ draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
551
+ transactionIds,
552
+ nextPageToken,
553
+ totalCount,
554
+ fetchState: { fetchState: 'Completed', error: undefined },
555
+ };
556
+ }
557
+ }
558
+ },
559
+ fetchCompletedTransactionsFailure(draft, action) {
560
+ const periodId = (0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod);
561
+ const cacheKey = (0, exports.getCompletedTransactionsCacheKey)(periodId, draft.bulkUpload.sortKey, draft.bulkUpload.sortOrder, draft.bulkUpload.completedSubTab);
562
+ const existing = draft.bulkUpload.completedTransactionsByPeriod[cacheKey];
563
+ if (existing != null) {
564
+ existing.fetchState = {
565
+ fetchState: 'Error',
566
+ error: action.payload.error,
567
+ };
568
+ }
569
+ else {
570
+ draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
571
+ fetchState: { fetchState: 'Error', error: action.payload.error },
572
+ nextPageToken: null,
573
+ totalCount: 0,
574
+ transactionIds: [],
575
+ };
576
+ }
577
+ },
127
578
  },
128
579
  });
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;
580
+ _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,
581
+ // Bulk Upload
582
+ exports.bulkUploadReceipts = _a.bulkUploadReceipts, exports.updateBulkUploadProgress = _a.updateBulkUploadProgress, exports.setBulkUploadUploadedFileCount = _a.setBulkUploadUploadedFileCount, exports.bulkUploadReceiptsSuccess = _a.bulkUploadReceiptsSuccess, exports.bulkUploadReceiptsFailure = _a.bulkUploadReceiptsFailure, exports.restoreBulkUploadMatchingState = _a.restoreBulkUploadMatchingState, 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,
583
+ // Completed Transactions
584
+ exports.fetchCompletedTransactions = _a.fetchCompletedTransactions, exports.fetchCompletedTransactionsSuccess = _a.fetchCompletedTransactionsSuccess, exports.fetchCompletedTransactionsFailure = _a.fetchCompletedTransactionsFailure;
130
585
  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,78 @@
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
+ uploadedFileCount: number;
55
+ uploadProgress: number;
56
+ uploadStatus: FetchStateAndError;
57
+ }
58
+ export interface ResolvedBatchDetails {
59
+ batchId: ID;
60
+ createdAt: string;
61
+ files: ResolvedBatchFile[];
62
+ status: string;
63
+ summary: {
64
+ failed: number;
65
+ matched: number;
66
+ noMatch: number;
67
+ possibleMatches: number;
68
+ total: number;
69
+ };
70
+ }
5
71
  export interface ExpenseAutomationMissingReceiptsViewSelector extends SelectorView {
72
+ bulkUpload: BulkUploadSelectorData;
6
73
  completionStatus: CompletionStatusType;
74
+ /** When set, UI should switch bulk-upload sub-tab once (e.g. Unmatched on batch completion). */
75
+ pendingMissingReceiptsTabNavigation: BulkUploadResultsTab | null;
7
76
  refreshStatus: FetchStateAndError;
8
77
  transactions: SupportedTransaction[];
9
78
  uiState: MissingReceiptsViewUIState;