@zeniai/client-epic-state 4.19.97 → 4.19.99-beta0ND

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 (251) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/commonStateTypes/coaBalance/coaBalanceType.d.ts +2 -0
  3. package/lib/commonStateTypes/coaBalance/coaBalanceType.js +6 -0
  4. package/lib/commonStateTypes/currencyHelper.d.ts +3 -0
  5. package/lib/commonStateTypes/currencyHelper.js +6 -1
  6. package/lib/commonStateTypes/reduceFetchState.d.ts +9 -0
  7. package/lib/commonStateTypes/reduceFetchState.js +26 -0
  8. package/lib/entity/account/accountPayload.d.ts +2 -0
  9. package/lib/entity/account/accountPayload.js +2 -0
  10. package/lib/entity/account/accountState.d.ts +2 -0
  11. package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -2
  12. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  13. package/lib/entity/customer/customerState.d.ts +0 -2
  14. package/lib/entity/customer/customerState.js +0 -5
  15. package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
  16. package/lib/entity/depositAccount/depositAccount.js +8 -1
  17. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +35 -0
  18. package/lib/entity/jeSchedules/jeSchedulesPayload.js +44 -0
  19. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -1
  20. package/lib/entity/jeSchedules/jeSchedulesSelector.js +2 -1
  21. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +13 -0
  22. package/lib/entity/reimbursement/reimbursementPayload.d.ts +2 -0
  23. package/lib/entity/reimbursement/reimbursementPayload.js +7 -0
  24. package/lib/entity/reimbursement/reimbursementState.d.ts +2 -0
  25. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  26. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  27. package/lib/entity/task/taskPayload.d.ts +1 -0
  28. package/lib/entity/task/taskPayload.js +1 -0
  29. package/lib/entity/task/taskState.d.ts +1 -0
  30. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  31. package/lib/entity/tenant/tenantReducer.js +1 -0
  32. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  33. package/lib/entity/tenant/tenantSelector.js +9 -1
  34. package/lib/entity/tenant/tenantState.d.ts +1 -0
  35. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -0
  36. package/lib/entity/transaction/payloadTypes/transactionPayload.js +11 -0
  37. package/lib/entity/transaction/stateTypes/transaction.d.ts +3 -0
  38. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  39. package/lib/entity/userGroups/userGroupsPayload.d.ts +7 -0
  40. package/lib/entity/userGroups/userGroupsPayload.js +10 -0
  41. package/lib/entity/userGroups/userGroupsReducer.d.ts +8 -0
  42. package/lib/entity/userGroups/userGroupsReducer.js +29 -0
  43. package/lib/entity/userGroups/userGroupsSelector.d.ts +4 -0
  44. package/lib/entity/userGroups/userGroupsSelector.js +12 -0
  45. package/lib/entity/userGroups/userGroupsState.d.ts +9 -0
  46. package/lib/entity/userGroups/userGroupsState.js +2 -0
  47. package/lib/epic.d.ts +13 -1
  48. package/lib/epic.js +13 -1
  49. package/lib/esm/commonStateTypes/coaBalance/coaBalanceType.js +5 -0
  50. package/lib/esm/commonStateTypes/currencyHelper.js +5 -0
  51. package/lib/esm/commonStateTypes/reduceFetchState.js +25 -0
  52. package/lib/esm/entity/account/accountPayload.js +2 -0
  53. package/lib/esm/entity/customer/customerState.js +1 -4
  54. package/lib/esm/entity/depositAccount/depositAccount.js +8 -1
  55. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +44 -0
  56. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -1
  57. package/lib/esm/entity/reimbursement/reimbursementPayload.js +7 -0
  58. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
  59. package/lib/esm/entity/task/taskPayload.js +1 -0
  60. package/lib/esm/entity/tenant/tenantReducer.js +1 -0
  61. package/lib/esm/entity/tenant/tenantSelector.js +7 -0
  62. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +11 -0
  63. package/lib/esm/entity/userGroups/userGroupsPayload.js +7 -0
  64. package/lib/esm/entity/userGroups/userGroupsReducer.js +25 -0
  65. package/lib/esm/entity/userGroups/userGroupsSelector.js +8 -0
  66. package/lib/esm/entity/userGroups/userGroupsState.js +1 -0
  67. package/lib/esm/epic.js +13 -1
  68. package/lib/esm/index.js +25 -16
  69. package/lib/esm/reducer.js +6 -0
  70. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +82 -1
  71. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +8 -2
  72. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +29 -0
  73. package/lib/esm/view/arAgingView/arAgingReport/arAgingReducer.js +1 -1
  74. package/lib/esm/view/arAgingView/arAgingReport/arAgingSelector.js +1 -1
  75. package/lib/esm/view/classList/fetchClassListEpic.js +9 -2
  76. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  77. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  78. package/lib/esm/view/expenseAutomationView/bulkUploadTiming.js +10 -0
  79. package/lib/esm/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +8 -3
  80. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +29 -0
  81. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +49 -0
  82. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +40 -0
  83. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +47 -0
  84. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +61 -0
  85. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +33 -0
  86. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +56 -0
  87. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +77 -0
  88. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
  89. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +79 -0
  90. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +24 -0
  91. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  92. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  93. package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +189 -1
  94. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +17 -1
  95. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +433 -2
  96. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +23 -1
  97. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +50 -3
  98. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +245 -2
  99. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  100. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +17 -1
  101. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +44 -0
  102. package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +2 -1
  103. package/lib/esm/view/financeStatement/financeStatementReducer.js +11 -8
  104. package/lib/esm/view/financeStatement/financeStatementSelector.js +24 -9
  105. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +322 -0
  106. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +9 -0
  107. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
  108. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  109. package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  110. package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +201 -0
  111. package/lib/esm/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +9 -7
  112. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  113. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
  114. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  115. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  116. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  117. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  118. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  119. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  120. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +7 -4
  121. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  122. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  123. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +3 -3
  124. package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
  125. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +3 -1
  126. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  127. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  128. package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +65 -0
  129. package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +16 -0
  130. package/lib/esm/view/userGroupListView/userGroupListViewState.js +1 -0
  131. package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +11 -0
  132. package/lib/esm/zeniAPI.js +0 -2
  133. package/lib/index.d.ts +31 -21
  134. package/lib/index.js +102 -34
  135. package/lib/reducer.d.ts +6 -0
  136. package/lib/reducer.js +6 -0
  137. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  138. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
  139. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
  140. package/lib/view/aiCfoView/aiCfoViewReducer.js +83 -2
  141. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
  142. package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
  143. package/lib/view/aiCfoView/aiCfoViewState.d.ts +18 -1
  144. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
  145. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +33 -0
  146. package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +2 -2
  147. package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +5 -5
  148. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  149. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  150. package/lib/view/classList/fetchClassListEpic.js +8 -1
  151. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -0
  152. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  153. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +1 -0
  154. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  155. package/lib/view/expenseAutomationView/bulkUploadTiming.d.ts +10 -0
  156. package/lib/view/expenseAutomationView/bulkUploadTiming.js +13 -0
  157. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +8 -3
  158. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +18 -0
  159. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +33 -0
  160. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +7 -0
  161. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +53 -0
  162. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +8 -0
  163. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +44 -0
  164. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +7 -0
  165. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +51 -0
  166. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +8 -0
  167. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +65 -0
  168. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +8 -0
  169. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +37 -0
  170. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +9 -0
  171. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +61 -0
  172. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +14 -0
  173. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +81 -0
  174. package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
  175. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +25 -0
  176. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +85 -0
  177. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +7 -0
  178. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +28 -0
  179. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  180. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  181. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  182. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +118 -0
  183. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +201 -0
  184. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  185. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +18 -2
  186. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +76 -3
  187. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +434 -2
  188. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +11 -3
  189. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +24 -2
  190. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
  191. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +69 -1
  192. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +1 -0
  193. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +50 -3
  194. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
  195. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +244 -1
  196. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  197. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +5 -0
  198. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +19 -0
  199. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +142 -0
  200. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +54 -1
  201. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -1
  202. package/lib/view/expenseAutomationView/types/transactionsViewState.js +2 -1
  203. package/lib/view/financeStatement/financeStatementReducer.js +11 -8
  204. package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
  205. package/lib/view/financeStatement/financeStatementSelector.js +24 -9
  206. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +13 -0
  207. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +326 -0
  208. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +111 -0
  209. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +13 -0
  210. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +4 -2
  211. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +7 -2
  212. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  213. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +4 -0
  214. package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  215. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +6 -0
  216. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +204 -0
  217. package/lib/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +8 -6
  218. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  219. package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  220. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  221. package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
  222. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  223. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  224. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  225. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  226. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  227. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  228. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  229. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +6 -3
  230. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
  231. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  232. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  233. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  234. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +3 -3
  235. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +1 -0
  236. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
  237. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +2 -0
  238. package/lib/view/taskManager/taskListView/taskListSelector.js +3 -1
  239. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  240. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  241. package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +23 -0
  242. package/lib/view/userGroupListView/userGroupListViewReducer.js +69 -0
  243. package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +7 -0
  244. package/lib/view/userGroupListView/userGroupListViewSelector.js +20 -0
  245. package/lib/view/userGroupListView/userGroupListViewState.d.ts +8 -0
  246. package/lib/view/userGroupListView/userGroupListViewState.js +2 -0
  247. package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +3 -1
  248. package/lib/view/userListView/fetchUserListByTypeEpic.js +11 -0
  249. package/lib/view/userListView/userListViewPayload.d.ts +2 -0
  250. package/lib/zeniAPI.js +0 -2
  251. package/package.json +2 -2
