@zeniai/client-epic-state 4.20.3 → 4.20.5

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 (169) 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/tsconfig.typecheck.tsbuildinfo +0 -1
  134. package/lib/view/expenseAutomationView/bulkUploadTiming.d.ts +0 -10
  135. package/lib/view/expenseAutomationView/bulkUploadTiming.js +0 -13
  136. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +0 -18
  137. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +0 -33
  138. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +0 -7
  139. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +0 -53
  140. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +0 -8
  141. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +0 -44
  142. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +0 -7
  143. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +0 -51
  144. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +0 -8
  145. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +0 -65
  146. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +0 -8
  147. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +0 -37
  148. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +0 -9
  149. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +0 -61
  150. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +0 -14
  151. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -81
  152. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +0 -25
  153. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +0 -85
  154. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +0 -7
  155. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +0 -28
  156. package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.d.ts +0 -9
  157. package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +0 -20
  158. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +0 -15
  159. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +0 -335
  160. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +0 -111
  161. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +0 -13
  162. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +0 -6
  163. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +0 -265
  164. package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +0 -23
  165. package/lib/view/userGroupListView/userGroupListViewReducer.js +0 -69
  166. package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +0 -7
  167. package/lib/view/userGroupListView/userGroupListViewSelector.js +0 -20
  168. package/lib/view/userGroupListView/userGroupListViewState.d.ts +0 -8
  169. package/lib/view/userGroupListView/userGroupListViewState.js +0 -2
