@zeniai/client-epic-state 4.20.4 → 4.20.6

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