@@ -0,0 +1,326 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProfitAndLossClassesHorizontalView = exports.profitAndLossHorizontalIdsInOrder = 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
+ exports.profitAndLossHorizontalIdsInOrder = [
11
+ 'income',
12
+ 'cogs',
13
+ 'grossProfit',
14
+ 'expenses',
15
+ 'earningsBeforeInterestAndTax',
16
+ 'otherIncome',
17
+ 'otherExpenses',
18
+ 'netOtherIncome',
19
+ 'netIncome',
20
+ ];
21
+ const SECTION_TITLES = {
22
+ income: 'Income',
23
+ cogs: 'Cost of Goods Sold',
24
+ grossProfit: 'Gross Profit',
25
+ expenses: 'Expenses',
26
+ earningsBeforeInterestAndTax: 'Net Operating Income',
27
+ otherIncome: 'Other Income',
28
+ otherExpenses: 'Other Expenses',
29
+ netOtherIncome: 'Net Other Income',
30
+ netIncome: 'Net Income',
31
+ };
32
+ /** Sections fetched and pivoted for horizontal layout (excludes e.g. `netOperatingIncome`). */
33
+ const HORIZONTAL_PANDL_SECTION_IDS = [
34
+ 'income',
35
+ 'cogs',
36
+ 'expenses',
37
+ 'otherIncome',
38
+ 'otherExpenses',
39
+ ];
40
+ const getProfitAndLossClassesHorizontalView = (filter, accountState, classState, sectionsState, profitAndLossClassesViewState, selectedPeriod) => {
41
+ const fetchState = (0, reduceFetchState_1.reduceFetchStateParallelTimeframes)([
42
+ profitAndLossClassesViewState.fetchState.month,
43
+ profitAndLossClassesViewState.fetchState.quarter,
44
+ profitAndLossClassesViewState.fetchState.year,
45
+ ]);
46
+ const reportId = 'profit_and_loss_by_classes';
47
+ // Build class columns from the class hierarchy (top-level only).
48
+ // Use `filter.classesToFilterOut` so PDF/Excel downloads (fresh store, empty UI state)
49
+ // respect `classes_to_filter_out` from the request; in-app `classFilter` mirrors uiState.
50
+ const classColumns = buildClassColumns(profitAndLossClassesViewState.classHierarchy, filter.classesToFilterOut);
51
+ const sections = {};
52
+ const calculatedSections = {};
53
+ let reportCurrency = currencyHelper_1.defaultCustomerCurrency;
54
+ if (fetchState.fetchState === 'Completed' && selectedPeriod != null) {
55
+ // Get section reports using existing selector infrastructure
56
+ const sectionReports = {};
57
+ HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
58
+ sectionReports[sectionId] = (0, sectionClassesViewSelector_1.getSectionClassesViewReport)(accountState, classState, sectionsState, { reportId, sectionId }, filter);
59
+ });
60
+ reportCurrency =
61
+ profitAndLossClassesViewState.currency ?? currencyHelper_1.defaultCustomerCurrency;
62
+ // Pivot each section from class→account to account→class
63
+ HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
64
+ const sectionReport = sectionReports[sectionId];
65
+ if (sectionReport != null) {
66
+ sections[sectionId] = pivotSectionToHorizontal(sectionReport, classColumns, SECTION_TITLES[sectionId] ?? sectionId, reportCurrency);
67
+ }
68
+ });
69
+ // Calculate derived sections
70
+ const incomeSection = sections['income'];
71
+ const cogsSection = sections['cogs'];
72
+ const expensesSection = sections['expenses'];
73
+ const otherIncomeSection = sections['otherIncome'];
74
+ const otherExpensesSection = sections['otherExpenses'];
75
+ // Gross Profit = Income - COGS
76
+ if (incomeSection != null && cogsSection != null) {
77
+ calculatedSections['grossProfit'] = computeCalculatedSection(incomeSection.classTotals, cogsSection.classTotals, incomeSection.sectionTotal, cogsSection.sectionTotal, 'subtract', SECTION_TITLES['grossProfit']);
78
+ }
79
+ // EBIT = Gross Profit - Expenses
80
+ const grossProfit = calculatedSections['grossProfit'];
81
+ if (grossProfit != null && expensesSection != null) {
82
+ calculatedSections['earningsBeforeInterestAndTax'] =
83
+ computeCalculatedSection(grossProfit.classTotals, expensesSection.classTotals, grossProfit.sectionTotal, expensesSection.sectionTotal, 'subtract', SECTION_TITLES['earningsBeforeInterestAndTax']);
84
+ }
85
+ // Net Other Income = Other Income - Other Expenses
86
+ if (otherIncomeSection != null && otherExpensesSection != null) {
87
+ calculatedSections['netOtherIncome'] = computeCalculatedSection(otherIncomeSection.classTotals, otherExpensesSection.classTotals, otherIncomeSection.sectionTotal, otherExpensesSection.sectionTotal, 'subtract', SECTION_TITLES['netOtherIncome']);
88
+ }
89
+ // Net Income = EBIT + Net Other Income
90
+ const ebit = calculatedSections['earningsBeforeInterestAndTax'];
91
+ const netOtherIncome = calculatedSections['netOtherIncome'];
92
+ if (ebit != null && netOtherIncome != null) {
93
+ calculatedSections['netIncome'] = computeCalculatedSection(ebit.classTotals, netOtherIncome.classTotals, ebit.sectionTotal, netOtherIncome.sectionTotal, 'add', SECTION_TITLES['netIncome']);
94
+ }
95
+ }
96
+ // Build synthetic header COABalances for rendering class names as column headers
97
+ const headerBalances = buildHeaderBalances(classColumns, filter.timeframe, selectedPeriod, reportCurrency);
98
+ const report = {
99
+ reportId,
100
+ reportTitle: 'Profit and Loss by Class',
101
+ firstMonthOfFY: profitAndLossClassesViewState.firstMonthOfFY,
102
+ fetchState: fetchState.fetchState,
103
+ bookCloseDate: profitAndLossClassesViewState.bookCloseDate,
104
+ dataAvailable: profitAndLossClassesViewState.dataAvailable,
105
+ selectedPeriod,
106
+ classColumns,
107
+ sections,
108
+ calculatedSections,
109
+ idsInOrder: exports.profitAndLossHorizontalIdsInOrder,
110
+ uiState: profitAndLossClassesViewState.uiState,
111
+ headerBalances,
112
+ };
113
+ (0, profitAndLossHorizontalEnrichment_1.enrichProfitAndLossByClassHorizontalReport)(report);
114
+ return report;
115
+ };
116
+ exports.getProfitAndLossClassesHorizontalView = getProfitAndLossClassesHorizontalView;
117
+ /**
118
+ * Build column definitions from class hierarchy (top-level classes only).
119
+ */
120
+ function buildClassColumns(classHierarchy, classesToFilterOut) {
121
+ const filteredIds = new Set(classesToFilterOut.map((id) => id[0]));
122
+ return classHierarchy
123
+ .filter((c) => !filteredIds.has(c.classId[0]))
124
+ .map((c) => ({
125
+ classId: c.classId[0],
126
+ className: c.className,
127
+ nestedClassId: c.classId,
128
+ qboId: c.qboId,
129
+ }))
130
+ .sort((a, b) => a.className.localeCompare(b.className, [], { sensitivity: 'base' }));
131
+ }
132
+ /**
133
+ * Pivot a section from class→account→balances to account→class→balance (single period).
134
+ */
135
+ function pivotSectionToHorizontal(section, classColumns, title, currency) {
136
+ // Map: accountId -> { accountName, classId -> balance }
137
+ const accountMap = new Map();
138
+ // Also track class totals
139
+ const classTotalMap = new Map();
140
+ classColumns.forEach((col) => classTotalMap.set(col.classId, 0));
141
+ // Iterate over each class in the section
142
+ section.classes.forEach((classReport) => {
143
+ const classId = classReport.id[0];
144
+ // Only process classes that are in our columns
145
+ if (!classTotalMap.has(classId)) {
146
+ return;
147
+ }
148
+ // Sum all sliced period balances (same slice as vertical columns; multi-period = range total)
149
+ const classBalance = sumBalancesInSlice(classReport.childrenBalancesTotal.balances);
150
+ classTotalMap.set(classId, classBalance);
151
+ // Iterate through accounts in this class
152
+ collectAccountsFromClass(classReport, classId, accountMap);
153
+ });
154
+ // Build account rows in COA tree order (same parent/child ordering as vertical P&L by class).
155
+ // Sorting by depth + name flattened the hierarchy and broke sub-account grouping.
156
+ const orderedIds = collectAccountIdsInTreeOrder(section, classColumns);
157
+ const usedIds = new Set();
158
+ const accounts = [];
159
+ const pushAccountRow = (accountId) => {
160
+ const accountData = accountMap.get(accountId);
161
+ if (accountData == null) {
162
+ return;
163
+ }
164
+ usedIds.add(accountId);
165
+ const classBalances = classColumns.map((col) => ({
166
+ classId: col.classId,
167
+ balance: (0, amount_1.toAmountWC)(accountData.classBalances.get(col.classId) ?? 0, currency),
168
+ }));
169
+ const rowTotal = classBalances.reduce((sum, cb) => sum + cb.balance.amount, 0);
170
+ accounts.push({
171
+ accountId,
172
+ accountName: accountData.accountName,
173
+ accountType: accountData.accountType,
174
+ depth: accountData.depth,
175
+ classBalances,
176
+ rowTotal: (0, amount_1.toAmountWC)(rowTotal, currency),
177
+ });
178
+ };
179
+ for (const id of orderedIds) {
180
+ pushAccountRow(id);
181
+ }
182
+ for (const accountId of accountMap.keys()) {
183
+ if (!usedIds.has(accountId)) {
184
+ pushAccountRow(accountId);
185
+ }
186
+ }
187
+ // Build class totals
188
+ const classTotals = classColumns.map((col) => ({
189
+ classId: col.classId,
190
+ balance: (0, amount_1.toAmountWC)(classTotalMap.get(col.classId) ?? 0, currency),
191
+ }));
192
+ const sectionTotal = classTotals.reduce((sum, ct) => sum + ct.balance.amount, 0);
193
+ return {
194
+ title,
195
+ accounts,
196
+ classTotals,
197
+ sectionTotal: (0, amount_1.toAmountWC)(sectionTotal, currency),
198
+ };
199
+ }
200
+ /**
201
+ * DFS account ids in the same order as vertical P&L by class, using the first class
202
+ * column that appears in this section as the canonical tree (structure is identical per class).
203
+ */
204
+ function collectAccountIdsInTreeOrder(section, classColumns) {
205
+ const ids = [];
206
+ const visitNested = (nested) => {
207
+ ids.push(nested.account.accountId);
208
+ nested.children.forEach(visitNested);
209
+ };
210
+ for (const col of classColumns) {
211
+ const classReport = section.classes.find((c) => c.id[0] === col.classId);
212
+ if (classReport == null) {
213
+ continue;
214
+ }
215
+ classReport.class.accounts.forEach(visitNested);
216
+ return ids;
217
+ }
218
+ return ids;
219
+ }
220
+ /**
221
+ * Recursively collect account balances from a NestedClassReportV2 into accountMap.
222
+ */
223
+ function collectAccountsFromClass(classReport, classId, accountMap) {
224
+ // Process accounts directly on this class (depth 2 matches vertical `AccountsSection` first level)
225
+ classReport.class.accounts.forEach((nestedAccount) => {
226
+ collectAccountsFromNestedAccount(nestedAccount, classId, accountMap, 2);
227
+ });
228
+ }
229
+ /**
230
+ * Recursively collect accounts from NestedAccountReport (handles sub-accounts).
231
+ */
232
+ function collectAccountsFromNestedAccount(nestedAccount, classId, accountMap, depth) {
233
+ const accountId = nestedAccount.account.accountId;
234
+ const accountName = nestedAccount.account.accountName;
235
+ const balance = sumBalancesInSlice(nestedAccount.account.balancesInTimeframe.balances);
236
+ if (!accountMap.has(accountId)) {
237
+ accountMap.set(accountId, {
238
+ accountName,
239
+ accountType: nestedAccount.account.accountType,
240
+ depth,
241
+ classBalances: new Map(),
242
+ });
243
+ }
244
+ const accountData = accountMap.get(accountId);
245
+ if (accountData == null) {
246
+ return;
247
+ }
248
+ accountData.depth = Math.max(accountData.depth, depth);
249
+ if (accountData.accountType == null &&
250
+ nestedAccount.account.accountType != null) {
251
+ accountData.accountType = nestedAccount.account.accountType;
252
+ }
253
+ const existing = accountData.classBalances.get(classId) ?? 0;
254
+ accountData.classBalances.set(classId, existing + balance);
255
+ // Process sub-accounts
256
+ nestedAccount.children.forEach((child) => {
257
+ collectAccountsFromNestedAccount(child, classId, accountMap, depth + 1);
258
+ });
259
+ }
260
+ /**
261
+ * Total `balance.amount` for the current COA slice (same aggregation as
262
+ * `getSummationFreeRangeTotalBalance`, used for class totals and account rows).
263
+ */
264
+ function sumBalancesInSlice(balances) {
265
+ if (balances.length === 0) {
266
+ return 0;
267
+ }
268
+ const summed = (0, getSummationBalance_1.getSummationFreeRangeTotalBalance)([...balances]);
269
+ return summed?.balance.amount ?? 0;
270
+ }
271
+ /**
272
+ * Compute a calculated section by adding or subtracting two sets of class totals.
273
+ */
274
+ function computeCalculatedSection(aTotals, bTotals, aTotal, bTotal, operation, title) {
275
+ const currency = {
276
+ currencyCode: aTotal.currencyCode,
277
+ currencySymbol: aTotal.currencySymbol,
278
+ };
279
+ const bTotalsMap = new Map(bTotals.map((b) => [b.classId, b.balance.amount]));
280
+ const classTotals = aTotals.map((a) => {
281
+ const bAmount = bTotalsMap.get(a.classId) ?? 0;
282
+ const resultAmount = operation === 'add'
283
+ ? a.balance.amount + bAmount
284
+ : a.balance.amount - bAmount;
285
+ return {
286
+ classId: a.classId,
287
+ balance: (0, amount_1.toAmountWC)(resultAmount, currency),
288
+ };
289
+ });
290
+ const sectionTotalAmount = operation === 'add'
291
+ ? aTotal.amount + bTotal.amount
292
+ : aTotal.amount - bTotal.amount;
293
+ return {
294
+ title,
295
+ classTotals,
296
+ sectionTotal: (0, amount_1.toAmountWC)(sectionTotalAmount, currency),
297
+ };
298
+ }
299
+ /**
300
+ * Build synthetic COABalance array for header rendering.
301
+ * One entry per class column + one for "Total".
302
+ */
303
+ function buildHeaderBalances(classColumns, timeframe, selectedPeriod, currency) {
304
+ if (selectedPeriod == null) {
305
+ return [];
306
+ }
307
+ const { endDate, startDate } = selectedPeriod;
308
+ const balances = classColumns.map((col) => ({
309
+ balance: (0, amount_1.toAmountWC)(0, currency),
310
+ balanceTimeFrame: timeframe,
311
+ endDate,
312
+ startDate,
313
+ type: 'default',
314
+ label: col.className,
315
+ }));
316
+ // Add a "Total" column
317
+ balances.push({
318
+ balance: (0, amount_1.toAmountWC)(0, currency),
319
+ balanceTimeFrame: timeframe,
320
+ endDate,
321
+ startDate,
322
+ type: 'default',
323
+ label: 'Total',
324
+ });
325
+ return balances;
326
+ }
@@ -0,0 +1,111 @@
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
+ }
@@ -0,0 +1,13 @@
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
+ }
@@ -2,7 +2,7 @@ import { NestedClassID } from '../../commonStateTypes/classesView/nestedClassID'
2
2
  import { AccountViewMode, ID } from '../../commonStateTypes/common';
