@zeniai/client-epic-state 5.0.1 → 5.0.2-betaRD2

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 (185) hide show
  1. package/lib/commonPayloadTypes/subAccountView/reportBySubAccountPayload.d.ts +2 -0
  2. package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.d.ts +13 -0
  3. package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +9 -0
  4. package/lib/commonStateTypes/common.d.ts +1 -1
  5. package/lib/commonStateTypes/projectView/projectViewParentID.d.ts +5 -0
  6. package/lib/commonStateTypes/projectView/projectViewParentID.js +2 -0
  7. package/lib/commonStateTypes/viewAndReport/reportIDHelper.d.ts +1 -0
  8. package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +3 -1
  9. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  10. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  11. package/lib/entity/account/accountReducer.js +6 -3
  12. package/lib/entity/account/accountSelector.d.ts +7 -0
  13. package/lib/entity/account/accountSelector.js +4 -2
  14. package/lib/entity/account/accountState.d.ts +3 -1
  15. package/lib/entity/account/accountState.js +4 -1
  16. package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +1 -0
  17. package/lib/entity/account/subAccountSelector.d.ts +2 -0
  18. package/lib/entity/account/subAccountSelector.js +2 -0
  19. package/lib/entity/accountGroup/accountGroupSelector.d.ts +22 -0
  20. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  21. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.d.ts +44 -0
  22. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +55 -0
  23. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.d.ts +10 -0
  24. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +51 -0
  25. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +48 -0
  26. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +66 -0
  27. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.d.ts +52 -0
  28. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.js +37 -0
  29. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  30. package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
  31. package/lib/entity/class/classReducer.d.ts +4 -4
  32. package/lib/entity/class/classState.d.ts +1 -1
  33. package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
  34. package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +2 -2
  35. package/lib/entity/forecast/forecastState.d.ts +1 -1
  36. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
  37. package/lib/entity/project/projectPayload.d.ts +13 -0
  38. package/lib/entity/project/projectPayload.js +30 -0
  39. package/lib/entity/project/projectReducer.d.ts +10 -0
  40. package/lib/entity/project/projectReducer.js +31 -0
  41. package/lib/entity/project/projectSelector.d.ts +5 -0
  42. package/lib/entity/project/projectSelector.js +12 -0
  43. package/lib/entity/project/projectState.d.ts +13 -0
  44. package/lib/entity/project/projectState.js +2 -0
  45. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  46. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  47. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  48. package/lib/entity/sectionProjectView/sectionProjectView.d.ts +11 -0
  49. package/lib/entity/sectionProjectView/sectionProjectView.js +6 -0
  50. package/lib/entity/sectionProjectView/sectionProjectViewEpic.d.ts +6 -0
  51. package/lib/entity/sectionProjectView/sectionProjectViewEpic.js +56 -0
  52. package/lib/entity/sectionProjectView/sectionProjectViewHelper.d.ts +10 -0
  53. package/lib/entity/sectionProjectView/sectionProjectViewHelper.js +14 -0
  54. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +15 -0
  55. package/lib/entity/sectionProjectView/sectionProjectViewReducer.js +56 -0
  56. package/lib/entity/sectionProjectView/sectionProjectViewSelector.d.ts +11 -0
  57. package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +94 -0
  58. package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.d.ts +16 -0
  59. package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +2 -0
  60. package/lib/entity/sectionProjectView/sectionProjectViewState.d.ts +4 -0
  61. package/lib/entity/sectionProjectView/sectionProjectViewState.js +2 -0
  62. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  63. package/lib/entity/tenant/clearAllEpic.d.ts +7 -2
  64. package/lib/entity/tenant/clearAllEpic.js +10 -0
  65. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  66. package/lib/entity/tenant/tenantReducer.js +1 -0
  67. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  68. package/lib/entity/tenant/tenantSelector.js +9 -1
  69. package/lib/entity/tenant/tenantState.d.ts +1 -0
  70. package/lib/entity/transaction/payloadTypes/transactionPayload.js +0 -21
  71. package/lib/entity/userRole/userRoleType.d.ts +2 -2
  72. package/lib/epic.d.ts +8 -1
  73. package/lib/epic.js +8 -1
  74. package/lib/esm/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +5 -0
  75. package/lib/esm/commonStateTypes/projectView/projectViewParentID.js +1 -0
  76. package/lib/esm/commonStateTypes/viewAndReport/reportIDHelper.js +1 -0
  77. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  78. package/lib/esm/entity/account/accountReducer.js +6 -3
  79. package/lib/esm/entity/account/accountSelector.js +4 -2
  80. package/lib/esm/entity/account/accountState.js +4 -1
  81. package/lib/esm/entity/account/subAccountSelector.js +2 -0
  82. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +49 -0
  83. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +47 -0
  84. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +62 -0
  85. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerState.js +31 -0
  86. package/lib/esm/entity/project/projectPayload.js +26 -0
  87. package/lib/esm/entity/project/projectReducer.js +27 -0
  88. package/lib/esm/entity/project/projectSelector.js +8 -0
  89. package/lib/esm/entity/project/projectState.js +1 -0
  90. package/lib/esm/entity/sectionProjectView/sectionProjectView.js +3 -0
  91. package/lib/esm/entity/sectionProjectView/sectionProjectViewEpic.js +52 -0
  92. package/lib/esm/entity/sectionProjectView/sectionProjectViewHelper.js +10 -0
  93. package/lib/esm/entity/sectionProjectView/sectionProjectViewReducer.js +52 -0
  94. package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +87 -0
  95. package/lib/esm/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +1 -0
  96. package/lib/esm/entity/sectionProjectView/sectionProjectViewState.js +1 -0
  97. package/lib/esm/entity/tenant/clearAllEpic.js +10 -0
  98. package/lib/esm/entity/tenant/tenantReducer.js +1 -0
  99. package/lib/esm/entity/tenant/tenantSelector.js +7 -0
  100. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +0 -21
  101. package/lib/esm/epic.js +8 -1
  102. package/lib/esm/index.js +14 -4
  103. package/lib/esm/reducer.js +15 -0
  104. package/lib/esm/view/aiAccountantView/aiAccountantViewPayload.js +2 -0
  105. package/lib/esm/view/aiAccountantView/aiAccountantViewReducer.js +149 -0
  106. package/lib/esm/view/aiAccountantView/aiAccountantViewSelector.js +72 -0
  107. package/lib/esm/view/aiAccountantView/aiAccountantViewState.js +11 -0
  108. package/lib/esm/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +46 -0
  109. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +27 -0
  110. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +47 -0
  111. package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +52 -0
  112. package/lib/esm/view/financeStatement/financeStatementSelector.js +12 -1
  113. package/lib/esm/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +47 -0
  114. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +30 -0
  115. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +1 -0
  116. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +113 -0
  117. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +65 -0
  118. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +1 -0
  119. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewState.js +1 -0
  120. package/lib/esm/view/reportsResync/reportsClassViewRefetchingEpic.js +4 -0
  121. package/lib/index.d.ts +20 -4
  122. package/lib/index.js +73 -34
  123. package/lib/reducer.d.ts +15 -0
  124. package/lib/reducer.js +15 -0
  125. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  126. package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +31 -0
  127. package/lib/view/aiAccountantView/aiAccountantViewPayload.js +8 -0
  128. package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +29 -0
  129. package/lib/view/aiAccountantView/aiAccountantViewReducer.js +153 -0
  130. package/lib/view/aiAccountantView/aiAccountantViewSelector.d.ts +14 -0
  131. package/lib/view/aiAccountantView/aiAccountantViewSelector.js +78 -0
  132. package/lib/view/aiAccountantView/aiAccountantViewState.d.ts +26 -0
  133. package/lib/view/aiAccountantView/aiAccountantViewState.js +13 -0
  134. package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.d.ts +33 -0
  135. package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +50 -0
  136. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.d.ts +23 -0
  137. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +31 -0
  138. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.d.ts +33 -0
  139. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +51 -0
  140. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.d.ts +28 -0
  141. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +56 -0
  142. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  143. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  144. package/lib/view/cardBalance/cardBalanceSelector.d.ts +2 -1
  145. package/lib/view/cashBalance/cashBalanceSelector.d.ts +2 -1
  146. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  147. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  148. package/lib/view/companyView/types/cockpitTypes.d.ts +6 -5
  149. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  150. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  151. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
  152. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  153. package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
  154. package/lib/view/financeStatement/financeStatementSelector.js +12 -1
  155. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  156. package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
  157. package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.d.ts +9 -0
  158. package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +51 -0
  159. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.d.ts +6 -0
  160. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +34 -0
  161. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.d.ts +33 -0
  162. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +2 -0
  163. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.d.ts +33 -0
  164. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +117 -0
  165. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.d.ts +9 -0
  166. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +69 -0
  167. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +19 -0
  168. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +2 -0
  169. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.d.ts +22 -0
  170. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.js +2 -0
  171. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  172. package/lib/view/reportsResync/reportsClassViewRefetchingEpic.d.ts +2 -1
  173. package/lib/view/reportsResync/reportsClassViewRefetchingEpic.js +4 -0
  174. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  175. package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +1 -1
  176. package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
  177. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  178. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -1
  179. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -4
  180. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
  181. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +3 -3
  182. package/lib/view/subscriptionView/types/subscriptionTypes.d.ts +1 -1
  183. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  184. package/lib/view/topEx/topExSelector.d.ts +1 -1
  185. package/package.json +1 -1
