@zeniai/client-epic-state 5.1.93 → 5.1.95-betaAK0

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 (245) hide show
  1. package/lib/commonStateTypes/viewAndReport/reportIDHelper.d.ts +16 -0
  2. package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +22 -1
  3. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  4. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
  5. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  6. package/lib/entity/aiCfo/aiCfoPayload.d.ts +7 -0
  7. package/lib/entity/aiCfo/aiCfoReducer.d.ts +3 -2
  8. package/lib/entity/aiCfo/aiCfoReducer.js +25 -2
  9. package/lib/entity/aiCfo/aiCfoState.d.ts +7 -0
  10. package/lib/entity/class/classReducer.d.ts +4 -4
  11. package/lib/entity/class/classSelectorV2.d.ts +2 -1
  12. package/lib/entity/class/classSelectorV2.js +7 -7
  13. package/lib/entity/class/classState.d.ts +1 -1
  14. package/lib/entity/company/companyPayload.d.ts +4 -0
  15. package/lib/entity/company/companyPayload.js +18 -8
  16. package/lib/entity/company/companyStateTypes.d.ts +4 -0
  17. package/lib/entity/customerSatisfaction/customerSatisfactionReducer.d.ts +1 -1
  18. package/lib/entity/customerSatisfaction/customerSatisfactionReducer.js +6 -2
  19. package/lib/entity/forecast/forecastState.d.ts +1 -1
  20. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +9 -0
  21. package/lib/entity/invoicing/invoicingCommonPayload.js +7 -0
  22. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  23. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  24. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  25. package/lib/entity/sectionClassesViewV2/sectionClassesViewSelector.d.ts +2 -1
  26. package/lib/entity/sectionClassesViewV2/sectionClassesViewSelector.js +3 -3
  27. package/lib/entity/sectionProjectView/sectionProjectView.d.ts +1 -1
  28. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +2 -2
  29. package/lib/entity/sectionProjectView/sectionProjectViewSelector.d.ts +2 -1
  30. package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +4 -4
  31. package/lib/entity/snackbar/snackbarApiError.d.ts +8 -0
  32. package/lib/entity/snackbar/snackbarApiError.js +15 -0
  33. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  34. package/lib/entity/snackbar/snackbarTypes.js +31 -0
  35. package/lib/entity/tenant/tenantReducer.d.ts +5 -1
  36. package/lib/entity/tenant/tenantReducer.js +21 -2
  37. package/lib/epic.d.ts +7 -1
  38. package/lib/epic.js +9 -1
  39. package/lib/esm/commonStateTypes/viewAndReport/reportIDHelper.js +17 -0
  40. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
  41. package/lib/esm/entity/aiCfo/aiCfoReducer.js +23 -1
  42. package/lib/esm/entity/class/classSelectorV2.js +7 -7
  43. package/lib/esm/entity/company/companyPayload.js +18 -8
  44. package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +4 -1
  45. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +6 -0
  46. package/lib/esm/entity/sectionClassesViewV2/sectionClassesViewSelector.js +3 -3
  47. package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +4 -4
  48. package/lib/esm/entity/snackbar/snackbarApiError.js +11 -0
  49. package/lib/esm/entity/snackbar/snackbarTypes.js +31 -0
  50. package/lib/esm/entity/tenant/tenantReducer.js +20 -1
  51. package/lib/esm/epic.js +9 -1
  52. package/lib/esm/index.js +19 -12
  53. package/lib/esm/reducer.js +6 -0
  54. package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewEpic.js +30 -0
  55. package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewPayload.js +1 -0
  56. package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewReducer.js +132 -0
  57. package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewSelector.js +90 -0
  58. package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewSelectorTypes.js +1 -0
  59. package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewState.js +1 -0
  60. package/lib/esm/view/balanceSheetClassesView/balanceSheetForTimeframeClassesViewEpic.js +61 -0
  61. package/lib/esm/view/balanceSheetProjectView/balanceSheetForTimeframeProjectViewEpic.js +63 -0
  62. package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewEpic.js +30 -0
  63. package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewPayload.js +1 -0
  64. package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewReducer.js +128 -0
  65. package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewSelector.js +90 -0
  66. package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewSelectorTypes.js +1 -0
  67. package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewState.js +1 -0
  68. package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +4 -1
  69. package/lib/esm/view/companyView/companyViewReducer.js +58 -1
  70. package/lib/esm/view/companyView/epic/updateCompanyProductServicesEpic.js +91 -0
  71. package/lib/esm/view/companyView/epic/updateCompanyQboRealmIdEpic.js +58 -0
  72. package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +52 -0
  73. package/lib/esm/view/companyView/types/cockpitTypes.js +13 -1
  74. package/lib/esm/view/companyView/types/companyManagementViewState.js +2 -0
  75. package/lib/esm/view/financeStatement/financeStatementSelector.js +21 -1
  76. package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +26 -4
  77. package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +26 -4
  78. package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
  79. package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +37 -10
  80. package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +39 -10
  81. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
  82. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +5 -4
  83. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +35 -5
  84. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +25 -3
  85. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +26 -4
  86. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +16 -4
  87. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +34 -1
  88. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +26 -4
  89. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +20 -3
  90. package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +65 -18
  91. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +35 -1
  92. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
  93. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +26 -0
  94. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +16 -0
  95. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +9 -1
  96. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +50 -1
  97. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +14 -1
  98. package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +31 -10
  99. package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +30 -5
  100. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +26 -4
  101. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +22 -14
  102. package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +49 -7
  103. package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +30 -9
  104. package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
  105. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +56 -1
  106. package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +45 -10
  107. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +7 -2
  108. package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +1 -1
  109. package/lib/esm/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +4 -1
  110. package/lib/esm/view/vendorTabView/vendorTabViewReducer.js +4 -1
  111. package/lib/index.d.ts +32 -18
  112. package/lib/index.js +90 -50
  113. package/lib/reducer.d.ts +6 -0
  114. package/lib/reducer.js +6 -0
  115. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  116. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewEpic.d.ts +6 -0
  117. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewEpic.js +34 -0
  118. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewPayload.d.ts +20 -0
  119. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewPayload.js +2 -0
  120. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewReducer.d.ts +34 -0
  121. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewReducer.js +136 -0
  122. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelector.d.ts +7 -0
  123. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelector.js +94 -0
  124. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelectorTypes.d.ts +7 -0
  125. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelectorTypes.js +2 -0
  126. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewState.d.ts +23 -0
  127. package/lib/view/balanceSheetClassesView/balanceSheetClassesViewState.js +2 -0
  128. package/lib/view/balanceSheetClassesView/balanceSheetForTimeframeClassesViewEpic.d.ts +9 -0
  129. package/lib/view/balanceSheetClassesView/balanceSheetForTimeframeClassesViewEpic.js +66 -0
  130. package/lib/view/balanceSheetProjectView/balanceSheetForTimeframeProjectViewEpic.d.ts +10 -0
  131. package/lib/view/balanceSheetProjectView/balanceSheetForTimeframeProjectViewEpic.js +68 -0
  132. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewEpic.d.ts +6 -0
  133. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewEpic.js +34 -0
  134. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewPayload.d.ts +20 -0
  135. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewPayload.js +2 -0
  136. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewReducer.d.ts +33 -0
  137. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewReducer.js +132 -0
  138. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelector.d.ts +7 -0
  139. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelector.js +94 -0
  140. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelectorTypes.d.ts +18 -0
  141. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelectorTypes.js +2 -0
  142. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewState.d.ts +22 -0
  143. package/lib/view/balanceSheetProjectView/balanceSheetProjectViewState.js +2 -0
  144. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  145. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  146. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  147. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  148. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  149. package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
  150. package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +5 -2
  151. package/lib/view/companyView/companyViewReducer.d.ts +22 -1
  152. package/lib/view/companyView/companyViewReducer.js +60 -3
  153. package/lib/view/companyView/epic/updateCompanyProductServicesEpic.d.ts +10 -0
  154. package/lib/view/companyView/epic/updateCompanyProductServicesEpic.js +95 -0
  155. package/lib/view/companyView/epic/updateCompanyQboRealmIdEpic.d.ts +8 -0
  156. package/lib/view/companyView/epic/updateCompanyQboRealmIdEpic.js +62 -0
  157. package/lib/view/companyView/selector/companyManagementViewSelector.d.ts +3 -0
  158. package/lib/view/companyView/selector/companyManagementViewSelector.js +55 -0
  159. package/lib/view/companyView/types/cockpitTypes.d.ts +7 -3
  160. package/lib/view/companyView/types/cockpitTypes.js +15 -1
  161. package/lib/view/companyView/types/companyManagementViewState.d.ts +2 -0
  162. package/lib/view/companyView/types/companyManagementViewState.js +2 -0
  163. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  164. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  165. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  166. package/lib/view/financeStatement/financeStatementSelector.d.ts +4 -0
  167. package/lib/view/financeStatement/financeStatementSelector.js +21 -1
  168. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  169. package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +2 -1
  170. package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +25 -3
  171. package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +2 -1
  172. package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +25 -3
  173. package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +22 -8
  174. package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
  175. package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +2 -1
  176. package/lib/view/invoicing/discountAction/discountActionEpic.js +35 -8
  177. package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +2 -1
  178. package/lib/view/invoicing/dunningAction/dunningActionEpic.js +37 -8
  179. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +3 -1
  180. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
  181. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +5 -4
  182. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -1
  183. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +34 -4
  184. package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +2 -1
  185. package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +24 -2
  186. package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +2 -1
  187. package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +25 -3
  188. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.d.ts +4 -0
  189. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +15 -3
  190. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +17 -0
  191. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.d.ts +7 -0
  192. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +37 -2
  193. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +2 -1
  194. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +25 -3
  195. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +2 -1
  196. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +19 -2
  197. package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +2 -1
  198. package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +63 -16
  199. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +15 -1
  200. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
  201. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +34 -0
  202. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +11 -31
  203. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
  204. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +22 -1
  205. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.d.ts +7 -0
  206. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +30 -0
  207. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.d.ts +6 -0
  208. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +20 -0
  209. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewEpics.d.ts +2 -2
  210. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.d.ts +12 -0
  211. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +11 -0
  212. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.d.ts +21 -4
  213. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +51 -2
  214. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.d.ts +3 -0
  215. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +16 -2
  216. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewState.d.ts +13 -0
  217. package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +2 -1
  218. package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +30 -9
  219. package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +29 -4
  220. package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +2 -1
  221. package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +25 -3
  222. package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +24 -7
  223. package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +23 -16
  224. package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +2 -1
  225. package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +48 -6
  226. package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +2 -1
  227. package/lib/view/invoicing/settingsView/settingsViewEpics.js +28 -7
  228. package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +10 -1
  229. package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
  230. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +44 -2
  231. package/lib/view/invoicing/settingsView/settingsViewSelector.js +59 -2
  232. package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +2 -1
  233. package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +43 -8
  234. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.d.ts +1 -0
  235. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +7 -2
  236. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  237. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  238. package/lib/view/spendManagement/spendManagementFilterHelpers.js +1 -1
  239. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  240. package/lib/view/topEx/topExSelector.d.ts +1 -1
  241. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +1 -1
  242. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +5 -2
  243. package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +1 -1
  244. package/lib/view/vendorTabView/vendorTabViewReducer.js +5 -2
  245. package/package.json +2 -2
