@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 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * After upload API success, hold the bar at 100% this long before transitioning to matching,
3
- * so the fill animation can complete without an abrupt swap to the auto-matching banner.
4
- */
5
- export const BULK_UPLOAD_BAR_COMPLETE_HOLD_MS = 400;
6
- /**
7
- * Max wall-clock wait for Pusher + batch-details resolution after upload. If exceeded, we stop
8
- * fallback polling, clear the automatching banner (`phase` → completed), and refresh batch list.
9
- */
10
- export const BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS = 300000;
@@ -1,29 +0,0 @@
1
- import { concat, of, timer } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
- import { BULK_UPLOAD_BAR_COMPLETE_HOLD_MS } from '../../bulkUploadTiming';
5
- import { bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess, updateBulkUploadProgress, } from '../../reducers/missingReceiptsViewReducer';
6
- export const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceipts.match), mergeMap((action) => {
7
- const { files } = action.payload;
8
- const formData = new FormData();
9
- for (const file of files) {
10
- formData.append('files', file, file.name);
11
- }
12
- return zeniAPI
13
- .postFormData(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`, formData)
14
- .pipe(mergeMap((response) => {
15
- if (isSuccessResponse(response) && response.data != null) {
16
- const batchId = String(response.data.batch_id ?? '').trim();
17
- if (batchId === '') {
18
- return of(bulkUploadReceiptsFailure({
19
- error: createZeniAPIStatus('Unexpected Error', 'Bulk upload succeeded but batch_id was missing or empty.'),
20
- }));
21
- }
22
- return concat(of(updateBulkUploadProgress(100)), timer(BULK_UPLOAD_BAR_COMPLETE_HOLD_MS).pipe(mergeMap(() => of(bulkUploadReceiptsSuccess({ batchId })))));
23
- }
24
- return of(bulkUploadReceiptsFailure({ error: response.status }));
25
- }), catchError((error) => of(bulkUploadReceiptsFailure({
26
- error: createZeniAPIStatus('Unexpected Error', 'Bulk upload receipts API call errored out: ' +
27
- JSON.stringify(error)),
28
- }))));
29
- }));
@@ -1,49 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, exhaustMap, filter, mergeMap } from 'rxjs/operators';
3
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
- import { confirmBulkUploadMatch, confirmBulkUploadMatchFailure, confirmBulkUploadMatchSuccess, } from '../../reducers/missingReceiptsViewReducer';
6
- export const confirmBulkUploadMatchEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(confirmBulkUploadMatch.match), exhaustMap((action) => {
7
- const { batchId, attachmentId, transactionId, transactionType, fileName } = action.payload;
8
- return zeniAPI
9
- .postAndGetJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/manual-match`, {
10
- attachment_id: attachmentId,
11
- transaction_id: transactionId,
12
- transaction_type: transactionType,
13
- file_name: fileName,
14
- })
15
- .pipe(mergeMap((response) => {
16
- if (isSuccessResponse(response)) {
17
- return from([
18
- confirmBulkUploadMatchSuccess({
19
- batchId,
20
- attachmentId,
21
- transactionId,
22
- }),
23
- openSnackbar({
24
- messageSection: 'receipt_match',
25
- messageText: 'success',
26
- type: 'success',
27
- }),
28
- ]);
29
- }
30
- return from([
31
- confirmBulkUploadMatchFailure({ error: response.status }),
32
- openSnackbar({
33
- messageSection: 'receipt_match',
34
- messageText: 'failed',
35
- type: 'error',
36
- }),
37
- ]);
38
- }), catchError((error) => from([
39
- confirmBulkUploadMatchFailure({
40
- error: createZeniAPIStatus('Unexpected Error', 'Confirm bulk upload match errored out: ' +
41
- JSON.stringify(error)),
42
- }),
43
- openSnackbar({
44
- messageSection: 'receipt_match',
45
- messageText: 'failed',
46
- type: 'error',
47
- }),
48
- ])));
49
- }));
@@ -1,40 +0,0 @@
1
- import { EMPTY, from, of } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
4
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
- import { extractTransactionPayloadsFromBatchFiles, isBatchDetailsApiStatusCompleted, shouldFetchBatchDetailsForBatchId, toBatchDetails, } from '../../payload/missingReceiptsPayload';
6
- import { fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsFailure, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, } from '../../reducers/missingReceiptsViewReducer';
7
- export const fetchBulkUploadBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchBulkUploadBatchDetails.match), mergeMap(() => {
8
- const bulkUpload = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
9
- const { currentBatchId } = bulkUpload;
10
- if (currentBatchId == null) {
11
- return of(fetchBulkUploadBatchDetailsFailure({
12
- error: createZeniAPIStatus('Unexpected Error', 'No current batch ID available'),
13
- }));
14
- }
15
- if (!shouldFetchBatchDetailsForBatchId(bulkUpload.batchStatusById, bulkUpload.batchListByPeriod, currentBatchId)) {
16
- return EMPTY;
17
- }
18
- return zeniAPI
19
- .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${currentBatchId}`)
20
- .pipe(mergeMap((response) => {
21
- if (!isSuccessResponse(response) ||
22
- response.data == null ||
23
- !isBatchDetailsApiStatusCompleted(response.data.status)) {
24
- if (isSuccessResponse(response) && response.data != null) {
25
- return EMPTY;
26
- }
27
- return of(fetchBulkUploadBatchDetailsFailure({ error: response.status }));
28
- }
29
- const actions = [];
30
- const transactionPayloads = extractTransactionPayloadsFromBatchFiles(response.data.files);
31
- if (transactionPayloads.length > 0) {
32
- actions.push(updateTransactions(transactionPayloads, (value) => value.transaction_id));
33
- }
34
- actions.push(fetchBulkUploadBatchDetailsSuccess(toBatchDetails(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
35
- actions.push(fetchBulkUploadBatches({ cacheOverride: true }));
36
- return from(actions);
37
- }), catchError((error) => of(fetchBulkUploadBatchDetailsFailure({
38
- error: createZeniAPIStatus('Unexpected Error', 'Fetch batch details errored out: ' + JSON.stringify(error)),
39
- }))));
40
- }));
@@ -1,47 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { convertToPeriod, toMonthYearPeriodId, } from '../../../../commonStateTypes/timePeriod';
4
- import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
6
- import { toBatchListItem, } from '../../payload/missingReceiptsPayload';
7
- import { fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess, } from '../../reducers/missingReceiptsViewReducer';
8
- export const fetchBulkUploadBatchesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchBulkUploadBatches.match), switchMap((action) => {
9
- const { cacheOverride } = action.payload;
10
- const state = state$.value;
11
- const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
12
- const currentTenant = getCurrentTenant(state);
13
- const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
14
- const periodId = toMonthYearPeriodId(selectedPeriod);
15
- const existingBatches = bulkUpload.batchListByPeriod[periodId] ?? [];
16
- if (cacheOverride !== true && existingBatches.length > 0) {
17
- return of(fetchBulkUploadBatchesSuccess({
18
- batchList: existingBatches,
19
- selectedPeriod,
20
- }));
21
- }
22
- const period = convertToPeriod(selectedPeriod);
23
- const queryParam = {
24
- start_date: period.start,
25
- end_date: period.end,
26
- sort_order: 'desc',
27
- };
28
- return zeniAPI
29
- .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
30
- .pipe(mergeMap((response) => {
31
- if (isSuccessResponse(response) && response.data != null) {
32
- /** Full list (all statuses) for UI; batch-details epics filter to `completed` only. */
33
- return of(fetchBulkUploadBatchesSuccess({
34
- batchList: response.data.batches.map(toBatchListItem),
35
- selectedPeriod,
36
- }));
37
- }
38
- return of(fetchBulkUploadBatchesFailure({
39
- error: response.status,
40
- selectedPeriod,
41
- }));
42
- }), catchError((error) => of(fetchBulkUploadBatchesFailure({
43
- error: createZeniAPIStatus('Unexpected Error', 'Fetch bulk upload batches errored out: ' +
44
- JSON.stringify(error)),
45
- selectedPeriod,
46
- }))));
47
- }));
@@ -1,61 +0,0 @@
1
- import { from, of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { convertToPeriod, toMonthYearPeriodId, } from '../../../../commonStateTypes/timePeriod';
4
- import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
- import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
6
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
7
- import { fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess, getCompletedTransactionsCacheKey, } from '../../reducers/missingReceiptsViewReducer';
8
- export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchCompletedTransactions.match), switchMap((action) => {
9
- const state = state$.value;
10
- const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
11
- const currentTenant = getCurrentTenant(state);
12
- const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
13
- const periodId = toMonthYearPeriodId(selectedPeriod);
14
- const isInitialLoad = action.payload.pageToken == null;
15
- const cacheKey = getCompletedTransactionsCacheKey(periodId, bulkUpload.sortKey, bulkUpload.sortOrder, bulkUpload.completedSubTab);
16
- const existingData = bulkUpload.completedTransactionsByPeriod[cacheKey];
17
- if (isInitialLoad &&
18
- action.payload.cacheOverride !== true &&
19
- existingData != null &&
20
- existingData.transactionIds.length > 0) {
21
- return from([]);
22
- }
23
- const period = convertToPeriod(selectedPeriod);
24
- const queryPayload = {
25
- start_date: period.start,
26
- end_date: period.end,
27
- sort_by: bulkUpload.sortKey,
28
- sort_order: bulkUpload.sortOrder === 'ascending' ? 'asc' : 'desc',
29
- page_token: action.payload.pageToken ?? null,
30
- page_size: 25,
31
- };
32
- if (bulkUpload.completedSubTab !== 'all') {
33
- queryPayload.match_type = bulkUpload.completedSubTab;
34
- }
35
- const encodedQuery = encodeURIComponent(JSON.stringify(queryPayload));
36
- return zeniAPI
37
- .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipt-agent/transactions/completed?query=${encodedQuery}`)
38
- .pipe(mergeMap((response) => {
39
- if (isSuccessResponse(response) && response.data != null) {
40
- const transactionIds = response.data.transactions.map((t) => t.transaction_id);
41
- const updateActions = [];
42
- updateActions.push(updateTransactions(response.data.transactions, (value) => value.transaction_id));
43
- updateActions.push(fetchCompletedTransactionsSuccess({
44
- isInitialLoad,
45
- transactionIds,
46
- nextPageToken: response.data.next_page_token,
47
- totalCount: response.data.total_count,
48
- selectedPeriod,
49
- }));
50
- return from(updateActions);
51
- }
52
- return of(fetchCompletedTransactionsFailure({
53
- error: response.status,
54
- selectedPeriod,
55
- }));
56
- }), catchError((error) => of(fetchCompletedTransactionsFailure({
57
- error: createZeniAPIStatus('Unexpected Error', 'Fetch completed transactions errored: ' +
58
- JSON.stringify(error)),
59
- selectedPeriod,
60
- }))));
61
- }));
@@ -1,33 +0,0 @@
1
- import { concat, of } from 'rxjs';
2
- import { catchError, exhaustMap, filter } from 'rxjs/operators';
3
- import { toMonthYearPeriodId } from '../../../../commonStateTypes/timePeriod';
4
- import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
- import { createZeniAPIStatus } from '../../../../responsePayload';
6
- import { filterBatchListItemsForBatchDetailsFetch } from '../../payload/missingReceiptsPayload';
7
- import { fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, } from '../../reducers/missingReceiptsViewReducer';
8
- import { fetchBatchDetailsByIds } from './fetchMultipleBatchDetailsEpic';
9
- const MORE_BATCH_PAGE_SIZE = 5;
10
- export const fetchMoreBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchMoreBatchDetails.match),
11
- /** One page at a time — avoids duplicate loads if IO + scroll fallback both fire. */
12
- exhaustMap(() => {
13
- const state = state$.value;
14
- const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
15
- const currentTenant = getCurrentTenant(state);
16
- const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
17
- if (selectedPeriod == null) {
18
- return of(fetchMoreBatchDetailsComplete());
19
- }
20
- const periodId = toMonthYearPeriodId(selectedPeriod);
21
- const batchList = bulkUpload.batchListByPeriod[periodId] ?? [];
22
- const failedIds = new Set(bulkUpload.failedBatchDetailIds);
23
- const unfetchedBatches = filterBatchListItemsForBatchDetailsFetch(batchList).filter((batch) => bulkUpload.batchDetailsById[batch.batchId] == null &&
24
- !failedIds.has(batch.batchId));
25
- const unfetchedBatchIds = unfetchedBatches.map((batch) => batch.batchId);
26
- if (unfetchedBatchIds.length === 0) {
27
- return of(fetchMoreBatchDetailsComplete());
28
- }
29
- const nextPage = unfetchedBatchIds.slice(0, MORE_BATCH_PAGE_SIZE);
30
- return concat(fetchBatchDetailsByIds(nextPage, zeniAPI), of(fetchMoreBatchDetailsComplete())).pipe(catchError((error) => of(fetchMoreBatchDetailsFailure({
31
- error: createZeniAPIStatus('Unexpected Error', 'Fetch more batch details errored out: ' + JSON.stringify(error)),
32
- }))));
33
- }));
@@ -1,56 +0,0 @@
1
- import { EMPTY, concat, from, of } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
4
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
- import { extractTransactionPayloadsFromBatchFiles, filterBatchListItemsForBatchDetailsFetch, isBatchDetailsApiStatusCompleted, shouldFetchBatchDetailsForBatchId, toBatchDetails, } from '../../payload/missingReceiptsPayload';
6
- import { batchDetailFetchFailed, fetchBulkUploadBatchDetails, fetchBulkUploadBatchesSuccess, fetchMoreBatchDetailsComplete, setInitialBatchDetailsLoading, storeBatchDetails, } from '../../reducers/missingReceiptsViewReducer';
7
- const INITIAL_BATCH_PAGE_SIZE = 5;
8
- export function fetchBatchDetailsByIds(batchIds, zeniAPI) {
9
- if (batchIds.length === 0) {
10
- return EMPTY;
11
- }
12
- return from(batchIds).pipe(mergeMap((batchId) => zeniAPI
13
- .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
14
- .pipe(mergeMap((response) => {
15
- if (!isSuccessResponse(response) ||
16
- response.data == null ||
17
- !isBatchDetailsApiStatusCompleted(response.data.status)) {
18
- return EMPTY;
19
- }
20
- const actions = [];
21
- const transactionPayloads = extractTransactionPayloadsFromBatchFiles(response.data.files);
22
- if (transactionPayloads.length > 0) {
23
- actions.push(updateTransactions(transactionPayloads, (value) => value.transaction_id));
24
- }
25
- actions.push(storeBatchDetails(toBatchDetails(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
26
- return from(actions);
27
- }), catchError((error) => {
28
- console.error(`Failed to fetch batch details for ${batchId}:`, createZeniAPIStatus('Unexpected Error', 'Fetch batch details errored out: ' + JSON.stringify(error)));
29
- return of(batchDetailFetchFailed({ batchId }));
30
- })), 5));
31
- }
32
- export const fetchMultipleBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchBulkUploadBatchesSuccess.match), mergeMap((action) => {
33
- const batchList = action.payload.batchList;
34
- const { batchDetailsById } = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
35
- /** Only completed list rows may trigger batch-details API; preserve platform order. */
36
- const completedBatchesMissingDetails = filterBatchListItemsForBatchDetailsFetch(batchList).filter((batch) => batchDetailsById[batch.batchId] == null);
37
- const completedBatchIds = completedBatchesMissingDetails.map((batch) => batch.batchId);
38
- const batchIdsToFetch = completedBatchIds.slice(0, INITIAL_BATCH_PAGE_SIZE);
39
- if (batchIdsToFetch.length === 0) {
40
- /**
41
- * List refresh can complete while no row is `completed` yet (multi-fetch skips), or
42
- * `currentBatchId` may not appear in the filtered list but still needs `GET /batches/:id`.
43
- * Fall back to the single-batch-details epic so `phase` and details can resolve.
44
- */
45
- const bulkUpload = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
46
- const currentId = bulkUpload.currentBatchId;
47
- if (currentId != null &&
48
- bulkUpload.phase === 'matching' &&
49
- bulkUpload.batchDetailsById[currentId] == null &&
50
- shouldFetchBatchDetailsForBatchId(bulkUpload.batchStatusById, bulkUpload.batchListByPeriod, currentId)) {
51
- return of(fetchBulkUploadBatchDetails());
52
- }
53
- return EMPTY;
54
- }
55
- return concat(of(setInitialBatchDetailsLoading()), fetchBatchDetailsByIds(batchIdsToFetch, zeniAPI), of(fetchMoreBatchDetailsComplete()));
56
- }));
@@ -1,77 +0,0 @@
1
- import { EMPTY, from, merge, of } from 'rxjs';
2
- import { catchError, debounceTime, filter, mergeMap, switchMap, } from 'rxjs/operators';
3
- import { convertToPeriod } from '../../../../commonStateTypes/timePeriod';
4
- import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
- import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
6
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
7
- import { supportedTransactionPayloadToManualSearchResult } from '../../payload/missingReceiptsPayload';
8
- import { searchTransactionsForManualMatch, searchTransactionsForManualMatchFailure, searchTransactionsForManualMatchSuccess, } from '../../reducers/missingReceiptsViewReducer';
9
- import { toTransactionsSortKey } from '../../types/transactionsViewState';
10
- /**
11
- * `auto_categorized` for manual transaction search (Unmatched).
12
- * Backend contract TBD — align with `fetchTransactionCategorizationEpic` (`selectedTab === 'autoCategorized'`)
13
- * when the expense-automation API documents the intended filter for this flow.
14
- */
15
- export const MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = false;
16
- export const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
17
- const searchActions$ = actions$.pipe(filter(searchTransactionsForManualMatch.match));
18
- const pagination$ = searchActions$.pipe(filter((action) => action.payload.pageToken != null));
19
- /**
20
- * No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP.
21
- */
22
- const newSearchTooShortOrClear$ = searchActions$.pipe(filter((action) => action.payload.pageToken == null &&
23
- action.payload.query.trim().length < 2));
24
- const newSearchDebounced$ = searchActions$.pipe(filter((action) => action.payload.pageToken == null &&
25
- action.payload.query.trim().length >= 2), debounceTime(300));
26
- return merge(pagination$, newSearchTooShortOrClear$, newSearchDebounced$).pipe(switchMap((action) => {
27
- const { query, pageToken } = action.payload;
28
- if (pageToken == null && query.trim().length < 2) {
29
- return EMPTY;
30
- }
31
- const state = state$.value;
32
- const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload: { manualSearch, sortKey, sortOrder }, }, } = state;
33
- const currentTenant = getCurrentTenant(state);
34
- const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
35
- if (selectedPeriod == null) {
36
- return of(searchTransactionsForManualMatchFailure({
37
- error: createZeniAPIStatus('Unexpected Error', 'Manual search requires a selected accounting period.'),
38
- }));
39
- }
40
- const period = convertToPeriod(selectedPeriod);
41
- const queryParam = {
42
- start_date: period.start,
43
- end_date: period.end,
44
- auto_categorized: MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED,
45
- sort_by: toTransactionsSortKey(sortKey),
46
- sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
47
- page_token: pageToken ?? null,
48
- page_size: manualSearch.pageSize,
49
- search_text: query,
50
- };
51
- return zeniAPI
52
- .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
53
- .pipe(mergeMap((response) => {
54
- if (isSuccessResponse(response) && response.data != null) {
55
- const { transactions, next_page_token, total_count } = response.data;
56
- const append = pageToken != null;
57
- const results = transactions.map(supportedTransactionPayloadToManualSearchResult);
58
- const actionsOut = [
59
- updateTransactions(transactions, (value) => value.transaction_id, 'merge'),
60
- searchTransactionsForManualMatchSuccess({
61
- append,
62
- nextPageToken: next_page_token ?? null,
63
- results,
64
- totalCount: total_count,
65
- }),
66
- ];
67
- return from(actionsOut);
68
- }
69
- return of(searchTransactionsForManualMatchFailure({
70
- error: response.status,
71
- }));
72
- }), catchError((error) => of(searchTransactionsForManualMatchFailure({
73
- error: createZeniAPIStatus('Unexpected Error', 'Search transactions for manual match errored: ' +
74
- JSON.stringify(error)),
75
- }))));
76
- }));
77
- };
@@ -1,79 +0,0 @@
1
- import { EMPTY, from, merge, of, timer } from 'rxjs';
2
- import { catchError, debounceTime, filter, mergeMap, switchMap, takeUntil, } from 'rxjs/operators';
3
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
- import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
5
- import { isSuccessResponse } from '../../../../responsePayload';
6
- import { BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS } from '../../bulkUploadTiming';
7
- import { extractTransactionPayloadsFromBatchFiles, isBatchDetailsApiStatusCompleted, toBatchDetails, } from '../../payload/missingReceiptsPayload';
8
- import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, } from '../../reducers/missingReceiptsViewReducer';
9
- /** First poll after upload; then interval while batch not resolved via Pusher or API. */
10
- const FALLBACK_FIRST_DELAY_MS = 30000;
11
- const FALLBACK_POLL_INTERVAL_MS = 10000;
12
- /**
13
- * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
14
- * and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
15
- */
16
- export const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.status === 'completed'), debounceTime(300), mergeMap(() => from([
17
- fetchBulkUploadBatches({
18
- cacheOverride: true,
19
- invalidateBatchDetailsCache: true,
20
- }),
21
- requestMissingReceiptsTabNavigation({ tab: 'unmatched' }),
22
- ])));
23
- /**
24
- * If Pusher and batch-details are delayed beyond {@link BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS},
25
- * force `phase` to `completed` (dismiss automatching banner) and refresh the batch list.
26
- * Cancels when the batch completes normally, bulk state is cleared, or another upload supersedes.
27
- */
28
- export const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), mergeMap((action) => {
29
- const { batchId } = action.payload;
30
- return timer(BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS).pipe(mergeMap(() => {
31
- const bulk = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
32
- if (bulk.phase !== 'matching' || bulk.currentBatchId !== batchId) {
33
- return EMPTY;
34
- }
35
- return from([
36
- bulkUploadAutomatchingTimedOut(batchId),
37
- fetchBulkUploadBatches({ cacheOverride: true }),
38
- ]);
39
- }), takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((a) => a.payload.batchId === batchId &&
40
- a.payload.status === 'completed')), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((a) => a.payload.batchId === batchId)))));
41
- }));
42
- /**
43
- * Fallback polling when Pusher is slow or unavailable. Network errors on a poll tick show one
44
- * error snackbar per upload session (first failure only) so the user is not spammed every
45
- * interval; Pusher or a later successful poll still completes the flow.
46
- */
47
- export const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), mergeMap((action) => {
48
- const { batchId } = action.payload;
49
- let pollErrorNotified = false;
50
- return timer(FALLBACK_FIRST_DELAY_MS, FALLBACK_POLL_INTERVAL_MS).pipe(takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.batchId === batchId)), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((action) => action.payload.batchId === batchId)), actions$.pipe(filter(bulkUploadAutomatchingTimedOut.match), filter((action) => action.payload.batchId === batchId)))), switchMap(() => zeniAPI
51
- .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
52
- .pipe(mergeMap((response) => {
53
- /** Same batch-details URL; polls until `status` is completed (Pusher may win first). */
54
- if (isSuccessResponse(response) && response.data != null) {
55
- if (isBatchDetailsApiStatusCompleted(response.data.status)) {
56
- const actions = [];
57
- const transactionPayloads = extractTransactionPayloadsFromBatchFiles(response.data.files);
58
- if (transactionPayloads.length > 0) {
59
- actions.push(updateTransactions(transactionPayloads, (value) => value.transaction_id));
60
- }
61
- actions.push(fetchBulkUploadBatchDetailsSuccess(toBatchDetails(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
62
- actions.push(fetchBulkUploadBatches({ cacheOverride: true }));
63
- actions.push(requestMissingReceiptsTabNavigation({ tab: 'unmatched' }));
64
- return from(actions);
65
- }
66
- }
67
- return EMPTY;
68
- }), catchError(() => {
69
- if (!pollErrorNotified) {
70
- pollErrorNotified = true;
71
- return of(openSnackbar({
72
- messageSection: 'receipts_upload',
73
- messageText: 'failed',
74
- type: 'error',
75
- }));
76
- }
77
- return EMPTY;
78
- }))));
79
- }));
@@ -1,24 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { filter, mergeMap } from 'rxjs/operators';
3
- import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
4
- import { updateTransaction } from '../../../../entity/transaction/transactionReducer';
5
- import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
6
- import { uploadTransactionCategorizationReceiptSuccess } from '../../reducers/transactionsViewReducer';
7
- export const uploadTransactionReceiptSuccessEpic = (actions$, state$) => actions$.pipe(filter(uploadTransactionCategorizationReceiptSuccess.match), mergeMap((action) => {
8
- const { transactionPayload, updateType } = action.payload;
9
- const updateActions = [];
10
- const currentTenant = getCurrentTenant(state$.value);
11
- const selectedPeriodByTenantId = state$.value.expenseAutomationViewState.selectedPeriodByTenantId;
12
- updateActions.push(updateTransaction(transactionPayload.transaction_id, transactionPayload, updateType));
13
- if (currentTenant != null) {
14
- const monthEndChecksPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
15
- if (monthEndChecksPeriod != null) {
16
- updateActions.push(fetchMonthEndCloseChecks({
17
- tenantId: currentTenant.tenantId,
18
- period: monthEndChecksPeriod,
19
- refreshViewInBackground: true,
20
- }));
21
- }
22
- }
23
- return from(updateActions);
24
- }));
@@ -1,17 +0,0 @@
1
- /**
2
- * Empty `COABalancesSlice` for horizontal P&L-by-class section / calculated headers when
3
- * enrichment has not produced balances yet, or for UI mapping fallbacks.
4
- * Structure matches {@link enrichProfitAndLossByClassHorizontalReport} output.
5
- */
6
- export function getEmptyHorizontalSectionBalancesSlice(firstMonthOfFY, timeframe = 'month') {
7
- return {
8
- balances: [],
9
- additionalBalances: [],
10
- filter: {
11
- firstMonthOfFY,
12
- timeframe,
13
- balancesRange: { numberOfPeriods: 0, orderBy: 'ascending_date' },
14
- additionalBalances: [],
15
- },
16
- };
17
- }