3
3
  import { ZeniAPIStatus, ZeniReportData } from '../../responsePayload';
4
4
  import { ProfitAndLossClassesViewPayload } from './profitAndLossClassesViewPayload';
5
- import { ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
5
+ import { ClassViewLayout, ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
6
6
  export declare const initialState: ProfitAndLossClassesViewState;
7
7
  export declare const fetchProfitAndLossClassesView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
8
8
  cacheOverride: boolean;
@@ -30,6 +30,8 @@ export declare const fetchProfitAndLossClassesView: import("@reduxjs/toolkit").A
30
30
  };
31
31
  }, "profitAndLossClassesView/updateProfitAndLossClassesViewUIState">, updateAccountViewMode: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
32
32
  viewMode: AccountViewMode;
33
- }, "profitAndLossClassesView/updateAccountViewMode">, resetProfitAndLossClassesNodeCollapseState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/resetProfitAndLossClassesNodeCollapseState">, clearProfitAndLossClassesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/clearProfitAndLossClassesView">;
33
+ }, "profitAndLossClassesView/updateAccountViewMode">, updateClassViewLayout: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
34
+ classViewLayout: ClassViewLayout;
35
+ }, "profitAndLossClassesView/updateClassViewLayout">, resetProfitAndLossClassesNodeCollapseState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/resetProfitAndLossClassesNodeCollapseState">, clearProfitAndLossClassesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/clearProfitAndLossClassesView">;
34
36
  declare const _default: import("redux").Reducer<ProfitAndLossClassesViewState>;