@@ -0,0 +1,61 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { updateSectionClassesView } from '../../entity/sectionClassesViewV2/sectionClassesViewReducer';
4
+ import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
5
+ import { toSectionId } from '../balanceSheet/balanceSheetPayload';
6
+ import { fetchBalanceSheetForTimeframeClassesView, updateBalanceSheetForTimeframeClassesView, updateBalanceSheetForTimeframeClassesViewFailure, } from './balanceSheetClassesViewReducer';
7
+ const getTimeSeriesGroup = (timeframe) => {
8
+ switch (timeframe) {
9
+ case 'month':
10
+ return 'months';
11
+ case 'quarter':
12
+ return 'quarters';
13
+ case 'year':
14
+ return 'years';
15
+ }
16
+ };
17
+ export const reportIdUniqueKey = () => 'balance_sheet_by_classes';
18
+ export const fetchBalanceSheetForTimeframeClassesViewEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchBalanceSheetForTimeframeClassesView.match), mergeMap((action) => {
19
+ const queryValue = {
20
+ // The report endpoint rejects a falsey is_full_response, so it is fixed.
21
+ is_full_response: true,
22
+ time_series_groups: [getTimeSeriesGroup(action.payload.timeframe)],
23
+ is_group_by_class: true,
24
+ // Only sent when refreshing: the flag makes the backend bypass its saved
25
+ // report and regenerate, so a normal lookup must not carry it.
26
+ ...(action.payload.cacheOverride === true
27
+ ? { is_hard_refresh: true }
28
+ : {}),
29
+ };
30
+ return zeniAPI
31
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/2.0/reports/balance_sheet?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
32
+ .pipe(mergeMap((response) => {
33
+ if (response.data != null && isSuccessResponse(response)) {
34
+ const actions = [];
35
+ const { report } = response.data;
36
+ const currency = report.currency;
37
+ actions.push(updateSectionClassesView(action.payload.timeframe, toSectionId('cash_and_equivalents'), reportIdUniqueKey(), report.assets.current_assets.cash_and_equivalents, report.classes, report.accounts, currency));
38
+ actions.push(updateSectionClassesView(action.payload.timeframe, toSectionId('accounts_receivable'), reportIdUniqueKey(), report.assets.current_assets.accounts_receivable, report.classes, report.accounts, currency));
39
+ actions.push(updateSectionClassesView(action.payload.timeframe, toSectionId('other_current_assets'), reportIdUniqueKey(), report.assets.current_assets.other_current_assets, report.classes, report.accounts, currency));
40
+ actions.push(updateSectionClassesView(action.payload.timeframe, toSectionId('fixed_assets'), reportIdUniqueKey(), report.assets.fixed_assets, report.classes, report.accounts, currency));
41
+ actions.push(updateSectionClassesView(action.payload.timeframe, toSectionId('other_assets'), reportIdUniqueKey(), report.assets.other_assets, report.classes, report.accounts, currency));
42
+ actions.push(updateSectionClassesView(action.payload.timeframe, toSectionId('accounts_payable'), reportIdUniqueKey(), report.liabilities.current_liabilities.accounts_payable, report.classes, report.accounts, currency));
43
+ actions.push(updateSectionClassesView(action.payload.timeframe, toSectionId('credit_cards'), reportIdUniqueKey(), report.liabilities.current_liabilities.credit_cards, report.classes, report.accounts, currency));
44
+ actions.push(updateSectionClassesView(action.payload.timeframe, toSectionId('other_current_liabilities'), reportIdUniqueKey(), report.liabilities.current_liabilities
45
+ .other_current_liabilities, report.classes, report.accounts, currency));
46
+ actions.push(updateSectionClassesView(action.payload.timeframe, toSectionId('long_term_liabilities'), reportIdUniqueKey(), report.liabilities.long_term_liabilities, report.classes, report.accounts, currency));
47
+ actions.push(updateSectionClassesView(action.payload.timeframe, toSectionId('equity'), reportIdUniqueKey(), report.equity, report.classes, report.accounts, currency));
48
+ actions.push(updateBalanceSheetForTimeframeClassesView({
49
+ timeframe: action.payload.timeframe,
50
+ report: response.data,
51
+ }));
52
+ return from(actions);
53
+ }
54
+ else {
55
+ return of(updateBalanceSheetForTimeframeClassesViewFailure(response.status, action.payload.timeframe));
56
+ }
57
+ }), catchError((error) => of(updateBalanceSheetForTimeframeClassesViewFailure(createZeniAPIStatus('Unexpected Error', 'Balance Sheet by Class REST API call errored out: ' +
58
+ (error instanceof Error
59
+ ? error.message
60
+ : JSON.stringify(error))), action.payload.timeframe))));
61
+ }));
@@ -0,0 +1,63 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { updateProjects } from '../../entity/project/projectReducer';
4
+ import { updateSectionProjectView } from '../../entity/sectionProjectView/sectionProjectViewReducer';
5
+ import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
6
+ import { toSectionId } from '../balanceSheet/balanceSheetPayload';
7
+ import { fetchBalanceSheetForTimeframeProjectView, updateBalanceSheetForTimeframeProjectView, updateBalanceSheetForTimeframeProjectViewFailure, } from './balanceSheetProjectViewReducer';
8
+ const getTimeSeriesGroup = (timeframe) => {
9
+ switch (timeframe) {
10
+ case 'month':
11
+ return 'months';
12
+ case 'quarter':
13
+ return 'quarters';
14
+ case 'year':
15
+ return 'years';
16
+ }
17
+ };
18
+ export const reportIdUniqueKey = () => 'balance_sheet_by_projects';
19
+ export const fetchBalanceSheetForTimeframeProjectViewEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchBalanceSheetForTimeframeProjectView.match), mergeMap((action) => {
20
+ const queryValue = {
21
+ // The report endpoint rejects a falsey is_full_response, so it is fixed.
22
+ is_full_response: true,
23
+ time_series_groups: [getTimeSeriesGroup(action.payload.timeframe)],
24
+ is_group_by_project: true,
25
+ // Only sent when refreshing: the flag makes the backend bypass its saved
26
+ // report and regenerate, so a normal lookup must not carry it.
27
+ ...(action.payload.cacheOverride === true
28
+ ? { is_hard_refresh: true }
29
+ : {}),
30
+ };
31
+ return zeniAPI
32
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/2.0/reports/balance_sheet?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
33
+ .pipe(mergeMap((response) => {
34
+ if (response.data != null && isSuccessResponse(response)) {
35
+ const actions = [];
36
+ const { report } = response.data;
37
+ const currency = report.currency;
38
+ actions.push(updateProjects(report.projects));
39
+ actions.push(updateSectionProjectView(action.payload.timeframe, toSectionId('cash_and_equivalents'), reportIdUniqueKey(), report.assets.current_assets.cash_and_equivalents, report.accounts, currency));
40
+ actions.push(updateSectionProjectView(action.payload.timeframe, toSectionId('accounts_receivable'), reportIdUniqueKey(), report.assets.current_assets.accounts_receivable, report.accounts, currency));
41
+ actions.push(updateSectionProjectView(action.payload.timeframe, toSectionId('other_current_assets'), reportIdUniqueKey(), report.assets.current_assets.other_current_assets, report.accounts, currency));
42
+ actions.push(updateSectionProjectView(action.payload.timeframe, toSectionId('fixed_assets'), reportIdUniqueKey(), report.assets.fixed_assets, report.accounts, currency));
43
+ actions.push(updateSectionProjectView(action.payload.timeframe, toSectionId('other_assets'), reportIdUniqueKey(), report.assets.other_assets, report.accounts, currency));
44
+ actions.push(updateSectionProjectView(action.payload.timeframe, toSectionId('accounts_payable'), reportIdUniqueKey(), report.liabilities.current_liabilities.accounts_payable, report.accounts, currency));
45
+ actions.push(updateSectionProjectView(action.payload.timeframe, toSectionId('credit_cards'), reportIdUniqueKey(), report.liabilities.current_liabilities.credit_cards, report.accounts, currency));
46
+ actions.push(updateSectionProjectView(action.payload.timeframe, toSectionId('other_current_liabilities'), reportIdUniqueKey(), report.liabilities.current_liabilities
47
+ .other_current_liabilities, report.accounts, currency));
48
+ actions.push(updateSectionProjectView(action.payload.timeframe, toSectionId('long_term_liabilities'), reportIdUniqueKey(), report.liabilities.long_term_liabilities, report.accounts, currency));
49
+ actions.push(updateSectionProjectView(action.payload.timeframe, toSectionId('equity'), reportIdUniqueKey(), report.equity, report.accounts, currency));
50
+ actions.push(updateBalanceSheetForTimeframeProjectView({
51
+ timeframe: action.payload.timeframe,
52
+ report: response.data,
53
+ }));
54
+ return from(actions);
55
+ }
56
+ else {
57
+ return of(updateBalanceSheetForTimeframeProjectViewFailure(response.status, action.payload.timeframe));
58
+ }
59
+ }), catchError((error) => of(updateBalanceSheetForTimeframeProjectViewFailure(createZeniAPIStatus('Unexpected Error', 'Balance Sheet by Project REST API call errored out: ' +
60
+ (error instanceof Error
61
+ ? error.message
62
+ : JSON.stringify(error))), action.payload.timeframe))));
63
+ }));
@@ -0,0 +1,30 @@
1
+ import { from } from 'rxjs';
2
+ import { filter, switchMap } from 'rxjs/operators';
3
+ import { fetchBalanceSheetForTimeframeProjectView, fetchBalanceSheetProjectView, } from './balanceSheetProjectViewReducer';
4
+ export const fetchBalanceSheetProjectViewEpic = (actions$, state) => actions$.pipe(filter(fetchBalanceSheetProjectView.match), switchMap((action) => {
5
+ const { cacheOverride } = action.payload;
6
+ if (cacheOverride === true) {
7
+ return from([
8
+ fetchBalanceSheetForTimeframeProjectView('month', true),
9
+ fetchBalanceSheetForTimeframeProjectView('quarter', true),
10
+ fetchBalanceSheetForTimeframeProjectView('year', true),
11
+ ]);
12
+ }
13
+ else {
14
+ const fetchActions = [];
15
+ const projectFetchState = state.value.balanceSheetProjectViewState.fetchState;
16
+ if (projectFetchState['month'].fetchState !== 'In-Progress' &&
17
+ projectFetchState['month'].fetchState !== 'Completed') {
18
+ fetchActions.push(fetchBalanceSheetForTimeframeProjectView('month'));
19
+ }
20
+ if (projectFetchState['quarter'].fetchState !== 'In-Progress' &&
21
+ projectFetchState['quarter'].fetchState !== 'Completed') {
22
+ fetchActions.push(fetchBalanceSheetForTimeframeProjectView('quarter'));
23
+ }
24
+ if (projectFetchState['year'].fetchState !== 'In-Progress' &&
25
+ projectFetchState['year'].fetchState !== 'Completed') {
26
+ fetchActions.push(fetchBalanceSheetForTimeframeProjectView('year'));
27
+ }
28
+ return from(fetchActions);
29
+ }
30
+ }));
@@ -0,0 +1,128 @@
1
+ import { createSlice } from '@reduxjs/toolkit';
2
+ import { mapReportPayloadV2ToReportV2 } from '../../commonPayloadTypes/v2/viewAndReportPayloadv2';
3
+ import { clearAll } from '../../rootActions';
4
+ export const initialState = {
5
+ bookCloseDate: undefined,
6
+ fetchState: {
7
+ month: {
8
+ fetchState: 'Not-Started',
9
+ error: undefined,
10
+ },
11
+ quarter: {
12
+ fetchState: 'Not-Started',
13
+ error: undefined,
14
+ },
15
+ year: {
16
+ fetchState: 'Not-Started',
17
+ error: undefined,
18
+ },
19
+ },
20
+ firstMonthOfFY: 1,
21
+ projectIds: [],
22
+ reportId: 'balance_sheet_by_projects',
23
+ reportTitle: 'balance_sheet_by_projects',
24
+ uiState: {
25
+ accountViewMode: 'account_group',
26
+ nodeCollapseState: {},
27
+ projectsToFilterOut: [],
28
+ scrollPosition: undefined,
29
+ },
30
+ };
31
+ const balanceSheetProjectView = createSlice({
32
+ name: 'balanceSheetProjectView',
33
+ initialState,
34
+ reducers: {
35
+ fetchBalanceSheetProjectView: {
36
+ prepare(cacheOverride = false) {
37
+ return { payload: { cacheOverride } };
38
+ },
39
+ reducer(
40
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
41
+ _draft,
42
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
43
+ _action) {
44
+ // nothing to do here
45
+ },
46
+ },
47
+ fetchBalanceSheetForTimeframeProjectView: {
48
+ prepare(timeframe, cacheOverride = false) {
49
+ return { payload: { timeframe, cacheOverride } };
50
+ },
51
+ reducer(draft, action) {
52
+ const timeframe = action.payload.timeframe;
53
+ draft.fetchState[timeframe].fetchState = 'In-Progress';
54
+ draft.fetchState[timeframe].error = undefined;
55
+ },
56
+ },
57
+ updateBalanceSheetForTimeframeProjectView(draft, action) {
58
+ doUpdateBalanceSheetProjectView(draft, action.payload.timeframe, action.payload.report);
59
+ },
60
+ updateBalanceSheetForTimeframeProjectViewFailure: {
61
+ prepare(error, timeframe) {
62
+ return {
63
+ payload: {
64
+ error,
65
+ timeframe,
66
+ },
67
+ };
68
+ },
69
+ reducer(draft, action) {
70
+ draft.fetchState[action.payload.timeframe] = {
71
+ fetchState: 'Error',
72
+ error: action.payload.error,
73
+ };
74
+ },
75
+ },
76
+ updateBalanceSheetProjectsToFilterOut(draft, action) {
77
+ draft.uiState.projectsToFilterOut = action.payload.projectsToFilterOut;
78
+ },
79
+ updateBalanceSheetProjectViewUIState(draft, action) {
80
+ const { nodeCollapseState, scrollPosition, resetLeftScroll } = action.payload;
81
+ if (nodeCollapseState != null) {
82
+ draft.uiState.nodeCollapseState = Object.assign({}, draft.uiState.nodeCollapseState, {
83
+ [nodeCollapseState.nodeId]: nodeCollapseState.isCollapsed,
84
+ });
85
+ }
86
+ // Mutually exclusive: resetLeftScroll clears only scrollLeft from the
87
+ // recorded position, scrollPosition replaces the whole record.
88
+ if (resetLeftScroll === true && draft.uiState.scrollPosition != null) {
89
+ draft.uiState.scrollPosition.scrollLeft = undefined;
90
+ }
91
+ else if (scrollPosition != null) {
92
+ draft.uiState.scrollPosition = scrollPosition;
93
+ }
94
+ },
95
+ updateBalanceSheetProjectViewAccountViewMode(draft, action) {
96
+ draft.uiState.accountViewMode = action.payload.viewMode;
97
+ },
98
+ resetBalanceSheetProjectNodeCollapseState(draft) {
99
+ draft.uiState.nodeCollapseState = {};
100
+ },
101
+ clearBalanceSheetProjectView(draft) {
102
+ Object.assign(draft, initialState);
103
+ },
104
+ },
105
+ extraReducers: (builder) => {
106
+ builder.addCase(clearAll, (draft) => {
107
+ Object.assign(draft, initialState);
108
+ });
109
+ },
110
+ });
111
+ export const { fetchBalanceSheetProjectView, fetchBalanceSheetForTimeframeProjectView, updateBalanceSheetForTimeframeProjectView, updateBalanceSheetForTimeframeProjectViewFailure, updateBalanceSheetProjectsToFilterOut, updateBalanceSheetProjectViewUIState, updateBalanceSheetProjectViewAccountViewMode, resetBalanceSheetProjectNodeCollapseState, clearBalanceSheetProjectView, } = balanceSheetProjectView.actions;
112
+ export default balanceSheetProjectView.reducer;
113
+ const doUpdateBalanceSheetProjectView = (draft, timeframe, balanceSheetReport) => {
114
+ const report = mapReportPayloadV2ToReportV2(balanceSheetReport.report);
115
+ draft.currency = report.currency;
116
+ draft.dataAvailable = report.dataAvailable;
117
+ draft.firstMonthOfFY = report.firstMonthOfFY;
118
+ draft.bookCloseDate = report.bookCloseDate;
119
+ draft.status = report.status;
120
+ draft.fetchState[timeframe].fetchState = 'Completed';
121
+ draft.fetchState[timeframe].error = undefined;
122
+ // Populated once, as with classHierarchy in the classes view: a project added
123
+ // mid-session is not picked up until the store is cleared, even by a hard
124
+ // refresh. Matches profitAndLossProjectViewReducer.
125
+ if (draft.projectIds.length <= 0) {
126
+ draft.projectIds = balanceSheetReport.report.projects.map((project) => project.accounting_project_id);
127
+ }
128
+ };
@@ -0,0 +1,90 @@
1
+ import { newAdditionalBalancesOptions } from '../../commonStateTypes/coaBalance/additionalBalances/getAdditionalBalances';
2
+ import { getSumOfBalancesByGroupedByPeriod } from '../../commonStateTypes/coaBalance/classBalances/getSumOfBalancesGroupedByPeriod';
3
+ import { getCOABalances } from '../../commonStateTypes/coaBalance/coaBalance';
4
+ import { reduceFetchStateParallelTimeframes } from '../../commonStateTypes/reduceFetchState';
5
+ import { getProjectsByIds } from '../../entity/project/projectSelector';
6
+ import { getSectionProjectViewReport } from '../../entity/sectionProjectView/sectionProjectViewSelector';
7
+ import { ALL_BALANCE_SHEET_REPORT_VIEW_ASSET_IDS, ALL_BALANCE_SHEET_REPORT_VIEW_EQUITY_IDS, ALL_BALANCE_SHEET_REPORT_VIEW_LIABILITY_IDS, ALL_BALANCE_SHEET_REPORT_VIEW_SECTION_IDS, balanceSheetSectionIdsInOrder, } from '../balanceSheet/balanceSheetSelectorTypes';
8
+ // The section-id constants and the display order are both module-level, so the
9
+ // sorted groupings are computed once instead of on every selector call.
10
+ const byDisplayOrder = (a, b) => balanceSheetSectionIdsInOrder.indexOf(a) -
11
+ balanceSheetSectionIdsInOrder.indexOf(b);
12
+ const ASSET_IDS_IN_ORDER = [...ALL_BALANCE_SHEET_REPORT_VIEW_ASSET_IDS].sort(byDisplayOrder);
13
+ const LIABILITY_IDS_IN_ORDER = [
14
+ ...ALL_BALANCE_SHEET_REPORT_VIEW_LIABILITY_IDS,
15
+ ].sort(byDisplayOrder);
16
+ const EQUITY_IDS_IN_ORDER = [...ALL_BALANCE_SHEET_REPORT_VIEW_EQUITY_IDS].sort(byDisplayOrder);
17
+ export const getBalanceSheetProjectView = (filter, accountState, projectState, sectionsState, balanceSheetProjectViewState) => {
18
+ const fetchState = reduceFetchStateParallelTimeframes([
19
+ balanceSheetProjectViewState.fetchState.month,
20
+ balanceSheetProjectViewState.fetchState.quarter,
21
+ balanceSheetProjectViewState.fetchState.year,
22
+ ]);
23
+ const reportId = 'balance_sheet_by_projects';
24
+ const sections = {};
25
+ const calculatedSections = {};
26
+ if (fetchState.fetchState === 'Completed') {
27
+ // Balance Sheet balances are point-in-time, so the extra columns must be
28
+ // read as snapshots rather than period sums.
29
+ const additionalBalancesOptions = newAdditionalBalancesOptions(true);
30
+ ALL_BALANCE_SHEET_REPORT_VIEW_SECTION_IDS.forEach((sectionId) => {
31
+ sections[`${sectionId}`] = getSectionProjectViewReport(accountState, projectState, sectionsState, balanceSheetProjectViewState.projectIds, {
32
+ reportId,
33
+ sectionId,
34
+ }, filter, additionalBalancesOptions);
35
+ });
36
+ const totalCurrentAssetsBalancesByPeriod = getSumOfBalancesByGroupedByPeriod([
37
+ sections['cashAndEquivalents'].sectionBalancesTotalByPeriod,
38
+ sections['accountsReceiable'].sectionBalancesTotalByPeriod,
39
+ sections['otherCurrentAssets'].sectionBalancesTotalByPeriod,
40
+ ]);
41
+ calculatedSections['totalCurrentAssets'] = getCOABalances(totalCurrentAssetsBalancesByPeriod, filter, additionalBalancesOptions);
42
+ const totalAssetsBalancesByPeriod = getSumOfBalancesByGroupedByPeriod([
43
+ totalCurrentAssetsBalancesByPeriod ?? {},
44
+ sections['fixedAssets'].sectionBalancesTotalByPeriod,
45
+ sections['otherAssets'].sectionBalancesTotalByPeriod,
46
+ ]);
47
+ calculatedSections['totalAssets'] = getCOABalances(totalAssetsBalancesByPeriod, filter, additionalBalancesOptions);
48
+ const totalCurrentLiabilitiesBalancesByPeriod = getSumOfBalancesByGroupedByPeriod([
49
+ sections['accountsPayable'].sectionBalancesTotalByPeriod,
50
+ sections['creditCards'].sectionBalancesTotalByPeriod,
51
+ sections['otherCurrentLiabilities'].sectionBalancesTotalByPeriod,
52
+ ]);
53
+ calculatedSections['totalCurrentLiabilities'] = getCOABalances(totalCurrentLiabilitiesBalancesByPeriod, filter, additionalBalancesOptions);
54
+ calculatedSections['totalNonCurrentLiabilities'] = getCOABalances(sections['longTermLiabilities'].sectionBalancesTotalByPeriod, filter, additionalBalancesOptions);
55
+ const totalLiabilitiesBalancesByPeriod = getSumOfBalancesByGroupedByPeriod([
56
+ totalCurrentLiabilitiesBalancesByPeriod ?? {},
57
+ sections['longTermLiabilities'].sectionBalancesTotalByPeriod,
58
+ ]);
59
+ calculatedSections['totalLiabilities'] = getCOABalances(totalLiabilitiesBalancesByPeriod, filter, additionalBalancesOptions);
60
+ calculatedSections['totalEquity'] = getCOABalances(sections['equity'].sectionBalancesTotalByPeriod, filter, additionalBalancesOptions);
61
+ const liabilitiesAndEquityBalancesByPeriod = getSumOfBalancesByGroupedByPeriod([
62
+ totalLiabilitiesBalancesByPeriod ?? {},
63
+ sections['equity'].sectionBalancesTotalByPeriod,
64
+ ]);
65
+ calculatedSections['liabilitiesAndEquity'] = getCOABalances(liabilitiesAndEquityBalancesByPeriod, filter, additionalBalancesOptions);
66
+ }
67
+ return {
68
+ sections,
69
+ calculatedSections,
70
+ reportId: balanceSheetProjectViewState.reportId,
71
+ reportTitle: balanceSheetProjectViewState.reportTitle,
72
+ firstMonthOfFY: balanceSheetProjectViewState.firstMonthOfFY,
73
+ dataAvailable: balanceSheetProjectViewState.dataAvailable,
74
+ bookCloseDate: balanceSheetProjectViewState.bookCloseDate,
75
+ version: balanceSheetProjectViewState.version,
76
+ status: balanceSheetProjectViewState.status,
77
+ fetchState: fetchState.fetchState,
78
+ error: fetchState.error,
79
+ filter,
80
+ uiState: balanceSheetProjectViewState.uiState,
81
+ projects: getProjectsByIds(projectState, balanceSheetProjectViewState.projectIds),
82
+ projectsToFilterOut: balanceSheetProjectViewState.uiState.projectsToFilterOut,
83
+ idsInOrder: balanceSheetSectionIdsInOrder,
84
+ rootSectionsWithSubSectionIds: {
85
+ assets: ASSET_IDS_IN_ORDER,
86
+ liabilities: LIABILITY_IDS_IN_ORDER,
87
+ equity: EQUITY_IDS_IN_ORDER,
88
+ },
89
+ };
90
+ };
@@ -31,10 +31,13 @@ const companyHealthMetricConfigView = createSlice({
31
31
  draft.fetchState = 'Error';
32
32
  draft.error = action.payload;
33
33
  },
34
+ clearCompanyHealthMetricConfigView() {
35
+ return initialState;
36
+ },
34
37
  },
