@zeniai/client-epic-state 4.19.95 → 4.19.96-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.
- package/lib/commonStateTypes/reduceFetchState.d.ts +9 -0
- package/lib/commonStateTypes/reduceFetchState.js +26 -0
- package/lib/esm/commonStateTypes/reduceFetchState.js +25 -0
- package/lib/esm/index.js +5 -4
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +8 -3
- package/lib/esm/view/financeStatement/financeStatementReducer.js +11 -8
- package/lib/esm/view/financeStatement/financeStatementSelector.js +10 -5
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +318 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +1 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
- package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
- package/lib/esm/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +9 -7
- package/lib/index.d.ts +7 -5
- package/lib/index.js +29 -25
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +8 -3
- package/lib/view/financeStatement/financeStatementReducer.js +11 -8
- package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
- package/lib/view/financeStatement/financeStatementSelector.js +10 -5
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +13 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +322 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +59 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +2 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +4 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +7 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +4 -0
- package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
- package/lib/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +8 -6
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ exports.getProfitAndLossClassesView = exports.profitAndLossIdsInOrder = void 0;
|
|
|
4
4
|
const getDifferenceOfBalancesGroupedByPeriod_1 = require("../../commonStateTypes/coaBalance/classBalances/getDifferenceOfBalancesGroupedByPeriod");
|
|
5
5
|
const getSumOfBalancesGroupedByPeriod_1 = require("../../commonStateTypes/coaBalance/classBalances/getSumOfBalancesGroupedByPeriod");
|
|
6
6
|
const coaBalance_1 = require("../../commonStateTypes/coaBalance/coaBalance");
|
|
7
|
+
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
7
8
|
const sectionClassesViewSelector_1 = require("../../entity/sectionClassesViewV2/sectionClassesViewSelector");
|
|
8
9
|
const profitAndLossClassesViewSelectorTypes_1 = require("./profitAndLossClassesViewSelectorTypes");
|
|
9
10
|
exports.profitAndLossIdsInOrder = [
|
|
@@ -18,7 +19,7 @@ exports.profitAndLossIdsInOrder = [
|
|
|
18
19
|
'netIncome',
|
|
19
20
|
];
|
|
20
21
|
const getProfitAndLossClassesView = (filter, accountState, classState, sectionsState, profitAndLossClassesViewState) => {
|
|
21
|
-
const fetchState =
|
|
22
|
+
const fetchState = (0, reduceFetchState_1.reduceFetchStateParallelTimeframes)([
|
|
22
23
|
profitAndLossClassesViewState.fetchState.month,
|
|
23
24
|
profitAndLossClassesViewState.fetchState.quarter,
|
|
24
25
|
profitAndLossClassesViewState.fetchState.year,
|
|
@@ -68,31 +69,3 @@ const getProfitAndLossClassesView = (filter, accountState, classState, sectionsS
|
|
|
68
69
|
};
|
|
69
70
|
};
|
|
70
71
|
exports.getProfitAndLossClassesView = getProfitAndLossClassesView;
|
|
71
|
-
function reduceFetchState(fetchStateList) {
|
|
72
|
-
const isAnyProgress = fetchStateList.reduce((prevValue, currentValue) => {
|
|
73
|
-
return prevValue === true || currentValue.fetchState === 'In-Progress';
|
|
74
|
-
}, false);
|
|
75
|
-
const isAllCompleted = fetchStateList.reduce((prevValue, currentValue) => {
|
|
76
|
-
return prevValue === true && currentValue.fetchState === 'Completed';
|
|
77
|
-
}, true);
|
|
78
|
-
const isAnyError = fetchStateList.reduce((prevValue, currentValue) => {
|
|
79
|
-
return prevValue === true || currentValue.fetchState === 'Error';
|
|
80
|
-
}, false);
|
|
81
|
-
const error = fetchStateList.reduce((prevValue, currentValue) => {
|
|
82
|
-
return prevValue ?? currentValue.error;
|
|
83
|
-
}, undefined);
|
|
84
|
-
let fetchState = 'Not-Started';
|
|
85
|
-
if (isAnyProgress) {
|
|
86
|
-
fetchState = 'In-Progress';
|
|
87
|
-
}
|
|
88
|
-
else if (isAllCompleted) {
|
|
89
|
-
fetchState = 'Completed';
|
|
90
|
-
}
|
|
91
|
-
else if (isAnyError) {
|
|
92
|
-
fetchState = 'Error';
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
fetchState,
|
|
96
|
-
error,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { Currency } from '../../commonStateTypes/amount';
|
|
1
2
|
import { NestedClassHierarchyForReport, NestedClassID } from '../../commonStateTypes/classesView/nestedClassID';
|
|
2
3
|
import { AccountViewMode, FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
3
4
|
import { Report } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
|
+
export type ClassViewLayout = 'vertical' | 'horizontal';
|
|
4
6
|
export interface ProfitAndLossClassesViewUIState {
|
|
5
7
|
accountViewMode: AccountViewMode;
|
|
6
8
|
classesToFilterOut: NestedClassID[];
|
|
9
|
+
classViewLayout: ClassViewLayout;
|
|
7
10
|
nodeCollapseState: Record<ID, boolean>;
|
|
8
11
|
scrollPosition: {
|
|
9
12
|
scrollTop: number;
|
|
@@ -18,4 +21,5 @@ export interface ProfitAndLossClassesViewState extends Report {
|
|
|
18
21
|
year: FetchStateAndError;
|
|
19
22
|
};
|
|
20
23
|
uiState: ProfitAndLossClassesViewUIState;
|
|
24
|
+
currency?: Currency;
|
|
21
25
|
}
|
|
@@ -27,11 +27,13 @@ const fetchProfitAndLossForTimeframeClassesViewEpic = (actions$, _, zeniAPI) =>
|
|
|
27
27
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
28
28
|
if (response.data != null && (0, responsePayload_1.isSuccessResponse)(response)) {
|
|
29
29
|
const actions = [];
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, '
|
|
33
|
-
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, '
|
|
34
|
-
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, '
|
|
30
|
+
const report = response.data.report;
|
|
31
|
+
const currency = report.currency;
|
|
32
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'cogs', 'profit_and_loss_by_classes', report.cogs, report.classes, report.accounts, currency));
|
|
33
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'expenses', 'profit_and_loss_by_classes', report.expenses, report.classes, report.accounts, currency));
|
|
34
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'income', 'profit_and_loss_by_classes', report.income, report.classes, report.accounts, currency));
|
|
35
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'otherExpenses', 'profit_and_loss_by_classes', report.other_expenses, report.classes, report.accounts, currency));
|
|
36
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, 'otherIncome', 'profit_and_loss_by_classes', report.other_income, report.classes, report.accounts, currency));
|
|
35
37
|
actions.push((0, profitAndLossClassesViewReducer_1.updateProfitAndLossForTimeframeClassesView)({
|
|
36
38
|
timeframe: action.payload.timeframe,
|
|
37
39
|
report: response.data,
|
|
@@ -11,9 +11,13 @@ const opExReducer_1 = require("../opEx/opExReducer");
|
|
|
11
11
|
const revenueReducer_1 = require("../revenue/revenueReducer");
|
|
12
12
|
const reportUIOptionsReducer_1 = require("./reportUIOptionsReducer");
|
|
13
13
|
const updateReportUIOptionCOABalancesRangeEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(reportUIOptionsReducer_1.updateReportUIOptionCOABalancesRange.match), (0, operators_1.switchMap)((action) => {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
14
|
+
const selectedRange = action.payload.selectedCOABalancesRange;
|
|
15
|
+
const thisPeriod = selectedRange.thisPeriod;
|
|
16
|
+
const orderBy = selectedRange.orderBy;
|
|
17
|
+
const numberOfPeriodsFromSelection = selectedRange.numberOfPeriods;
|
|
18
|
+
const highlightedNoOfPeriods = state$.value.reportUIOptionsState.isCompareModeOn === true
|
|
19
|
+
? numberOfPeriodsFromSelection
|
|
20
|
+
: 1;
|
|
17
21
|
const highlightedCOABalancesRange = action.payload.highlightedCOABalancesRange == null && thisPeriod != null
|
|
18
22
|
? {
|
|
19
23
|
numberOfPeriods: highlightedNoOfPeriods,
|
|
@@ -65,9 +69,7 @@ const updateReportUIOptionCOABalancesRangeEpic = (actions$, state$) => actions$.
|
|
|
65
69
|
thisPeriod: action.payload.highlightedCOABalancesRange != null
|
|
66
70
|
? action.payload.highlightedCOABalancesRange.thisPeriod
|
|
67
71
|
: thisPeriod,
|
|
68
|
-
numberOfPeriods:
|
|
69
|
-
? 4
|
|
70
|
-
: financeStatementReducer_1.initialFinanceStatementState.maxNumOfPeriodsToHighlight,
|
|
72
|
+
numberOfPeriods: numberOfPeriodsFromSelection,
|
|
71
73
|
orderBy,
|
|
72
74
|
}));
|
|
73
75
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.
|
|
3
|
+
"version": "4.19.96-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",
|