35
37
  export default _default;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearProfitAndLossClassesView = exports.resetProfitAndLossClassesNodeCollapseState = exports.updateAccountViewMode = exports.updateProfitAndLossClassesViewUIState = exports.updateClassesToFilterOut = exports.updateProfitAndLossForTimeframeClassesViewFailure = exports.updateProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossClassesView = exports.initialState = void 0;
4
+ exports.clearProfitAndLossClassesView = exports.resetProfitAndLossClassesNodeCollapseState = exports.updateClassViewLayout = exports.updateAccountViewMode = exports.updateProfitAndLossClassesViewUIState = exports.updateClassesToFilterOut = exports.updateProfitAndLossForTimeframeClassesViewFailure = exports.updateProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossClassesView = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const viewAndReportPayloadv2_1 = require("../../commonPayloadTypes/v2/viewAndReportPayloadv2");
7
7
  const getNestedClassIDHierarchyForReport_1 = require("../../commonStateTypes/classesView/getNestedClassIDHierarchyForReport");
@@ -27,6 +27,7 @@ exports.initialState = {
27
27
  nodeCollapseState: {},
28
28
  scrollPosition: undefined,
29
29
  accountViewMode: 'account_group',
30
+ classViewLayout: 'vertical',
30
31
  classesToFilterOut: [],
31
32
  },
