@zeniai/client-epic-state 5.0.21-betaRD1 → 5.0.21-betaRD2
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/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +10 -2
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +9 -1
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.d.ts +1 -1
- package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +9 -1
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +8 -0
- package/package.json +1 -1
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { from, of } from 'rxjs';
|
|
1
|
+
import { EMPTY, from, of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateProjects } from '../../entity/project/projectReducer';
|
|
4
4
|
import { updateSectionProjectView } from '../../entity/sectionProjectView/sectionProjectViewReducer';
|
|
5
|
+
import { getIsAccountingProjectsEnabled } from '../../entity/tenant/tenantSelector';
|
|
5
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
|
|
6
7
|
import { fetchProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectViewFailure, } from './profitAndLossProjectViewReducer';
|
|
7
|
-
export const fetchProfitAndLossForTimeframeProjectViewEpic = (actions$,
|
|
8
|
+
export const fetchProfitAndLossForTimeframeProjectViewEpic = (actions$, state, zeniAPI) => actions$.pipe(filter(fetchProfitAndLossForTimeframeProjectView.match), mergeMap((action) => {
|
|
9
|
+
// Tenant-level guard mirroring fetchProfitAndLossProjectViewEpic.
|
|
10
|
+
// Defends against any direct dispatches of this leaf action (e.g.
|
|
11
|
+
// ReportsScreen's per-timeframe useEffect) when projects accounting
|
|
12
|
+
// isn't enabled for the current tenant.
|
|
13
|
+
if (getIsAccountingProjectsEnabled(state.value) === false) {
|
|
14
|
+
return EMPTY;
|
|
15
|
+
}
|
|
8
16
|
const getTimeSeriesGroup = (timeframe) => {
|
|
9
17
|
switch (timeframe) {
|
|
10
18
|
case 'month':
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
1
|
+
import { EMPTY, from } from 'rxjs';
|
|
2
2
|
import { filter, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { getIsAccountingProjectsEnabled } from '../../entity/tenant/tenantSelector';
|
|
3
4
|
import { fetchProfitAndLossForTimeframeProjectView, fetchProfitAndLossProjectView, } from './profitAndLossProjectViewReducer';
|
|
4
5
|
export const fetchProfitAndLossProjectViewEpic = (actions$, state) => actions$.pipe(filter(fetchProfitAndLossProjectView.match), switchMap((action) => {
|
|
6
|
+
// Tenant-level guard: when projects accounting isn't enabled for the
|
|
7
|
+
// current tenant, the View By dropdown hides "Project" and the API
|
|
8
|
+
// would either error or return empty. Skip the fetch entirely so we
|
|
9
|
+
// don't fan out three timeframe requests on every dropdown open.
|
|
10
|
+
if (getIsAccountingProjectsEnabled(state.value) === false) {
|
|
11
|
+
return EMPTY;
|
|
12
|
+
}
|
|
5
13
|
const { cacheOverride } = action.payload;
|
|
6
14
|
if (cacheOverride === true) {
|
|
7
15
|
return from([
|