35
38
  extraReducers: (builder) => {
36
39
  builder.addCase(clearAll, () => initialState);
37
40
  },
38
41
  });
39
- export const { fetchCompanyHealthMetricConfig, updateCompanyHealthMetricConfig, updateCompanyHealthMetricConfigFailure, } = companyHealthMetricConfigView.actions;
42
+ export const { clearCompanyHealthMetricConfigView, fetchCompanyHealthMetricConfig, updateCompanyHealthMetricConfig, updateCompanyHealthMetricConfigFailure, } = companyHealthMetricConfigView.actions;
40
43
  export default companyHealthMetricConfigView.reducer;
@@ -377,6 +377,63 @@ const companyView = createSlice({
377
377
  clearQboProjectsReconnectRequest(draft) {
378
378
  draft.passportView.needsQboProjectsReconnect = false;
379
379
  },
380
+ updateCompanyProductServices: {
381
+ reducer(draft, action) {
382
+ draft.managementView.productServicesUpdateStatusByCompanyId[action.payload.companyId] = {
383
+ fetchState: 'In-Progress',
384
+ error: undefined,
385
+ };
386
+ },
387
+ prepare(companyId, services) {
388
+ return { payload: { companyId, services } };
389
+ },
390
+ },
391
+ updateCompanyProductServicesSuccess(draft, action) {
392
+ draft.managementView.productServicesUpdateStatusByCompanyId[action.payload.companyId] = {
393
+ fetchState: 'Completed',
394
+ error: undefined,
395
+ };
396
+ },
397
+ updateCompanyProductServicesFailure: {
398
+ reducer(draft, action) {
399
+ draft.managementView.productServicesUpdateStatusByCompanyId[action.payload.companyId] = {
400
+ fetchState: 'Error',
401
+ error: action.payload.status,
402
+ };
403
+ },
404
+ prepare(companyId, status) {
405
+ return { payload: { companyId, status } };
406
+ },
407
+ },
408
+ updateCompanyQboRealmId: {
409
+ reducer(draft, action) {
410
+ draft.managementView.qboRealmIdUpdateStatusByCompanyId[action.payload.companyId] = {
411
+ fetchState: 'In-Progress',
412
+ error: undefined,
413
+ };
414
+ },
415
+ // qboRealmId omitted -> reset (the epic sends null); a value -> update.
416
+ prepare(companyId, qboRealmId) {
417
+ return { payload: { companyId, qboRealmId } };
418
+ },
419
+ },
420
+ updateCompanyQboRealmIdSuccess(draft, action) {
421
+ draft.managementView.qboRealmIdUpdateStatusByCompanyId[action.payload.companyId] = {
422
+ fetchState: 'Completed',
423
+ error: undefined,
424
+ };
425
+ },
426
+ updateCompanyQboRealmIdFailure: {
427
+ reducer(draft, action) {
428
+ draft.managementView.qboRealmIdUpdateStatusByCompanyId[action.payload.companyId] = {
429
+ fetchState: 'Error',
430
+ error: action.payload.status,
431
+ };
432
+ },
433
+ prepare(companyId, status) {
434
+ return { payload: { companyId, status } };
435
+ },
436
+ },
380
437
  updateCapitalizationAccountThreshold: {
381
438
  prepare(companyId, accountId, threshold, dismissOnboardingForAccount, allOverrides) {
382
439
  return {
@@ -700,5 +757,5 @@ const companyView = createSlice({
700
757
  });
701
758
  },
702
759
  });
703
- export const { fetchCompanyPassportView, fetchAllCockpitViews, fetchOnboardingView, fetchManagementView, fetchSubscriptionView, fetchPortfolioView, fetchCompanyManagementView, companyManagementSaveUpdates, companyManagementSavePendingUpdates, companyManagementDiscardUpdates, companyManagementSaveUpdatesSuccess, companyManagementSaveUpdatesFailure, updateCompanyViewOnSuccess, updateCompanyViewOnFailure, fetchCompanyPortfolioView, fetchZeniUsers, updateZeniUsersOnSuccess, updateZeniUsersOnFailure, clearCompanyView, updateCompanyPortfolioUIState, updateCompanyManagementUIState, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, companyPassportClearDataInLocalStore, companyPassportUpdateCompanyDetails, companyPassportUpdateCompanyDetailsSuccess, companyPassportUpdateCompanyDetailsFailure, updateAccountingClassesEnabled, updateAccountingClassesEnabledSuccess, updateAccountingClassesEnabledFailure, enableAccountingProjects, resumeEnableAccountingProjects, disableAccountingProjects, updateAccountingProjectsEnabledSuccess, updateAccountingProjectsEnabledFailure, requestQboProjectsReconnect, clearQboProjectsReconnectRequest, updateCapitalizationAccountThreshold, updateCapitalizationAccountThresholdSuccess, updateCapitalizationAccountThresholdFailure, dismissCapitalizationOnboarding, companyPassportUpdatePrimaryContact, companyPassportUpdatePrimaryContactSuccess, companyPassportUpdatePrimaryContactFailure, companyPassportUpdateCompanyOfficer, companyPassportUpdateCompanyOfficerSuccess, companyPassportUpdateCompanyOfficerFailure, companyPassportCreateCompanyOfficers, companyPassportCreateCompanyOfficersSuccess, companyPassportCreateCompanyOfficersFailure, updateCompanyPassportLocalStoreData, saveIndustryAndIncDateInCompanyPassportLocalStore, saveCompanyPassportDetails, fetchParentSubsidiaryManagementView, updateParentSubsidiaryView, updateParentSubsidiaryViewOnFailure, updateCompanyDownloadState, fetchCompanyMetaData, updateCompanyMetaDataOnSuccess, updateCompanyMetaDataOnFailure, updateMetaDataOnSendMonthEndReport, } = companyView.actions;
760
+ export const { fetchCompanyPassportView, fetchAllCockpitViews, fetchOnboardingView, fetchManagementView, fetchSubscriptionView, fetchPortfolioView, fetchCompanyManagementView, companyManagementSaveUpdates, companyManagementSavePendingUpdates, companyManagementDiscardUpdates, companyManagementSaveUpdatesSuccess, companyManagementSaveUpdatesFailure, updateCompanyViewOnSuccess, updateCompanyViewOnFailure, fetchCompanyPortfolioView, fetchZeniUsers, updateZeniUsersOnSuccess, updateZeniUsersOnFailure, clearCompanyView, updateCompanyPortfolioUIState, updateCompanyManagementUIState, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, companyPassportClearDataInLocalStore, companyPassportUpdateCompanyDetails, companyPassportUpdateCompanyDetailsSuccess, companyPassportUpdateCompanyDetailsFailure, updateAccountingClassesEnabled, updateAccountingClassesEnabledSuccess, updateAccountingClassesEnabledFailure, updateCompanyProductServices, updateCompanyProductServicesSuccess, updateCompanyProductServicesFailure, updateCompanyQboRealmId, updateCompanyQboRealmIdSuccess, updateCompanyQboRealmIdFailure, enableAccountingProjects, resumeEnableAccountingProjects, disableAccountingProjects, updateAccountingProjectsEnabledSuccess, updateAccountingProjectsEnabledFailure, requestQboProjectsReconnect, clearQboProjectsReconnectRequest, updateCapitalizationAccountThreshold, updateCapitalizationAccountThresholdSuccess, updateCapitalizationAccountThresholdFailure, dismissCapitalizationOnboarding, companyPassportUpdatePrimaryContact, companyPassportUpdatePrimaryContactSuccess, companyPassportUpdatePrimaryContactFailure, companyPassportUpdateCompanyOfficer, companyPassportUpdateCompanyOfficerSuccess, companyPassportUpdateCompanyOfficerFailure, companyPassportCreateCompanyOfficers, companyPassportCreateCompanyOfficersSuccess, companyPassportCreateCompanyOfficersFailure, updateCompanyPassportLocalStoreData, saveIndustryAndIncDateInCompanyPassportLocalStore, saveCompanyPassportDetails, fetchParentSubsidiaryManagementView, updateParentSubsidiaryView, updateParentSubsidiaryViewOnFailure, updateCompanyDownloadState, fetchCompanyMetaData, updateCompanyMetaDataOnSuccess, updateCompanyMetaDataOnFailure, updateMetaDataOnSendMonthEndReport, } = companyView.actions;
704
761
  export default companyView.reducer;
@@ -0,0 +1,91 @@
1
+ import { from } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { updateCompanies } from '../../../entity/company/companyReducer';
4
+ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
5
+ import { updateTenantProductSettings } from '../../../entity/tenant/tenantReducer';
6
+ import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
7
+ import { updateCompanyProductServices, updateCompanyProductServicesFailure, updateCompanyProductServicesSuccess, } from '../companyViewReducer';
8
+ import { resolveTenantIdByCompanyId } from '../selector/companyManagementViewSelector';
9
+ export const updateCompanyProductServicesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateCompanyProductServices.match),
10
+ // Per-row admin action: an operator can enable services on several
11
+ // companies at once, so each trigger keeps its own request (matches
12
+ // updateCompanyQboRealmIdEpic).
13
+ mergeMap((action) => {
14
+ const { companyId, services } = action.payload;
15
+ const { isBookkeepingEnabled, isBillPayEnabled, isReimbursementEnabled } = services;
16
+ const tenantId = resolveTenantIdByCompanyId(state$.value, companyId);
17
+ // Send only the service-enable fields so the backend routes this through
18
+ // its isolated "enable services" path. Bookkeeping is a Tenant product
19
+ // flag and implies spend management; bill pay / reimbursement are Company
20
+ // feature flags.
21
+ const requestBody = {};
22
+ if (isBookkeepingEnabled != null) {
23
+ requestBody.is_book_keeping_enabled = isBookkeepingEnabled;
24
+ requestBody.is_spend_management_enabled = isBookkeepingEnabled;
25
+ }
26
+ if (isBillPayEnabled != null) {
27
+ requestBody.is_bill_pay_feature_enabled = isBillPayEnabled;
28
+ }
29
+ if (isReimbursementEnabled != null) {
30
+ requestBody.is_reimbursement_feature_enabled = isReimbursementEnabled;
31
+ }
32
+ // No fields set would fall through to the normal company PUT on the backend;
33
+ // treat it as an immediate no-op success so the In-Progress status resolves.
34
+ if (Object.keys(requestBody).length === 0) {
35
+ return from([updateCompanyProductServicesSuccess({ companyId })]);
36
+ }
37
+ return zeniAPI
38
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, requestBody)
39
+ .pipe(mergeMap((response) => {
40
+ if (isSuccessResponse(response)) {
41
+ const companies = response.data?.companies ?? [];
42
+ const actions = [];
43
+ // The response normally carries the updated company; only write
44
+ // company state when it does (a 200 is still a success even with
45
+ // an empty company array).
46
+ if (companies.length > 0) {
47
+ actions.push(updateCompanies({
48
+ payload: companies,
49
+ schema: {},
50
+ isUpdate: true,
51
+ }));
52
+ }
53
+ // Independent of the company array: the company PUT is the source
54
+ // of truth and this tenant-state patch is a best-effort optimistic
55
+ // sync, skipped when the tenant isn't loaded (UI relies on the
56
+ // next tenant fetch).
57
+ if (isBookkeepingEnabled != null && tenantId != null) {
58
+ actions.push(updateTenantProductSettings({
59
+ tenantId,
60
+ isBookkeepingEnabled,
61
+ isSpendManagementEnabled: isBookkeepingEnabled,
62
+ }));
63
+ }
64
+ actions.push(updateCompanyProductServicesSuccess({ companyId }));
65
+ actions.push(openSnackbar({
66
+ messageSection: 'product_services_update',
67
+ messageText: 'success',
68
+ type: 'success',
69
+ }));
70
+ return from(actions);
71
+ }
72
+ return from([
73
+ updateCompanyProductServicesFailure(companyId, response.status),
74
+ openSnackbar({
75
+ messageSection: 'product_services_update',
76
+ messageText: 'failed',
77
+ type: 'error',
78
+ }),
79
+ ]);
80
+ }), catchError((error) => from([
81
+ updateCompanyProductServicesFailure(companyId, createZeniAPIStatus('Unexpected error', 'Update Company Product Services errored out: ' +
82
+ (error instanceof Error
83
+ ? error.message
84
+ : JSON.stringify(error)))),
85
+ openSnackbar({
86
+ messageSection: 'product_services_update',
87
+ messageText: 'failed',
88
+ type: 'error',
89
+ }),
90
+ ])));
91
+ }));
@@ -0,0 +1,58 @@
1
+ import { from } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
4
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
5
+ import { updateCompanyQboRealmId, updateCompanyQboRealmIdFailure, updateCompanyQboRealmIdSuccess, } from '../companyViewReducer';
6
+ import { resolveTenantIdByCompanyId } from '../selector/companyManagementViewSelector';
7
+ export const updateCompanyQboRealmIdEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateCompanyQboRealmId.match),
8
+ // Per-row admin action: several rows can be in flight at once, so each
9
+ // trigger keeps its own request instead of cancelling the previous one.
10
+ mergeMap((action) => {
11
+ const { companyId, qboRealmId } = action.payload;
12
+ const tenantId = resolveTenantIdByCompanyId(state$.value, companyId);
13
+ if (tenantId == null) {
14
+ return from([
15
+ updateCompanyQboRealmIdFailure(companyId, createZeniAPIStatus('Unexpected error', `No tenant found for companyId: ${companyId}`)),
16
+ openSnackbar({
17
+ messageSection: 'qbo_realm_id_update',
18
+ messageText: 'failed',
19
+ type: 'error',
20
+ }),
21
+ ]);
22
+ }
23
+ // The FE route reads the target tenant from the zeni-tenant-id header,
24
+ // which overrides the operator's ambient tenant for this request only.
25
+ // qboRealmId omitted -> null clears the pin; a value overwrites it.
26
+ return zeniAPI
27
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/qbo-realm-id`, { qbo_realm_id: qboRealmId ?? null }, { 'zeni-tenant-id': tenantId })
28
+ .pipe(mergeMap((response) => {
29
+ if (isSuccessResponse(response)) {
30
+ return from([
31
+ updateCompanyQboRealmIdSuccess({ companyId }),
32
+ openSnackbar({
33
+ messageSection: 'qbo_realm_id_update',
34
+ messageText: 'success',
35
+ type: 'success',
36
+ }),
37
+ ]);
38
+ }
39
+ return from([
40
+ updateCompanyQboRealmIdFailure(companyId, response.status),
41
+ openSnackbar({
42
+ messageSection: 'qbo_realm_id_update',
43
+ messageText: 'failed',
44
+ type: 'error',
45
+ }),
46
+ ]);
47
+ }), catchError((error) => from([
48
+ updateCompanyQboRealmIdFailure(companyId, createZeniAPIStatus('Unexpected error', 'Update Company QBO realm id errored out: ' +
49
+ (error instanceof Error
50
+ ? error.message
51
+ : JSON.stringify(error)))),
52
+ openSnackbar({
53
+ messageSection: 'qbo_realm_id_update',
54
+ messageText: 'failed',
55
+ type: 'error',
56
+ }),
57
+ ])));
58
+ }));