32
33
  firstMonthOfFY: 1,
@@ -98,6 +99,9 @@ const profitAndLossClassesView = (0, toolkit_1.createSlice)({
98
99
  updateAccountViewMode(draft, action) {
99
100
  draft.uiState.accountViewMode = action.payload.viewMode;
100
101
  },
102
+ updateClassViewLayout(draft, action) {
103
+ draft.uiState.classViewLayout = action.payload.classViewLayout;
104
+ },
101
105
  resetProfitAndLossClassesNodeCollapseState(draft) {
102
106
  draft.uiState.nodeCollapseState = {};
103
107
  },
@@ -106,10 +110,11 @@ const profitAndLossClassesView = (0, toolkit_1.createSlice)({
106
110
  },
107
111
  },
108
112
  });
109
- _a = profitAndLossClassesView.actions, exports.fetchProfitAndLossClassesView = _a.fetchProfitAndLossClassesView, exports.fetchProfitAndLossForTimeframeClassesView = _a.fetchProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesView = _a.updateProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesViewFailure = _a.updateProfitAndLossForTimeframeClassesViewFailure, exports.updateClassesToFilterOut = _a.updateClassesToFilterOut, exports.updateProfitAndLossClassesViewUIState = _a.updateProfitAndLossClassesViewUIState, exports.updateAccountViewMode = _a.updateAccountViewMode, exports.resetProfitAndLossClassesNodeCollapseState = _a.resetProfitAndLossClassesNodeCollapseState, exports.clearProfitAndLossClassesView = _a.clearProfitAndLossClassesView;
113
+ _a = profitAndLossClassesView.actions, exports.fetchProfitAndLossClassesView = _a.fetchProfitAndLossClassesView, exports.fetchProfitAndLossForTimeframeClassesView = _a.fetchProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesView = _a.updateProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesViewFailure = _a.updateProfitAndLossForTimeframeClassesViewFailure, exports.updateClassesToFilterOut = _a.updateClassesToFilterOut, exports.updateProfitAndLossClassesViewUIState = _a.updateProfitAndLossClassesViewUIState, exports.updateAccountViewMode = _a.updateAccountViewMode, exports.updateClassViewLayout = _a.updateClassViewLayout, exports.resetProfitAndLossClassesNodeCollapseState = _a.resetProfitAndLossClassesNodeCollapseState, exports.clearProfitAndLossClassesView = _a.clearProfitAndLossClassesView;
110
114
  exports.default = profitAndLossClassesView.reducer;
