@zeniai/client-epic-state 5.3.23 → 5.3.24-betaAK1
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/esm/view/dashboard/dashboardSelector.js +12 -9
- package/lib/esm/view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardSelector.js +1 -4
- package/lib/esm/view/opEx/opExSelector.js +4 -4
- package/lib/view/dashboard/dashboardSelector.js +12 -9
- package/lib/view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardSelector.js +1 -4
- package/lib/view/opEx/opExSelector.js +4 -4
- package/package.json +1 -1
|
@@ -22,15 +22,18 @@ import { getReimbursementCardReport } from '../reimbursementCard/reimbursementCa
|
|
|
22
22
|
import { getRevenueReport } from '../revenue/revenueSelector';
|
|
23
23
|
import { getTasksCardReport } from '../tasksCard/tasksCardSelector';
|
|
24
24
|
import { getTop6Expenses } from '../topEx/topExSelector';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
25
|
+
// Every input must return the same reference until the slices it reads change, or getDashboard
|
|
26
|
+
// rebuilds every card's balances on each dispatched action.
|
|
27
|
+
const getNetBurnOrIncomeFilter = createSelector((state) => state.netBurnOrIncomeState.netBurnOrIncome.firstMonthOfFY, (state) => state.netBurnOrIncomeState.uiState.timeframe, (state) => state.netBurnOrIncomeState.uiState.selectedAdditionalBalances, (firstMonthOfFY, timeframe, selectedAdditionalBalances) => newBalancesFilter(firstMonthOfFY, timeframe, 4, undefined, 'ascending_date', selectedAdditionalBalances));
|
|
28
|
+
const getNetBurnOrIncomeForLast4Periods = createSelector((state) => state.accountState, (state) => state.accountGroupState, (state) => state.sectionAccountsViewState, (state) => state.netBurnOrIncomeState, (state) => state.forecastState, (state) => state.forecastListState, getNetBurnOrIncomeFilter, (accountState, accountGroupState, sectionAccountsViewState, netBurnOrIncomeState, forecastState, forecastListState, filter) => getNetBurnOrIncomeReport(accountState, accountGroupState, sectionAccountsViewState, netBurnOrIncomeState, forecastState, forecastListState, filter));
|
|
29
|
+
const getOperatingExpensesFilter = createSelector((state) => state.opExState.opEx.firstMonthOfFY, (state) => state.opExState.uiState.timeframe, (state) => state.opExState.uiState.selectedAdditionalBalances, (firstMonthOfFY, timeframe, selectedAdditionalBalances) => newBalancesFilter(firstMonthOfFY, timeframe, 5, undefined, 'ascending_date', selectedAdditionalBalances));
|
|
30
|
+
const getOperatingExpensesForLast5Periods = (state) => getOperatingExpensesReport(state, getOperatingExpensesFilter(state));
|
|
31
|
+
const getRevenueFilter = createSelector((state) => state.revenueState.revenue.firstMonthOfFY, (state) => state.revenueState.uiState.timeframe, (state) => state.revenueState.uiState.selectedAdditionalBalances, (firstMonthOfFY, timeframe, selectedAdditionalBalances) => newBalancesFilter(firstMonthOfFY, timeframe, 4, undefined, 'ascending_date', selectedAdditionalBalances));
|
|
32
|
+
const getRevenueForLast4Periods = createSelector(getRevenueFilter, (state) => state.accountState, (state) => state.accountGroupState, (state) => state.sectionAccountsViewState, (state) => state.forecastListState, (state) => state.revenueState, (state) => state.forecastState, (filter, accountState, accountGroupState, sectionAccountsViewState, forecastListState, revenueState, forecastState) => getRevenueReport(filter, accountState, accountGroupState, sectionAccountsViewState, forecastListState, revenueState, forecastState));
|
|
33
|
+
const getCashPositionFilter = createSelector((state) => state.cashPositionState.firstMonthOfFY, (state) => state.cashPositionState.uiState.timeframe, (state) => state.cashPositionState.uiState.selectedAdditionalBalances, (firstMonthOfFY, timeframe, selectedAdditionalBalances) => newBalancesFilter(firstMonthOfFY, timeframe, 5, undefined, 'ascending_date', selectedAdditionalBalances));
|
|
34
|
+
const getCashPositionLast5Periods = createSelector((state) => state.accountState, (state) => state.cashPositionState, getCashPositionFilter, (accountState, cashPositionState, filter) => getCashPosition(accountState, cashPositionState, filter));
|
|
35
|
+
const getCashInCashOutFilter = createSelector((state) => state.cashInCashOutState.firstMonthOfFY, (state) => state.cashInCashOutState.uiState.timeframe, (state) => state.cashInCashOutState.uiState.selectedAdditionalBalances, (firstMonthOfFY, timeframe, selectedAdditionalBalances) => newBalancesFilter(firstMonthOfFY, timeframe, 4, undefined, 'ascending_date', selectedAdditionalBalances));
|
|
36
|
+
const getCashInCashOutLast4Periods = createSelector((state) => state.accountState, (state) => state.accountGroupState, (state) => state.cashInCashOutState, getCashInCashOutFilter, (accountState, accountGroupState, cashInCashOutState, filter) => getCashInCashOut(accountState, accountGroupState, cashInCashOutState, filter));
|
|
34
37
|
const getNetBurnOrIncomeStoryCard = (state) => getNetBurnOrIncomeStoryCardReport(state);
|
|
35
38
|
const apAgingSelector = (state) => getApAgingReport(state);
|
|
36
39
|
const arAgingSelector = (state) => getArAgingReport(state);
|
|
@@ -5,12 +5,9 @@ import { getCurrentTenant } from '../../entity/tenant/tenantSelector';
|
|
|
5
5
|
import { defaultPeriods } from '../netBurnOrIncome/netBurnOrIncomeReducer';
|
|
6
6
|
import { ALL_ACCOUNTING_METHODS, toAccountingMethod, } from './netBurnOrIncomeStoryCardSelectorTypes';
|
|
7
7
|
import { ALL_TIME_SPAN_IDS_FOR_AVERAGE, } from './netBurnOrIncomeStoryCardState';
|
|
8
|
-
export const getNetBurnOrIncomeStoryCardReport = createSelector((state) => state, (
|
|
9
|
-
const { netBurnOrIncomeStoryCardState, netBurnOrIncomeState } = rootState;
|
|
8
|
+
export const getNetBurnOrIncomeStoryCardReport = createSelector((state) => state.netBurnOrIncomeStoryCardState, (state) => state.netBurnOrIncomeState.netBurnOrIncome.firstMonthOfFY, getCurrentTenant, (netBurnOrIncomeStoryCardState, firstMonthOfFY, currentTenant) => {
|
|
10
9
|
const { opExCash, ebitda, netIncome, runwayCash, runwayEbitda, runwayNetIncome, reportId, reportTitle, version, status, fetchState, error, updateStatus, } = netBurnOrIncomeStoryCardState;
|
|
11
|
-
const { firstMonthOfFY } = netBurnOrIncomeState.netBurnOrIncome;
|
|
12
10
|
const filter = newBalancesFilter(firstMonthOfFY, 'month', defaultPeriods.numberOfPeriods, undefined, 'ascending_date');
|
|
13
|
-
const currentTenant = getCurrentTenant(rootState);
|
|
14
11
|
const selectedAccountingMethod = currentTenant?.netBurnSettings?.accountingMethod;
|
|
15
12
|
const timeSpanIdForAverage = currentTenant?.netBurnSettings?.timeSpanIdForAverage;
|
|
16
13
|
let netBurnOrIncomeBalances;
|
|
@@ -58,7 +58,7 @@ export const getOperatingExpensesUIState = createSelector((state) => state.opExS
|
|
|
58
58
|
reportFormat,
|
|
59
59
|
};
|
|
60
60
|
});
|
|
61
|
-
|
|
61
|
+
function getOpExBalancesInTimeFrame(opExState, sectionState, readCustomRangeSlot) {
|
|
62
62
|
// Custom detail reads its own section-accounts slot so a default fetch can't
|
|
63
63
|
// overwrite the partial-period data; the dashboard reads the default slot.
|
|
64
64
|
const reportId = reportIdUniqueKey(undefined, readCustomRangeSlot && opExState.uiState.customTimeframe != null);
|
|
@@ -73,8 +73,8 @@ const getOpExBalancesInTimeFrame = createSelector((state) => state.opExState, (s
|
|
|
73
73
|
return incomeOrExpenseBalances.balances;
|
|
74
74
|
}
|
|
75
75
|
return [];
|
|
76
|
-
}
|
|
77
|
-
export const getOperatingExpensesReport = createSelector((state) => state
|
|
76
|
+
}
|
|
77
|
+
export const getOperatingExpensesReport = createSelector((state) => state.accountState, (state) => state.accountGroupState, (state) => state.sectionAccountsViewState, (state) => state.opExState, (state) => state.forecastState, (state) => state.forecastListState, (_state, filter) => filter, (_state, _filter, forecastId) => forecastId, (_state, _filter, _forecastId, readCustomRangeSlot) => readCustomRangeSlot === true, (accountState, accountGroupState, sectionsState, opExState, forecastState, forecastListState, filter, forecastId, readCustomRangeSlot) => {
|
|
78
78
|
const opEx = getState(opExState, opExState.uiState.isForecastModeOn, forecastId);
|
|
79
79
|
// The detail screen opts into customFetchState so its Completed check fires
|
|
80
80
|
// off the custom fetch; the dashboard (no flag) reads the shared fetchState,
|
|
@@ -103,7 +103,7 @@ export const getOperatingExpensesReport = createSelector((state) => state, (stat
|
|
|
103
103
|
}, filter);
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
const balancesInTimeframe = getOpExBalancesInTimeFrame(
|
|
106
|
+
const balancesInTimeframe = getOpExBalancesInTimeFrame(opExState, sectionsState, useCustomRange);
|
|
107
107
|
const allTimeframeTicks = balancesInTimeframe.map((balance) => toTimeframeTick(balance));
|
|
108
108
|
const forecast = opEx.forecastId != null
|
|
109
109
|
? getForecast(forecastState, opEx.forecastId)
|
|
@@ -25,15 +25,18 @@ const reimbursementCardSelector_1 = require("../reimbursementCard/reimbursementC
|
|
|
25
25
|
const revenueSelector_1 = require("../revenue/revenueSelector");
|
|
26
26
|
const tasksCardSelector_1 = require("../tasksCard/tasksCardSelector");
|
|
27
27
|
const topExSelector_1 = require("../topEx/topExSelector");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
28
|
+
// Every input must return the same reference until the slices it reads change, or getDashboard
|
|
29
|
+
// rebuilds every card's balances on each dispatched action.
|
|
30
|
+
const getNetBurnOrIncomeFilter = (0, toolkit_1.createSelector)((state) => state.netBurnOrIncomeState.netBurnOrIncome.firstMonthOfFY, (state) => state.netBurnOrIncomeState.uiState.timeframe, (state) => state.netBurnOrIncomeState.uiState.selectedAdditionalBalances, (firstMonthOfFY, timeframe, selectedAdditionalBalances) => (0, coaBalancesFilter_1.newBalancesFilter)(firstMonthOfFY, timeframe, 4, undefined, 'ascending_date', selectedAdditionalBalances));
|
|
31
|
+
const getNetBurnOrIncomeForLast4Periods = (0, toolkit_1.createSelector)((state) => state.accountState, (state) => state.accountGroupState, (state) => state.sectionAccountsViewState, (state) => state.netBurnOrIncomeState, (state) => state.forecastState, (state) => state.forecastListState, getNetBurnOrIncomeFilter, (accountState, accountGroupState, sectionAccountsViewState, netBurnOrIncomeState, forecastState, forecastListState, filter) => (0, netBurnOrIncomeSelector_1.getNetBurnOrIncomeReport)(accountState, accountGroupState, sectionAccountsViewState, netBurnOrIncomeState, forecastState, forecastListState, filter));
|
|
32
|
+
const getOperatingExpensesFilter = (0, toolkit_1.createSelector)((state) => state.opExState.opEx.firstMonthOfFY, (state) => state.opExState.uiState.timeframe, (state) => state.opExState.uiState.selectedAdditionalBalances, (firstMonthOfFY, timeframe, selectedAdditionalBalances) => (0, coaBalancesFilter_1.newBalancesFilter)(firstMonthOfFY, timeframe, 5, undefined, 'ascending_date', selectedAdditionalBalances));
|
|
33
|
+
const getOperatingExpensesForLast5Periods = (state) => (0, opExSelector_1.getOperatingExpensesReport)(state, getOperatingExpensesFilter(state));
|
|
34
|
+
const getRevenueFilter = (0, toolkit_1.createSelector)((state) => state.revenueState.revenue.firstMonthOfFY, (state) => state.revenueState.uiState.timeframe, (state) => state.revenueState.uiState.selectedAdditionalBalances, (firstMonthOfFY, timeframe, selectedAdditionalBalances) => (0, coaBalancesFilter_1.newBalancesFilter)(firstMonthOfFY, timeframe, 4, undefined, 'ascending_date', selectedAdditionalBalances));
|
|
35
|
+
const getRevenueForLast4Periods = (0, toolkit_1.createSelector)(getRevenueFilter, (state) => state.accountState, (state) => state.accountGroupState, (state) => state.sectionAccountsViewState, (state) => state.forecastListState, (state) => state.revenueState, (state) => state.forecastState, (filter, accountState, accountGroupState, sectionAccountsViewState, forecastListState, revenueState, forecastState) => (0, revenueSelector_1.getRevenueReport)(filter, accountState, accountGroupState, sectionAccountsViewState, forecastListState, revenueState, forecastState));
|
|
36
|
+
const getCashPositionFilter = (0, toolkit_1.createSelector)((state) => state.cashPositionState.firstMonthOfFY, (state) => state.cashPositionState.uiState.timeframe, (state) => state.cashPositionState.uiState.selectedAdditionalBalances, (firstMonthOfFY, timeframe, selectedAdditionalBalances) => (0, coaBalancesFilter_1.newBalancesFilter)(firstMonthOfFY, timeframe, 5, undefined, 'ascending_date', selectedAdditionalBalances));
|
|
37
|
+
const getCashPositionLast5Periods = (0, toolkit_1.createSelector)((state) => state.accountState, (state) => state.cashPositionState, getCashPositionFilter, (accountState, cashPositionState, filter) => (0, cashPositionSelector_1.getCashPosition)(accountState, cashPositionState, filter));
|
|
38
|
+
const getCashInCashOutFilter = (0, toolkit_1.createSelector)((state) => state.cashInCashOutState.firstMonthOfFY, (state) => state.cashInCashOutState.uiState.timeframe, (state) => state.cashInCashOutState.uiState.selectedAdditionalBalances, (firstMonthOfFY, timeframe, selectedAdditionalBalances) => (0, coaBalancesFilter_1.newBalancesFilter)(firstMonthOfFY, timeframe, 4, undefined, 'ascending_date', selectedAdditionalBalances));
|
|
39
|
+
const getCashInCashOutLast4Periods = (0, toolkit_1.createSelector)((state) => state.accountState, (state) => state.accountGroupState, (state) => state.cashInCashOutState, getCashInCashOutFilter, (accountState, accountGroupState, cashInCashOutState, filter) => (0, cashInCashOutSelector_1.getCashInCashOut)(accountState, accountGroupState, cashInCashOutState, filter));
|
|
37
40
|
const getNetBurnOrIncomeStoryCard = (state) => (0, netBurnOrIncomeStoryCardSelector_1.getNetBurnOrIncomeStoryCardReport)(state);
|
|
38
41
|
const apAgingSelector = (state) => (0, apAgingSelector_1.getApAgingReport)(state);
|
|
39
42
|
const arAgingSelector = (state) => (0, arAgingSelector_1.getArAgingReport)(state);
|
|
@@ -8,12 +8,9 @@ const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
|
|
|
8
8
|
const netBurnOrIncomeReducer_1 = require("../netBurnOrIncome/netBurnOrIncomeReducer");
|
|
9
9
|
const netBurnOrIncomeStoryCardSelectorTypes_1 = require("./netBurnOrIncomeStoryCardSelectorTypes");
|
|
10
10
|
const netBurnOrIncomeStoryCardState_1 = require("./netBurnOrIncomeStoryCardState");
|
|
11
|
-
exports.getNetBurnOrIncomeStoryCardReport = (0, toolkit_1.createSelector)((state) => state, (
|
|
12
|
-
const { netBurnOrIncomeStoryCardState, netBurnOrIncomeState } = rootState;
|
|
11
|
+
exports.getNetBurnOrIncomeStoryCardReport = (0, toolkit_1.createSelector)((state) => state.netBurnOrIncomeStoryCardState, (state) => state.netBurnOrIncomeState.netBurnOrIncome.firstMonthOfFY, tenantSelector_1.getCurrentTenant, (netBurnOrIncomeStoryCardState, firstMonthOfFY, currentTenant) => {
|
|
13
12
|
const { opExCash, ebitda, netIncome, runwayCash, runwayEbitda, runwayNetIncome, reportId, reportTitle, version, status, fetchState, error, updateStatus, } = netBurnOrIncomeStoryCardState;
|
|
14
|
-
const { firstMonthOfFY } = netBurnOrIncomeState.netBurnOrIncome;
|
|
15
13
|
const filter = (0, coaBalancesFilter_1.newBalancesFilter)(firstMonthOfFY, 'month', netBurnOrIncomeReducer_1.defaultPeriods.numberOfPeriods, undefined, 'ascending_date');
|
|
16
|
-
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(rootState);
|
|
17
14
|
const selectedAccountingMethod = currentTenant?.netBurnSettings?.accountingMethod;
|
|
18
15
|
const timeSpanIdForAverage = currentTenant?.netBurnSettings?.timeSpanIdForAverage;
|
|
19
16
|
let netBurnOrIncomeBalances;
|
|
@@ -61,7 +61,7 @@ exports.getOperatingExpensesUIState = (0, toolkit_1.createSelector)((state) => s
|
|
|
61
61
|
reportFormat,
|
|
62
62
|
};
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
function getOpExBalancesInTimeFrame(opExState, sectionState, readCustomRangeSlot) {
|
|
65
65
|
// Custom detail reads its own section-accounts slot so a default fetch can't
|
|
66
66
|
// overwrite the partial-period data; the dashboard reads the default slot.
|
|
67
67
|
const reportId = (0, opExForTimeFrameEpic_1.reportIdUniqueKey)(undefined, readCustomRangeSlot && opExState.uiState.customTimeframe != null);
|
|
@@ -76,8 +76,8 @@ const getOpExBalancesInTimeFrame = (0, toolkit_1.createSelector)((state) => stat
|
|
|
76
76
|
return incomeOrExpenseBalances.balances;
|
|
77
77
|
}
|
|
78
78
|
return [];
|
|
79
|
-
}
|
|
80
|
-
exports.getOperatingExpensesReport = (0, toolkit_1.createSelector)((state) => state
|
|
79
|
+
}
|
|
80
|
+
exports.getOperatingExpensesReport = (0, toolkit_1.createSelector)((state) => state.accountState, (state) => state.accountGroupState, (state) => state.sectionAccountsViewState, (state) => state.opExState, (state) => state.forecastState, (state) => state.forecastListState, (_state, filter) => filter, (_state, _filter, forecastId) => forecastId, (_state, _filter, _forecastId, readCustomRangeSlot) => readCustomRangeSlot === true, (accountState, accountGroupState, sectionsState, opExState, forecastState, forecastListState, filter, forecastId, readCustomRangeSlot) => {
|
|
81
81
|
const opEx = (0, opExReducer_1.getState)(opExState, opExState.uiState.isForecastModeOn, forecastId);
|
|
82
82
|
// The detail screen opts into customFetchState so its Completed check fires
|
|
83
83
|
// off the custom fetch; the dashboard (no flag) reads the shared fetchState,
|
|
@@ -106,7 +106,7 @@ exports.getOperatingExpensesReport = (0, toolkit_1.createSelector)((state) => st
|
|
|
106
106
|
}, filter);
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
const balancesInTimeframe = getOpExBalancesInTimeFrame(
|
|
109
|
+
const balancesInTimeframe = getOpExBalancesInTimeFrame(opExState, sectionsState, useCustomRange);
|
|
110
110
|
const allTimeframeTicks = balancesInTimeframe.map((balance) => (0, timeframeTick_1.toTimeframeTick)(balance));
|
|
111
111
|
const forecast = opEx.forecastId != null
|
|
112
112
|
? (0, forecastSelector_1.getForecast)(forecastState, opEx.forecastId)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.24-betaAK1",
|
|
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",
|