@@ -1,85 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pollBulkUploadBatchStatusEpic = exports.bulkUploadAutomatchingTimeoutEpic = exports.pusherBatchStatusCompletionEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
7
- const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
8
- const responsePayload_1 = require("../../../../responsePayload");
9
- const bulkUploadTiming_1 = require("../../bulkUploadTiming");
10
- const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
11
- const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
12
- /** First poll after upload; then interval while batch not resolved via Pusher or API. */
13
- const FALLBACK_FIRST_DELAY_MS = 30000;
14
- const FALLBACK_POLL_INTERVAL_MS = 10000;
15
- /**
16
- * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
17
- * and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
18
- */
19
- const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match), (0, operators_1.filter)((action) => action.payload.status === 'completed'), (0, operators_1.debounceTime)(300), (0, operators_1.mergeMap)(() => (0, rxjs_1.from)([
20
- (0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({
21
- cacheOverride: true,
22
- invalidateBatchDetailsCache: true,
23
- }),
24
- (0, missingReceiptsViewReducer_1.requestMissingReceiptsTabNavigation)({ tab: 'unmatched' }),
25
- ])));
26
- exports.pusherBatchStatusCompletionEpic = pusherBatchStatusCompletionEpic;
27
- /**
28
- * If Pusher and batch-details are delayed beyond {@link BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS},
29
- * force `phase` to `completed` (dismiss automatching banner) and refresh the batch list.
30
- * Cancels when the batch completes normally, bulk state is cleared, or another upload supersedes.
31
- */
32
- const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess.match), (0, operators_1.mergeMap)((action) => {
33
- const { batchId } = action.payload;
34
- return (0, rxjs_1.timer)(bulkUploadTiming_1.BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS).pipe((0, operators_1.mergeMap)(() => {
35
- const bulk = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
36
- if (bulk.phase !== 'matching' || bulk.currentBatchId !== batchId) {
37
- return rxjs_1.EMPTY;
38
- }
39
- return (0, rxjs_1.from)([
40
- (0, missingReceiptsViewReducer_1.bulkUploadAutomatchingTimedOut)(batchId),
41
- (0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({ cacheOverride: true }),
42
- ]);
43
- }), (0, operators_1.takeUntil)((0, rxjs_1.merge)(actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.clearBulkUpload.match)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match), (0, operators_1.filter)((a) => a.payload.batchId === batchId &&
44
- a.payload.status === 'completed')), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess.match), (0, operators_1.filter)((a) => a.payload.batchId === batchId)))));
45
- }));
46
- exports.bulkUploadAutomatchingTimeoutEpic = bulkUploadAutomatchingTimeoutEpic;
47
- /**
48
- * Fallback polling when Pusher is slow or unavailable. Network errors on a poll tick show one
49
- * error snackbar per upload session (first failure only) so the user is not spammed every
50
- * interval; Pusher or a later successful poll still completes the flow.
51
- */
52
- const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess.match), (0, operators_1.mergeMap)((action) => {
53
- const { batchId } = action.payload;
54
- let pollErrorNotified = false;
55
- return (0, rxjs_1.timer)(FALLBACK_FIRST_DELAY_MS, FALLBACK_POLL_INTERVAL_MS).pipe((0, operators_1.takeUntil)((0, rxjs_1.merge)(actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.clearBulkUpload.match)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match), (0, operators_1.filter)((action) => action.payload.batchId === batchId)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess.match), (0, operators_1.filter)((action) => action.payload.batchId === batchId)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadAutomatchingTimedOut.match), (0, operators_1.filter)((action) => action.payload.batchId === batchId)))), (0, operators_1.switchMap)(() => zeniAPI
56
- .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
57
- .pipe((0, operators_1.mergeMap)((response) => {
58
- /** Same batch-details URL; polls until `status` is completed (Pusher may win first). */
59
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
60
- if ((0, missingReceiptsPayload_1.isBatchDetailsApiStatusCompleted)(response.data.status)) {
61
- const actions = [];
62
- const transactionPayloads = (0, missingReceiptsPayload_1.extractTransactionPayloadsFromBatchFiles)(response.data.files);
63
- if (transactionPayloads.length > 0) {
64
- actions.push((0, transactionReducer_1.updateTransactions)(transactionPayloads, (value) => value.transaction_id));
65
- }
66
- actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess)((0, missingReceiptsPayload_1.toBatchDetails)(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
67
- actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({ cacheOverride: true }));
68
- actions.push((0, missingReceiptsViewReducer_1.requestMissingReceiptsTabNavigation)({ tab: 'unmatched' }));
69
- return (0, rxjs_1.from)(actions);
70
- }
71
- }
72
- return rxjs_1.EMPTY;
73
- }), (0, operators_1.catchError)(() => {
74
- if (!pollErrorNotified) {
75
- pollErrorNotified = true;
76
- return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
77
- messageSection: 'receipts_upload',
78
- messageText: 'failed',
79
- type: 'error',
80
- }));
81
- }
82
- return rxjs_1.EMPTY;
83
- }))));
84
- }));
85
- exports.pollBulkUploadBatchStatusEpic = pollBulkUploadBatchStatusEpic;
@@ -1,7 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { updateTransaction } from '../../../../entity/transaction/transactionReducer';
3
- import { RootState } from '../../../../reducer';
4
- import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
5
- import { uploadTransactionCategorizationReceiptSuccess } from '../../reducers/transactionsViewReducer';
6
- export type ActionType = ReturnType<typeof uploadTransactionCategorizationReceiptSuccess> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof updateTransaction>;
7
- export declare const uploadTransactionReceiptSuccessEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => import("rxjs").Observable<ActionType>;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uploadTransactionReceiptSuccessEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
7
- const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
8
- const monthEndCloseChecksViewReducer_1 = require("../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer");
9
- const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
10
- const uploadTransactionReceiptSuccessEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.uploadTransactionCategorizationReceiptSuccess.match), (0, operators_1.mergeMap)((action) => {
11
- const { transactionPayload, updateType } = action.payload;
12
- const updateActions = [];
13
- const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
14
- const selectedPeriodByTenantId = state$.value.expenseAutomationViewState.selectedPeriodByTenantId;
15
- updateActions.push((0, transactionReducer_1.updateTransaction)(transactionPayload.transaction_id, transactionPayload, updateType));
16
- if (currentTenant != null) {
17
- const monthEndChecksPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
18
- if (monthEndChecksPeriod != null) {
19
- updateActions.push((0, monthEndCloseChecksViewReducer_1.fetchMonthEndCloseChecks)({
20
- tenantId: currentTenant.tenantId,
21
- period: monthEndChecksPeriod,
22
- refreshViewInBackground: true,
23
- }));
24
- }
25
- }
26
- return (0, rxjs_1.from)(updateActions);
27
- }));
28
- exports.uploadTransactionReceiptSuccessEpic = uploadTransactionReceiptSuccessEpic;
@@ -1,9 +0,0 @@
1
- import { COABalanceTimeFrame } from '../../commonStateTypes/coaBalance/coaBalance';
2
- import { COABalancesSlice } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
3
- import { Month } from '../../commonStateTypes/timePeriod';
4
- /**
5
- * Empty `COABalancesSlice` for horizontal P&L-by-class section / calculated headers when
6
- * enrichment has not produced balances yet, or for UI mapping fallbacks.
7
- * Structure matches {@link enrichProfitAndLossByClassHorizontalReport} output.
8
- */
9
- export declare function getEmptyHorizontalSectionBalancesSlice(firstMonthOfFY: Month, timeframe?: COABalanceTimeFrame): COABalancesSlice;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEmptyHorizontalSectionBalancesSlice = getEmptyHorizontalSectionBalancesSlice;
4
- /**
5
- * Empty `COABalancesSlice` for horizontal P&L-by-class section / calculated headers when
6
- * enrichment has not produced balances yet, or for UI mapping fallbacks.
7
- * Structure matches {@link enrichProfitAndLossByClassHorizontalReport} output.
8
- */
9
- function getEmptyHorizontalSectionBalancesSlice(firstMonthOfFY, timeframe = 'month') {
10
- return {
11
- balances: [],
12
- additionalBalances: [],
13
- filter: {
14
- firstMonthOfFY,
15
- timeframe,
16
- balancesRange: { numberOfPeriods: 0, orderBy: 'ascending_date' },
17
- additionalBalances: [],
18
- },
19
- };
20
- }
@@ -1,15 +0,0 @@
1
- import { COABalancesFilterClassesView } from '../../commonStateTypes/coaBalance/coaBalancesFilterClassesView';
2
- import { AccountState } from '../../entity/account/accountState';
3
- import { ClassState } from '../../entity/class/classState';
4
- import { SectionClassesViewStateV2 } from '../../entity/sectionClassesViewV2/sectionClassesViewState';
5
- import { ZeniDate } from '../../zeniDayJS';
6
- import { ProfitAndLossByClassHorizontalReport } from './profitAndLossClassesByClassHorizontalSelectorTypes';
7
- import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from './profitAndLossClassesViewSelectorTypes';
8
- import { ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
9
- /** Standard class ID returned by the accounting platform for transactions without an assigned class. */
10
- export declare const NOT_SPECIFIED_CLASS_ID = "not_specified";
11
- export declare const profitAndLossHorizontalIdsInOrder: (PandLReportViewSectionID | PandLReportViewCalculatedSectionID)[];
12
- export declare const getProfitAndLossClassesHorizontalView: (filter: COABalancesFilterClassesView, accountState: AccountState, classState: ClassState, sectionsState: SectionClassesViewStateV2, profitAndLossClassesViewState: ProfitAndLossClassesViewState, selectedPeriod: {
13
- endDate: ZeniDate;
14
- startDate: ZeniDate;
15
- } | undefined) => ProfitAndLossByClassHorizontalReport;
@@ -1,335 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProfitAndLossClassesHorizontalView = exports.profitAndLossHorizontalIdsInOrder = exports.NOT_SPECIFIED_CLASS_ID = void 0;
4
- const amount_1 = require("../../commonStateTypes/amount");
5
- const getSummationBalance_1 = require("../../commonStateTypes/coaBalance/additionalBalances/getSummationBalance");
6
- const currencyHelper_1 = require("../../commonStateTypes/currencyHelper");
7
- const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
8
- const sectionClassesViewSelector_1 = require("../../entity/sectionClassesViewV2/sectionClassesViewSelector");
9
- const profitAndLossHorizontalEnrichment_1 = require("./profitAndLossHorizontalEnrichment");
10
- /** Standard class ID returned by the accounting platform for transactions without an assigned class. */
11
- exports.NOT_SPECIFIED_CLASS_ID = 'not_specified';
12
- exports.profitAndLossHorizontalIdsInOrder = [
13
- 'income',
14
- 'cogs',
15
- 'grossProfit',
16
- 'expenses',
17
- 'earningsBeforeInterestAndTax',
18
- 'otherIncome',
19
- 'otherExpenses',
20
- 'netOtherIncome',
21
- 'netIncome',
22
- ];
23
- const SECTION_TITLES = {
24
- income: 'Income',
25
- cogs: 'Cost of Goods Sold',
26
- grossProfit: 'Gross Profit',
27
- expenses: 'Expenses',
28
- earningsBeforeInterestAndTax: 'Net Operating Income',
29
- otherIncome: 'Other Income',
30
- otherExpenses: 'Other Expenses',
31
- netOtherIncome: 'Net Other Income',
32
- netIncome: 'Net Income',
33
- };
34
- /** Sections fetched and pivoted for horizontal layout (excludes e.g. `netOperatingIncome`). */
35
- const HORIZONTAL_PANDL_SECTION_IDS = [
36
- 'income',
37
- 'cogs',
38
- 'expenses',
39
- 'otherIncome',
40
- 'otherExpenses',
41
- ];
42
- const getProfitAndLossClassesHorizontalView = (filter, accountState, classState, sectionsState, profitAndLossClassesViewState, selectedPeriod) => {
43
- const fetchState = (0, reduceFetchState_1.reduceFetchStateParallelTimeframes)([
44
- profitAndLossClassesViewState.fetchState.month,
45
- profitAndLossClassesViewState.fetchState.quarter,
46
- profitAndLossClassesViewState.fetchState.year,
47
- ]);
48
- const reportId = 'profit_and_loss_by_classes';
49
- // Build class columns from the class hierarchy (top-level only).
50
- // Use `filter.classesToFilterOut` so PDF/Excel downloads (fresh store, empty UI state)
51
- // respect `classes_to_filter_out` from the request; in-app `classFilter` mirrors uiState.
52
- const classColumns = buildClassColumns(profitAndLossClassesViewState.classHierarchy, filter.classesToFilterOut);
53
- const sections = {};
54
- const calculatedSections = {};
55
- let reportCurrency = currencyHelper_1.defaultCustomerCurrency;
56
- if (fetchState.fetchState === 'Completed' && selectedPeriod != null) {
57
- reportCurrency =
58
- profitAndLossClassesViewState.currency ?? currencyHelper_1.defaultCustomerCurrency;
59
- // Fetch each section and pivot class→account to account→class in one pass
60
- HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
61
- const sectionReport = (0, sectionClassesViewSelector_1.getSectionClassesViewReport)(accountState, classState, sectionsState, { reportId, sectionId }, filter);
62
- if (sectionReport != null) {
63
- sections[sectionId] = pivotSectionToHorizontal(sectionReport, classColumns, SECTION_TITLES[sectionId] ?? sectionId, reportCurrency);
64
- }
65
- });
66
- // Calculate derived sections
67
- const incomeSection = sections['income'];
68
- const cogsSection = sections['cogs'];
69
- const expensesSection = sections['expenses'];
70
- const otherIncomeSection = sections['otherIncome'];
71
- const otherExpensesSection = sections['otherExpenses'];
72
- // Gross Profit = Income - COGS
73
- if (incomeSection != null && cogsSection != null) {
74
- calculatedSections['grossProfit'] = computeCalculatedSection(incomeSection.classTotals, cogsSection.classTotals, incomeSection.sectionTotal, cogsSection.sectionTotal, 'subtract', SECTION_TITLES['grossProfit']);
75
- }
76
- // EBIT = Gross Profit - Expenses
77
- const grossProfit = calculatedSections['grossProfit'];
78
- if (grossProfit != null && expensesSection != null) {
79
- calculatedSections['earningsBeforeInterestAndTax'] =
80
- computeCalculatedSection(grossProfit.classTotals, expensesSection.classTotals, grossProfit.sectionTotal, expensesSection.sectionTotal, 'subtract', SECTION_TITLES['earningsBeforeInterestAndTax']);
81
- }
82
- // Net Other Income = Other Income - Other Expenses
83
- if (otherIncomeSection != null && otherExpensesSection != null) {
84
- calculatedSections['netOtherIncome'] = computeCalculatedSection(otherIncomeSection.classTotals, otherExpensesSection.classTotals, otherIncomeSection.sectionTotal, otherExpensesSection.sectionTotal, 'subtract', SECTION_TITLES['netOtherIncome']);
85
- }
86
- // Net Income = EBIT + Net Other Income
87
- const ebit = calculatedSections['earningsBeforeInterestAndTax'];
88
- const netOtherIncome = calculatedSections['netOtherIncome'];
89
- if (ebit != null && netOtherIncome != null) {
90
- calculatedSections['netIncome'] = computeCalculatedSection(ebit.classTotals, netOtherIncome.classTotals, ebit.sectionTotal, netOtherIncome.sectionTotal, 'add', SECTION_TITLES['netIncome']);
91
- }
92
- }
93
- // Build synthetic header COABalances for rendering class names as column headers
94
- const headerBalances = buildHeaderBalances(classColumns, filter.timeframe, selectedPeriod, reportCurrency);
95
- const report = {
96
- reportId,
97
- reportTitle: 'Profit and Loss by Class',
98
- firstMonthOfFY: profitAndLossClassesViewState.firstMonthOfFY,
99
- fetchState: fetchState.fetchState,
100
- bookCloseDate: profitAndLossClassesViewState.bookCloseDate,
101
- dataAvailable: profitAndLossClassesViewState.dataAvailable,
102
- selectedPeriod,
103
- classColumns,
104
- sections,
105
- calculatedSections,
106
- idsInOrder: exports.profitAndLossHorizontalIdsInOrder,
107
- uiState: profitAndLossClassesViewState.uiState,
108
- headerBalances,
109
- };
110
- (0, profitAndLossHorizontalEnrichment_1.enrichProfitAndLossByClassHorizontalReport)(report);
111
- return report;
112
- };
113
- exports.getProfitAndLossClassesHorizontalView = getProfitAndLossClassesHorizontalView;
114
- /**
115
- * Build column definitions from class hierarchy (top-level classes only).
116
- */
117
- function buildClassColumns(classHierarchy, classesToFilterOut) {
118
- const filteredIds = new Set(classesToFilterOut.map((id) => id[0]));
119
- return classHierarchy
120
- .filter((c) => !filteredIds.has(c.classId[0]))
121
- .map((c) => ({
122
- classId: c.classId[0],
123
- className: c.className,
124
- nestedClassId: c.classId,
125
- qboId: c.qboId,
126
- }))
127
- .sort((a, b) => {
128
- const aIsNotSpecified = a.classId === exports.NOT_SPECIFIED_CLASS_ID;
129
- const bIsNotSpecified = b.classId === exports.NOT_SPECIFIED_CLASS_ID;
130
- if (aIsNotSpecified && !bIsNotSpecified) {
131
- return 1;
132
- }
133
- if (!aIsNotSpecified && bIsNotSpecified) {
134
- return -1;
135
- }
136
- return a.className.localeCompare(b.className, [], {
137
- sensitivity: 'base',
138
- });
139
- });
140
- }
141
- /**
142
- * Pivot a section from class→account→balances to account→class→balance (single period).
143
- */
144
- function pivotSectionToHorizontal(section, classColumns, title, currency) {
145
- // Map: accountId -> { accountName, classId -> balance }
146
- const accountMap = new Map();
147
- // Also track class totals
148
- const classTotalMap = new Map();
149
- classColumns.forEach((col) => classTotalMap.set(col.classId, 0));
150
- // Iterate over each class in the section
151
- section.classes.forEach((classReport) => {
152
- const classId = classReport.id[0];
153
- // Only process classes that are in our columns
154
- if (!classTotalMap.has(classId)) {
155
- return;
156
- }
157
- // Sum all sliced period balances (same slice as vertical columns; multi-period = range total)
158
- const classBalance = sumBalancesInSlice(classReport.childrenBalancesTotal.balances);
159
- classTotalMap.set(classId, classBalance);
160
- // Iterate through accounts in this class
161
- collectAccountsFromClass(classReport, classId, accountMap);
162
- });
163
- // Build account rows in COA tree order (same parent/child ordering as vertical P&L by class).
164
- // Sorting by depth + name flattened the hierarchy and broke sub-account grouping.
165
- const orderedIds = collectAccountIdsInTreeOrder(section, classColumns);
166
- const usedIds = new Set();
167
- const accounts = [];
168
- const pushAccountRow = (accountId) => {
169
- const accountData = accountMap.get(accountId);
170
- if (accountData == null) {
171
- return;
172
- }
173
- usedIds.add(accountId);
174
- const classBalances = classColumns.map((col) => ({
175
- classId: col.classId,
176
- balance: (0, amount_1.toAmountWC)(accountData.classBalances.get(col.classId) ?? 0, currency),
177
- }));
178
- const rowTotal = classBalances.reduce((sum, cb) => sum + cb.balance.amount, 0);
179
- accounts.push({
180
- accountId,
181
- accountName: accountData.accountName,
182
- accountType: accountData.accountType,
183
- depth: accountData.depth,
184
- classBalances,
185
- rowTotal: (0, amount_1.toAmountWC)(rowTotal, currency),
186
- });
187
- };
188
- for (const id of orderedIds) {
189
- pushAccountRow(id);
190
- }
191
- for (const accountId of accountMap.keys()) {
192
- if (!usedIds.has(accountId)) {
193
- pushAccountRow(accountId);
194
- }
195
- }
196
- // Build class totals
197
- const classTotals = classColumns.map((col) => ({
198
- classId: col.classId,
199
- balance: (0, amount_1.toAmountWC)(classTotalMap.get(col.classId) ?? 0, currency),
200
- }));
201
- const sectionTotal = classTotals.reduce((sum, ct) => sum + ct.balance.amount, 0);
202
- return {
203
- title,
204
- accounts,
205
- classTotals,
206
- sectionTotal: (0, amount_1.toAmountWC)(sectionTotal, currency),
207
- };
208
- }
209
- /**
210
- * DFS account ids in the same order as vertical P&L by class, using the first class
211
- * column that appears in this section as the canonical tree (structure is identical per class).
212
- */
213
- function collectAccountIdsInTreeOrder(section, classColumns) {
214
- const ids = [];
215
- const visitNested = (nested) => {
216
- ids.push(nested.account.accountId);
217
- nested.children.forEach(visitNested);
218
- };
219
- for (const col of classColumns) {
220
- const classReport = section.classes.find((c) => c.id[0] === col.classId);
221
- if (classReport == null) {
222
- continue;
223
- }
224
- classReport.class.accounts.forEach(visitNested);
225
- return ids;
226
- }
227
- return ids;
228
- }
229
- /**
230
- * Recursively collect account balances from a NestedClassReportV2 into accountMap.
231
- */
232
- function collectAccountsFromClass(classReport, classId, accountMap) {
233
- // Process accounts directly on this class (depth 2 matches vertical `AccountsSection` first level)
234
- classReport.class.accounts.forEach((nestedAccount) => {
235
- collectAccountsFromNestedAccount(nestedAccount, classId, accountMap, 2);
236
- });
237
- }
238
- /**
239
- * Recursively collect accounts from NestedAccountReport (handles sub-accounts).
240
- */
241
- function collectAccountsFromNestedAccount(nestedAccount, classId, accountMap, depth) {
242
- const accountId = nestedAccount.account.accountId;
243
- const accountName = nestedAccount.account.accountName;
244
- const balance = sumBalancesInSlice(nestedAccount.account.balancesInTimeframe.balances);
245
- if (!accountMap.has(accountId)) {
246
- accountMap.set(accountId, {
247
- accountName,
248
- accountType: nestedAccount.account.accountType,
249
- depth,
250
- classBalances: new Map(),
251
- });
252
- }
253
- const accountData = accountMap.get(accountId);
254
- if (accountData == null) {
255
- return;
256
- }
257
- accountData.depth = Math.max(accountData.depth, depth);
258
- if (accountData.accountType == null &&
259
- nestedAccount.account.accountType != null) {
260
- accountData.accountType = nestedAccount.account.accountType;
261
- }
262
- const existing = accountData.classBalances.get(classId) ?? 0;
263
- accountData.classBalances.set(classId, existing + balance);
264
- // Process sub-accounts
265
- nestedAccount.children.forEach((child) => {
266
- collectAccountsFromNestedAccount(child, classId, accountMap, depth + 1);
267
- });
268
- }
269
- /**
270
- * Total `balance.amount` for the current COA slice (same aggregation as
271
- * `getSummationFreeRangeTotalBalance`, used for class totals and account rows).
272
- */
273
- function sumBalancesInSlice(balances) {
274
- if (balances.length === 0) {
275
- return 0;
276
- }
277
- const summed = (0, getSummationBalance_1.getSummationFreeRangeTotalBalance)(balances);
278
- return summed?.balance.amount ?? 0;
279
- }
280
- /**
281
- * Compute a calculated section by adding or subtracting two sets of class totals.
282
- */
283
- function computeCalculatedSection(aTotals, bTotals, aTotal, bTotal, operation, title) {
284
- const currency = {
285
- currencyCode: aTotal.currencyCode,
286
- currencySymbol: aTotal.currencySymbol,
287
- };
288
- const bTotalsMap = new Map(bTotals.map((b) => [b.classId, b.balance.amount]));
289
- const classTotals = aTotals.map((a) => {
290
- const bAmount = bTotalsMap.get(a.classId) ?? 0;
291
- const resultAmount = operation === 'add'
292
- ? a.balance.amount + bAmount
293
- : a.balance.amount - bAmount;
294
- return {
295
- classId: a.classId,
296
- balance: (0, amount_1.toAmountWC)(resultAmount, currency),
297
- };
298
- });
299
- const sectionTotalAmount = operation === 'add'
300
- ? aTotal.amount + bTotal.amount
301
- : aTotal.amount - bTotal.amount;
302
- return {
303
- title,
304
- classTotals,
305
- sectionTotal: (0, amount_1.toAmountWC)(sectionTotalAmount, currency),
306
- };
307
- }
308
- /**
309
- * Build synthetic COABalance array for header rendering.
310
- * One entry per class column + one for "Total".
311
- */
312
- function buildHeaderBalances(classColumns, timeframe, selectedPeriod, currency) {
313
- if (selectedPeriod == null) {
314
- return [];
315
- }
316
- const { endDate, startDate } = selectedPeriod;
317
- const balances = classColumns.map((col) => ({
318
- balance: (0, amount_1.toAmountWC)(0, currency),
319
- balanceTimeFrame: timeframe,
320
- endDate,
321
- startDate,
322
- type: 'default',
323
- label: col.className,
324
- }));
325
- // Add a "Total" column
326
- balances.push({
327
- balance: (0, amount_1.toAmountWC)(0, currency),
328
- balanceTimeFrame: timeframe,
329
- endDate,
330
- startDate,
331
- type: 'default',
332
- label: 'Total',
333
- });
334
- return balances;
335
- }
@@ -1,111 +0,0 @@
1
- import { Amount } from '../../commonStateTypes/amount';
2
- import { NestedClassID } from '../../commonStateTypes/classesView/nestedClassID';
3
- import { COABalance } from '../../commonStateTypes/coaBalance/coaBalance';
4
- import { COABalancesSlice } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
5
- import { FetchState, ID } from '../../commonStateTypes/common';
6
- import { DataAvailable } from '../../commonStateTypes/dataAvailable';
7
- import { Month } from '../../commonStateTypes/timePeriod';
8
- import { ReportID } from '../../commonStateTypes/viewAndReport/viewAndReport';
9
- import { AccountType } from '../../entity/account/accountState';
10
- import { ZeniDate } from '../../zeniDayJS';
11
- import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from './profitAndLossClassesViewSelectorTypes';
12
- import { ProfitAndLossClassesViewUIState } from './profitAndLossClassesViewState';
13
- export interface ClassColumnDefinition {
14
- classId: string;
15
- className: string;
16
- nestedClassId: NestedClassID;
17
- qboId?: ID;
18
- }
19
- export interface HorizontalClassBalance {
20
- balance: Amount;
21
- classId: string;
22
- }
23
- /** Synthetic COABalance `id` for the horizontal class report Total column (transaction routing). */
24
- export declare const HORIZONTAL_CLASS_TOTAL_BALANCE_ID = "__horizontal_total__";
25
- /** One line in the account column tree chrome (same role as report-tree ancestor metadata). */
26
- export interface HorizontalAccountTreeLineMetadata {
27
- depth: number;
28
- hasChildren: boolean;
29
- hasSibling: boolean;
30
- isLastNode: boolean;
31
- name?: string;
32
- }
33
- export interface HorizontalAccountTreeView {
34
- hasChildren: boolean;
35
- hasSiblings: boolean;
36
- isLastNode: boolean;
37
- isLeaf: boolean;
38
- subAccountAncestorMetadata: HorizontalAccountTreeLineMetadata[];
39
- treeDepth: number;
40
- }
41
- /**
42
- * Row payload for horizontal P&L-by-class account cells (synthetic balances + tree chrome).
43
- */
44
- export interface HorizontalAccountReportData {
45
- accountId: string;
46
- accountName: string;
47
- balancesInTimeframe: COABalancesSlice;
48
- /** Nesting depth in the section account tree (matches `HorizontalAccountRow.depth`). */
49
- depth: number;
50
- accountType?: AccountType;
51
- horizontalTreeView?: HorizontalAccountTreeView;
52
- }
53
- export declare function isHorizontalAccountReportData(data: unknown): data is HorizontalAccountReportData;
54
- export interface HorizontalAccountRow {
55
- accountId: string;
56
- accountName: string;
57
- classBalances: HorizontalClassBalance[];
58
- /** Matches vertical classes PDF account indentation (`depth * 6` pt); top-level rows use 2. */
59
- depth: number;
60
- rowTotal: Amount;
61
- /**
62
- * Filled by `enrichProfitAndLossByClassHorizontalReport` for UI tree mapping
63
- * (balances slice + `TreeViewRow` metadata).
64
- */
65
- accountReportData?: HorizontalAccountReportData;
66
- /** COA account type (same as vertical `AccountReport.accountType`) for transaction links. */
67
- accountType?: AccountType;
68
- }
69
- /** Nested account row structure for a horizontal section (flat rows → tree). */
70
- export interface HorizontalSectionTreeLayout {
71
- /** Parent row index → child row indices. */
72
- childrenRowIndicesByParent: Record<number, number[]>;
73
- rootAccountRowIndices: number[];
74
- }
75
- export interface HorizontalSectionReport {
76
- accounts: HorizontalAccountRow[];
77
- classTotals: HorizontalClassBalance[];
78
- sectionTotal: Amount;
79
- title: string;
80
- /** Synthetic balances for the section header row (class columns + Total); set by enrichment. */
81
- sectionHeaderBalancesSlice?: COABalancesSlice;
82
- /** Row hierarchy for mapping to report-tree nodes; set by enrichment. */
83
- treeLayout?: HorizontalSectionTreeLayout;
84
- }
85
- export interface HorizontalCalculatedSection {
86
- classTotals: HorizontalClassBalance[];
87
- sectionTotal: Amount;
88
- title: string;
89
- /** Synthetic balances for the calculated row; set by enrichment. */
90
- sectionHeaderBalancesSlice?: COABalancesSlice;
91
- }
92
- export interface ProfitAndLossByClassHorizontalReport {
93
- calculatedSections: Partial<Record<PandLReportViewCalculatedSectionID, HorizontalCalculatedSection>>;
94
- classColumns: ClassColumnDefinition[];
95
- fetchState: FetchState;
96
- firstMonthOfFY: Month;
97
- /** Synthetic COABalance array for header rendering — one per class column + total */
98
- headerBalances: COABalance[];
99
- idsInOrder: (PandLReportViewSectionID | PandLReportViewCalculatedSectionID)[];
100
- reportId: ReportID;
101
- reportTitle: string;
102
- sections: Partial<Record<PandLReportViewSectionID, HorizontalSectionReport>>;
103
- selectedPeriod: {
104
- endDate: ZeniDate;
105
- startDate: ZeniDate;
106
- label?: string;
107
- } | undefined;
108
- uiState: ProfitAndLossClassesViewUIState;
109
- bookCloseDate?: ZeniDate;
110
- dataAvailable?: DataAvailable;
111
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HORIZONTAL_CLASS_TOTAL_BALANCE_ID = void 0;
4
- exports.isHorizontalAccountReportData = isHorizontalAccountReportData;
5
- /** Synthetic COABalance `id` for the horizontal class report Total column (transaction routing). */
6
- exports.HORIZONTAL_CLASS_TOTAL_BALANCE_ID = '__horizontal_total__';
7
- function isHorizontalAccountReportData(data) {
8
- return (typeof data === 'object' &&
9
- data !== null &&
10
- 'depth' in data &&
11
- typeof data.depth === 'number' &&
12
- !('filter' in data));
13
- }
@@ -1,6 +0,0 @@
1
- import { ProfitAndLossByClassHorizontalReport } from './profitAndLossClassesByClassHorizontalSelectorTypes';
2
- /**
3
- * Populates `sectionHeaderBalancesSlice`, and per-account `accountReportData`, so the
4
- * web layer only maps selector output to tree nodes.
5
- */
6
- export declare function enrichProfitAndLossByClassHorizontalReport(report: ProfitAndLossByClassHorizontalReport): void;