@@ -0,0 +1,113 @@
1
+ import { createSlice } from '@reduxjs/toolkit';
2
+ import { mapReportPayloadV2ToReportV2 } from '../../commonPayloadTypes/v2/viewAndReportPayloadv2';
3
+ export const initialState = {
4
+ bookCloseDate: undefined,
5
+ fetchState: {
6
+ month: {
7
+ fetchState: 'Not-Started',
8
+ error: undefined,
9
+ },
10
+ quarter: {
11
+ fetchState: 'Not-Started',
12
+ error: undefined,
13
+ },
14
+ year: {
15
+ fetchState: 'Not-Started',
16
+ error: undefined,
17
+ },
18
+ },
19
+ firstMonthOfFY: 1,
20
+ projectIds: [],
21
+ reportId: 'profit_and_loss_by_projects',
22
+ reportTitle: 'profit_and_loss_by_projects',
23
+ uiState: {
24
+ accountViewMode: 'project',
25
+ nodeCollapseState: {},
26
+ projectsToFilterOut: [],
27
+ scrollPosition: undefined,
28
+ },
29
+ };
30
+ const profitAndLossProjectView = createSlice({
31
+ name: 'profitAndLossProjectView',
32
+ initialState,
33
+ reducers: {
34
+ fetchProfitAndLossProjectView: {
35
+ prepare(cacheOverride = false) {
36
+ return { payload: { cacheOverride } };
37
+ },
38
+ reducer(
39
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
40
+ _draft,
41
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
+ _action) {
43
+ // nothing to do here
44
+ },
45
+ },
46
+ fetchProfitAndLossForTimeframeProjectView: {
47
+ prepare(timeframe, fetchFullReport = true, cacheOverride = false) {
48
+ return { payload: { timeframe, fetchFullReport, cacheOverride } };
49
+ },
50
+ reducer(draft, action) {
51
+ const timeframe = action.payload.timeframe;
52
+ draft.fetchState[timeframe].fetchState = 'In-Progress';
53
+ draft.fetchState[timeframe].error = undefined;
54
+ },
55
+ },
56
+ updateProfitAndLossForTimeframeProjectView(draft, action) {
57
+ doUpdateProfitAndLossProjectView(draft, action.payload.timeframe, action.payload.report);
58
+ },
59
+ updateProfitAndLossForTimeframeProjectViewFailure: {
60
+ prepare(error, timeframe) {
61
+ return {
62
+ payload: {
63
+ error,
64
+ timeframe,
65
+ },
66
+ };
67
+ },
68
+ reducer(draft, action) {
69
+ draft.fetchState[action.payload.timeframe] = {
70
+ fetchState: 'Error',
71
+ error: action.payload.error,
72
+ };
73
+ },
74
+ },
75
+ updateProjectsToFilterOut(draft, action) {
76
+ draft.uiState.projectsToFilterOut = action.payload.projectsToFilterOut;
77
+ },
78
+ updateProfitAndLossProjectViewUIState(draft, action) {
79
+ const { nodeCollapseState, scrollPosition } = action.payload;
80
+ if (nodeCollapseState != null) {
81
+ draft.uiState.nodeCollapseState = Object.assign({}, draft.uiState.nodeCollapseState, {
82
+ [nodeCollapseState.nodeId]: nodeCollapseState.isCollapsed,
83
+ });
84
+ }
85
+ if (scrollPosition != null) {
86
+ draft.uiState.scrollPosition = scrollPosition;
87
+ }
88
+ },
89
+ updateProjectViewAccountViewMode(draft, action) {
90
+ draft.uiState.accountViewMode = action.payload.viewMode;
91
+ },
92
+ resetProfitAndLossProjectNodeCollapseState(draft) {
93
+ draft.uiState.nodeCollapseState = {};
94
+ },
95
+ clearProfitAndLossProjectView(draft) {
96
+ Object.assign(draft, initialState);
97
+ },
98
+ },
99
+ });
100
+ export const { fetchProfitAndLossProjectView, fetchProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectViewFailure, updateProjectsToFilterOut, updateProfitAndLossProjectViewUIState, updateProjectViewAccountViewMode, resetProfitAndLossProjectNodeCollapseState, clearProfitAndLossProjectView, } = profitAndLossProjectView.actions;
101
+ export default profitAndLossProjectView.reducer;
102
+ const doUpdateProfitAndLossProjectView = (draft, timeframe, pandLReport) => {
103
+ const report = mapReportPayloadV2ToReportV2(pandLReport.report);
104
+ draft.currency = report.currency;
105
+ draft.dataAvailable = report.dataAvailable;
106
+ draft.firstMonthOfFY = report.firstMonthOfFY;
107
+ draft.bookCloseDate = report.bookCloseDate;
108
+ draft.status = report.status;
109
+ draft.fetchState[timeframe].fetchState = 'Completed';
110
+ if (draft.projectIds.length <= 0) {
111
+ draft.projectIds = pandLReport.report.projects.map((project) => project.zeni_project_id);
112
+ }
113
+ };
@@ -0,0 +1,65 @@
1
+ import { getDifferenceOfBalancesGroupedByPeriod } from '../../commonStateTypes/coaBalance/classBalances/getDifferenceOfBalancesGroupedByPeriod';
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_PANDL_REPORT_VIEW_SECTION_IDS, } from '../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
8
+ export const profitAndLossProjectIdsInOrder = [
9
+ 'income',
10
+ 'cogs',
11
+ 'grossProfit',
12
+ 'expenses',
13
+ 'earningsBeforeInterestAndTax',
14
+ 'otherIncome',
15
+ 'otherExpenses',
16
+ 'netOtherIncome',
17
+ 'netIncome',
18
+ ];
19
+ export const getProfitAndLossProjectView = (filter, accountState, projectState, sectionsState, profitAndLossProjectViewState) => {
20
+ const fetchState = reduceFetchStateParallelTimeframes([
21
+ profitAndLossProjectViewState.fetchState.month,
22
+ profitAndLossProjectViewState.fetchState.quarter,
23
+ profitAndLossProjectViewState.fetchState.year,
24
+ ]);
25
+ const reportId = 'profit_and_loss_by_projects';
26
+ const sections = {};
27
+ const calculatedSections = {};
28
+ if (fetchState.fetchState === 'Completed') {
29
+ ALL_PANDL_REPORT_VIEW_SECTION_IDS.forEach((sectionId) => {
30
+ sections[`${sectionId}`] = getSectionProjectViewReport(accountState, projectState, sectionsState, profitAndLossProjectViewState.projectIds, {
31
+ reportId,
32
+ sectionId,
33
+ }, filter);
34
+ });
35
+ const grossProfitBalancesByPeriod = getDifferenceOfBalancesGroupedByPeriod(sections['income'].sectionBalancesTotalByPeriod, sections['cogs'].sectionBalancesTotalByPeriod);
36
+ calculatedSections['grossProfit'] = getCOABalances(grossProfitBalancesByPeriod, filter);
37
+ const ebitBalancesByPeriod = getDifferenceOfBalancesGroupedByPeriod(grossProfitBalancesByPeriod, sections['expenses'].sectionBalancesTotalByPeriod);
38
+ calculatedSections['earningsBeforeInterestAndTax'] = getCOABalances(ebitBalancesByPeriod, filter);
39
+ const netOtherIncomeBalances = getDifferenceOfBalancesGroupedByPeriod(sections['otherIncome'].sectionBalancesTotalByPeriod, sections['otherExpenses'].sectionBalancesTotalByPeriod);
40
+ calculatedSections['netOtherIncome'] = getCOABalances(netOtherIncomeBalances, filter);
41
+ const netIncomeBalances = getSumOfBalancesByGroupedByPeriod([
42
+ ebitBalancesByPeriod,
43
+ netOtherIncomeBalances,
44
+ ]);
45
+ calculatedSections['netIncome'] = getCOABalances(netIncomeBalances, filter);
46
+ }
47
+ return {
48
+ sections,
49
+ calculatedSections,
50
+ reportId: profitAndLossProjectViewState.reportId,
51
+ reportTitle: profitAndLossProjectViewState.reportTitle,
52
+ firstMonthOfFY: profitAndLossProjectViewState.firstMonthOfFY,
53
+ dataAvailable: profitAndLossProjectViewState.dataAvailable,
54
+ bookCloseDate: profitAndLossProjectViewState.bookCloseDate,
55
+ version: profitAndLossProjectViewState.version,
56
+ status: profitAndLossProjectViewState.status,
57
+ fetchState: fetchState.fetchState,
58
+ error: fetchState.error,
59
+ filter,
60
+ uiState: profitAndLossProjectViewState.uiState,
61
+ projects: getProjectsByIds(projectState, profitAndLossProjectViewState.projectIds),
62
+ projectsToFilterOut: profitAndLossProjectViewState.uiState.projectsToFilterOut,
63
+ idsInOrder: profitAndLossProjectIdsInOrder,
64
+ };
65
+ };
@@ -3,6 +3,7 @@ import { filter, switchMap } from 'rxjs/operators';
3
3
  import { fetchNetBurnOrIncomeClassesView } from '../netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer';
