@zeniai/client-epic-state 5.2.93-betaNB2 → 5.2.94
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/timeframeTick.d.ts +1 -0
- package/lib/commonStateTypes/timeframeTick.js +1 -0
- package/lib/commonStateTypes/viewAndReport/reportUIState.d.ts +2 -0
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -0
- package/lib/entity/reconciliationReport/reconciliationReportPayload.d.ts +0 -1
- package/lib/entity/reconciliationReport/reconciliationReportReducer.js +0 -1
- package/lib/entity/reconciliationReport/reconciliationReportState.d.ts +2 -4
- package/lib/entity/reconciliationReport/reconciliationReportState.js +1 -4
- package/lib/esm/commonStateTypes/timeframeTick.js +1 -0
- package/lib/esm/entity/reconciliationReport/reconciliationReportReducer.js +0 -1
- package/lib/esm/entity/reconciliationReport/reconciliationReportState.js +1 -4
- package/lib/esm/view/balanceSheet/balanceSheetForTimeframeEpic.js +4 -0
- package/lib/esm/view/balanceSheet/balanceSheetReducer.js +8 -2
- package/lib/esm/view/cashFlow/cashFlowForTimeframeEpic.js +4 -0
- package/lib/esm/view/cashFlow/cashFlowReducer.js +2 -2
- package/lib/esm/view/cashInCashOut/cashInCashOutEpic.js +22 -14
- package/lib/esm/view/cashInCashOut/cashInCashOutReducer.js +161 -41
- package/lib/esm/view/cashInCashOut/cashInCashOutSelector.js +42 -15
- package/lib/esm/view/cashPosition/cashPositionEpic.js +21 -13
- package/lib/esm/view/cashPosition/cashPositionReducer.js +155 -44
- package/lib/esm/view/cashPosition/cashPositionSelector.js +28 -9
- package/lib/esm/view/netBurnOrIncome/netBurnOrIncomeEpic.js +7 -7
- package/lib/esm/view/netBurnOrIncome/netBurnOrIncomeForTimeframeEpic.js +25 -10
- package/lib/esm/view/netBurnOrIncome/netBurnOrIncomeReducer.js +184 -40
- package/lib/esm/view/netBurnOrIncome/netBurnOrIncomeSelector.js +26 -8
- package/lib/esm/view/opEx/opExEpic.js +7 -7
- package/lib/esm/view/opEx/opExForTimeFrameEpic.js +21 -6
- package/lib/esm/view/opEx/opExReducer.js +169 -32
- package/lib/esm/view/opEx/opExSelector.js +28 -10
- package/lib/esm/view/profitAndLoss/profitAndLossForTimeframeEpic.js +4 -0
- package/lib/esm/view/profitAndLoss/profitAndLossReducer.js +9 -2
- package/lib/esm/view/revenue/revenueEpic.js +7 -7
- package/lib/esm/view/revenue/revenueForTimeframeEpic.js +23 -8
- package/lib/esm/view/revenue/revenueReducer.js +183 -40
- package/lib/esm/view/revenue/revenueSelector.js +30 -10
- package/lib/view/balanceSheet/balanceSheetForTimeframeEpic.js +4 -0
- package/lib/view/balanceSheet/balanceSheetReducer.d.ts +3 -1
- package/lib/view/balanceSheet/balanceSheetReducer.js +8 -2
- package/lib/view/cashFlow/cashFlowForTimeframeEpic.js +4 -0
- package/lib/view/cashFlow/cashFlowReducer.d.ts +3 -1
- package/lib/view/cashFlow/cashFlowReducer.js +2 -2
- package/lib/view/cashInCashOut/cashInCashOutEpic.d.ts +8 -2
- package/lib/view/cashInCashOut/cashInCashOutEpic.js +22 -14
- package/lib/view/cashInCashOut/cashInCashOutReducer.d.ts +13 -1
- package/lib/view/cashInCashOut/cashInCashOutReducer.js +161 -41
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +2 -1
- package/lib/view/cashInCashOut/cashInCashOutSelector.js +42 -15
- package/lib/view/cashInCashOut/cashInCashOutState.d.ts +5 -1
- package/lib/view/cashPosition/cashPositionEpic.d.ts +8 -2
- package/lib/view/cashPosition/cashPositionEpic.js +21 -13
- package/lib/view/cashPosition/cashPositionReducer.d.ts +13 -2
- package/lib/view/cashPosition/cashPositionReducer.js +155 -44
- package/lib/view/cashPosition/cashPositionSelector.d.ts +2 -1
- package/lib/view/cashPosition/cashPositionSelector.js +28 -9
- package/lib/view/cashPosition/cashPositionState.d.ts +5 -1
- package/lib/view/financeStatement/financeStatementEpic.d.ts +6 -0
- package/lib/view/netBurnOrIncome/fetchNetBurnOrIncomeWithForecastEpic.d.ts +1 -0
- package/lib/view/netBurnOrIncome/netBurnOrIncomeEpic.js +7 -7
- package/lib/view/netBurnOrIncome/netBurnOrIncomeForTimeframeEpic.d.ts +2 -1
- package/lib/view/netBurnOrIncome/netBurnOrIncomeForTimeframeEpic.js +26 -11
- package/lib/view/netBurnOrIncome/netBurnOrIncomeReducer.d.ts +12 -3
- package/lib/view/netBurnOrIncome/netBurnOrIncomeReducer.js +184 -40
- package/lib/view/netBurnOrIncome/netBurnOrIncomeSelector.d.ts +1 -1
- package/lib/view/netBurnOrIncome/netBurnOrIncomeSelector.js +26 -8
- package/lib/view/netBurnOrIncome/netBurnOrIncomeState.d.ts +8 -0
- package/lib/view/opEx/fetchOpExWithForecastEpic.d.ts +1 -0
- package/lib/view/opEx/opExEpic.js +7 -7
- package/lib/view/opEx/opExForTimeFrameEpic.d.ts +2 -1
- package/lib/view/opEx/opExForTimeFrameEpic.js +22 -7
- package/lib/view/opEx/opExReducer.d.ts +12 -3
- package/lib/view/opEx/opExReducer.js +168 -31
- package/lib/view/opEx/opExSelector.d.ts +1 -1
- package/lib/view/opEx/opExSelector.js +28 -10
- package/lib/view/opEx/opExState.d.ts +6 -0
- package/lib/view/profitAndLoss/profitAndLossForTimeframeEpic.js +4 -0
- package/lib/view/profitAndLoss/profitAndLossReducer.d.ts +3 -1
- package/lib/view/profitAndLoss/profitAndLossReducer.js +9 -2
- package/lib/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.d.ts +15 -0
- package/lib/view/revenue/fetchRevenueWithForecastEpic.d.ts +1 -0
- package/lib/view/revenue/revenueEpic.js +7 -7
- package/lib/view/revenue/revenueForTimeframeEpic.d.ts +2 -1
- package/lib/view/revenue/revenueForTimeframeEpic.js +24 -9
- package/lib/view/revenue/revenueReducer.d.ts +12 -3
- package/lib/view/revenue/revenueReducer.js +182 -39
- package/lib/view/revenue/revenueSelector.d.ts +1 -1
- package/lib/view/revenue/revenueSelector.js +30 -10
- package/lib/view/revenue/revenueState.d.ts +8 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ const dataAvailable_1 = require("../../commonStateTypes/dataAvailable");
|
|
|
9
9
|
const thisPeriodHelpers_1 = require("../../commonStateTypes/viewAndReport/thisPeriodHelpers");
|
|
10
10
|
const insightSummaryPayload_1 = require("../../entity/insights/insightSummaryPayload");
|
|
11
11
|
const rootActions_1 = require("../../rootActions");
|
|
12
|
+
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
12
13
|
const getSelectedAndHighlightedRanges_1 = require("../common/getSelectedAndHighlightedRanges");
|
|
13
14
|
exports.defaultPeriods = {
|
|
14
15
|
numberOfPeriods: 8,
|
|
@@ -18,6 +19,12 @@ exports.initialState = {
|
|
|
18
19
|
error: undefined,
|
|
19
20
|
cashPosition: undefined,
|
|
20
21
|
dataAvailable: undefined,
|
|
22
|
+
// Custom-date slots must be explicit in initialState so clearAll's
|
|
23
|
+
// Object.assign(draft, initialState) resets them on tenant switch (absent
|
|
24
|
+
// keys would otherwise survive). Mirrors cashInCashOut.
|
|
25
|
+
customCashPosition: undefined,
|
|
26
|
+
customDataAvailable: undefined,
|
|
27
|
+
customFetchState: undefined,
|
|
21
28
|
firstMonthOfFY: 1,
|
|
22
29
|
reportId: 'cash_position',
|
|
23
30
|
reportTitle: '',
|
|
@@ -49,52 +56,54 @@ const cashPosition = (0, toolkit_1.createSlice)({
|
|
|
49
56
|
initialState: exports.initialState,
|
|
50
57
|
reducers: {
|
|
51
58
|
fetchCashPosition: {
|
|
52
|
-
prepare(fetchFullReport = false) {
|
|
53
|
-
return { payload: { fetchFullReport } };
|
|
59
|
+
prepare(fetchFullReport = false, startDate, endDate) {
|
|
60
|
+
return { payload: { fetchFullReport, startDate, endDate } };
|
|
54
61
|
},
|
|
55
|
-
reducer(draft) {
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
reducer(draft, action) {
|
|
63
|
+
// Route by the fetch's own dates, not the global flag: a custom fetch
|
|
64
|
+
// (carries start/end) marks customFetchState so the shared fetchState the
|
|
65
|
+
// dashboard reads is never left In-Progress by a detail-screen fetch.
|
|
66
|
+
const isCustomDateRange = action.payload.startDate != null && action.payload.endDate != null;
|
|
67
|
+
if (isCustomDateRange) {
|
|
68
|
+
draft.customFetchState = {
|
|
69
|
+
fetchState: 'In-Progress',
|
|
70
|
+
error: undefined,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
draft.fetchState = 'In-Progress';
|
|
75
|
+
draft.error = undefined;
|
|
76
|
+
}
|
|
58
77
|
},
|
|
59
78
|
},
|
|
60
|
-
updateCashPosition
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
draft.cashPosition =
|
|
68
|
-
(0, coaBalancePayload_1.mapCOABalanceGroupedWithAccountIDsPayloadToCOABalanceGroupedWithAccountIDs)({
|
|
69
|
-
...cash_position,
|
|
70
|
-
account_ids: reportDataPayload.report.accounts.map((payload) => payload.account_id),
|
|
71
|
-
});
|
|
72
|
-
draft.insights = (0, insightSummaryPayload_1.mapInsightsPayloadtoInsightsState)(insights);
|
|
73
|
-
draft.dataAvailable = report.dataAvailable
|
|
74
|
-
? report.dataAvailable
|
|
75
|
-
: (0, dataAvailable_1.getDataAvailableDateRange)(draft.cashPosition);
|
|
76
|
-
if (draft.dataAvailable != null) {
|
|
77
|
-
const timeframe = draft.uiState.timeframe;
|
|
78
|
-
const coaBalances = (0, getSelectedAndHighlightedRanges_1.getAvailableCOABalancesWithMostRecentNonZeroBalance)(draft.firstMonthOfFY, timeframe, [draft.cashPosition], draft.dataAvailable);
|
|
79
|
-
const selectionRanges = (0, getSelectedAndHighlightedRanges_1.getInitialSelectedAndHighlightedRanges)({
|
|
80
|
-
firstMonthOfFY: draft.firstMonthOfFY,
|
|
81
|
-
timeframe,
|
|
82
|
-
coaBalances,
|
|
83
|
-
orderBy: 'ascending_date',
|
|
84
|
-
maxNumOfPeriodsToSelect: exports.defaultPeriods.numberOfPeriods,
|
|
85
|
-
maxNumOfPeriodsToHighlight: exports.initialState.uiState.maxNumOfPeriodsToHighlight,
|
|
86
|
-
});
|
|
87
|
-
if (selectionRanges?.selectedCOABalancesRange != null) {
|
|
88
|
-
draft.uiState.selectedCOABalancesRange =
|
|
89
|
-
selectionRanges?.selectedCOABalancesRange;
|
|
90
|
-
}
|
|
91
|
-
draft.uiState.highlightedCOABalancesRange =
|
|
92
|
-
selectionRanges?.highlightedCOABalancesRange;
|
|
93
|
-
}
|
|
79
|
+
updateCashPosition: {
|
|
80
|
+
prepare(reportData, isCustomDateRange = false) {
|
|
81
|
+
return { payload: { reportData, isCustomDateRange } };
|
|
82
|
+
},
|
|
83
|
+
reducer(draft, action) {
|
|
84
|
+
doUpdateCashPosition(draft, action.payload.reportData, action.payload.isCustomDateRange);
|
|
85
|
+
},
|
|
94
86
|
},
|
|
95
|
-
updateCashPositionFailure
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
updateCashPositionFailure: {
|
|
88
|
+
prepare(error, isCustomDateRange = false) {
|
|
89
|
+
return { payload: { error, isCustomDateRange } };
|
|
90
|
+
},
|
|
91
|
+
reducer(draft, action) {
|
|
92
|
+
// Route the error like the request/success: a custom (dated) fetch's
|
|
93
|
+
// failure lands in customFetchState so the shared default the dashboard
|
|
94
|
+
// reads isn't marked Error, and the detail's customFetchState isn't left
|
|
95
|
+
// stuck In-Progress.
|
|
96
|
+
if (action.payload.isCustomDateRange === true) {
|
|
97
|
+
draft.customFetchState = {
|
|
98
|
+
fetchState: 'Error',
|
|
99
|
+
error: action.payload.error,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
draft.fetchState = 'Error';
|
|
104
|
+
draft.error = action.payload.error;
|
|
105
|
+
}
|
|
106
|
+
},
|
|
98
107
|
},
|
|
99
108
|
updateCashPositionAdditionalBalancesSelection(draft, action) {
|
|
100
109
|
const { cashPosition, dataAvailable, uiState } = draft;
|
|
@@ -109,7 +118,7 @@ const cashPosition = (0, toolkit_1.createSlice)({
|
|
|
109
118
|
action.payload.additionalBalances.length != 0
|
|
110
119
|
? true
|
|
111
120
|
: false;
|
|
112
|
-
if (dataAvailable != null) {
|
|
121
|
+
if (dataAvailable != null && draft.uiState.customTimeframe == null) {
|
|
113
122
|
const coaBalances = (0, getSelectedAndHighlightedRanges_1.getAvailableCOABalancesWithMostRecentNonZeroBalance)(draft.firstMonthOfFY, uiState.timeframe, [cashPosition], dataAvailable);
|
|
114
123
|
const thisPeriod = (0, thisPeriodHelpers_1.extractThisPeriod)(draft.firstMonthOfFY, timeframe, selectedCOABalancesRange, coaBalances);
|
|
115
124
|
if (thisPeriod != null &&
|
|
@@ -138,6 +147,46 @@ const cashPosition = (0, toolkit_1.createSlice)({
|
|
|
138
147
|
}
|
|
139
148
|
},
|
|
140
149
|
updateCashPositionCOABalancesRange(draft, action) {
|
|
150
|
+
if (action.payload.isCustomDateRange != null) {
|
|
151
|
+
if (action.payload.isCustomDateRange === true) {
|
|
152
|
+
// Collapse the two raw date strings into a single customTimeframe object.
|
|
153
|
+
// Presence of customTimeframe signals custom-mode active (replaces the
|
|
154
|
+
// old isCustomDateRangeActive boolean + customStartDate/customEndDate).
|
|
155
|
+
draft.uiState.customTimeframe =
|
|
156
|
+
action.payload.customStartDate != null &&
|
|
157
|
+
action.payload.customEndDate != null
|
|
158
|
+
? {
|
|
159
|
+
startDate: (0, zeniDayJS_1.date)(action.payload.customStartDate),
|
|
160
|
+
endDate: (0, zeniDayJS_1.date)(action.payload.customEndDate),
|
|
161
|
+
}
|
|
162
|
+
: undefined;
|
|
163
|
+
// Invalidate the shared default-window fetchState so dashboardEpic
|
|
164
|
+
// refetches the default data on the next dashboard visit — the custom
|
|
165
|
+
// fetch writes into the shared report store, and this lets the card
|
|
166
|
+
// self-heal without a reload. The detail screen reads customFetchState.
|
|
167
|
+
draft.fetchState = 'Not-Started';
|
|
168
|
+
draft.error = undefined;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
draft.uiState.customTimeframe = undefined;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// A custom date range drives the visible window directly: honor the exact
|
|
175
|
+
// numberOfPeriods + thisPeriod from the payload instead of re-deriving
|
|
176
|
+
// (which clamps the range to the available/non-zero periods).
|
|
177
|
+
if (draft.uiState.customTimeframe != null) {
|
|
178
|
+
draft.uiState.selectedCOABalancesRange =
|
|
179
|
+
action.payload.selectedCOABalancesRange;
|
|
180
|
+
if (action.payload.highlightedCOABalancesRange != null) {
|
|
181
|
+
// Clamp the highlight to the same cap the non-custom path enforces so
|
|
182
|
+
// a wide custom range doesn't highlight all N periods at once.
|
|
183
|
+
draft.uiState.highlightedCOABalancesRange = {
|
|
184
|
+
...action.payload.highlightedCOABalancesRange,
|
|
185
|
+
numberOfPeriods: Math.min(action.payload.highlightedCOABalancesRange.numberOfPeriods, draft.uiState.maxNumOfPeriodsToHighlight),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
141
190
|
const { cashPosition, dataAvailable, uiState } = draft;
|
|
142
191
|
if (dataAvailable != null &&
|
|
143
192
|
action.payload.selectedCOABalancesRange.thisPeriod != null) {
|
|
@@ -178,6 +227,13 @@ const cashPosition = (0, toolkit_1.createSlice)({
|
|
|
178
227
|
}
|
|
179
228
|
},
|
|
180
229
|
updateCashPositionThisPeriod(draft, action) {
|
|
230
|
+
// In custom-date mode the picker drives the window; skip re-deriving the
|
|
231
|
+
// selected/highlighted ranges from the default dataAvailable (the epic
|
|
232
|
+
// re-dispatches the default thisPeriod on every response, which would
|
|
233
|
+
// otherwise clamp the custom window back to the default).
|
|
234
|
+
if (draft.uiState.customTimeframe != null) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
181
237
|
const { cashPosition, dataAvailable, uiState } = draft;
|
|
182
238
|
if (dataAvailable != null && action.payload.thisPeriod != null) {
|
|
183
239
|
const coaBalances = (0, getSelectedAndHighlightedRanges_1.getAvailableCOABalancesWithMostRecentNonZeroBalance)(draft.firstMonthOfFY, uiState.timeframe, [cashPosition], dataAvailable);
|
|
@@ -222,7 +278,7 @@ const cashPosition = (0, toolkit_1.createSlice)({
|
|
|
222
278
|
draft.uiState.maxNumOfPeriodsToHighlight =
|
|
223
279
|
exports.initialState.uiState.maxNumOfPeriodsToHighlight;
|
|
224
280
|
}
|
|
225
|
-
if (dataAvailable != null) {
|
|
281
|
+
if (dataAvailable != null && draft.uiState.customTimeframe == null) {
|
|
226
282
|
const timeframe = draft.uiState.timeframe;
|
|
227
283
|
const coaBalances = (0, getSelectedAndHighlightedRanges_1.getAvailableCOABalancesWithMostRecentNonZeroBalance)(draft.firstMonthOfFY, timeframe, [cashPosition], dataAvailable);
|
|
228
284
|
const selectionRanges = (0, getSelectedAndHighlightedRanges_1.getInitialSelectedAndHighlightedRanges)({
|
|
@@ -262,5 +318,60 @@ const cashPosition = (0, toolkit_1.createSlice)({
|
|
|
262
318
|
});
|
|
263
319
|
},
|
|
264
320
|
});
|
|
321
|
+
const doUpdateCashPosition = (draft, reportDataPayload, isCustomDateRange) => {
|
|
322
|
+
const report = (0, viewAndReportPayload_1.mapReportPayloadToReport)(reportDataPayload.report);
|
|
323
|
+
const { cash_position, insights } = reportDataPayload.report;
|
|
324
|
+
const cashPosition = (0, coaBalancePayload_1.mapCOABalanceGroupedWithAccountIDsPayloadToCOABalanceGroupedWithAccountIDs)({
|
|
325
|
+
...cash_position,
|
|
326
|
+
account_ids: reportDataPayload.report.accounts.map((payload) => payload.account_id),
|
|
327
|
+
});
|
|
328
|
+
const dataAvailable = report.dataAvailable
|
|
329
|
+
? report.dataAvailable
|
|
330
|
+
: (0, dataAvailable_1.getDataAvailableDateRange)(cashPosition);
|
|
331
|
+
// Route custom-date results (identified by the fetch's own dates, not the
|
|
332
|
+
// global flag) to the separate slots so the dashboard card (which reads
|
|
333
|
+
// cashPosition / dataAvailable) keeps the default window.
|
|
334
|
+
if (isCustomDateRange) {
|
|
335
|
+
draft.customCashPosition = cashPosition;
|
|
336
|
+
// Don't let a custom slice shrink the shared dataAvailable the dashboard uses;
|
|
337
|
+
// a default fetch always updates it, a custom one only populates it on first
|
|
338
|
+
// load (when nothing has set it yet).
|
|
339
|
+
draft.customDataAvailable = dataAvailable;
|
|
340
|
+
if (draft.dataAvailable == null) {
|
|
341
|
+
draft.dataAvailable = dataAvailable;
|
|
342
|
+
}
|
|
343
|
+
draft.customFetchState = { fetchState: 'Completed', error: undefined };
|
|
344
|
+
// Skip insights on a custom fetch so the dashboard card keeps the
|
|
345
|
+
// default-window copy (matches cashInCashOut / opEx / revenue / netBurn).
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
Object.assign(draft, report);
|
|
349
|
+
draft.fetchState = 'Completed';
|
|
350
|
+
draft.error = undefined;
|
|
351
|
+
draft.cashPosition = cashPosition;
|
|
352
|
+
draft.insights = (0, insightSummaryPayload_1.mapInsightsPayloadtoInsightsState)(insights);
|
|
353
|
+
draft.dataAvailable = dataAvailable;
|
|
354
|
+
if (draft.dataAvailable != null &&
|
|
355
|
+
// A custom date range drives the window; don't reset it to the default on
|
|
356
|
+
// every report receipt (this is what clamped wide ranges back to 8).
|
|
357
|
+
draft.uiState.customTimeframe == null) {
|
|
358
|
+
const timeframe = draft.uiState.timeframe;
|
|
359
|
+
const coaBalances = (0, getSelectedAndHighlightedRanges_1.getAvailableCOABalancesWithMostRecentNonZeroBalance)(draft.firstMonthOfFY, timeframe, [draft.cashPosition], draft.dataAvailable);
|
|
360
|
+
const selectionRanges = (0, getSelectedAndHighlightedRanges_1.getInitialSelectedAndHighlightedRanges)({
|
|
361
|
+
firstMonthOfFY: draft.firstMonthOfFY,
|
|
362
|
+
timeframe,
|
|
363
|
+
coaBalances,
|
|
364
|
+
orderBy: 'ascending_date',
|
|
365
|
+
maxNumOfPeriodsToSelect: exports.defaultPeriods.numberOfPeriods,
|
|
366
|
+
maxNumOfPeriodsToHighlight: exports.initialState.uiState.maxNumOfPeriodsToHighlight,
|
|
367
|
+
});
|
|
368
|
+
if (selectionRanges?.selectedCOABalancesRange != null) {
|
|
369
|
+
draft.uiState.selectedCOABalancesRange =
|
|
370
|
+
selectionRanges?.selectedCOABalancesRange;
|
|
371
|
+
}
|
|
372
|
+
draft.uiState.highlightedCOABalancesRange =
|
|
373
|
+
selectionRanges?.highlightedCOABalancesRange;
|
|
374
|
+
}
|
|
375
|
+
};
|
|
265
376
|
_a = cashPosition.actions, exports.fetchCashPosition = _a.fetchCashPosition, exports.updateCashPosition = _a.updateCashPosition, exports.updateCashPositionFailure = _a.updateCashPositionFailure, exports.updateCashPositionTimeFrame = _a.updateCashPositionTimeFrame, exports.updateCashPositionCOABalancesRange = _a.updateCashPositionCOABalancesRange, exports.updateCashPositionAdditionalBalancesSelection = _a.updateCashPositionAdditionalBalancesSelection, exports.updateCashPositionThisPeriod = _a.updateCashPositionThisPeriod, exports.updateCashPositionDownloadState = _a.updateCashPositionDownloadState, exports.updateCashPositionUIState = _a.updateCashPositionUIState;
|
|
266
377
|
exports.default = cashPosition.reducer;
|
|
@@ -5,7 +5,7 @@ import { AccountState } from '../../entity/account/accountState';
|
|
|
5
5
|
import { RootState } from '../../rootStateTypes';
|
|
6
6
|
import { CashPositionReport, CashPositionUIStateSelectorView } from './cashPositionSelectorTypes';
|
|
7
7
|
import { CashPositionState } from './cashPositionState';
|
|
8
|
-
export declare const getCashPosition: (accountState: AccountState, cashPositionState: CashPositionState, filter: COABalancesFilter) => {
|
|
8
|
+
export declare const getCashPosition: (accountState: AccountState, cashPositionState: CashPositionState, filter: COABalancesFilter, readCustomRangeSlot?: boolean) => {
|
|
9
9
|
filter: COABalancesFilter;
|
|
10
10
|
cashPosition: SectionWithAccountOnly;
|
|
11
11
|
allTimeframeTicks: TimeframeTickWithMetaData[];
|
|
@@ -20,6 +20,7 @@ export declare const getCashPosition: (accountState: AccountState, cashPositionS
|
|
|
20
20
|
error: import("../..").ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
21
21
|
insights: import("../..").InsightSummary[];
|
|
22
22
|
downloadState: import("../..").FetchState;
|
|
23
|
+
customTimeframe: import("../../commonStateTypes/timeframeTick").TimeframeTick | undefined;
|
|
23
24
|
};
|
|
24
25
|
export declare const getCashPositionUIState: (state: RootState) => CashPositionUIStateSelectorView;
|
|
25
26
|
export declare const getCashPositionForSelectedRange: (state: RootState) => CashPositionReport;
|
|
@@ -7,20 +7,30 @@ const getCOABalancesSlice_1 = require("../../commonStateTypes/coaBalance/getCOAB
|
|
|
7
7
|
const dataAvailable_1 = require("../../commonStateTypes/dataAvailable");
|
|
8
8
|
const timeframeTick_1 = require("../../commonStateTypes/timeframeTick");
|
|
9
9
|
const accountSelector_1 = require("../../entity/account/accountSelector");
|
|
10
|
-
const getCashPosition = (accountState, cashPositionState, filter) => {
|
|
10
|
+
const getCashPosition = (accountState, cashPositionState, filter, readCustomRangeSlot) => {
|
|
11
|
+
// The detail screen opts into the isolated custom slot when custom mode is
|
|
12
|
+
// active; the dashboard (no flag) reads the default slot, so a default fetch
|
|
13
|
+
// can't clobber the custom partial-period data the detail is showing.
|
|
14
|
+
const useCustomRange = readCustomRangeSlot === true &&
|
|
15
|
+
cashPositionState.uiState.customTimeframe != null;
|
|
16
|
+
const activeCashPosition = useCustomRange
|
|
17
|
+
? cashPositionState.customCashPosition
|
|
18
|
+
: cashPositionState.cashPosition;
|
|
19
|
+
const dataAvailable = useCustomRange
|
|
20
|
+
? cashPositionState.customDataAvailable
|
|
21
|
+
: cashPositionState.dataAvailable;
|
|
11
22
|
const cashPosition = {
|
|
12
23
|
itemOrder: 'last_balance_descending',
|
|
13
24
|
accountsOrdered: (0, accountSelector_1.getAccountsOrdered)(filter, accountState, {
|
|
14
|
-
accountIDs:
|
|
25
|
+
accountIDs: activeCashPosition?.accountIDs ?? [],
|
|
15
26
|
reportId: 'cash_position',
|
|
16
27
|
}, 'cashPosition'),
|
|
17
|
-
...(0, getCOABalancesSlice_1.getCOABalances)(
|
|
28
|
+
...(0, getCOABalancesSlice_1.getCOABalances)(activeCashPosition, filter),
|
|
18
29
|
};
|
|
19
30
|
let allTimeframeTicks = [];
|
|
20
|
-
const dataAvailable = cashPositionState.dataAvailable;
|
|
21
31
|
if (dataAvailable != null) {
|
|
22
32
|
const noFilter = (0, coaBalancesFilter_1.newBalancesFilterForDateRange)(cashPositionState.firstMonthOfFY, cashPositionState.uiState.timeframe, dataAvailable, 'ascending_date', []);
|
|
23
|
-
const cashPositionBalances = (0, getCOABalancesSlice_1.getCOABalances)(
|
|
33
|
+
const cashPositionBalances = (0, getCOABalancesSlice_1.getCOABalances)(activeCashPosition, noFilter);
|
|
24
34
|
allTimeframeTicks = cashPositionBalances.balances.map((balance) => (0, timeframeTick_1.toTimeframeTick)(balance));
|
|
25
35
|
}
|
|
26
36
|
return {
|
|
@@ -34,10 +44,19 @@ const getCashPosition = (accountState, cashPositionState, filter) => {
|
|
|
34
44
|
reportTitle: cashPositionState.reportTitle,
|
|
35
45
|
version: cashPositionState.version,
|
|
36
46
|
status: cashPositionState.status,
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
// The detail screen opts into customFetchState so its loading/complete state
|
|
48
|
+
// tracks the custom fetch; the dashboard (no flag) reads the shared
|
|
49
|
+
// fetchState, which custom-mode activation reset so dashboardEpic refetches.
|
|
50
|
+
fetchState: useCustomRange && cashPositionState.customFetchState != null
|
|
51
|
+
? cashPositionState.customFetchState.fetchState
|
|
52
|
+
: cashPositionState.fetchState,
|
|
53
|
+
error: useCustomRange && cashPositionState.customFetchState != null
|
|
54
|
+
? cashPositionState.customFetchState.error
|
|
55
|
+
: cashPositionState.error,
|
|
39
56
|
insights: cashPositionState.insights ?? [],
|
|
40
57
|
downloadState: cashPositionState.uiState.downloadState,
|
|
58
|
+
// Surface the customTimeframe so the detail picker can restore the selection.
|
|
59
|
+
customTimeframe: cashPositionState.uiState.customTimeframe,
|
|
41
60
|
};
|
|
42
61
|
};
|
|
43
62
|
exports.getCashPosition = getCashPosition;
|
|
@@ -64,11 +83,11 @@ exports.getCashPositionUIState = (0, toolkit_1.createSelector)((state) => state.
|
|
|
64
83
|
exports.getCashPositionForSelectedRange = (0, toolkit_1.createSelector)((state) => state.accountState, (state) => state.cashPositionState, (accountState, cashPositionState) => {
|
|
65
84
|
const { timeframe, selectedCOABalancesRange, selectedAdditionalBalances } = cashPositionState.uiState;
|
|
66
85
|
const noFilter = (0, coaBalancesFilter_1.newBalancesFilter)(cashPositionState.firstMonthOfFY, timeframe, selectedCOABalancesRange.numberOfPeriods, selectedCOABalancesRange.thisPeriod, 'ascending_date', selectedAdditionalBalances);
|
|
67
|
-
return (0, exports.getCashPosition)(accountState, cashPositionState, noFilter);
|
|
86
|
+
return (0, exports.getCashPosition)(accountState, cashPositionState, noFilter, true);
|
|
68
87
|
});
|
|
69
88
|
exports.getCashPositionForHighlightedRange = (0, toolkit_1.createSelector)((state) => state.accountState, (state) => state.cashPositionState, (accountState, cashPositionState) => {
|
|
70
89
|
const { timeframe, highlightedCOABalancesRange, selectedAdditionalBalances, maxNumOfPeriodsToHighlight, } = cashPositionState.uiState;
|
|
71
90
|
const filter = (0, coaBalancesFilter_1.newBalancesFilter)(cashPositionState.firstMonthOfFY, timeframe, highlightedCOABalancesRange?.numberOfPeriods ??
|
|
72
91
|
maxNumOfPeriodsToHighlight, highlightedCOABalancesRange?.thisPeriod, 'ascending_date', selectedAdditionalBalances);
|
|
73
|
-
return (0, exports.getCashPosition)(accountState, cashPositionState, filter);
|
|
92
|
+
return (0, exports.getCashPosition)(accountState, cashPositionState, filter, true);
|
|
74
93
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { COABalanceGroupedWithAccountIDs } from '../../commonStateTypes/coaBalance/coaBalance';
|
|
2
|
-
import { FetchedState, ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { FetchStateAndError, FetchedState, ID } from '../../commonStateTypes/common';
|
|
3
|
+
import { DataAvailable } from '../../commonStateTypes/dataAvailable';
|
|
3
4
|
import { ReportUIState } from '../../commonStateTypes/viewAndReport/reportUIState';
|
|
4
5
|
import { Report } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
6
|
import { InsightSummary } from '../../entity/insights/insightSummary';
|
|
@@ -14,4 +15,7 @@ export interface CashPositionState extends FetchedState, Report {
|
|
|
14
15
|
insights: InsightSummary[];
|
|
15
16
|
uiState: CashPositionUIState;
|
|
16
17
|
cashPosition?: COABalanceGroupedWithAccountIDs;
|
|
18
|
+
customCashPosition?: COABalanceGroupedWithAccountIDs;
|
|
19
|
+
customDataAvailable?: DataAvailable;
|
|
20
|
+
customFetchState?: FetchStateAndError;
|
|
17
21
|
}
|
|
@@ -22,6 +22,8 @@ export declare const fetchFinanceStatementEpic: (actions$: ActionsObservable<Act
|
|
|
22
22
|
timeframe: "month" | "year" | "quarter";
|
|
23
23
|
fetchFullReport: boolean;
|
|
24
24
|
cacheOverride: boolean;
|
|
25
|
+
startDate: string | undefined;
|
|
26
|
+
endDate: string | undefined;
|
|
25
27
|
};
|
|
26
28
|
type: "balanceSheet/fetchBalanceSheetForTimeframe";
|
|
27
29
|
} | {
|
|
@@ -34,6 +36,8 @@ export declare const fetchFinanceStatementEpic: (actions$: ActionsObservable<Act
|
|
|
34
36
|
payload: {
|
|
35
37
|
timeframe: "month" | "year" | "quarter";
|
|
36
38
|
fetchFullReport: boolean;
|
|
39
|
+
startDate: string | undefined;
|
|
40
|
+
endDate: string | undefined;
|
|
37
41
|
};
|
|
38
42
|
type: "cashFlow/fetchCashFlowForTimeframe";
|
|
39
43
|
} | {
|
|
@@ -42,6 +46,8 @@ export declare const fetchFinanceStatementEpic: (actions$: ActionsObservable<Act
|
|
|
42
46
|
timeframe: "month" | "year" | "quarter";
|
|
43
47
|
fetchFullReport: boolean;
|
|
44
48
|
cacheOverride: boolean;
|
|
49
|
+
startDate: string | undefined;
|
|
50
|
+
endDate: string | undefined;
|
|
45
51
|
};
|
|
46
52
|
type: "profitAndLoss/fetchProfitAndLossForTimeframe";
|
|
47
53
|
} | {
|
|
@@ -9,6 +9,7 @@ export declare const fetchNetBurnOrIncomeWithForecastEpic: (actions$: ActionsObs
|
|
|
9
9
|
error: import("../../zeniAPIStatus").ZeniAPIStatus<Record<string, unknown>>;
|
|
10
10
|
forecastId: string | undefined;
|
|
11
11
|
timeframe: "month" | "year" | "quarter";
|
|
12
|
+
isCustomDateRange: boolean;
|
|
12
13
|
};
|
|
13
14
|
type: "net_burn_or_income/updateNetBurnOrIncomeForTimeframeFailure";
|
|
14
15
|
}[]>;
|
|
@@ -5,12 +5,12 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const netBurnOrIncomeReducer_1 = require("./netBurnOrIncomeReducer");
|
|
7
7
|
const fetchNetBurnOrIncomeEpic = (actions$, state) => actions$.pipe((0, operators_1.filter)(netBurnOrIncomeReducer_1.fetchNetBurnOrIncome.match), (0, operators_1.mergeMap)((action) => {
|
|
8
|
-
const { cacheOverride, forecastId } = action.payload;
|
|
8
|
+
const { cacheOverride, endDate, forecastId, startDate } = action.payload;
|
|
9
9
|
if (cacheOverride === true) {
|
|
10
10
|
return (0, rxjs_1.from)([
|
|
11
|
-
(0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('month', forecastId),
|
|
12
|
-
(0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('quarter', forecastId),
|
|
13
|
-
(0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('year', forecastId),
|
|
11
|
+
(0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('month', forecastId, true, false, startDate, endDate),
|
|
12
|
+
(0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('quarter', forecastId, true, false, startDate, endDate),
|
|
13
|
+
(0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('year', forecastId, true, false, startDate, endDate),
|
|
14
14
|
]);
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
@@ -19,15 +19,15 @@ const fetchNetBurnOrIncomeEpic = (actions$, state) => actions$.pipe((0, operator
|
|
|
19
19
|
const timeframeFetchState = netBurnOrIncomeState.fetchState;
|
|
20
20
|
if (timeframeFetchState['month'].fetchState !== 'In-Progress' &&
|
|
21
21
|
timeframeFetchState['month'].fetchState !== 'Completed') {
|
|
22
|
-
fetchActions.push((0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('month', forecastId));
|
|
22
|
+
fetchActions.push((0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('month', forecastId, true, false, startDate, endDate));
|
|
23
23
|
}
|
|
24
24
|
if (timeframeFetchState['quarter'].fetchState !== 'In-Progress' &&
|
|
25
25
|
timeframeFetchState['quarter'].fetchState !== 'Completed') {
|
|
26
|
-
fetchActions.push((0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('quarter', forecastId));
|
|
26
|
+
fetchActions.push((0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('quarter', forecastId, true, false, startDate, endDate));
|
|
27
27
|
}
|
|
28
28
|
if (timeframeFetchState['year'].fetchState !== 'In-Progress' &&
|
|
29
29
|
timeframeFetchState['year'].fetchState !== 'Completed') {
|
|
30
|
-
fetchActions.push((0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('year', forecastId));
|
|
30
|
+
fetchActions.push((0, netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe)('year', forecastId, true, false, startDate, endDate));
|
|
31
31
|
}
|
|
32
32
|
return (0, rxjs_1.from)(fetchActions);
|
|
33
33
|
}
|
|
@@ -7,5 +7,6 @@ import { RootState } from '../../rootStateTypes';
|
|
|
7
7
|
import { ZeniAPI } from '../../zeniAPI';
|
|
8
8
|
import { fetchNetBurnOrIncomeForTimeframe, updateNetBurnOrIncomeForTimeframe, updateNetBurnOrIncomeForTimeframeFailure, updateNetBurnOrIncomeThisPeriod } from './netBurnOrIncomeReducer';
|
|
9
9
|
export type ActionType = ReturnType<typeof fetchNetBurnOrIncomeForTimeframe> | ReturnType<typeof updateNetBurnOrIncomeForTimeframe> | ReturnType<typeof updateNetBurnOrIncomeForTimeframeFailure> | ReturnType<typeof updateSectionAccountsView> | ReturnType<typeof updateCalculatedSectionAccountsView> | ReturnType<typeof updateForecast> | ReturnType<typeof updateNetBurnOrIncomeThisPeriod>;
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const CUSTOM_DATE_RANGE_SECTION_MARKER: ID;
|
|
11
|
+
export declare const reportIdUniqueKey: (forecastId?: ID, isCustomDateRange?: boolean) => "net_burn_or_income" | `net_burn_or_income+${string}`;
|
|
11
12
|
export declare const fetchNetBurnOrIncomeForTimeframeEpic: (actions$: ActionsObservable<ActionType>, state: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchNetBurnOrIncomeForTimeframeEpic = exports.reportIdUniqueKey = void 0;
|
|
3
|
+
exports.fetchNetBurnOrIncomeForTimeframeEpic = exports.reportIdUniqueKey = exports.CUSTOM_DATE_RANGE_SECTION_MARKER = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const forecastReducer_1 = require("../../entity/forecast/forecastReducer");
|
|
@@ -8,9 +8,15 @@ const sectionAccountsViewReducer_1 = require("../../entity/sectionAccountsView/s
|
|
|
8
8
|
const responsePayload_1 = require("../../responsePayload");
|
|
9
9
|
const reportsHelpers_1 = require("../common/reportsHelpers");
|
|
10
10
|
const netBurnOrIncomeReducer_1 = require("./netBurnOrIncomeReducer");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// Reserved forecast-slot marker so custom-date section-accounts data lives under
|
|
12
|
+
// its own key (net_burn_or_income+<marker>) and a default fetch can never
|
|
13
|
+
// overwrite it. Real forecast ids are UUIDs, so this never collides.
|
|
14
|
+
exports.CUSTOM_DATE_RANGE_SECTION_MARKER = '__custom_date_range__';
|
|
15
|
+
const reportIdUniqueKey = (forecastId, isCustomDateRange) => isCustomDateRange === true
|
|
16
|
+
? `net_burn_or_income+${exports.CUSTOM_DATE_RANGE_SECTION_MARKER}`
|
|
17
|
+
: forecastId != null
|
|
18
|
+
? `net_burn_or_income+${forecastId}`
|
|
19
|
+
: 'net_burn_or_income';
|
|
14
20
|
exports.reportIdUniqueKey = reportIdUniqueKey;
|
|
15
21
|
const fetchNetBurnOrIncomeForTimeframeEpic = (actions$, state, zeniAPI) => actions$.pipe((0, operators_1.filter)(netBurnOrIncomeReducer_1.fetchNetBurnOrIncomeForTimeframe.match), (0, operators_1.mergeMap)((action) => {
|
|
16
22
|
const queryValue = {
|
|
@@ -22,20 +28,27 @@ const fetchNetBurnOrIncomeForTimeframeEpic = (actions$, state, zeniAPI) => actio
|
|
|
22
28
|
queryValue.forecast_id = action.payload.forecastId;
|
|
23
29
|
queryValue.is_forecast_vs_actual = true;
|
|
24
30
|
}
|
|
31
|
+
if (action.payload.startDate != null && action.payload.endDate != null) {
|
|
32
|
+
queryValue.custom_start_date = action.payload.startDate;
|
|
33
|
+
queryValue.custom_end_date = action.payload.endDate;
|
|
34
|
+
}
|
|
25
35
|
return zeniAPI
|
|
26
36
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/2.0/reports/net_burn_or_income?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
|
|
27
37
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
28
38
|
if (response.data != null && (0, responsePayload_1.isSuccessResponse)(response)) {
|
|
29
39
|
const actions = [];
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
actions.push((0, sectionAccountsViewReducer_1.updateSectionAccountsView)(action.payload.timeframe, '
|
|
33
|
-
actions.push((0, sectionAccountsViewReducer_1.
|
|
34
|
-
actions.push((0, sectionAccountsViewReducer_1.
|
|
40
|
+
const isCustomDateRange = action.payload.startDate != null &&
|
|
41
|
+
action.payload.endDate != null;
|
|
42
|
+
actions.push((0, sectionAccountsViewReducer_1.updateSectionAccountsView)(action.payload.timeframe, 'cogs', (0, exports.reportIdUniqueKey)(action.payload.forecastId, isCustomDateRange), response.data.report.cogs, response.data.report.accounts, response.data.report.account_groups, response.data.report.currency));
|
|
43
|
+
actions.push((0, sectionAccountsViewReducer_1.updateSectionAccountsView)(action.payload.timeframe, 'expenses', (0, exports.reportIdUniqueKey)(action.payload.forecastId, isCustomDateRange), response.data.report.expenses, response.data.report.accounts, response.data.report.account_groups, response.data.report.currency));
|
|
44
|
+
actions.push((0, sectionAccountsViewReducer_1.updateSectionAccountsView)(action.payload.timeframe, 'income', (0, exports.reportIdUniqueKey)(action.payload.forecastId, isCustomDateRange), response.data.report.income, response.data.report.accounts, response.data.report.account_groups, response.data.report.currency));
|
|
45
|
+
actions.push((0, sectionAccountsViewReducer_1.updateCalculatedSectionAccountsView)(action.payload.timeframe, 'grossBurn', (0, exports.reportIdUniqueKey)(action.payload.forecastId, isCustomDateRange), response.data.report.gross_burn, response.data.report.currency));
|
|
46
|
+
actions.push((0, sectionAccountsViewReducer_1.updateCalculatedSectionAccountsView)(action.payload.timeframe, 'netBurnOrIncome', (0, exports.reportIdUniqueKey)(action.payload.forecastId, isCustomDateRange), response.data.report.net_burn_or_income, response.data.report.currency));
|
|
35
47
|
actions.push((0, netBurnOrIncomeReducer_1.updateNetBurnOrIncomeForTimeframe)({
|
|
36
48
|
timeframe: action.payload.timeframe,
|
|
37
49
|
forecastId: action.payload.forecastId,
|
|
38
50
|
report: response.data,
|
|
51
|
+
isCustomDateRange,
|
|
39
52
|
}));
|
|
40
53
|
if (action.payload.forecastId == null &&
|
|
41
54
|
action.payload.timeframe === 'month') {
|
|
@@ -50,9 +63,11 @@ const fetchNetBurnOrIncomeForTimeframeEpic = (actions$, state, zeniAPI) => actio
|
|
|
50
63
|
return (0, rxjs_1.from)(actions);
|
|
51
64
|
}
|
|
52
65
|
else {
|
|
53
|
-
return (0, rxjs_1.of)((0, netBurnOrIncomeReducer_1.updateNetBurnOrIncomeForTimeframeFailure)(response.status, action.payload.forecastId, action.payload.timeframe
|
|
66
|
+
return (0, rxjs_1.of)((0, netBurnOrIncomeReducer_1.updateNetBurnOrIncomeForTimeframeFailure)(response.status, action.payload.forecastId, action.payload.timeframe, action.payload.startDate != null &&
|
|
67
|
+
action.payload.endDate != null));
|
|
54
68
|
}
|
|
55
69
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, netBurnOrIncomeReducer_1.updateNetBurnOrIncomeForTimeframeFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Net burn or income REST API call errored out' +
|
|
56
|
-
JSON.stringify(error)), action.payload.forecastId, action.payload.timeframe
|
|
70
|
+
JSON.stringify(error)), action.payload.forecastId, action.payload.timeframe, action.payload.startDate != null &&
|
|
71
|
+
action.payload.endDate != null))));
|
|
57
72
|
}));
|
|
58
73
|
exports.fetchNetBurnOrIncomeForTimeframeEpic = fetchNetBurnOrIncomeForTimeframeEpic;
|
|
@@ -10,23 +10,29 @@ export declare const defaultPeriods: {
|
|
|
10
10
|
};
|
|
11
11
|
export declare const initialNetBurnOrIncomeState: NetBurnOrIncomeState;
|
|
12
12
|
export declare const initialState: NetBurnOrIncomeWithForecastState;
|
|
13
|
-
export declare const fetchNetBurnOrIncome: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchFullReport?: any, forecastId?: string | undefined, cacheOverride?: any], {
|
|
13
|
+
export declare const fetchNetBurnOrIncome: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchFullReport?: any, forecastId?: string | undefined, cacheOverride?: any, startDate?: string | undefined, endDate?: string | undefined], {
|
|
14
14
|
fetchFullReport: any;
|
|
15
15
|
forecastId: string | undefined;
|
|
16
16
|
cacheOverride: any;
|
|
17
|
-
|
|
17
|
+
startDate: string | undefined;
|
|
18
|
+
endDate: string | undefined;
|
|
19
|
+
}, "net_burn_or_income/fetchNetBurnOrIncome", never, never>, fetchNetBurnOrIncomeForTimeframe: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[timeframe: "month" | "year" | "quarter", forecastId?: string | undefined, fetchFullReport?: boolean | undefined, cacheOverride?: boolean | undefined, startDate?: string | undefined, endDate?: string | undefined], {
|
|
18
20
|
forecastId: string | undefined;
|
|
19
21
|
timeframe: "month" | "year" | "quarter";
|
|
20
22
|
fetchFullReport: boolean;
|
|
21
23
|
cacheOverride: boolean;
|
|
24
|
+
startDate: string | undefined;
|
|
25
|
+
endDate: string | undefined;
|
|
22
26
|
}, "net_burn_or_income/fetchNetBurnOrIncomeForTimeframe", never, never>, updateNetBurnOrIncomeForTimeframe: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
23
27
|
forecastId: string | undefined;
|
|
24
28
|
report: ZeniReportData<NetBurnOrIncomePayload>;
|
|
25
29
|
timeframe: "month" | "quarter" | "year";
|
|
26
|
-
|
|
30
|
+
isCustomDateRange?: boolean;
|
|
31
|
+
}, "net_burn_or_income/updateNetBurnOrIncomeForTimeframe">, updateNetBurnOrIncomeForTimeframeFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>, forecastId: string | undefined, timeframe: "month" | "year" | "quarter", isCustomDateRange?: boolean | undefined], {
|
|
27
32
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
28
33
|
forecastId: string | undefined;
|
|
29
34
|
timeframe: "month" | "year" | "quarter";
|
|
35
|
+
isCustomDateRange: boolean;
|
|
30
36
|
}, "net_burn_or_income/updateNetBurnOrIncomeForTimeframeFailure", never, never>, updateNetBurnOrIncomeThisPeriod: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
31
37
|
thisPeriod: TimeframeTick | undefined;
|
|
32
38
|
}, "net_burn_or_income/updateNetBurnOrIncomeThisPeriod">, updateNetBurnOrIncomeUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -45,7 +51,10 @@ export declare const fetchNetBurnOrIncome: import("@reduxjs/toolkit").ActionCrea
|
|
|
45
51
|
maxNumOfPeriodsToHighlight: number;
|
|
46
52
|
}, "net_burn_or_income/updateNetBurnOrIncomeAdditionalBalancesSelection">, updateNetBurnOrIncomeCOABalancesRange: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
47
53
|
selectedCOABalancesRange: COABalancesRange;
|
|
54
|
+
customEndDate?: string;
|
|
55
|
+
customStartDate?: string;
|
|
48
56
|
highlightedCOABalancesRange?: COABalancesRangeWithThisPeriod;
|
|
57
|
+
isCustomDateRange?: boolean;
|
|
49
58
|
}, "net_burn_or_income/updateNetBurnOrIncomeCOABalancesRange">, netBurnOrIncomeToggleForecastMode: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
50
59
|
isForecastModeOn: boolean;
|
|
51
60
|
maxNumOfPeriodsToHighlightWithForecast: number;
|