@zeniai/client-epic-state 4.19.86 → 4.19.87-beta0ND

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ import { RootState } from '../../reducer';
8
8
  import { BalanceSheetReport } from '../balanceSheet/balanceSheetSelectorTypes';
9
9
  import { CashFlowReport } from '../cashFlow/cashFlowSelectorTypes';
10
10
  import { ProfitAndLossReport } from '../profitAndLoss/profitAndLossSelector';
11
+ import { ProfitAndLossByClassHorizontalReport } from '../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes';
11
12
  import { ProfitAndLossClassesViewReport } from '../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
12
13
  export interface FinanceStatementReport extends SelectorReport {
13
14
  allTimeframeTicks: TimeframeTickWithMetaData[];
@@ -18,6 +19,7 @@ export interface FinanceStatementReport extends SelectorReport {
18
19
  downloadState: FetchState;
19
20
  filter: COABalancesFilter;
20
21
  isCompareModeOn: boolean;
22
+ profitAndLossByClassHorizontalReport: ProfitAndLossByClassHorizontalReport;
21
23
  profitAndLossByClassReport: ProfitAndLossClassesViewReport;
22
24
  profitAndLossReport: ProfitAndLossReport;
23
25
  reportFormat: ReportFormat;
@@ -11,6 +11,7 @@ const thisPeriodHelpers_1 = require("../../commonStateTypes/viewAndReport/thisPe
11
11
  const balanceSheetSelector_1 = require("../balanceSheet/balanceSheetSelector");
12
12
  const cashFlowSelector_1 = require("../cashFlow/cashFlowSelector");
13
13
  const profitAndLossSelector_1 = require("../profitAndLoss/profitAndLossSelector");
14
+ const profitAndLossClassesByClassHorizontalSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector");
14
15
  const profitAndLossClassesViewSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesViewSelector");
15
16
  function getDateRangeForFinanceReports(profitAndLossState, balanceSheetState, cashFlowState) {
16
17
  const datesSorted = [
@@ -63,6 +64,9 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
63
64
  const profitAndLossReport = (0, profitAndLossSelector_1.getProfitAndLossReport)(filter, undefined, accountState, accountGroupState, sectionAccountsViewState, profitAndLossState, forecastState);
64
65
  const classFilter = (0, coaBalancesFilterClassesView_1.newBalancesFilterClassesView)(filter.firstMonthOfFY, filter.timeframe, filter.balancesRange.numberOfPeriods, filter.balancesRange.thisPeriod, filter.balancesRange.orderBy, filter.additionalBalances, profitAndLossClassesViewState.uiState.classesToFilterOut);
65
66
  const profitAndLossByClassReport = (0, profitAndLossClassesViewSelector_1.getProfitAndLossClassesView)(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState);
67
+ const profitAndLossByClassHorizontalReport = profitAndLossClassesViewState.uiState.classViewLayout === 'horizontal'
68
+ ? (0, profitAndLossClassesByClassHorizontalSelector_1.getProfitAndLossClassesHorizontalView)(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState, thisPeriod)
69
+ : (0, profitAndLossClassesByClassHorizontalSelector_1.getProfitAndLossClassesHorizontalView)(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState, undefined);
66
70
  const balanceSheetReport = (0, balanceSheetSelector_1.getBalanceSheet)(filter, accountState, accountGroupState, sectionAccountsViewState, balanceSheetState);
67
71
  const cashFlowReport = (0, cashFlowSelector_1.getCashFlow)(filter, accountState, accountGroupState, sectionAccountsViewState, cashFlowState);
68
72
  const allReports = [
@@ -110,6 +114,7 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
110
114
  dataAvailable,
111
115
  profitAndLossReport,
112
116
  profitAndLossByClassReport,
117
+ profitAndLossByClassHorizontalReport,
113
118
  balanceSheetReport,
114
119
  cashFlowReport,
115
120
  filter,
@@ -0,0 +1,13 @@
1
+ import { COABalancesFilterClassesView } from '../../commonStateTypes/coaBalance/coaBalancesFilterClassesView';
2
+ import { AccountState } from '../../entity/account/accountState';
3
+ import { ClassState } from '../../entity/class/classState';
4
+ import { SectionClassesViewStateV2 } from '../../entity/sectionClassesViewV2/sectionClassesViewState';
5
+ import { ZeniDate } from '../../zeniDayJS';
6
+ import { ProfitAndLossByClassHorizontalReport } from './profitAndLossClassesByClassHorizontalSelectorTypes';
7
+ import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from './profitAndLossClassesViewSelectorTypes';
8
+ import { ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
9
+ export declare const profitAndLossHorizontalIdsInOrder: (PandLReportViewSectionID | PandLReportViewCalculatedSectionID)[];
10
+ export declare const getProfitAndLossClassesHorizontalView: (filter: COABalancesFilterClassesView, accountState: AccountState, classState: ClassState, sectionsState: SectionClassesViewStateV2, profitAndLossClassesViewState: ProfitAndLossClassesViewState, selectedPeriod: {
11
+ endDate: ZeniDate;
12
+ startDate: ZeniDate;
13
+ } | undefined) => ProfitAndLossByClassHorizontalReport;
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProfitAndLossClassesHorizontalView = exports.profitAndLossHorizontalIdsInOrder = void 0;
4
+ const amount_1 = require("../../commonStateTypes/amount");
5
+ const sectionClassesViewSelector_1 = require("../../entity/sectionClassesViewV2/sectionClassesViewSelector");
6
+ const profitAndLossClassesViewSelectorTypes_1 = require("./profitAndLossClassesViewSelectorTypes");
7
+ const DEFAULT_CURRENCY = { currencyCode: 'USD', currencySymbol: '$' };
8
+ exports.profitAndLossHorizontalIdsInOrder = [
9
+ 'income',
10
+ 'cogs',
11
+ 'grossProfit',
12
+ 'expenses',
13
+ 'earningsBeforeInterestAndTax',
14
+ 'otherIncome',
15
+ 'otherExpenses',
16
+ 'netOtherIncome',
17
+ 'netIncome',
18
+ ];
19
+ const SECTION_TITLES = {
20
+ income: 'Income',
21
+ cogs: 'Cost of Goods Sold',
22
+ grossProfit: 'Gross Profit',
23
+ expenses: 'Expenses',
24
+ earningsBeforeInterestAndTax: 'Net Operating Income',
25
+ otherIncome: 'Other Income',
26
+ otherExpenses: 'Other Expenses',
27
+ netOtherIncome: 'Net Other Income',
28
+ netIncome: 'Net Income',
29
+ };
30
+ const getProfitAndLossClassesHorizontalView = (filter, accountState, classState, sectionsState, profitAndLossClassesViewState, selectedPeriod) => {
31
+ const fetchState = reduceFetchState([
32
+ profitAndLossClassesViewState.fetchState.month,
33
+ profitAndLossClassesViewState.fetchState.quarter,
34
+ profitAndLossClassesViewState.fetchState.year,
35
+ ]);
36
+ const reportId = 'profit_and_loss_by_classes';
37
+ // Build class columns from the class hierarchy (top-level only)
38
+ const classColumns = buildClassColumns(profitAndLossClassesViewState.classHierarchy, profitAndLossClassesViewState.uiState.classesToFilterOut);
39
+ const sections = {};
40
+ const calculatedSections = {};
41
+ if (fetchState.fetchState === 'Completed' && selectedPeriod != null) {
42
+ // Get section reports using existing selector infrastructure
43
+ const sectionReports = {};
44
+ profitAndLossClassesViewSelectorTypes_1.ALL_PANDL_REPORT_VIEW_SECTION_IDS.forEach((sectionId) => {
45
+ sectionReports[sectionId] = (0, sectionClassesViewSelector_1.getSectionClassesViewReport)(accountState, classState, sectionsState, { reportId, sectionId }, filter);
46
+ });
47
+ // Pivot each section from class→account to account→class
48
+ const sectionIds = [
49
+ 'income',
50
+ 'cogs',
51
+ 'expenses',
52
+ 'otherIncome',
53
+ 'otherExpenses',
54
+ ];
55
+ sectionIds.forEach((sectionId) => {
56
+ const sectionReport = sectionReports[sectionId];
57
+ if (sectionReport != null) {
58
+ sections[sectionId] = pivotSectionToHorizontal(sectionReport, classColumns, selectedPeriod, SECTION_TITLES[sectionId] ?? sectionId);
59
+ }
60
+ });
61
+ // Calculate derived sections
62
+ const incomeSection = sections['income'];
63
+ const cogsSection = sections['cogs'];
64
+ const expensesSection = sections['expenses'];
65
+ const otherIncomeSection = sections['otherIncome'];
66
+ const otherExpensesSection = sections['otherExpenses'];
67
+ // Gross Profit = Income - COGS
68
+ if (incomeSection != null && cogsSection != null) {
69
+ calculatedSections['grossProfit'] = computeCalculatedSection(incomeSection.classTotals, cogsSection.classTotals, incomeSection.sectionTotal, cogsSection.sectionTotal, 'subtract', SECTION_TITLES['grossProfit']);
70
+ }
71
+ // EBIT = Gross Profit - Expenses
72
+ const grossProfit = calculatedSections['grossProfit'];
73
+ if (grossProfit != null && expensesSection != null) {
74
+ calculatedSections['earningsBeforeInterestAndTax'] =
75
+ computeCalculatedSection(grossProfit.classTotals, expensesSection.classTotals, grossProfit.sectionTotal, expensesSection.sectionTotal, 'subtract', SECTION_TITLES['earningsBeforeInterestAndTax']);
76
+ }
77
+ // Net Other Income = Other Income - Other Expenses
78
+ if (otherIncomeSection != null && otherExpensesSection != null) {
79
+ calculatedSections['netOtherIncome'] = computeCalculatedSection(otherIncomeSection.classTotals, otherExpensesSection.classTotals, otherIncomeSection.sectionTotal, otherExpensesSection.sectionTotal, 'subtract', SECTION_TITLES['netOtherIncome']);
80
+ }
81
+ // Net Income = EBIT + Net Other Income
82
+ const ebit = calculatedSections['earningsBeforeInterestAndTax'];
83
+ const netOtherIncome = calculatedSections['netOtherIncome'];
84
+ if (ebit != null && netOtherIncome != null) {
85
+ calculatedSections['netIncome'] = computeCalculatedSection(ebit.classTotals, netOtherIncome.classTotals, ebit.sectionTotal, netOtherIncome.sectionTotal, 'add', SECTION_TITLES['netIncome']);
86
+ }
87
+ }
88
+ // Build synthetic header COABalances for rendering class names as column headers
89
+ const headerBalances = buildHeaderBalances(classColumns, filter.timeframe, selectedPeriod);
90
+ return {
91
+ reportId,
92
+ reportTitle: 'Profit and Loss by Class',
93
+ firstMonthOfFY: profitAndLossClassesViewState.firstMonthOfFY,
94
+ fetchState: fetchState.fetchState,
95
+ bookCloseDate: profitAndLossClassesViewState.bookCloseDate,
96
+ dataAvailable: profitAndLossClassesViewState.dataAvailable,
97
+ selectedPeriod,
98
+ classColumns,
99
+ sections,
100
+ calculatedSections,
101
+ idsInOrder: exports.profitAndLossHorizontalIdsInOrder,
102
+ uiState: profitAndLossClassesViewState.uiState,
103
+ headerBalances,
104
+ };
105
+ };
106
+ exports.getProfitAndLossClassesHorizontalView = getProfitAndLossClassesHorizontalView;
107
+ /**
108
+ * Build column definitions from class hierarchy (top-level classes only).
109
+ */
110
+ function buildClassColumns(classHierarchy, classesToFilterOut) {
111
+ return classHierarchy
112
+ .filter((c) => !classesToFilterOut.some((filteredId) => filteredId[0] === c.classId[0]))
113
+ .map((c) => ({
114
+ classId: c.classId[0],
115
+ className: c.className,
116
+ nestedClassId: c.classId,
117
+ qboId: c.qboId,
118
+ }));
119
+ }
120
+ /**
121
+ * Pivot a section from class→account→balances to account→class→balance (single period).
122
+ */
123
+ function pivotSectionToHorizontal(section, classColumns, selectedPeriod, title) {
124
+ // Map: accountId -> { accountName, classId -> balance }
125
+ const accountMap = new Map();
126
+ // Also track class totals
127
+ const classTotalMap = new Map();
128
+ classColumns.forEach((col) => classTotalMap.set(col.classId, 0));
129
+ // Iterate over each class in the section
130
+ section.classes.forEach((classReport) => {
131
+ const classId = classReport.id[0];
132
+ // Only process classes that are in our columns
133
+ if (!classColumns.some((col) => col.classId === classId)) {
134
+ return;
135
+ }
136
+ // Get the class-level balance for this period (total for the class in this section)
137
+ const classBalance = findBalanceForPeriod(classReport.childrenBalancesTotal.balances, selectedPeriod);
138
+ classTotalMap.set(classId, classBalance);
139
+ // Iterate through accounts in this class
140
+ collectAccountsFromClass(classReport, classId, selectedPeriod, accountMap);
141
+ });
142
+ // Build account rows
143
+ const accounts = [];
144
+ accountMap.forEach((accountData, accountId) => {
145
+ const classBalances = classColumns.map((col) => ({
146
+ classId: col.classId,
147
+ balance: (0, amount_1.toAmountWC)(accountData.classBalances.get(col.classId) ?? 0, DEFAULT_CURRENCY),
148
+ }));
149
+ const rowTotal = classBalances.reduce((sum, cb) => sum + cb.balance.amount, 0);
150
+ accounts.push({
151
+ accountId,
152
+ accountName: accountData.accountName,
153
+ classBalances,
154
+ rowTotal: (0, amount_1.toAmountWC)(rowTotal, DEFAULT_CURRENCY),
155
+ });
156
+ });
157
+ // Build class totals
158
+ const classTotals = classColumns.map((col) => ({
159
+ classId: col.classId,
160
+ balance: (0, amount_1.toAmountWC)(classTotalMap.get(col.classId) ?? 0, DEFAULT_CURRENCY),
161
+ }));
162
+ const sectionTotal = classTotals.reduce((sum, ct) => sum + ct.balance.amount, 0);
163
+ return {
164
+ title,
165
+ accounts,
166
+ classTotals,
167
+ sectionTotal: (0, amount_1.toAmountWC)(sectionTotal, DEFAULT_CURRENCY),
168
+ };
169
+ }
170
+ /**
171
+ * Recursively collect account balances from a NestedClassReportV2 into accountMap.
172
+ */
173
+ function collectAccountsFromClass(classReport, classId, selectedPeriod, accountMap) {
174
+ // Process accounts directly on this class
175
+ classReport.class.accounts.forEach((nestedAccount) => {
176
+ collectAccountsFromNestedAccount(nestedAccount, classId, selectedPeriod, accountMap);
177
+ });
178
+ }
179
+ /**
180
+ * Recursively collect accounts from NestedAccountReport (handles sub-accounts).
181
+ */
182
+ function collectAccountsFromNestedAccount(nestedAccount, classId, selectedPeriod, accountMap) {
183
+ const accountId = nestedAccount.account.accountId;
184
+ const accountName = nestedAccount.account.accountName;
185
+ const balance = findBalanceForPeriod(nestedAccount.account.balancesInTimeframe.balances, selectedPeriod);
186
+ if (!accountMap.has(accountId)) {
187
+ accountMap.set(accountId, {
188
+ accountName,
189
+ classBalances: new Map(),
190
+ });
191
+ }
192
+ const accountData = accountMap.get(accountId);
193
+ if (accountData == null) {
194
+ return;
195
+ }
196
+ const existing = accountData.classBalances.get(classId) ?? 0;
197
+ accountData.classBalances.set(classId, existing + balance);
198
+ // Process sub-accounts
199
+ nestedAccount.children.forEach((child) => {
200
+ collectAccountsFromNestedAccount(child, classId, selectedPeriod, accountMap);
201
+ });
202
+ }
203
+ /**
204
+ * Find the balance amount for a specific period from a COABalance array.
205
+ */
206
+ function findBalanceForPeriod(balances, selectedPeriod) {
207
+ for (const bal of balances) {
208
+ const b = bal;
209
+ if (b.startDate != null && b.endDate != null) {
210
+ if (b.startDate.isSame(selectedPeriod.startDate, 'day') &&
211
+ b.endDate.isSame(selectedPeriod.endDate, 'day')) {
212
+ return b.balance?.amount ?? 0;
213
+ }
214
+ }
215
+ }
216
+ return 0;
217
+ }
218
+ /**
219
+ * Compute a calculated section by adding or subtracting two sets of class totals.
220
+ */
221
+ function computeCalculatedSection(aTotals, bTotals, aTotal, bTotal, operation, title) {
222
+ const classTotals = aTotals.map((a) => {
223
+ const bMatch = bTotals.find((b) => b.classId === a.classId);
224
+ const bAmount = bMatch?.balance.amount ?? 0;
225
+ const resultAmount = operation === 'add'
226
+ ? a.balance.amount + bAmount
227
+ : a.balance.amount - bAmount;
228
+ return {
229
+ classId: a.classId,
230
+ balance: (0, amount_1.toAmountWC)(resultAmount, DEFAULT_CURRENCY),
231
+ };
232
+ });
233
+ const sectionTotalAmount = operation === 'add'
234
+ ? aTotal.amount + bTotal.amount
235
+ : aTotal.amount - bTotal.amount;
236
+ return {
237
+ title,
238
+ classTotals,
239
+ sectionTotal: (0, amount_1.toAmountWC)(sectionTotalAmount, DEFAULT_CURRENCY),
240
+ };
241
+ }
242
+ /**
243
+ * Build synthetic COABalance array for header rendering.
244
+ * One entry per class column + one for "Total".
245
+ */
246
+ function buildHeaderBalances(classColumns, timeframe, selectedPeriod) {
247
+ if (selectedPeriod == null) {
248
+ return [];
249
+ }
250
+ const { endDate, startDate } = selectedPeriod;
251
+ const balances = classColumns.map((col) => ({
252
+ balance: (0, amount_1.toAmountWC)(0, DEFAULT_CURRENCY),
253
+ balanceTimeFrame: timeframe,
254
+ endDate,
255
+ startDate,
256
+ type: 'default',
257
+ label: col.className,
258
+ }));
259
+ // Add a "Total" column
260
+ balances.push({
261
+ balance: (0, amount_1.toAmountWC)(0, DEFAULT_CURRENCY),
262
+ balanceTimeFrame: timeframe,
263
+ endDate,
264
+ startDate,
265
+ type: 'default',
266
+ label: 'Total',
267
+ });
268
+ return balances;
269
+ }
270
+ function reduceFetchState(fetchStateList) {
271
+ const isAnyProgress = fetchStateList.some((s) => s.fetchState === 'In-Progress');
272
+ const isAllCompleted = fetchStateList.every((s) => s.fetchState === 'Completed');
273
+ const isAnyError = fetchStateList.some((s) => s.fetchState === 'Error');
274
+ const error = fetchStateList.find((s) => s.error != null)?.error;
275
+ let fetchState = 'Not-Started';
276
+ if (isAnyProgress) {
277
+ fetchState = 'In-Progress';
278
+ }
279
+ else if (isAllCompleted) {
280
+ fetchState = 'Completed';
281
+ }
282
+ else if (isAnyError) {
283
+ fetchState = 'Error';
284
+ }
285
+ return { fetchState, error };
286
+ }
@@ -0,0 +1,56 @@
1
+ import { Amount } from '../../commonStateTypes/amount';
2
+ import { NestedClassID } from '../../commonStateTypes/classesView/nestedClassID';
3
+ import { COABalance } from '../../commonStateTypes/coaBalance/coaBalance';
4
+ import { FetchState, ID } from '../../commonStateTypes/common';
5
+ import { DataAvailable } from '../../commonStateTypes/dataAvailable';
6
+ import { Month } from '../../commonStateTypes/timePeriod';
7
+ import { ZeniDate } from '../../zeniDayJS';
8
+ import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from './profitAndLossClassesViewSelectorTypes';
9
+ import { ProfitAndLossClassesViewUIState } from './profitAndLossClassesViewState';
10
+ export interface ClassColumnDefinition {
11
+ classId: string;
12
+ className: string;
13
+ nestedClassId: NestedClassID;
14
+ qboId?: ID;
15
+ }
16
+ export interface HorizontalClassBalance {
17
+ balance: Amount;
18
+ classId: string;
19
+ }
20
+ export interface HorizontalAccountRow {
21
+ accountId: string;
22
+ accountName: string;
23
+ classBalances: HorizontalClassBalance[];
24
+ rowTotal: Amount;
25
+ }
26
+ export interface HorizontalSectionReport {
27
+ accounts: HorizontalAccountRow[];
28
+ classTotals: HorizontalClassBalance[];
29
+ sectionTotal: Amount;
30
+ title: string;
31
+ }
32
+ export interface HorizontalCalculatedSection {
33
+ classTotals: HorizontalClassBalance[];
34
+ sectionTotal: Amount;
35
+ title: string;
36
+ }
37
+ export interface ProfitAndLossByClassHorizontalReport {
38
+ calculatedSections: Partial<Record<PandLReportViewCalculatedSectionID, HorizontalCalculatedSection>>;
39
+ classColumns: ClassColumnDefinition[];
40
+ fetchState: FetchState;
41
+ firstMonthOfFY: Month;
42
+ /** Synthetic COABalance array for header rendering — one per class column + total */
43
+ headerBalances: COABalance[];
44
+ idsInOrder: (PandLReportViewSectionID | PandLReportViewCalculatedSectionID)[];
45
+ reportId: string;
46
+ reportTitle: string;
47
+ sections: Partial<Record<PandLReportViewSectionID, HorizontalSectionReport>>;
48
+ selectedPeriod: {
49
+ endDate: ZeniDate;
50
+ startDate: ZeniDate;
51
+ label?: string;
52
+ } | undefined;
53
+ uiState: ProfitAndLossClassesViewUIState;
54
+ bookCloseDate?: ZeniDate;
55
+ dataAvailable?: DataAvailable;
56
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,7 +2,7 @@ import { NestedClassID } from '../../commonStateTypes/classesView/nestedClassID'
2
2
  import { AccountViewMode, ID } from '../../commonStateTypes/common';
3
3
  import { ZeniAPIStatus, ZeniReportData } from '../../responsePayload';
4
4
  import { ProfitAndLossClassesViewPayload } from './profitAndLossClassesViewPayload';
5
- import { ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
5
+ import { ClassViewLayout, ProfitAndLossClassesViewState } from './profitAndLossClassesViewState';
6
6
  export declare const initialState: ProfitAndLossClassesViewState;
7
7
  export declare const fetchProfitAndLossClassesView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
8
8
  cacheOverride: boolean;
@@ -30,6 +30,8 @@ export declare const fetchProfitAndLossClassesView: import("@reduxjs/toolkit").A
30
30
  };
31
31
  }, "profitAndLossClassesView/updateProfitAndLossClassesViewUIState">, updateAccountViewMode: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
32
32
  viewMode: AccountViewMode;
33
- }, "profitAndLossClassesView/updateAccountViewMode">, resetProfitAndLossClassesNodeCollapseState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/resetProfitAndLossClassesNodeCollapseState">, clearProfitAndLossClassesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/clearProfitAndLossClassesView">;
33
+ }, "profitAndLossClassesView/updateAccountViewMode">, updateClassViewLayout: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
34
+ classViewLayout: ClassViewLayout;
35
+ }, "profitAndLossClassesView/updateClassViewLayout">, resetProfitAndLossClassesNodeCollapseState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/resetProfitAndLossClassesNodeCollapseState">, clearProfitAndLossClassesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"profitAndLossClassesView/clearProfitAndLossClassesView">;
34
36
  declare const _default: import("redux").Reducer<ProfitAndLossClassesViewState>;
35
37
  export default _default;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearProfitAndLossClassesView = exports.resetProfitAndLossClassesNodeCollapseState = exports.updateAccountViewMode = exports.updateProfitAndLossClassesViewUIState = exports.updateClassesToFilterOut = exports.updateProfitAndLossForTimeframeClassesViewFailure = exports.updateProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossClassesView = exports.initialState = void 0;
4
+ exports.clearProfitAndLossClassesView = exports.resetProfitAndLossClassesNodeCollapseState = exports.updateClassViewLayout = exports.updateAccountViewMode = exports.updateProfitAndLossClassesViewUIState = exports.updateClassesToFilterOut = exports.updateProfitAndLossForTimeframeClassesViewFailure = exports.updateProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossForTimeframeClassesView = exports.fetchProfitAndLossClassesView = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const viewAndReportPayloadv2_1 = require("../../commonPayloadTypes/v2/viewAndReportPayloadv2");
7
7
  const getNestedClassIDHierarchyForReport_1 = require("../../commonStateTypes/classesView/getNestedClassIDHierarchyForReport");
@@ -27,6 +27,7 @@ exports.initialState = {
27
27
  nodeCollapseState: {},
28
28
  scrollPosition: undefined,
29
29
  accountViewMode: 'account_group',
30
+ classViewLayout: 'vertical',
30
31
  classesToFilterOut: [],
31
32
  },
32
33
  firstMonthOfFY: 1,
@@ -98,6 +99,9 @@ const profitAndLossClassesView = (0, toolkit_1.createSlice)({
98
99
  updateAccountViewMode(draft, action) {
99
100
  draft.uiState.accountViewMode = action.payload.viewMode;
100
101
  },
102
+ updateClassViewLayout(draft, action) {
103
+ draft.uiState.classViewLayout = action.payload.classViewLayout;
104
+ },
101
105
  resetProfitAndLossClassesNodeCollapseState(draft) {
102
106
  draft.uiState.nodeCollapseState = {};
103
107
  },
@@ -106,7 +110,7 @@ const profitAndLossClassesView = (0, toolkit_1.createSlice)({
106
110
  },
107
111
  },
108
112
  });
109
- _a = profitAndLossClassesView.actions, exports.fetchProfitAndLossClassesView = _a.fetchProfitAndLossClassesView, exports.fetchProfitAndLossForTimeframeClassesView = _a.fetchProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesView = _a.updateProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesViewFailure = _a.updateProfitAndLossForTimeframeClassesViewFailure, exports.updateClassesToFilterOut = _a.updateClassesToFilterOut, exports.updateProfitAndLossClassesViewUIState = _a.updateProfitAndLossClassesViewUIState, exports.updateAccountViewMode = _a.updateAccountViewMode, exports.resetProfitAndLossClassesNodeCollapseState = _a.resetProfitAndLossClassesNodeCollapseState, exports.clearProfitAndLossClassesView = _a.clearProfitAndLossClassesView;
113
+ _a = profitAndLossClassesView.actions, exports.fetchProfitAndLossClassesView = _a.fetchProfitAndLossClassesView, exports.fetchProfitAndLossForTimeframeClassesView = _a.fetchProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesView = _a.updateProfitAndLossForTimeframeClassesView, exports.updateProfitAndLossForTimeframeClassesViewFailure = _a.updateProfitAndLossForTimeframeClassesViewFailure, exports.updateClassesToFilterOut = _a.updateClassesToFilterOut, exports.updateProfitAndLossClassesViewUIState = _a.updateProfitAndLossClassesViewUIState, exports.updateAccountViewMode = _a.updateAccountViewMode, exports.updateClassViewLayout = _a.updateClassViewLayout, exports.resetProfitAndLossClassesNodeCollapseState = _a.resetProfitAndLossClassesNodeCollapseState, exports.clearProfitAndLossClassesView = _a.clearProfitAndLossClassesView;
110
114
  exports.default = profitAndLossClassesView.reducer;
111
115
  const doUpdatedProfitAndLossClassesView = (draft, timeframe, pandLReport) => {
112
116
  const report = (0, viewAndReportPayloadv2_1.mapReportPayloadV2ToReportV2)(pandLReport.report);
@@ -1,9 +1,11 @@
1
1
  import { NestedClassHierarchyForReport, NestedClassID } from '../../commonStateTypes/classesView/nestedClassID';
2
2
  import { AccountViewMode, FetchStateAndError, ID } from '../../commonStateTypes/common';
3
3
  import { Report } from '../../commonStateTypes/viewAndReport/viewAndReport';
4
+ export type ClassViewLayout = 'vertical' | 'horizontal';
4
5
  export interface ProfitAndLossClassesViewUIState {
5
6
  accountViewMode: AccountViewMode;
6
7
  classesToFilterOut: NestedClassID[];
8
+ classViewLayout: ClassViewLayout;
7
9
  nodeCollapseState: Record<ID, boolean>;
8
10
  scrollPosition: {
9
11
  scrollTop: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.19.86",
3
+ "version": "4.19.87-beta0ND",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",