4
4
  import { fetchOpExClassesView } from '../opExClassesView/opExClassesViewReducer';
5
5
  import { fetchProfitAndLossClassesView } from '../profitAndLossClassesView/profitAndLossClassesViewReducer';
6
+ import { fetchProfitAndLossProjectView } from '../profitAndLossProjectView/profitAndLossProjectViewReducer';
6
7
  import { fetchRevenueClassesView } from '../revenueClassesView/revenueClassesViewReducer';
7
8
  import { initiateReportsClassViewRefetching } from './reportsResyncReducer';
8
9
  export const initiateReportsClassViewRefetchingEpic = (actions$,
@@ -23,6 +24,9 @@ _) => actions$.pipe(filter(initiateReportsClassViewRefetching.match), switchMap(
23
24
  case 'net_burn_or_income_by_classes':
24
25
  actions.push(fetchNetBurnOrIncomeClassesView(true));
25
26
  break;
27
+ case 'profit_and_loss_by_projects':
28
+ actions.push(fetchProfitAndLossProjectView(true));
29
+ break;
26
30
  default:
27
31
  break;
28
32
  }
package/lib/index.d.ts CHANGED
@@ -35,7 +35,7 @@ import { stringToUnion, stringToUnionStrict } from './commonStateTypes/stringToU
35
35
  import { AbsoluteDay, Day, Month, MonthYearPeriod, Quarter, SCHEDULE_DAYS_OF_MONTH, ScheduleDaysOfMonth, TimePeriod, convertToPeriod, toAbsoluteDay, toMonth, toMonthStrict, toMonthYearPeriodId, toQuarter, toQuarterStrict, toScheduleDaysOfMonth } from './commonStateTypes/timePeriod';
36
36
  import { TimeframeTick, TimeframeTickWithMetaData, mapTimePeriodtoTimeframeTick, toTimePeriod, toTimeframeTick } from './commonStateTypes/timeframeTick';
37
37
  import { AgingDateSelectionType, AgingDetailReportInvoice, AgingDetailReportUIState, AgingReportId, AgingReportInvoice, AgingReportSortKey, AgingReportUIState } from './commonStateTypes/viewAndReport/agingReportStateTypes';
38
- import { isAgingReport, isCashFlowOrBalanceSheetReport, isDashboardClassesViewReport, isDashboardReport, isFluxAnalysisOpExReport, isOpExByVendorReport, isPAndLClassesViewReport, isPAndLReport } from './commonStateTypes/viewAndReport/reportIDHelper';
38
+ import { isAgingReport, isCashFlowOrBalanceSheetReport, isDashboardClassesViewReport, isDashboardReport, isFluxAnalysisOpExReport, isOpExByVendorReport, isPAndLClassesViewReport, isPAndLProjectViewReport, isPAndLReport } from './commonStateTypes/viewAndReport/reportIDHelper';
39
39
  import { PageToken, Report, ReportFormat, ReportID, ReportIDPlusForecastID, SelectorReport, SelectorView, View, toReportFormatStrict, toReportID } from './commonStateTypes/viewAndReport/viewAndReport';
40
40
  import { PAYMENT_BUSINESS_DAYS, filterDays, getNextNthWorkingDay, getPreviousNthWorkingDay, getYearsList, holidaysFormatted, isHoliday, isHolidayToday } from './commonStateTypes/workingDayHelper';
41
41
  import { AccountReport, AccountWithBalanceReport } from './entity/account/accountSelector';
@@ -124,7 +124,7 @@ import { getTaskGroupById } from './entity/taskGroup/taskGroupSelector';
124
124
  import { TaskGroupState } from './entity/taskGroup/taskGroupState';
125
125
  import { TaskGroupTemplate } from './entity/taskGroupTemplate/taskGroupTemplateState';
126
126
  import { DoSignInPayload, clearAll, doMagicLinkSignIn, doSignIn, doSignOut, fetchActiveTenant, fetchAllTenants, fetchExcludedResources as fetchExcludedResourcesForTenant, fetchExternalConnections as fetchExternalConnectionsForTenant, fetchSubscriptionSummaryForTenant, resendVerifyDeviceOTP, resetSignInState, saveExternalConnection as saveExternalConnectionForTenant, sendEmailMagicLinkToUser, updateCurrentTenant, updateSignInState, verifyDeviceWithTwoFA } from './entity/tenant/tenantReducer';
127
- import { CurrentTenant, TenantBaseView, TenantCoreDetailsView, TenantView, TenantsBaseOrdered, TenantsOrdered, getCurrentTenant, getIsAccountingClassesEnabled, getTenantBaseById, getTenantBaseViewForTenantId, getTenantBaseViewForTenantView, getTenantsBaseByCheckInDateSelector, getTenantsByCheckInDateSelector, getTenantsCoreDetailsByCheckInDateSelector, isOtherProductsEnabledForTenant, isTenantBankingOnly, isTenantBookkeepingEnabled, isTenantCardsOnly, isTenantUsingZeniCOA, isZeniDomainTenant, toTenantCoreDetailsView } from './entity/tenant/tenantSelector';
127
+ import { CurrentTenant, TenantBaseView, TenantCoreDetailsView, TenantView, TenantsBaseOrdered, TenantsOrdered, getCurrentTenant, getIsAccountingClassesEnabled, getIsAccountingProjectsEnabled, getTenantBaseById, getTenantBaseViewForTenantId, getTenantBaseViewForTenantView, getTenantsBaseByCheckInDateSelector, getTenantsByCheckInDateSelector, getTenantsCoreDetailsByCheckInDateSelector, isOtherProductsEnabledForTenant, isTenantBankingOnly, isTenantBookkeepingEnabled, isTenantCardsOnly, isTenantUsingZeniCOA, isZeniDomainTenant, toTenantCoreDetailsView } from './entity/tenant/tenantSelector';
128
128
  import { Connection, LoggedInUser, RoleResource, Tenant, TenantProductSettings } from './entity/tenant/tenantState';
129
129
  import { ToastNotificationPayload } from './entity/toastNotification/toastNotificationPayload';
130
130
  import { pushToastNotification } from './entity/toastNotification/toastNotificationReducer';
@@ -355,6 +355,12 @@ import { fetchProfitAndLossClassesView, resetProfitAndLossClassesNodeCollapseSta
355
355
  import { getProfitAndLossClassesView } from './view/profitAndLossClassesView/profitAndLossClassesViewSelector';
356
356
  import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID, ProfitAndLossClassesViewReport, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID } from './view/profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
357
357
  import { ClassViewLayout, ProfitAndLossClassesViewUIState } from './view/profitAndLossClassesView/profitAndLossClassesViewState';
358
+ import { clearProfitAndLossProjectView, fetchProfitAndLossForTimeframeProjectView, fetchProfitAndLossProjectView, resetProfitAndLossProjectNodeCollapseState, updateProjectViewAccountViewMode, updateProjectsToFilterOut, updateProfitAndLossProjectViewUIState } from './view/profitAndLossProjectView/profitAndLossProjectViewReducer';
359
+ import { ProfitAndLossProjectViewUIState } from './view/profitAndLossProjectView/profitAndLossProjectViewState';
360
+ import { Project } from './entity/project/projectState';
361
+ import { getProfitAndLossProjectView } from './view/profitAndLossProjectView/profitAndLossProjectViewSelector';
362
+ import { ProfitAndLossProjectViewReport } from './view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes';
363
+ import { ProjectReportWithBalances, SectionProjectViewReport } from './entity/sectionProjectView/sectionProjectViewSelectorTypes';
358
364
  import { fetchEntityRecommendationsByTransactionId, fetchRecommendationByEntityId, fetchRecommendationByEntityName } from './view/recommendation/recommendationReducer';
359
365
  import { clearReferrals, fetchReferrals, fetchRewardsPlan, resendReferralInvite, saveReferralFormDataInLocalStore, sendReferralInvite, updateReferViewed, updateReferralListSortUiState } from './view/referralView/referralReducer';
360
366
  import { ReferralListSelectorView, RewardsPlanCardReport, getInviteFormView, getReferralListView, getRewardsPlanCard } from './view/referralView/referralSelector';
@@ -611,7 +617,7 @@ export default initialize;
611
617
  export { initializePusher, disconnectPusher, Dayjs, ZeniDate, dateInLocal as zeniDateInLocal, date as zeniDate, dateLocal, dateNow, getBusinessDayOfDate, formatZeniDateFY as formatZeniDate, getFYMonths, getFYQuarterAndYear, getStartOfAndEndOfTimeframeForFY, getActualPeriodOfFYQtr, getActualPeriodOfFY, getLocalTimezone, addPeriod, subtractPeriod, setLocalTimezone, updateZeniDateLocaleID, ZeniUrl, toZeniUrl, toZeniUrlWithoutBaseURL, RESTAPIEndpoints, RootState, updateZeniAPIClientConfig, zeniAPIClientConfig, injectFeatureEpics, injectFeatureModules, initializeWithNewStore, ZeniStore, ZeniAPIStatus, getTimeframeTickTag, TimeFrameTickTag, isIncompleteMonthPresentInTimeframeTick, getLastMonthOfFYQuarter, getLastMonthOfFYYear, getMonthIndex, dateFromYearMonthDate, getMinDate, ExternalAPIEndpoints, };
612
618
  export { ID, FetchState, FetchStateAndError, FetchedState, UpdateType, Mode, AccountViewMode, CompletionStatusType, };
613
619
  export { Amount, toAmount, Currency };
614
- export { View, SelectorView, Report, ReportID, toReportID, ReportIDPlusForecastID, SelectorReport, ReportFormat, toReportFormatStrict, isCashFlowOrBalanceSheetReport, isDashboardReport, isDashboardClassesViewReport, isPAndLReport, isPAndLClassesViewReport, isAgingReport, isOpExByVendorReport, isFluxAnalysisOpExReport, PageToken, };
620
+ export { View, SelectorView, Report, ReportID, toReportID, ReportIDPlusForecastID, SelectorReport, ReportFormat, toReportFormatStrict, isCashFlowOrBalanceSheetReport, isDashboardReport, isDashboardClassesViewReport, isPAndLReport, isPAndLClassesViewReport, isPAndLProjectViewReport, isAgingReport, isOpExByVendorReport, isFluxAnalysisOpExReport, PageToken, };
615
621
  export { NestedClassIDHierarchy, NestedClassID, NestedClassHierarchyForReport };
616
622
  export { NestedAccountHierarchyForReport, NestedAccountID, NestedAccountIDHierarchy, };
617
623
  export { NestedCustomerID, NestedCustomerHierarchy };
@@ -637,7 +643,7 @@ export { TimeframeTick, TimeframeTickWithMetaData, toTimeframeTick, mapTimePerio
637
643
  export { VendorSpendTrendFilterTabType, toVendorSpendTrendFilterTabsTypeStrict, } from './entity/vendorExpense/vendorExpenseSelector';
638
644
  export { getNumberOfPeriods };
639
645
  export { SCHEDULE_DAYS_OF_MONTH, ScheduleDaysOfMonth, toScheduleDaysOfMonth, Day, Month, toMonth, toMonthStrict, Quarter, toQuarter, toQuarterStrict, AbsoluteDay, TimePeriod, };
640
- export { Tenant, TenantView, LoggedInUser, TenantBaseView, CurrentTenant, TenantProductSettings, getTenantBaseById, getCurrentTenant, getIsAccountingClassesEnabled, getTenantsByCheckInDateSelector, getTenantsBaseByCheckInDateSelector, getTenantsCoreDetailsByCheckInDateSelector, toTenantCoreDetailsView, getTenantBaseViewForTenantView, getTenantBaseViewForTenantId, isZeniDomainTenant, isTenantUsingZeniCOA, TenantsBaseOrdered, TenantsOrdered, TenantCoreDetailsView, fetchActiveTenant, fetchAllTenants, updateCurrentTenant, clearAll, doMagicLinkSignIn, verifyDeviceWithTwoFA, resendVerifyDeviceOTP, sendEmailMagicLinkToUser, doSignIn, updateSignInState, DoSignInPayload, doSignOut, resetSignInState, RoleResource, Connection, fetchExcludedResourcesForTenant, fetchExternalConnectionsForTenant, saveExternalConnectionForTenant, fetchSubscriptionSummaryForTenant, isTenantBankingOnly, isTenantCardsOnly, isTenantBookkeepingEnabled, isOtherProductsEnabledForTenant, };
646
+ export { Tenant, TenantView, LoggedInUser, TenantBaseView, CurrentTenant, TenantProductSettings, getTenantBaseById, getCurrentTenant, getIsAccountingClassesEnabled, getIsAccountingProjectsEnabled, getTenantsByCheckInDateSelector, getTenantsBaseByCheckInDateSelector, getTenantsCoreDetailsByCheckInDateSelector, toTenantCoreDetailsView, getTenantBaseViewForTenantView, getTenantBaseViewForTenantId, isZeniDomainTenant, isTenantUsingZeniCOA, TenantsBaseOrdered, TenantsOrdered, TenantCoreDetailsView, fetchActiveTenant, fetchAllTenants, updateCurrentTenant, clearAll, doMagicLinkSignIn, verifyDeviceWithTwoFA, resendVerifyDeviceOTP, sendEmailMagicLinkToUser, doSignIn, updateSignInState, DoSignInPayload, doSignOut, resetSignInState, RoleResource, Connection, fetchExcludedResourcesForTenant, fetchExternalConnectionsForTenant, saveExternalConnectionForTenant, fetchSubscriptionSummaryForTenant, isTenantBankingOnly, isTenantCardsOnly, isTenantBookkeepingEnabled, isOtherProductsEnabledForTenant, };
641
647
  export { Account, AccountType, AccountBase, StatementCloseDay, toAccountType, AccountReport, NestedAccountReport, AccountWithBalanceReport, AccountGroup, AccountGroupReportV2, AccountGroupType, toAccountGroupType, AccountGroupReport, getAccountGroupKey, AccountGroupKey, RecommendedAccountBase, };
642
648
  export { Class, ClassBase, RecommendedClassBase, } from './entity/class/classState';
643
649
  export { getClassById } from './entity/class/classSelector';
@@ -670,6 +676,7 @@ export { updateDashboardLayout };
670
676
  export { PandLWithForecastView, getPandLWithForecast, } from './view/profitAndLoss/pAndLWithForecast/pAndLWithForecastSelector';
671
677
  export { fetchProfitAndLoss, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState, ProfitAndLossState, ProfitAndLossUIState, getProfitAndLossReport, ProfitAndLossReport, getPandLReportFetchState, fetchProfitAndLossForTimeframe, };
672
678
  export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, ProfitAndLossClassesViewUIState, ProfitAndLossClassesViewReport, getProfitAndLossClassesView, getEmptyHorizontalSectionBalancesSlice, getProfitAndLossClassesHorizontalView, PandLReportViewSectionID, PandLReportViewCalculatedSectionID, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, ClassViewLayout, ProfitAndLossByClassHorizontalReport, ClassColumnDefinition, HORIZONTAL_CLASS_TOTAL_BALANCE_ID, HorizontalAccountReportData, HorizontalAccountRow, HorizontalClassBalance, HorizontalSectionReport, HorizontalSectionTreeLayout, HorizontalCalculatedSection, isHorizontalAccountReportData, };
679
+ export { clearProfitAndLossProjectView, fetchProfitAndLossForTimeframeProjectView, fetchProfitAndLossProjectView, resetProfitAndLossProjectNodeCollapseState, updateProjectViewAccountViewMode, updateProjectsToFilterOut, updateProfitAndLossProjectViewUIState, ProfitAndLossProjectViewUIState, getProfitAndLossProjectView, ProfitAndLossProjectViewReport, Project, ProjectReportWithBalances, SectionProjectViewReport, };
673
680
  export { AccountingProviderAttachmentSelector, getAccountingProviderAttachment };
674
681
  export { fetchUserListByType, getUserList, UserListSelectorView };
675
682
  export { fetchAllPeopleRequiredViews, fetchPeoplePage, fetchPeople, deletePerson, resendInvite, changeZeniPersonRoles, invitePeople, inviteZeniPeople, updatePeopleUIState, peopleSaveUpdates, resetUpdateErrorMessage, peopleSaveDataInLocalStore, peopleClearDataInLocalStore, PeopleSelectorView, PeopleLocalDataView, Person, getPeople, getPeopleLocalData, PeopleState, PersonUpdateType, PeoplePageMode, ZeniPersonUserRoleType, PeopleUIState, PeopleLocalData, initializeEditPerson, };
@@ -856,6 +863,15 @@ export { Country };
856
863
  export { InternationalWireVerificationState, VerificationFormField, VerificationFormLocalData, FieldValueType, fetchInternationalVerificationForm, submitInternationalVerificationForm, updateVerificationFormLocalData, getIntlWireVerificationView, InternationalWireVerificationView, };
857
864
  export { fetchExpressPayInitialDetails, updateExpressPayFormLocalData, submitExpressPay, resetExpressPayLocalData, ExpressPayFormLocalData, ExpressPayView, getExpressPayView, };
858
865
  export { acceptTreasuryTerms, fetchTreasurySetupView, clearTreasurySetupView, fetchTreasuryFunds, updatePortfolioAllocation, fetchPortfolioAllocation, updateFundAllocationLocalData, updateTreasuryVideoViewed, FundAllocationOption, FundComposition, FundData, TreasurySetupView, getTreasurySetupViewDetails, getTreasuryFundsMaximumYield, };
866
+ export { AiAccountantCustomer, AiAccountantCustomerState, AiAccountantEnrollment, AiAccountantEnrollmentStatus, AiAccountantJob, AiAccountantJobStatus, AiAccountantOperationType, toAiAccountantEnrollmentStatus, toAiAccountantJobStatus, toAiAccountantOperationType, } from './entity/aiAccountantCustomer/aiAccountantCustomerState';
867
+ export { AiAccountantCustomerPayload, AiAccountantEnrollmentPayload, AiAccountantJobPayload, toAiAccountantCustomer, toAiAccountantEnrollment, toAiAccountantJob, } from './entity/aiAccountantCustomer/aiAccountantCustomerPayload';
868
+ export { AiAccountantCancelOnboardingResponse, AiAccountantCancelOnboardingResponseData, AiAccountantCustomersResponse, AiAccountantCustomersResponseData, AiAccountantJobsResponse, AiAccountantJobsResponseData, AiAccountantTriggerJobResponse, AiAccountantTriggerJobResponseData, } from './view/aiAccountantView/aiAccountantViewPayload';
869
+ export { clearAllAiAccountantCustomers, updateAiAccountantCustomers, updateAiAccountantCustomer, updateAiAccountantJobs, } from './entity/aiAccountantCustomer/aiAccountantCustomerReducer';
870
+ export { AiAccountantCustomerView, AiAccountantEnrollmentView, AiAccountantJobView, getAiAccountantCustomers, getAiAccountantJobsByTenantId, } from './entity/aiAccountantCustomer/aiAccountantCustomerSelector';
871
+ export { AiAccountantCustomerViewState, AiAccountantSortKey, AiAccountantUIState, AiAccountantViewState, } from './view/aiAccountantView/aiAccountantViewState';
872
+ export { AiAccountantFilterCategoryField } from './view/companyView/types/cockpitTypes';
873
+ export { cancelAiAccountantOnboarding, clearAiAccountantView, fetchAiAccountantCustomers, fetchAiAccountantJobs, setSelectedTenantIdsForJobTrigger, triggerAiAccountantJob, updateAiAccountantUIState, } from './view/aiAccountantView/aiAccountantViewReducer';
874
+ export { AiAccountantCockpitView, getAiAccountantCockpitView, } from './view/aiAccountantView/aiAccountantViewSelector';
859
875
  export { fetchChatSessionsForUser, createSession, submitQuestion, updateAiCfoViewScrollPosition, updateCurrentInput, updateCotCollapsedState, clearInput, setSession, clearAiCfoView, clearCurrentSessionId, clearDeleteChatSessionStatus, clearLastContextMessage, createSessionAndSubmit, stopSubmit, stopSubmitQuestion, fetchChatHistory, acceptMasterTOS, deleteChatSession, updateResponseState, fetchSuggestedQuestions, fetchSuggestedQuestionsSuccess, fetchSuggestedQuestionsFailure, applyAiCfoSidePanelHostPageTransition, clearAiCfoSidePanelHostPageContext, } from './view/aiCfoView/aiCfoViewReducer';
860
876
  export { AiCfoViewState, AiCfoViewUIState, SuggestedQuestionsForPageContext, } from './view/aiCfoView/aiCfoViewState';
861
877
  export { FetchSuggestedQuestionsResponse, SuggestedQuestionsDataPayload, } from './view/aiCfoView/aiCfoViewPayload';