@zeniai/client-epic-state 5.2.88 → 5.2.90-betaRD0
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.
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/tenant/tenantReducer.js +1 -0
- package/lib/entity/tenant/tenantState.d.ts +1 -0
- package/lib/esm/entity/tenant/tenantReducer.js +1 -0
- package/lib/esm/view/financeStatement/financeStatementCompareBalances.js +23 -0
- package/lib/esm/view/financeStatement/financeStatementReducer.js +6 -11
- package/lib/esm/view/financeStatement/financeStatementSelector.js +23 -12
- package/lib/esm/view/reportUIOptions/updateReportUIOptionCompareModeEpic.js +2 -5
- package/lib/esm/view/reportUIOptions/updateReportUIOptionIsCompareModeOnEpic.js +6 -10
- package/lib/view/financeStatement/financeStatementCompareBalances.d.ts +3 -0
- package/lib/view/financeStatement/financeStatementCompareBalances.js +27 -0
- package/lib/view/financeStatement/financeStatementReducer.js +6 -11
- package/lib/view/financeStatement/financeStatementSelector.js +22 -11
- package/lib/view/reportUIOptions/updateReportUIOptionCompareModeEpic.js +2 -5
- package/lib/view/reportUIOptions/updateReportUIOptionIsCompareModeOnEpic.js +6 -10
- package/package.json +26 -1
|
@@ -98,6 +98,7 @@ interface TenantPayload {
|
|
|
98
98
|
master_tos_info?: MasterTOSInfoPayload;
|
|
99
99
|
receipts_email?: string | null;
|
|
100
100
|
reimbursement_info?: UserReimbursementInfoDataPayload;
|
|
101
|
+
unit_connected_account_application_id?: ID | null;
|
|
101
102
|
zeni_book_close_date?: string;
|
|
102
103
|
zeni_book_close_month_and_year?: string;
|
|
103
104
|
}
|
|
@@ -1025,6 +1025,7 @@ function mapTenantPayloadToTenant(payload, userTenantPayload) {
|
|
|
1025
1025
|
hubSpotId: payload.hubspot_id ?? undefined,
|
|
1026
1026
|
isOnboardingCompleted: true,
|
|
1027
1027
|
qboRealmId: payload.qbo_realm_id,
|
|
1028
|
+
unitConnectedAccountApplicationId: payload.unit_connected_account_application_id ?? undefined,
|
|
1028
1029
|
isCustomerCreated: payload.is_customer_created,
|
|
1029
1030
|
isEmailGroupCreated: payload.is_email_group_created,
|
|
1030
1031
|
userReimbursementInfo: payload.reimbursement_info != null
|
|
@@ -113,6 +113,7 @@ export interface Tenant {
|
|
|
113
113
|
masterTOSInfo?: MasterTOSInfo;
|
|
114
114
|
receiptsEmail?: string;
|
|
115
115
|
rewardsLastViewedTime?: ZeniDate;
|
|
116
|
+
unitConnectedAccountApplicationId?: ID;
|
|
116
117
|
userReimbursementInfo?: UserReimbursementInfo;
|
|
117
118
|
zeniBookCloseDate?: ZeniDate;
|
|
118
119
|
zeniBookCloseMonthAndYear?: MonthYearPeriod;
|
|
@@ -1014,6 +1014,7 @@ function mapTenantPayloadToTenant(payload, userTenantPayload) {
|
|
|
1014
1014
|
hubSpotId: payload.hubspot_id ?? undefined,
|
|
1015
1015
|
isOnboardingCompleted: true,
|
|
1016
1016
|
qboRealmId: payload.qbo_realm_id,
|
|
1017
|
+
unitConnectedAccountApplicationId: payload.unit_connected_account_application_id ?? undefined,
|
|
1017
1018
|
isCustomerCreated: payload.is_customer_created,
|
|
1018
1019
|
isEmailGroupCreated: payload.is_email_group_created,
|
|
1019
1020
|
userReimbursementInfo: payload.reimbursement_info != null
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { stripCompareAdditionalBalanceTypes, } from '../../commonStateTypes/coaBalance/coaBalanceType';
|
|
2
|
+
// Reports can show the $ and % change columns together, so every requested compare type is kept;
|
|
3
|
+
// compareMode picks one only when none was requested.
|
|
4
|
+
export function getFinanceStatementAdditionalBalances(requestedBalances, isCompareModeOn, compareBalanceFromMode) {
|
|
5
|
+
const otherBalances = stripCompareAdditionalBalanceTypes(requestedBalances);
|
|
6
|
+
if (!isCompareModeOn) {
|
|
7
|
+
return otherBalances;
|
|
8
|
+
}
|
|
9
|
+
const requestedCompareBalances = requestedBalances.filter((balance) => !otherBalances.includes(balance));
|
|
10
|
+
return [
|
|
11
|
+
...otherBalances,
|
|
12
|
+
...(requestedCompareBalances.length > 0
|
|
13
|
+
? requestedCompareBalances
|
|
14
|
+
: [compareBalanceFromMode]),
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
// The table has one change column with a $/% picker, so only the first selected compare type is
|
|
18
|
+
// shown; the rest of the selection still reaches the download.
|
|
19
|
+
export function getDisplayedAdditionalBalances(selectedBalances) {
|
|
20
|
+
const otherBalances = stripCompareAdditionalBalanceTypes(selectedBalances);
|
|
21
|
+
const displayedCompareBalance = selectedBalances.find((balance) => !otherBalances.includes(balance));
|
|
22
|
+
return selectedBalances.filter((balance) => otherBalances.includes(balance) || balance === displayedCompareBalance);
|
|
23
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import { stripCompareAdditionalBalanceTypes, } from '../../commonStateTypes/coaBalance/coaBalanceType';
|
|
2
3
|
import { extractThisPeriod, getMatchingThisPeriod, } from '../../commonStateTypes/viewAndReport/thisPeriodHelpers';
|
|
3
4
|
import { clearAll } from '../../rootActions';
|
|
4
5
|
import { dateNow } from '../../zeniDayJS';
|
|
@@ -88,17 +89,11 @@ const financeStatement = createSlice({
|
|
|
88
89
|
updateFinanceStatementAdditionalBalancesSelection(draft, action) {
|
|
89
90
|
const { additionalBalances: additionalBalancesPayload, maxNumOfPeriodsToHighlight, } = action.payload;
|
|
90
91
|
const additionalBalances = additionalBalancesPayload ?? [];
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
additionalBalances.includes(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (id > -1) {
|
|
97
|
-
const balance = tempAdditionalBalances.splice(id, 1);
|
|
98
|
-
tempAdditionalBalances = [...balance, ...tempAdditionalBalances];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
draft.selectedAdditionalBalances = tempAdditionalBalances;
|
|
92
|
+
const otherBalances = stripCompareAdditionalBalanceTypes(additionalBalances);
|
|
93
|
+
draft.selectedAdditionalBalances = [
|
|
94
|
+
...additionalBalances.filter((balance) => !otherBalances.includes(balance)),
|
|
95
|
+
...otherBalances,
|
|
96
|
+
];
|
|
102
97
|
draft.maxNumOfPeriodsToHighlight = maxNumOfPeriodsToHighlight;
|
|
103
98
|
draft.isAdditionalBalancesShown =
|
|
104
99
|
additionalBalances.length != 0 ? true : false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
|
-
import { stripCompareAdditionalBalanceTypes } from '../../commonStateTypes/coaBalance/coaBalanceType';
|
|
2
|
+
import { stripCompareAdditionalBalanceTypes, } from '../../commonStateTypes/coaBalance/coaBalanceType';
|
|
3
3
|
import { newBalancesFilter, newBalancesFilterForDateRange, } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
|
|
4
4
|
import { newBalancesFilterClassesView } from '../../commonStateTypes/coaBalance/coaBalancesFilterClassesView';
|
|
5
5
|
import { newBalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
@@ -17,6 +17,17 @@ import { getProfitAndLossReport, } from '../profitAndLoss/profitAndLossSelector'
|
|
|
17
17
|
import { getProfitAndLossClassesHorizontalView } from '../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector';
|
|
18
18
|
import { getProfitAndLossClassesView } from '../profitAndLossClassesView/profitAndLossClassesViewSelector';
|
|
19
19
|
import { getProfitAndLossProjectView } from '../profitAndLossProjectView/profitAndLossProjectViewSelector';
|
|
20
|
+
import { getDisplayedAdditionalBalances } from './financeStatementCompareBalances';
|
|
21
|
+
/**
|
|
22
|
+
* Reports are built from the displayed columns, but their filter carries the full selection: the
|
|
23
|
+
* download and the Add Columns picker read it from there.
|
|
24
|
+
*/
|
|
25
|
+
function withSelectedAdditionalBalances(report, selectedAdditionalBalances) {
|
|
26
|
+
return {
|
|
27
|
+
...report,
|
|
28
|
+
filter: { ...report.filter, additionalBalances: selectedAdditionalBalances },
|
|
29
|
+
};
|
|
30
|
+
}
|
|
20
31
|
function getDateRangeForFinanceReports(profitAndLossState, balanceSheetState, cashFlowState) {
|
|
21
32
|
const datesSorted = [
|
|
22
33
|
profitAndLossState.dataAvailable?.startDate,
|
|
@@ -71,7 +82,7 @@ export const getFinanceStatement = createSelector((state) => state.accountState,
|
|
|
71
82
|
const additionalBalancesForFilter = useHorizontalClassesLayout
|
|
72
83
|
? stripCompareAdditionalBalanceTypes(rawAdditionalBalances)
|
|
73
84
|
: rawAdditionalBalances;
|
|
74
|
-
const filter = newBalancesFilter(firstMonthOfFY, financeStatementState.timeframe, Math.min(getNumberOfPeriods(firstMonthOfFY, financeStatementState.timeframe, dataAvailable) ?? financeStatementState.selectedCOABalancesRange.numberOfPeriods, financeStatementState.selectedCOABalancesRange.numberOfPeriods), thisPeriod, 'ascending_date', additionalBalancesForFilter);
|
|
85
|
+
const filter = newBalancesFilter(firstMonthOfFY, financeStatementState.timeframe, Math.min(getNumberOfPeriods(firstMonthOfFY, financeStatementState.timeframe, dataAvailable) ?? financeStatementState.selectedCOABalancesRange.numberOfPeriods, financeStatementState.selectedCOABalancesRange.numberOfPeriods), thisPeriod, 'ascending_date', getDisplayedAdditionalBalances(additionalBalancesForFilter));
|
|
75
86
|
const profitAndLossReport = getProfitAndLossReport(filter, undefined, accountState, accountGroupState, sectionAccountsViewState, profitAndLossState, forecastState);
|
|
76
87
|
const classFilter = newBalancesFilterClassesView(filter.firstMonthOfFY, filter.timeframe, filter.balancesRange.numberOfPeriods, filter.balancesRange.thisPeriod, filter.balancesRange.orderBy, filter.additionalBalances, profitAndLossClassesViewState.uiState.classesToFilterOut);
|
|
77
88
|
const profitAndLossByClassReport = getProfitAndLossClassesView(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState);
|
|
@@ -163,17 +174,17 @@ export const getFinanceStatement = createSelector((state) => state.accountState,
|
|
|
163
174
|
reportFormat: financeStatementState.reportFormat,
|
|
164
175
|
firstMonthOfFY,
|
|
165
176
|
dataAvailable,
|
|
166
|
-
profitAndLossReport,
|
|
167
|
-
profitAndLossByClassReport,
|
|
168
|
-
profitAndLossByProjectReport,
|
|
177
|
+
profitAndLossReport: withSelectedAdditionalBalances(profitAndLossReport, additionalBalancesForFilter),
|
|
178
|
+
profitAndLossByClassReport: withSelectedAdditionalBalances(profitAndLossByClassReport, additionalBalancesForFilter),
|
|
179
|
+
profitAndLossByProjectReport: withSelectedAdditionalBalances(profitAndLossByProjectReport, additionalBalancesForFilter),
|
|
169
180
|
profitAndLossByClassHorizontalReport,
|
|
170
|
-
balanceSheetReport,
|
|
171
|
-
balanceSheetByClassReport,
|
|
172
|
-
cashFlowByClassReport,
|
|
173
|
-
cashFlowByProjectReport,
|
|
174
|
-
balanceSheetByProjectReport,
|
|
175
|
-
cashFlowReport,
|
|
176
|
-
filter,
|
|
181
|
+
balanceSheetReport: withSelectedAdditionalBalances(balanceSheetReport, additionalBalancesForFilter),
|
|
182
|
+
balanceSheetByClassReport: withSelectedAdditionalBalances(balanceSheetByClassReport, additionalBalancesForFilter),
|
|
183
|
+
cashFlowByClassReport: withSelectedAdditionalBalances(cashFlowByClassReport, additionalBalancesForFilter),
|
|
184
|
+
cashFlowByProjectReport: withSelectedAdditionalBalances(cashFlowByProjectReport, additionalBalancesForFilter),
|
|
185
|
+
balanceSheetByProjectReport: withSelectedAdditionalBalances(balanceSheetByProjectReport, additionalBalancesForFilter),
|
|
186
|
+
cashFlowReport: withSelectedAdditionalBalances(cashFlowReport, additionalBalancesForFilter),
|
|
187
|
+
filter: { ...filter, additionalBalances: additionalBalancesForFilter },
|
|
177
188
|
selectedReportId: financeStatementState.selectedReportId,
|
|
178
189
|
downloadState: financeStatementState.downloadState,
|
|
179
190
|
isCompareModeOn: useHorizontalClassesLayout
|
|
@@ -2,6 +2,7 @@ import { of } from 'rxjs';
|
|
|
2
2
|
import { filter, switchMap } from 'rxjs/operators';
|
|
3
3
|
import { updateCashInCashOutAdditionalBalancesSelection } from '../cashInCashOut/cashInCashOutReducer';
|
|
4
4
|
import { updateCashPositionAdditionalBalancesSelection } from '../cashPosition/cashPositionReducer';
|
|
5
|
+
import { getFinanceStatementAdditionalBalances } from '../financeStatement/financeStatementCompareBalances';
|
|
5
6
|
import { updateFinanceStatementAdditionalBalancesSelection } from '../financeStatement/financeStatementReducer';
|
|
6
7
|
import { getFinanceStatement } from '../financeStatement/financeStatementSelector';
|
|
7
8
|
import { updateNetBurnOrIncomeAdditionalBalancesSelection } from '../netBurnOrIncome/netBurnOrIncomeReducer';
|
|
@@ -15,11 +16,7 @@ export const updateReportUIOptionIsCompareModeEpic = (actions$, state) => action
|
|
|
15
16
|
? 'this_period_vs_last_period_percent'
|
|
16
17
|
: 'this_period_vs_last_period';
|
|
17
18
|
const financeStatementState = getFinanceStatement(state.value);
|
|
18
|
-
const
|
|
19
|
-
balance !== 'this_period_vs_last_period_percent');
|
|
20
|
-
const financeAdditionalBalances = isCompareModeOn
|
|
21
|
-
? [...filteredFinanceAdditionalBalances, additionalBalance]
|
|
22
|
-
: filteredFinanceAdditionalBalances;
|
|
19
|
+
const financeAdditionalBalances = getFinanceStatementAdditionalBalances(additionalBalances, isCompareModeOn, additionalBalance);
|
|
23
20
|
return of(updateNetBurnOrIncomeAdditionalBalancesSelection({
|
|
24
21
|
isCompareModeOn,
|
|
25
22
|
additionalBalances: isCompareModeOn ? [additionalBalance] : [],
|
|
@@ -2,6 +2,7 @@ import { from } from 'rxjs';
|
|
|
2
2
|
import { filter, switchMap } from 'rxjs/operators';
|
|
3
3
|
import { updateCashInCashOutAdditionalBalancesSelection } from '../cashInCashOut/cashInCashOutReducer';
|
|
4
4
|
import { updateCashPositionAdditionalBalancesSelection } from '../cashPosition/cashPositionReducer';
|
|
5
|
+
import { getFinanceStatementAdditionalBalances } from '../financeStatement/financeStatementCompareBalances';
|
|
5
6
|
import { updateFinanceStatementAdditionalBalancesSelection } from '../financeStatement/financeStatementReducer';
|
|
6
7
|
import { getFinanceStatement } from '../financeStatement/financeStatementSelector';
|
|
7
8
|
import { updateNetBurnOrIncomeAdditionalBalancesSelection } from '../netBurnOrIncome/netBurnOrIncomeReducer';
|
|
@@ -10,19 +11,14 @@ import { updateRevenueAdditionalBalancesSelection } from '../revenue/revenueRedu
|
|
|
10
11
|
import { toggleReportUIOptionForecastMode, updateReportUIOptionIsCompareModeOn, } from './reportUIOptionsReducer';
|
|
11
12
|
export const updateReportUIOptionIsCompareModeOnEpic = (actions$, state) => actions$.pipe(filter(updateReportUIOptionIsCompareModeOn.match), switchMap((action) => {
|
|
12
13
|
const { additionalBalances } = action.payload;
|
|
14
|
+
const compareBalanceFromMode = state.value.reportUIOptionsState.compareMode === 'compare_mode_percent'
|
|
15
|
+
? 'this_period_vs_last_period_percent'
|
|
16
|
+
: 'this_period_vs_last_period';
|
|
13
17
|
const additionalBalance = action.payload.isCompareModeOn
|
|
14
|
-
?
|
|
15
|
-
'compare_mode_percent'
|
|
16
|
-
? ['this_period_vs_last_period_percent']
|
|
17
|
-
: ['this_period_vs_last_period']
|
|
18
|
+
? [compareBalanceFromMode]
|
|
18
19
|
: [];
|
|
19
20
|
const financeStatementState = getFinanceStatement(state.value);
|
|
20
|
-
const
|
|
21
|
-
balance !== 'this_period_vs_last_period_percent');
|
|
22
|
-
const financeAdditionalBalances = [
|
|
23
|
-
...filteredFinanceAdditionalBalances,
|
|
24
|
-
...additionalBalance,
|
|
25
|
-
];
|
|
21
|
+
const financeAdditionalBalances = getFinanceStatementAdditionalBalances(additionalBalances, action.payload.isCompareModeOn, compareBalanceFromMode);
|
|
26
22
|
const actions = [
|
|
27
23
|
updateNetBurnOrIncomeAdditionalBalancesSelection({
|
|
28
24
|
isCompareModeOn: action.payload.isCompareModeOn,
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { COABalanceType } from '../../commonStateTypes/coaBalance/coaBalanceType';
|
|
2
|
+
export declare function getFinanceStatementAdditionalBalances(requestedBalances: COABalanceType[], isCompareModeOn: boolean, compareBalanceFromMode: COABalanceType): COABalanceType[];
|
|
3
|
+
export declare function getDisplayedAdditionalBalances(selectedBalances: COABalanceType[]): COABalanceType[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFinanceStatementAdditionalBalances = getFinanceStatementAdditionalBalances;
|
|
4
|
+
exports.getDisplayedAdditionalBalances = getDisplayedAdditionalBalances;
|
|
5
|
+
const coaBalanceType_1 = require("../../commonStateTypes/coaBalance/coaBalanceType");
|
|
6
|
+
// Reports can show the $ and % change columns together, so every requested compare type is kept;
|
|
7
|
+
// compareMode picks one only when none was requested.
|
|
8
|
+
function getFinanceStatementAdditionalBalances(requestedBalances, isCompareModeOn, compareBalanceFromMode) {
|
|
9
|
+
const otherBalances = (0, coaBalanceType_1.stripCompareAdditionalBalanceTypes)(requestedBalances);
|
|
10
|
+
if (!isCompareModeOn) {
|
|
11
|
+
return otherBalances;
|
|
12
|
+
}
|
|
13
|
+
const requestedCompareBalances = requestedBalances.filter((balance) => !otherBalances.includes(balance));
|
|
14
|
+
return [
|
|
15
|
+
...otherBalances,
|
|
16
|
+
...(requestedCompareBalances.length > 0
|
|
17
|
+
? requestedCompareBalances
|
|
18
|
+
: [compareBalanceFromMode]),
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
// The table has one change column with a $/% picker, so only the first selected compare type is
|
|
22
|
+
// shown; the rest of the selection still reaches the download.
|
|
23
|
+
function getDisplayedAdditionalBalances(selectedBalances) {
|
|
24
|
+
const otherBalances = (0, coaBalanceType_1.stripCompareAdditionalBalanceTypes)(selectedBalances);
|
|
25
|
+
const displayedCompareBalance = selectedBalances.find((balance) => !otherBalances.includes(balance));
|
|
26
|
+
return selectedBalances.filter((balance) => otherBalances.includes(balance) || balance === displayedCompareBalance);
|
|
27
|
+
}
|
|
@@ -3,6 +3,7 @@ var _a;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.updateFinanceStatementFormat = exports.updateFinanceStatementDisplayOrder = exports.updateDownloadState = exports.updateFinanceStatementAdditionalBalancesSelection = exports.updateSelectedReportId = exports.updateCOABalancesRange = exports.updateFinanceStatementThisPeriod = exports.updateFinanceStatementTimeframe = exports.fetchFinanceStatement = exports.initialFinanceStatementState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const coaBalanceType_1 = require("../../commonStateTypes/coaBalance/coaBalanceType");
|
|
6
7
|
const thisPeriodHelpers_1 = require("../../commonStateTypes/viewAndReport/thisPeriodHelpers");
|
|
7
8
|
const rootActions_1 = require("../../rootActions");
|
|
8
9
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
@@ -92,17 +93,11 @@ const financeStatement = (0, toolkit_1.createSlice)({
|
|
|
92
93
|
updateFinanceStatementAdditionalBalancesSelection(draft, action) {
|
|
93
94
|
const { additionalBalances: additionalBalancesPayload, maxNumOfPeriodsToHighlight, } = action.payload;
|
|
94
95
|
const additionalBalances = additionalBalancesPayload ?? [];
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
additionalBalances.includes(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (id > -1) {
|
|
101
|
-
const balance = tempAdditionalBalances.splice(id, 1);
|
|
102
|
-
tempAdditionalBalances = [...balance, ...tempAdditionalBalances];
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
draft.selectedAdditionalBalances = tempAdditionalBalances;
|
|
96
|
+
const otherBalances = (0, coaBalanceType_1.stripCompareAdditionalBalanceTypes)(additionalBalances);
|
|
97
|
+
draft.selectedAdditionalBalances = [
|
|
98
|
+
...additionalBalances.filter((balance) => !otherBalances.includes(balance)),
|
|
99
|
+
...otherBalances,
|
|
100
|
+
];
|
|
106
101
|
draft.maxNumOfPeriodsToHighlight = maxNumOfPeriodsToHighlight;
|
|
107
102
|
draft.isAdditionalBalancesShown =
|
|
108
103
|
additionalBalances.length != 0 ? true : false;
|
|
@@ -20,6 +20,17 @@ const profitAndLossSelector_1 = require("../profitAndLoss/profitAndLossSelector"
|
|
|
20
20
|
const profitAndLossClassesByClassHorizontalSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector");
|
|
21
21
|
const profitAndLossClassesViewSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesViewSelector");
|
|
22
22
|
const profitAndLossProjectViewSelector_1 = require("../profitAndLossProjectView/profitAndLossProjectViewSelector");
|
|
23
|
+
const financeStatementCompareBalances_1 = require("./financeStatementCompareBalances");
|
|
24
|
+
/**
|
|
25
|
+
* Reports are built from the displayed columns, but their filter carries the full selection: the
|
|
26
|
+
* download and the Add Columns picker read it from there.
|
|
27
|
+
*/
|
|
28
|
+
function withSelectedAdditionalBalances(report, selectedAdditionalBalances) {
|
|
29
|
+
return {
|
|
30
|
+
...report,
|
|
31
|
+
filter: { ...report.filter, additionalBalances: selectedAdditionalBalances },
|
|
32
|
+
};
|
|
33
|
+
}
|
|
23
34
|
function getDateRangeForFinanceReports(profitAndLossState, balanceSheetState, cashFlowState) {
|
|
24
35
|
const datesSorted = [
|
|
25
36
|
profitAndLossState.dataAvailable?.startDate,
|
|
@@ -74,7 +85,7 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
|
|
|
74
85
|
const additionalBalancesForFilter = useHorizontalClassesLayout
|
|
75
86
|
? (0, coaBalanceType_1.stripCompareAdditionalBalanceTypes)(rawAdditionalBalances)
|
|
76
87
|
: rawAdditionalBalances;
|
|
77
|
-
const filter = (0, coaBalancesFilter_1.newBalancesFilter)(firstMonthOfFY, financeStatementState.timeframe, Math.min((0, dataAvailable_1.getNumberOfPeriods)(firstMonthOfFY, financeStatementState.timeframe, dataAvailable) ?? financeStatementState.selectedCOABalancesRange.numberOfPeriods, financeStatementState.selectedCOABalancesRange.numberOfPeriods), thisPeriod, 'ascending_date', additionalBalancesForFilter);
|
|
88
|
+
const filter = (0, coaBalancesFilter_1.newBalancesFilter)(firstMonthOfFY, financeStatementState.timeframe, Math.min((0, dataAvailable_1.getNumberOfPeriods)(firstMonthOfFY, financeStatementState.timeframe, dataAvailable) ?? financeStatementState.selectedCOABalancesRange.numberOfPeriods, financeStatementState.selectedCOABalancesRange.numberOfPeriods), thisPeriod, 'ascending_date', (0, financeStatementCompareBalances_1.getDisplayedAdditionalBalances)(additionalBalancesForFilter));
|
|
78
89
|
const profitAndLossReport = (0, profitAndLossSelector_1.getProfitAndLossReport)(filter, undefined, accountState, accountGroupState, sectionAccountsViewState, profitAndLossState, forecastState);
|
|
79
90
|
const classFilter = (0, coaBalancesFilterClassesView_1.newBalancesFilterClassesView)(filter.firstMonthOfFY, filter.timeframe, filter.balancesRange.numberOfPeriods, filter.balancesRange.thisPeriod, filter.balancesRange.orderBy, filter.additionalBalances, profitAndLossClassesViewState.uiState.classesToFilterOut);
|
|
80
91
|
const profitAndLossByClassReport = (0, profitAndLossClassesViewSelector_1.getProfitAndLossClassesView)(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState);
|
|
@@ -166,17 +177,17 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
|
|
|
166
177
|
reportFormat: financeStatementState.reportFormat,
|
|
167
178
|
firstMonthOfFY,
|
|
168
179
|
dataAvailable,
|
|
169
|
-
profitAndLossReport,
|
|
170
|
-
profitAndLossByClassReport,
|
|
171
|
-
profitAndLossByProjectReport,
|
|
180
|
+
profitAndLossReport: withSelectedAdditionalBalances(profitAndLossReport, additionalBalancesForFilter),
|
|
181
|
+
profitAndLossByClassReport: withSelectedAdditionalBalances(profitAndLossByClassReport, additionalBalancesForFilter),
|
|
182
|
+
profitAndLossByProjectReport: withSelectedAdditionalBalances(profitAndLossByProjectReport, additionalBalancesForFilter),
|
|
172
183
|
profitAndLossByClassHorizontalReport,
|
|
173
|
-
balanceSheetReport,
|
|
174
|
-
balanceSheetByClassReport,
|
|
175
|
-
cashFlowByClassReport,
|
|
176
|
-
cashFlowByProjectReport,
|
|
177
|
-
balanceSheetByProjectReport,
|
|
178
|
-
cashFlowReport,
|
|
179
|
-
filter,
|
|
184
|
+
balanceSheetReport: withSelectedAdditionalBalances(balanceSheetReport, additionalBalancesForFilter),
|
|
185
|
+
balanceSheetByClassReport: withSelectedAdditionalBalances(balanceSheetByClassReport, additionalBalancesForFilter),
|
|
186
|
+
cashFlowByClassReport: withSelectedAdditionalBalances(cashFlowByClassReport, additionalBalancesForFilter),
|
|
187
|
+
cashFlowByProjectReport: withSelectedAdditionalBalances(cashFlowByProjectReport, additionalBalancesForFilter),
|
|
188
|
+
balanceSheetByProjectReport: withSelectedAdditionalBalances(balanceSheetByProjectReport, additionalBalancesForFilter),
|
|
189
|
+
cashFlowReport: withSelectedAdditionalBalances(cashFlowReport, additionalBalancesForFilter),
|
|
190
|
+
filter: { ...filter, additionalBalances: additionalBalancesForFilter },
|
|
180
191
|
selectedReportId: financeStatementState.selectedReportId,
|
|
181
192
|
downloadState: financeStatementState.downloadState,
|
|
182
193
|
isCompareModeOn: useHorizontalClassesLayout
|
|
@@ -5,6 +5,7 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const cashInCashOutReducer_1 = require("../cashInCashOut/cashInCashOutReducer");
|
|
7
7
|
const cashPositionReducer_1 = require("../cashPosition/cashPositionReducer");
|
|
8
|
+
const financeStatementCompareBalances_1 = require("../financeStatement/financeStatementCompareBalances");
|
|
8
9
|
const financeStatementReducer_1 = require("../financeStatement/financeStatementReducer");
|
|
9
10
|
const financeStatementSelector_1 = require("../financeStatement/financeStatementSelector");
|
|
10
11
|
const netBurnOrIncomeReducer_1 = require("../netBurnOrIncome/netBurnOrIncomeReducer");
|
|
@@ -18,11 +19,7 @@ const updateReportUIOptionIsCompareModeEpic = (actions$, state) => actions$.pipe
|
|
|
18
19
|
? 'this_period_vs_last_period_percent'
|
|
19
20
|
: 'this_period_vs_last_period';
|
|
20
21
|
const financeStatementState = (0, financeStatementSelector_1.getFinanceStatement)(state.value);
|
|
21
|
-
const
|
|
22
|
-
balance !== 'this_period_vs_last_period_percent');
|
|
23
|
-
const financeAdditionalBalances = isCompareModeOn
|
|
24
|
-
? [...filteredFinanceAdditionalBalances, additionalBalance]
|
|
25
|
-
: filteredFinanceAdditionalBalances;
|
|
22
|
+
const financeAdditionalBalances = (0, financeStatementCompareBalances_1.getFinanceStatementAdditionalBalances)(additionalBalances, isCompareModeOn, additionalBalance);
|
|
26
23
|
return (0, rxjs_1.of)((0, netBurnOrIncomeReducer_1.updateNetBurnOrIncomeAdditionalBalancesSelection)({
|
|
27
24
|
isCompareModeOn,
|
|
28
25
|
additionalBalances: isCompareModeOn ? [additionalBalance] : [],
|
|
@@ -5,6 +5,7 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const cashInCashOutReducer_1 = require("../cashInCashOut/cashInCashOutReducer");
|
|
7
7
|
const cashPositionReducer_1 = require("../cashPosition/cashPositionReducer");
|
|
8
|
+
const financeStatementCompareBalances_1 = require("../financeStatement/financeStatementCompareBalances");
|
|
8
9
|
const financeStatementReducer_1 = require("../financeStatement/financeStatementReducer");
|
|
9
10
|
const financeStatementSelector_1 = require("../financeStatement/financeStatementSelector");
|
|
10
11
|
const netBurnOrIncomeReducer_1 = require("../netBurnOrIncome/netBurnOrIncomeReducer");
|
|
@@ -13,19 +14,14 @@ const revenueReducer_1 = require("../revenue/revenueReducer");
|
|
|
13
14
|
const reportUIOptionsReducer_1 = require("./reportUIOptionsReducer");
|
|
14
15
|
const updateReportUIOptionIsCompareModeOnEpic = (actions$, state) => actions$.pipe((0, operators_1.filter)(reportUIOptionsReducer_1.updateReportUIOptionIsCompareModeOn.match), (0, operators_1.switchMap)((action) => {
|
|
15
16
|
const { additionalBalances } = action.payload;
|
|
17
|
+
const compareBalanceFromMode = state.value.reportUIOptionsState.compareMode === 'compare_mode_percent'
|
|
18
|
+
? 'this_period_vs_last_period_percent'
|
|
19
|
+
: 'this_period_vs_last_period';
|
|
16
20
|
const additionalBalance = action.payload.isCompareModeOn
|
|
17
|
-
?
|
|
18
|
-
'compare_mode_percent'
|
|
19
|
-
? ['this_period_vs_last_period_percent']
|
|
20
|
-
: ['this_period_vs_last_period']
|
|
21
|
+
? [compareBalanceFromMode]
|
|
21
22
|
: [];
|
|
22
23
|
const financeStatementState = (0, financeStatementSelector_1.getFinanceStatement)(state.value);
|
|
23
|
-
const
|
|
24
|
-
balance !== 'this_period_vs_last_period_percent');
|
|
25
|
-
const financeAdditionalBalances = [
|
|
26
|
-
...filteredFinanceAdditionalBalances,
|
|
27
|
-
...additionalBalance,
|
|
28
|
-
];
|
|
24
|
+
const financeAdditionalBalances = (0, financeStatementCompareBalances_1.getFinanceStatementAdditionalBalances)(additionalBalances, action.payload.isCompareModeOn, compareBalanceFromMode);
|
|
29
25
|
const actions = [
|
|
30
26
|
(0, netBurnOrIncomeReducer_1.updateNetBurnOrIncomeAdditionalBalancesSelection)({
|
|
31
27
|
isCompareModeOn: action.payload.isCompareModeOn,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.90-betaRD0",
|
|
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",
|
|
@@ -53,6 +53,31 @@
|
|
|
53
53
|
"url": "https://github.com/zeni-ai/client-epic-state/issues"
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://github.com/zeni-ai/client-epic-state#readme",
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@eslint/js": "^9.24.0",
|
|
58
|
+
"@liveblocks/client": "^2.23.0",
|
|
59
|
+
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
60
|
+
"@types/big.js": "^6.2.2",
|
|
61
|
+
"@types/lodash": "^4.17.23",
|
|
62
|
+
"@types/node": "^20.19.0",
|
|
63
|
+
"@types/url-parse": "^1.4.11",
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
65
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
66
|
+
"concurrently": "^9.1.2",
|
|
67
|
+
"eslint": "^9.24.0",
|
|
68
|
+
"eslint-config-prettier": "^10.0.2",
|
|
69
|
+
"eslint-plugin-perfectionist": "^4.15.0",
|
|
70
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
71
|
+
"globals": "^16.0.0",
|
|
72
|
+
"knip": "^6.21.0",
|
|
73
|
+
"madge": "^8.0.0",
|
|
74
|
+
"prettier": "^3.5.3",
|
|
75
|
+
"rimraf": "^6.0.1",
|
|
76
|
+
"semver": "^7.7.1",
|
|
77
|
+
"typescript": "^5.7.3",
|
|
78
|
+
"vite": "^7.3.5",
|
|
79
|
+
"vitest": "^4.1.11"
|
|
80
|
+
},
|
|
56
81
|
"dependencies": {
|
|
57
82
|
"@redux-devtools/extension": "^3.3.0",
|
|
58
83
|
"@reduxjs/toolkit": "^1.6.2",
|