111
115
  const doUpdatedProfitAndLossClassesView = (draft, timeframe, pandLReport) => {
112
116
  const report = (0, viewAndReportPayloadv2_1.mapReportPayloadV2ToReportV2)(pandLReport.report);
117
+ draft.currency = report.currency;
113
118
  draft.dataAvailable = report.dataAvailable;
114
119
  draft.firstMonthOfFY = report.firstMonthOfFY;
115
120
  draft.bookCloseDate = report.bookCloseDate;
@@ -4,6 +4,7 @@ exports.getProfitAndLossClassesView = exports.profitAndLossIdsInOrder = void 0;
4
4
  const getDifferenceOfBalancesGroupedByPeriod_1 = require("../../commonStateTypes/coaBalance/classBalances/getDifferenceOfBalancesGroupedByPeriod");
5
5
  const getSumOfBalancesGroupedByPeriod_1 = require("../../commonStateTypes/coaBalance/classBalances/getSumOfBalancesGroupedByPeriod");
6
6
  const coaBalance_1 = require("../../commonStateTypes/coaBalance/coaBalance");
7
+ const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
7
8
  const sectionClassesViewSelector_1 = require("../../entity/sectionClassesViewV2/sectionClassesViewSelector");
8
9
  const profitAndLossClassesViewSelectorTypes_1 = require("./profitAndLossClassesViewSelectorTypes");
9
10
  exports.profitAndLossIdsInOrder = [
@@ -18,7 +19,7 @@ exports.profitAndLossIdsInOrder = [
18
19
  'netIncome',
19
20
  ];
20
21
  const getProfitAndLossClassesView = (filter, accountState, classState, sectionsState, profitAndLossClassesViewState) => {
21
- const fetchState = reduceFetchState([
22
+ const fetchState = (0, reduceFetchState_1.reduceFetchStateParallelTimeframes)([
22
23
  profitAndLossClassesViewState.fetchState.month,
23
24
  profitAndLossClassesViewState.fetchState.quarter,
24
25
  profitAndLossClassesViewState.fetchState.year,
@@ -68,31 +69,3 @@ const getProfitAndLossClassesView = (filter, accountState, classState, sectionsS
68
69
  };
69
70
  };
70
71
  exports.getProfitAndLossClassesView = getProfitAndLossClassesView;
71
- function reduceFetchState(fetchStateList) {
72
- const isAnyProgress = fetchStateList.reduce((prevValue, currentValue) => {
73
- return prevValue === true || currentValue.fetchState === 'In-Progress';
74
- }, false);
75
- const isAllCompleted = fetchStateList.reduce((prevValue, currentValue) => {
76
- return prevValue === true && currentValue.fetchState === 'Completed';
77
- }, true);
78
- const isAnyError = fetchStateList.reduce((prevValue, currentValue) => {
79
- return prevValue === true || currentValue.fetchState === 'Error';
80
- }, false);
81
- const error = fetchStateList.reduce((prevValue, currentValue) => {
82
- return prevValue ?? currentValue.error;
83
- }, undefined);
84
- let fetchState = 'Not-Started';
85
- if (isAnyProgress) {
86
- fetchState = 'In-Progress';
87
- }
88
- else if (isAllCompleted) {
89
- fetchState = 'Completed';
90
- }
91
- else if (isAnyError) {
92
- fetchState = 'Error';
93
- }
94
- return {
95
- fetchState,
96
- error,
97
- };
98
- }
@@ -1,9 +1,12 @@
1
+ import { Currency } from '../../commonStateTypes/amount';
1
2
  import { NestedClassHierarchyForReport, NestedClassID } from '../../commonStateTypes/classesView/nestedClassID';
2
3
  import { AccountViewMode, FetchStateAndError, ID } from '../../commonStateTypes/common';
3
4
  import { Report } from '../../commonStateTypes/viewAndReport/viewAndReport';
5
+ export type ClassViewLayout = 'vertical' | 'horizontal';
4
6
  export interface ProfitAndLossClassesViewUIState {
5
7
  accountViewMode: AccountViewMode;
6
8
  classesToFilterOut: NestedClassID[];
9
+ classViewLayout: ClassViewLayout;
7
10
  nodeCollapseState: Record<ID, boolean>;
8
11
  scrollPosition: {
9
12
  scrollTop: number;
@@ -18,4 +21,5 @@ export interface ProfitAndLossClassesViewState extends Report {
18
21
  year: FetchStateAndError;
19
22
  };
20
23
  uiState: ProfitAndLossClassesViewUIState;
24
+ currency?: Currency;
21
25
  }
@@ -27,11 +27,13 @@ const fetchProfitAndLossForTimeframeClassesViewEpic = (actions$, _, zeniAPI) =>
27
27
  .pipe((0, operators_1.mergeMap)((response) => {
28
28
  if (response.data != null && (0, responsePayload_1.isSuccessResponse)(response)) {
29
29
  const actions = [];
30
- actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'cogs', 'profit_and_loss_by_classes', response.data.report.cogs, response.data.report.classes, response.data.report.accounts, response.data.report.currency));
31
- actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'expenses', 'profit_and_loss_by_classes', response.data.report.expenses, response.data.report.classes, response.data.report.accounts, response.data.report.currency));
32
- actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'income', 'profit_and_loss_by_classes', response.data.report.income, response.data.report.classes, response.data.report.accounts, response.data.report.currency));
33
- actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'otherExpenses', 'profit_and_loss_by_classes', response.data.report.other_expenses, response.data.report.classes, response.data.report.accounts, response.data.report.currency));
34
- actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'otherIncome', 'profit_and_loss_by_classes', response.data.report.other_income, response.data.report.classes, response.data.report.accounts, response.data.report.currency));
30
+ const report = response.data.report;
31
+ const currency = report.currency;
32
+ actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'cogs', 'profit_and_loss_by_classes', report.cogs, report.classes, report.accounts, currency));
33
+ actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'expenses', 'profit_and_loss_by_classes', report.expenses, report.classes, report.accounts, currency));
34
+ actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'income', 'profit_and_loss_by_classes', report.income, report.classes, report.accounts, currency));
35
+ actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'otherExpenses', 'profit_and_loss_by_classes', report.other_expenses, report.classes, report.accounts, currency));
36
+ actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'otherIncome', 'profit_and_loss_by_classes', report.other_income, report.classes, report.accounts, currency));
35
37
  actions.push((0, profitAndLossClassesViewReducer_1.updateProfitAndLossForTimeframeClassesView)({
36
38
  timeframe: action.payload.timeframe,
37
39
  report: response.data,
@@ -0,0 +1,6 @@
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;