@zeniai/client-epic-state 5.2.35-beta6MM → 5.2.35-beta7MM
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/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +5 -9
- package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +1 -9
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +13 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +35 -16
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -5
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewReducer.js +2 -1
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -1
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +1 -2
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +5 -9
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +1 -2
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +1 -9
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +13 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.d.ts +5 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +34 -15
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +1 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -5
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +2 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -1
- package/package.json +1 -1
package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js
CHANGED
|
@@ -3,7 +3,6 @@ import { filter, switchMap } from 'rxjs/operators';
|
|
|
3
3
|
import { convertToPeriod, toAbsoluteDay, toMonthYearPeriodId, } from '../../../../commonStateTypes/timePeriod';
|
|
4
4
|
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
5
|
import { fetchAllExpenseAutomationTabs } from '../../expenseAutomationViewReducer';
|
|
6
|
-
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
7
6
|
import { fetchFluxAnalysisView } from '../../reducers/fluxAnalysisViewReducer';
|
|
8
7
|
import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
|
|
9
8
|
import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
|
|
@@ -11,7 +10,7 @@ import { fetchReconciliation } from '../../reducers/reconciliationViewReducer';
|
|
|
11
10
|
import { fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
|
|
12
11
|
import { getJESchedulePeriodTabKey } from '../../types/jeSchedulesViewState';
|
|
13
12
|
export const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe(filter(fetchAllExpenseAutomationTabs.match), switchMap((action) => {
|
|
14
|
-
const { cacheOverride, refreshViewInBackground } = action.payload;
|
|
13
|
+
const { cacheOverride, refreshViewInBackground, isAccrualEnabled } = action.payload;
|
|
15
14
|
const state = state$.value;
|
|
16
15
|
const { monthEndCloseChecksState } = state;
|
|
17
16
|
const { monthEndCloseChecksByTenantId } = monthEndCloseChecksState;
|
|
@@ -32,14 +31,11 @@ export const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.
|
|
|
32
31
|
}
|
|
33
32
|
if (cacheOverride === true) {
|
|
34
33
|
const actions = [];
|
|
35
|
-
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
36
34
|
actions.push(fetchTransactionCategorizationView(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, cacheOverride, false, undefined, undefined, refreshViewInBackground, false), fetchMissingReceipts({ start: timePeriodStart, end: timePeriodEnd }, {
|
|
37
35
|
amount: 75.0,
|
|
38
36
|
currencyCode: 'USD',
|
|
39
37
|
currencySymbol: '$',
|
|
40
|
-
}, cacheOverride, refreshViewInBackground), fetchFluxAnalysisView(selectedPeriod, cacheOverride, refreshViewInBackground, null),
|
|
41
|
-
? fetchActualMatchingPage({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride)
|
|
42
|
-
: fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride));
|
|
38
|
+
}, cacheOverride, refreshViewInBackground), fetchFluxAnalysisView(selectedPeriod, cacheOverride, refreshViewInBackground, null), fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
43
39
|
if (reconciliationEnabled) {
|
|
44
40
|
actions.push(fetchReconciliation(selectedPeriod, undefined, cacheOverride, refreshViewInBackground));
|
|
45
41
|
}
|
|
@@ -66,7 +62,7 @@ export const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.
|
|
|
66
62
|
}
|
|
67
63
|
// The two JE tabs cache separately, so only the tab actually being shown decides whether a
|
|
68
64
|
// fetch is still needed. Actual Matching is a third tab on the same page with its own
|
|
69
|
-
// endpoint
|
|
65
|
+
// endpoint; fetchJeSchedulesPage carries isAccrualEnabled so the prefetch epic can warm AM.
|
|
70
66
|
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
71
67
|
if (selectedPageTab === 'actual_matching') {
|
|
72
68
|
const actualMatchingPeriodKeys = state.expenseAutomationActualMatchingViewState.matchIdsByPeriod[monthYearPeriodId];
|
|
@@ -74,7 +70,7 @@ export const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.
|
|
|
74
70
|
'In-Progress' &&
|
|
75
71
|
(!state.expenseAutomationActualMatchingViewState.hasValidState() ||
|
|
76
72
|
actualMatchingPeriodKeys == null)) {
|
|
77
|
-
fetchActions.push(
|
|
73
|
+
fetchActions.push(fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
78
74
|
}
|
|
79
75
|
}
|
|
80
76
|
else {
|
|
@@ -86,7 +82,7 @@ export const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.
|
|
|
86
82
|
.jeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null ||
|
|
87
83
|
state.expenseAutomationJESchedulesViewState
|
|
88
84
|
.failedJeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null)) {
|
|
89
|
-
fetchActions.push(fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride));
|
|
85
|
+
fetchActions.push(fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
90
86
|
}
|
|
91
87
|
}
|
|
92
88
|
if (state.expenseAutomationReconciliationViewState.fetchState !==
|
package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js
CHANGED
|
@@ -4,7 +4,6 @@ import { convertToPeriod, toAbsoluteDay, } from '../../../../commonStateTypes/ti
|
|
|
4
4
|
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
5
|
import { fetchCompanyMonthEndReportTemplates, fetchCompanyMonthEndReportView, } from '../../../companyMonthEndReportView/companyMonthEndReportViewReducer';
|
|
6
6
|
import { refreshExpenseAutomationCurrentTab } from '../../expenseAutomationViewReducer';
|
|
7
|
-
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
8
7
|
import { fetchFluxAnalysisView } from '../../reducers/fluxAnalysisViewReducer';
|
|
9
8
|
import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
|
|
10
9
|
import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
|
|
@@ -39,17 +38,10 @@ export const refreshExpenseAutomationCurrentTabEpic = (actions$, state$) => acti
|
|
|
39
38
|
return from([
|
|
40
39
|
fetchFluxAnalysisView(selectedPeriod, true, true, null),
|
|
41
40
|
]);
|
|
42
|
-
case 'je_schedules':
|
|
43
|
-
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
44
|
-
if (selectedPageTab === 'actual_matching') {
|
|
45
|
-
return from([
|
|
46
|
-
fetchActualMatchingPage({ start: timePeriodStart, end: timePeriodEnd }, true),
|
|
47
|
-
]);
|
|
48
|
-
}
|
|
41
|
+
case 'je_schedules':
|
|
49
42
|
return from([
|
|
50
43
|
fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, true),
|
|
51
44
|
]);
|
|
52
|
-
}
|
|
53
45
|
case 'month_end_insights':
|
|
54
46
|
return from([
|
|
55
47
|
fetchCompanyMonthEndReportView(true, companyId, currentTenant.tenantId, period.end, true),
|
|
@@ -2,24 +2,34 @@ import { concat, from } from 'rxjs';
|
|
|
2
2
|
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { fetchAccountList } from '../../../accountList/accountListReducer';
|
|
4
4
|
import { getAccountsTypesForScheduleEpics } from '../../../scheduleView/scheduleListView/scheduleListHelper';
|
|
5
|
+
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
5
6
|
import { fetchJeSchedules, fetchJeSchedulesPage, initializeAccountSettingsView, } from '../../reducers/jeSchedulesViewReducer';
|
|
6
7
|
export const fetchJeSchedulesPageEpic = (actions$, state$) => actions$.pipe(filter(fetchJeSchedulesPage.match), mergeMap((action) => {
|
|
7
8
|
const jeSchedulePageActions = [];
|
|
8
9
|
const { period, refreshViewInBackground } = action.payload;
|
|
10
|
+
const state = state$.value;
|
|
11
|
+
const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
|
|
9
12
|
const accountType = getAccountsTypesForScheduleEpics();
|
|
10
|
-
const accountListState = state
|
|
13
|
+
const accountListState = state.accountListState;
|
|
11
14
|
if (accountListState.byReportId[accountType.accountListKey].fetchState ===
|
|
12
15
|
'Not-Started') {
|
|
13
16
|
// call this only if the account list for schedules is not fetched already
|
|
14
17
|
jeSchedulePageActions.push(fetchAccountList(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
|
|
15
18
|
}
|
|
16
|
-
|
|
19
|
+
// AM is chrome on this page but a different endpoint. fetchJeSchedules with
|
|
20
|
+
// selectedPageTab === 'actual_matching' would hit /1.0/schedules and write a bogus cache slot.
|
|
21
|
+
if (selectedPageTab === 'actual_matching') {
|
|
22
|
+
jeSchedulePageActions.push(fetchActualMatchingPage(period, refreshViewInBackground));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
jeSchedulePageActions.push(fetchJeSchedules(period, refreshViewInBackground));
|
|
26
|
+
}
|
|
17
27
|
// Only on the first page load. Account settings cannot change from a tab switch or a
|
|
18
28
|
// refresh, and re-initializing puts accountSettingsView back to 'In-Progress' -- which the
|
|
19
29
|
// page reads as "still loading" and answers with a full skeleton over rows it already has.
|
|
20
30
|
// The action also resets localData, so re-dispatching it blindly would empty the settings
|
|
21
31
|
// form until the refetch lands. Saving account settings still re-initializes explicitly.
|
|
22
|
-
if (!state
|
|
32
|
+
if (!state.expenseAutomationJESchedulesViewState.accountSettings
|
|
23
33
|
.hasLoadedAccountSettings) {
|
|
24
34
|
jeSchedulePageActions.push(initializeAccountSettingsView());
|
|
25
35
|
}
|
package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { EMPTY,
|
|
1
|
+
import { EMPTY, from } from 'rxjs';
|
|
2
2
|
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { toMonthYearPeriodId } from '../../../../commonStateTypes/timePeriod';
|
|
4
4
|
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
|
+
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
5
6
|
import { fetchJeSchedules, fetchJeSchedulesPage, } from '../../reducers/jeSchedulesViewReducer';
|
|
6
7
|
import { ALL_JE_PAGE_TABS, getJESchedulePeriodTabKey, } from '../../types/jeSchedulesViewState';
|
|
7
8
|
/**
|
|
@@ -9,29 +10,47 @@ import { ALL_JE_PAGE_TABS, getJESchedulePeriodTabKey, } from '../../types/jeSche
|
|
|
9
10
|
*
|
|
10
11
|
* Listens for `fetchJeSchedulesPage` rather than `fetchJeSchedules` on purpose: the prefetch emits
|
|
11
12
|
* `fetchJeSchedules`, so listening for that would make this epic feed itself.
|
|
13
|
+
*
|
|
14
|
+
* Review <-> Existing share `/1.0/schedules`. Actual Matching is a different endpoint; it is
|
|
15
|
+
* warmed with `fetchActualMatchingPage` when the page action carries `isAccrualEnabled`.
|
|
12
16
|
*/
|
|
13
17
|
export const prefetchOtherJeSchedulesTabEpic = (actions$, state$) => actions$.pipe(filter(fetchJeSchedulesPage.match), mergeMap((action) => {
|
|
14
18
|
const state = state$.value;
|
|
15
|
-
const { period } = action.payload;
|
|
19
|
+
const { period, isAccrualEnabled } = action.payload;
|
|
16
20
|
const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
|
|
17
|
-
|
|
18
|
-
//
|
|
21
|
+
const actions = [];
|
|
22
|
+
// AM is chrome-only on ALL_JE_PAGE_TABS; warming it with fetchJeSchedules
|
|
23
|
+
// would hit the wrong endpoint.
|
|
19
24
|
const otherPageTab = ALL_JE_PAGE_TABS.find((pageTab) => pageTab !== selectedPageTab && pageTab !== 'actual_matching');
|
|
20
|
-
if (otherPageTab == null) {
|
|
21
|
-
return EMPTY;
|
|
22
|
-
}
|
|
23
25
|
const currentTenant = getCurrentTenant(state);
|
|
24
26
|
const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
|
|
25
|
-
if (selectedPeriod
|
|
26
|
-
|
|
27
|
+
if (otherPageTab != null && selectedPeriod != null) {
|
|
28
|
+
const otherPeriodTabKey = getJESchedulePeriodTabKey(otherPageTab, toMonthYearPeriodId(selectedPeriod));
|
|
29
|
+
const isOtherTabAlreadyLoaded = state.expenseAutomationJESchedulesViewState
|
|
30
|
+
.jeScheduleTransactionKeysByPeriodAndTab[otherPeriodTabKey] != null;
|
|
31
|
+
if (!isOtherTabAlreadyLoaded) {
|
|
32
|
+
actions.push(fetchJeSchedules(period, true, otherPageTab));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// GET /actual-matching is not Statsig-gated; CES has no Statsig. The screen
|
|
36
|
+
// passes is_accrual_enabled so disabled tenants do not pay for a list they
|
|
37
|
+
// cannot open. Visible AM is fetchJeSchedulesPageEpic's job.
|
|
38
|
+
if (isAccrualEnabled === true &&
|
|
39
|
+
selectedPageTab !== 'actual_matching') {
|
|
40
|
+
const periodId = toMonthYearPeriodId({
|
|
41
|
+
month: period.start.month,
|
|
42
|
+
year: period.start.year,
|
|
43
|
+
});
|
|
44
|
+
const actualMatching = state.expenseAutomationActualMatchingViewState;
|
|
45
|
+
const amAlreadyLoading = actualMatching.fetchState === 'In-Progress' ||
|
|
46
|
+
actualMatching.refreshStatus.fetchState === 'In-Progress';
|
|
47
|
+
if (!amAlreadyLoading &&
|
|
48
|
+
actualMatching.matchIdsByPeriod[periodId] == null) {
|
|
49
|
+
actions.push(fetchActualMatchingPage(period, true));
|
|
50
|
+
}
|
|
27
51
|
}
|
|
28
|
-
|
|
29
|
-
// just left, since a switch also fires fetchJeSchedulesPage.
|
|
30
|
-
const otherPeriodTabKey = getJESchedulePeriodTabKey(otherPageTab, toMonthYearPeriodId(selectedPeriod));
|
|
31
|
-
const isOtherTabAlreadyLoaded = state.expenseAutomationJESchedulesViewState
|
|
32
|
-
.jeScheduleTransactionKeysByPeriodAndTab[otherPeriodTabKey] != null;
|
|
33
|
-
if (isOtherTabAlreadyLoaded) {
|
|
52
|
+
if (actions.length === 0) {
|
|
34
53
|
return EMPTY;
|
|
35
54
|
}
|
|
36
|
-
return
|
|
55
|
+
return from(actions);
|
|
37
56
|
}));
|
|
@@ -2,7 +2,6 @@ import { EMPTY, of } from 'rxjs';
|
|
|
2
2
|
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { convertToPeriod, toAbsoluteDay, } from '../../../../commonStateTypes/timePeriod';
|
|
4
4
|
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
|
-
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
6
5
|
import { fetchJeSchedulesPage, updateJESchedulesUIState, } from '../../reducers/jeSchedulesViewReducer';
|
|
7
6
|
export const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe(filter(updateJESchedulesUIState.match), filter((action) => action.payload.selectedPageTab != null), mergeMap(() => {
|
|
8
7
|
const state = state$.value;
|
|
@@ -25,9 +24,5 @@ export const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe(filt
|
|
|
25
24
|
if (timePeriodStart == null || timePeriodEnd == null) {
|
|
26
25
|
return EMPTY;
|
|
27
26
|
}
|
|
28
|
-
const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
|
|
29
|
-
if (selectedPageTab === 'actual_matching') {
|
|
30
|
-
return of(fetchActualMatchingPage({ start: timePeriodStart, end: timePeriodEnd }, true));
|
|
31
|
-
}
|
|
32
27
|
return of(fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, true));
|
|
33
28
|
}));
|
|
@@ -19,11 +19,12 @@ const expenseAutomationView = createSlice({
|
|
|
19
19
|
reducer() {
|
|
20
20
|
//do nothing
|
|
21
21
|
},
|
|
22
|
-
prepare(cacheOverride = false, refreshViewInBackground = false) {
|
|
22
|
+
prepare(cacheOverride = false, refreshViewInBackground = false, isAccrualEnabled = false) {
|
|
23
23
|
return {
|
|
24
24
|
payload: {
|
|
25
25
|
cacheOverride,
|
|
26
26
|
refreshViewInBackground,
|
|
27
|
+
isAccrualEnabled,
|
|
27
28
|
},
|
|
28
29
|
};
|
|
29
30
|
},
|
|
@@ -105,11 +105,12 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
105
105
|
initialState,
|
|
106
106
|
reducers: {
|
|
107
107
|
fetchJeSchedulesPage: {
|
|
108
|
-
prepare(period, refreshViewInBackground = false) {
|
|
108
|
+
prepare(period, refreshViewInBackground = false, isAccrualEnabled = false) {
|
|
109
109
|
return {
|
|
110
110
|
payload: {
|
|
111
111
|
period,
|
|
112
112
|
refreshViewInBackground,
|
|
113
|
+
isAccrualEnabled,
|
|
113
114
|
},
|
|
114
115
|
};
|
|
115
116
|
},
|
|
@@ -3,11 +3,10 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
import { RootState } from '../../../../rootStateTypes';
|
|
4
4
|
import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
|
|
5
5
|
import { fetchAllExpenseAutomationTabs } from '../../expenseAutomationViewReducer';
|
|
6
|
-
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
7
6
|
import { fetchFluxAnalysisView } from '../../reducers/fluxAnalysisViewReducer';
|
|
8
7
|
import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
|
|
9
8
|
import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
|
|
10
9
|
import { fetchReconciliation } from '../../reducers/reconciliationViewReducer';
|
|
11
10
|
import { fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
|
|
12
|
-
export type ActionType = ReturnType<typeof fetchAllExpenseAutomationTabs> | ReturnType<typeof
|
|
11
|
+
export type ActionType = ReturnType<typeof fetchAllExpenseAutomationTabs> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchTransactionCategorizationView>;
|
|
13
12
|
export declare const fetchAllExpenseAutomationTabsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -6,7 +6,6 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
7
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
8
|
const expenseAutomationViewReducer_1 = require("../../expenseAutomationViewReducer");
|
|
9
|
-
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
10
9
|
const fluxAnalysisViewReducer_1 = require("../../reducers/fluxAnalysisViewReducer");
|
|
11
10
|
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
12
11
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
@@ -14,7 +13,7 @@ const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewRe
|
|
|
14
13
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
15
14
|
const jeSchedulesViewState_1 = require("../../types/jeSchedulesViewState");
|
|
16
15
|
const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expenseAutomationViewReducer_1.fetchAllExpenseAutomationTabs.match), (0, operators_1.switchMap)((action) => {
|
|
17
|
-
const { cacheOverride, refreshViewInBackground } = action.payload;
|
|
16
|
+
const { cacheOverride, refreshViewInBackground, isAccrualEnabled } = action.payload;
|
|
18
17
|
const state = state$.value;
|
|
19
18
|
const { monthEndCloseChecksState } = state;
|
|
20
19
|
const { monthEndCloseChecksByTenantId } = monthEndCloseChecksState;
|
|
@@ -35,14 +34,11 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
35
34
|
}
|
|
36
35
|
if (cacheOverride === true) {
|
|
37
36
|
const actions = [];
|
|
38
|
-
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
39
37
|
actions.push((0, transactionsViewReducer_1.fetchTransactionCategorizationView)(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, cacheOverride, false, undefined, undefined, refreshViewInBackground, false), (0, missingReceiptsViewReducer_1.fetchMissingReceipts)({ start: timePeriodStart, end: timePeriodEnd }, {
|
|
40
38
|
amount: 75.0,
|
|
41
39
|
currencyCode: 'USD',
|
|
42
40
|
currencySymbol: '$',
|
|
43
|
-
}, cacheOverride, refreshViewInBackground), (0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, cacheOverride, refreshViewInBackground, null),
|
|
44
|
-
? (0, actualMatchingViewReducer_1.fetchActualMatchingPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride)
|
|
45
|
-
: (0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride));
|
|
41
|
+
}, cacheOverride, refreshViewInBackground), (0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, cacheOverride, refreshViewInBackground, null), (0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
46
42
|
if (reconciliationEnabled) {
|
|
47
43
|
actions.push((0, reconciliationViewReducer_1.fetchReconciliation)(selectedPeriod, undefined, cacheOverride, refreshViewInBackground));
|
|
48
44
|
}
|
|
@@ -69,7 +65,7 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
69
65
|
}
|
|
70
66
|
// The two JE tabs cache separately, so only the tab actually being shown decides whether a
|
|
71
67
|
// fetch is still needed. Actual Matching is a third tab on the same page with its own
|
|
72
|
-
// endpoint
|
|
68
|
+
// endpoint; fetchJeSchedulesPage carries isAccrualEnabled so the prefetch epic can warm AM.
|
|
73
69
|
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
74
70
|
if (selectedPageTab === 'actual_matching') {
|
|
75
71
|
const actualMatchingPeriodKeys = state.expenseAutomationActualMatchingViewState.matchIdsByPeriod[monthYearPeriodId];
|
|
@@ -77,7 +73,7 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
77
73
|
'In-Progress' &&
|
|
78
74
|
(!state.expenseAutomationActualMatchingViewState.hasValidState() ||
|
|
79
75
|
actualMatchingPeriodKeys == null)) {
|
|
80
|
-
fetchActions.push((0,
|
|
76
|
+
fetchActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
81
77
|
}
|
|
82
78
|
}
|
|
83
79
|
else {
|
|
@@ -89,7 +85,7 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
89
85
|
.jeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null ||
|
|
90
86
|
state.expenseAutomationJESchedulesViewState
|
|
91
87
|
.failedJeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null)) {
|
|
92
|
-
fetchActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride));
|
|
88
|
+
fetchActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
91
|
if (state.expenseAutomationReconciliationViewState.fetchState !==
|
package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts
CHANGED
|
@@ -4,11 +4,10 @@ import { RootState } from '../../../../rootStateTypes';
|
|
|
4
4
|
import { fetchCompanyMonthEndReportTemplates, fetchCompanyMonthEndReportView } from '../../../companyMonthEndReportView/companyMonthEndReportViewReducer';
|
|
5
5
|
import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
|
|
6
6
|
import { refreshExpenseAutomationCurrentTab } from '../../expenseAutomationViewReducer';
|
|
7
|
-
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
8
7
|
import { fetchFluxAnalysisView } from '../../reducers/fluxAnalysisViewReducer';
|
|
9
8
|
import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
|
|
10
9
|
import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
|
|
11
10
|
import { fetchReconciliation } from '../../reducers/reconciliationViewReducer';
|
|
12
11
|
import { fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
|
|
13
|
-
export type ActionType = ReturnType<typeof refreshExpenseAutomationCurrentTab> | ReturnType<typeof
|
|
12
|
+
export type ActionType = ReturnType<typeof refreshExpenseAutomationCurrentTab> | ReturnType<typeof fetchCompanyMonthEndReportView> | ReturnType<typeof fetchCompanyMonthEndReportTemplates> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof fetchTransactionCategorizationView>;
|
|
14
13
|
export declare const refreshExpenseAutomationCurrentTabEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js
CHANGED
|
@@ -7,7 +7,6 @@ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
|
7
7
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
8
|
const companyMonthEndReportViewReducer_1 = require("../../../companyMonthEndReportView/companyMonthEndReportViewReducer");
|
|
9
9
|
const expenseAutomationViewReducer_1 = require("../../expenseAutomationViewReducer");
|
|
10
|
-
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
11
10
|
const fluxAnalysisViewReducer_1 = require("../../reducers/fluxAnalysisViewReducer");
|
|
12
11
|
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
13
12
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
@@ -42,17 +41,10 @@ const refreshExpenseAutomationCurrentTabEpic = (actions$, state$) => actions$.pi
|
|
|
42
41
|
return (0, rxjs_1.from)([
|
|
43
42
|
(0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, true, true, null),
|
|
44
43
|
]);
|
|
45
|
-
case 'je_schedules':
|
|
46
|
-
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
47
|
-
if (selectedPageTab === 'actual_matching') {
|
|
48
|
-
return (0, rxjs_1.from)([
|
|
49
|
-
(0, actualMatchingViewReducer_1.fetchActualMatchingPage)({ start: timePeriodStart, end: timePeriodEnd }, true),
|
|
50
|
-
]);
|
|
51
|
-
}
|
|
44
|
+
case 'je_schedules':
|
|
52
45
|
return (0, rxjs_1.from)([
|
|
53
46
|
(0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, true),
|
|
54
47
|
]);
|
|
55
|
-
}
|
|
56
48
|
case 'month_end_insights':
|
|
57
49
|
return (0, rxjs_1.from)([
|
|
58
50
|
(0, companyMonthEndReportViewReducer_1.fetchCompanyMonthEndReportView)(true, companyId, currentTenant.tenantId, period.end, true),
|
|
@@ -2,6 +2,7 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../rootStateTypes';
|
|
4
4
|
import { fetchAccountList } from '../../../accountList/accountListReducer';
|
|
5
|
+
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
5
6
|
import { fetchJeSchedules, fetchJeSchedulesPage, initializeAccountSettingsView } from '../../reducers/jeSchedulesViewReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof initializeAccountSettingsView>;
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchActualMatchingPage> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof initializeAccountSettingsView>;
|
|
7
8
|
export declare const fetchJeSchedulesPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -5,24 +5,34 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const accountListReducer_1 = require("../../../accountList/accountListReducer");
|
|
7
7
|
const scheduleListHelper_1 = require("../../../scheduleView/scheduleListView/scheduleListHelper");
|
|
8
|
+
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
8
9
|
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
9
10
|
const fetchJeSchedulesPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchJeSchedulesPage.match), (0, operators_1.mergeMap)((action) => {
|
|
10
11
|
const jeSchedulePageActions = [];
|
|
11
12
|
const { period, refreshViewInBackground } = action.payload;
|
|
13
|
+
const state = state$.value;
|
|
14
|
+
const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
|
|
12
15
|
const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
|
|
13
|
-
const accountListState = state
|
|
16
|
+
const accountListState = state.accountListState;
|
|
14
17
|
if (accountListState.byReportId[accountType.accountListKey].fetchState ===
|
|
15
18
|
'Not-Started') {
|
|
16
19
|
// call this only if the account list for schedules is not fetched already
|
|
17
20
|
jeSchedulePageActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
// AM is chrome on this page but a different endpoint. fetchJeSchedules with
|
|
23
|
+
// selectedPageTab === 'actual_matching' would hit /1.0/schedules and write a bogus cache slot.
|
|
24
|
+
if (selectedPageTab === 'actual_matching') {
|
|
25
|
+
jeSchedulePageActions.push((0, actualMatchingViewReducer_1.fetchActualMatchingPage)(period, refreshViewInBackground));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
jeSchedulePageActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedules)(period, refreshViewInBackground));
|
|
29
|
+
}
|
|
20
30
|
// Only on the first page load. Account settings cannot change from a tab switch or a
|
|
21
31
|
// refresh, and re-initializing puts accountSettingsView back to 'In-Progress' -- which the
|
|
22
32
|
// page reads as "still loading" and answers with a full skeleton over rows it already has.
|
|
23
33
|
// The action also resets localData, so re-dispatching it blindly would empty the settings
|
|
24
34
|
// form until the refetch lands. Saving account settings still re-initializes explicitly.
|
|
25
|
-
if (!state
|
|
35
|
+
if (!state.expenseAutomationJESchedulesViewState.accountSettings
|
|
26
36
|
.hasLoadedAccountSettings) {
|
|
27
37
|
jeSchedulePageActions.push((0, jeSchedulesViewReducer_1.initializeAccountSettingsView)());
|
|
28
38
|
}
|
package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../rootStateTypes';
|
|
4
|
+
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
4
5
|
import { fetchJeSchedules, fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesPage>;
|
|
6
|
+
export type ActionType = ReturnType<typeof fetchActualMatchingPage> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesPage>;
|
|
6
7
|
/**
|
|
7
8
|
* Warms the tab the user is not looking at, so switching to it renders rows instead of a skeleton.
|
|
8
9
|
*
|
|
9
10
|
* Listens for `fetchJeSchedulesPage` rather than `fetchJeSchedules` on purpose: the prefetch emits
|
|
10
11
|
* `fetchJeSchedules`, so listening for that would make this epic feed itself.
|
|
12
|
+
*
|
|
13
|
+
* Review <-> Existing share `/1.0/schedules`. Actual Matching is a different endpoint; it is
|
|
14
|
+
* warmed with `fetchActualMatchingPage` when the page action carries `isAccrualEnabled`.
|
|
11
15
|
*/
|
|
12
16
|
export declare const prefetchOtherJeSchedulesTabEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -5,6 +5,7 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
7
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
|
+
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
8
9
|
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
9
10
|
const jeSchedulesViewState_1 = require("../../types/jeSchedulesViewState");
|
|
10
11
|
/**
|
|
@@ -12,30 +13,48 @@ const jeSchedulesViewState_1 = require("../../types/jeSchedulesViewState");
|
|
|
12
13
|
*
|
|
13
14
|
* Listens for `fetchJeSchedulesPage` rather than `fetchJeSchedules` on purpose: the prefetch emits
|
|
14
15
|
* `fetchJeSchedules`, so listening for that would make this epic feed itself.
|
|
16
|
+
*
|
|
17
|
+
* Review <-> Existing share `/1.0/schedules`. Actual Matching is a different endpoint; it is
|
|
18
|
+
* warmed with `fetchActualMatchingPage` when the page action carries `isAccrualEnabled`.
|
|
15
19
|
*/
|
|
16
20
|
const prefetchOtherJeSchedulesTabEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchJeSchedulesPage.match), (0, operators_1.mergeMap)((action) => {
|
|
17
21
|
const state = state$.value;
|
|
18
|
-
const { period } = action.payload;
|
|
22
|
+
const { period, isAccrualEnabled } = action.payload;
|
|
19
23
|
const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
|
|
20
|
-
|
|
21
|
-
//
|
|
24
|
+
const actions = [];
|
|
25
|
+
// AM is chrome-only on ALL_JE_PAGE_TABS; warming it with fetchJeSchedules
|
|
26
|
+
// would hit the wrong endpoint.
|
|
22
27
|
const otherPageTab = jeSchedulesViewState_1.ALL_JE_PAGE_TABS.find((pageTab) => pageTab !== selectedPageTab && pageTab !== 'actual_matching');
|
|
23
|
-
if (otherPageTab == null) {
|
|
24
|
-
return rxjs_1.EMPTY;
|
|
25
|
-
}
|
|
26
28
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
27
29
|
const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
|
|
28
|
-
if (selectedPeriod
|
|
29
|
-
|
|
30
|
+
if (otherPageTab != null && selectedPeriod != null) {
|
|
31
|
+
const otherPeriodTabKey = (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(otherPageTab, (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod));
|
|
32
|
+
const isOtherTabAlreadyLoaded = state.expenseAutomationJESchedulesViewState
|
|
33
|
+
.jeScheduleTransactionKeysByPeriodAndTab[otherPeriodTabKey] != null;
|
|
34
|
+
if (!isOtherTabAlreadyLoaded) {
|
|
35
|
+
actions.push((0, jeSchedulesViewReducer_1.fetchJeSchedules)(period, true, otherPageTab));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// GET /actual-matching is not Statsig-gated; CES has no Statsig. The screen
|
|
39
|
+
// passes is_accrual_enabled so disabled tenants do not pay for a list they
|
|
40
|
+
// cannot open. Visible AM is fetchJeSchedulesPageEpic's job.
|
|
41
|
+
if (isAccrualEnabled === true &&
|
|
42
|
+
selectedPageTab !== 'actual_matching') {
|
|
43
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)({
|
|
44
|
+
month: period.start.month,
|
|
45
|
+
year: period.start.year,
|
|
46
|
+
});
|
|
47
|
+
const actualMatching = state.expenseAutomationActualMatchingViewState;
|
|
48
|
+
const amAlreadyLoading = actualMatching.fetchState === 'In-Progress' ||
|
|
49
|
+
actualMatching.refreshStatus.fetchState === 'In-Progress';
|
|
50
|
+
if (!amAlreadyLoading &&
|
|
51
|
+
actualMatching.matchIdsByPeriod[periodId] == null) {
|
|
52
|
+
actions.push((0, actualMatchingViewReducer_1.fetchActualMatchingPage)(period, true));
|
|
53
|
+
}
|
|
30
54
|
}
|
|
31
|
-
|
|
32
|
-
// just left, since a switch also fires fetchJeSchedulesPage.
|
|
33
|
-
const otherPeriodTabKey = (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(otherPageTab, (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod));
|
|
34
|
-
const isOtherTabAlreadyLoaded = state.expenseAutomationJESchedulesViewState
|
|
35
|
-
.jeScheduleTransactionKeysByPeriodAndTab[otherPeriodTabKey] != null;
|
|
36
|
-
if (isOtherTabAlreadyLoaded) {
|
|
55
|
+
if (actions.length === 0) {
|
|
37
56
|
return rxjs_1.EMPTY;
|
|
38
57
|
}
|
|
39
|
-
return (0, rxjs_1.
|
|
58
|
+
return (0, rxjs_1.from)(actions);
|
|
40
59
|
}));
|
|
41
60
|
exports.prefetchOtherJeSchedulesTabEpic = prefetchOtherJeSchedulesTabEpic;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../reducer';
|
|
4
|
-
import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
|
|
5
4
|
import { fetchJeSchedulesPage, updateJESchedulesUIState } from '../../reducers/jeSchedulesViewReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof
|
|
5
|
+
export type ActionType = ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof updateJESchedulesUIState>;
|
|
7
6
|
export declare const switchJESchedulesTabEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -5,7 +5,6 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
7
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
|
-
const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
|
|
9
8
|
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
10
9
|
const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.updateJESchedulesUIState.match), (0, operators_1.filter)((action) => action.payload.selectedPageTab != null), (0, operators_1.mergeMap)(() => {
|
|
11
10
|
const state = state$.value;
|
|
@@ -28,10 +27,6 @@ const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe((0, operato
|
|
|
28
27
|
if (timePeriodStart == null || timePeriodEnd == null) {
|
|
29
28
|
return rxjs_1.EMPTY;
|
|
30
29
|
}
|
|
31
|
-
const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
|
|
32
|
-
if (selectedPageTab === 'actual_matching') {
|
|
33
|
-
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.fetchActualMatchingPage)({ start: timePeriodStart, end: timePeriodEnd }, true));
|
|
34
|
-
}
|
|
35
30
|
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, true));
|
|
36
31
|
}));
|
|
37
32
|
exports.switchJESchedulesTabEpic = switchJESchedulesTabEpic;
|
|
@@ -2,9 +2,10 @@ import { ID } from '../../commonStateTypes/common';
|
|
|
2
2
|
import { MonthYearPeriod } from '../../commonStateTypes/timePeriod';
|
|
3
3
|
import { ExpenseAutomationViewState } from './expenseAutomationViewState';
|
|
4
4
|
export declare const initialState: ExpenseAutomationViewState;
|
|
5
|
-
export declare const fetchAllExpenseAutomationTabs: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined, refreshViewInBackground?: boolean | undefined], {
|
|
5
|
+
export declare const fetchAllExpenseAutomationTabs: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined, refreshViewInBackground?: boolean | undefined, isAccrualEnabled?: boolean | undefined], {
|
|
6
6
|
cacheOverride: boolean;
|
|
7
7
|
refreshViewInBackground: boolean;
|
|
8
|
+
isAccrualEnabled: boolean;
|
|
8
9
|
}, "expenseAutomationView/fetchAllExpenseAutomationTabs", never, never>, updateCurrentSelectedPeriod: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, newSelectedPeriod: MonthYearPeriod], {
|
|
9
10
|
newSelectedPeriod: MonthYearPeriod;
|
|
10
11
|
tenantId: string;
|
|
@@ -23,11 +23,12 @@ const expenseAutomationView = (0, toolkit_1.createSlice)({
|
|
|
23
23
|
reducer() {
|
|
24
24
|
//do nothing
|
|
25
25
|
},
|
|
26
|
-
prepare(cacheOverride = false, refreshViewInBackground = false) {
|
|
26
|
+
prepare(cacheOverride = false, refreshViewInBackground = false, isAccrualEnabled = false) {
|
|
27
27
|
return {
|
|
28
28
|
payload: {
|
|
29
29
|
cacheOverride,
|
|
30
30
|
refreshViewInBackground,
|
|
31
|
+
isAccrualEnabled,
|
|
31
32
|
},
|
|
32
33
|
};
|
|
33
34
|
},
|
|
@@ -51,9 +51,10 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
|
|
|
51
51
|
selectedPageTab: JEPageTab;
|
|
52
52
|
selectedPeriod: MonthYearPeriod;
|
|
53
53
|
status: ZeniAPIStatus;
|
|
54
|
-
}, "expenseAutomationJESchedulesView/fetchJeSchedulesFailure">, fetchJeSchedulesPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
|
|
54
|
+
}, "expenseAutomationJESchedulesView/fetchJeSchedulesFailure">, fetchJeSchedulesPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any, isAccrualEnabled?: any], {
|
|
55
55
|
period: TimePeriod;
|
|
56
56
|
refreshViewInBackground: any;
|
|
57
|
+
isAccrualEnabled: any;
|
|
57
58
|
}, "expenseAutomationJESchedulesView/fetchJeSchedulesPage", never, never>, fetchJeSchedulesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
58
59
|
accruedJeSchedules: JEAccruedScheduledTransactionPayload[];
|
|
59
60
|
failedJeSchedules: JEScheduledTransactionPayload[];
|
|
@@ -111,11 +111,12 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
111
111
|
initialState: exports.initialState,
|
|
112
112
|
reducers: {
|
|
113
113
|
fetchJeSchedulesPage: {
|
|
114
|
-
prepare(period, refreshViewInBackground = false) {
|
|
114
|
+
prepare(period, refreshViewInBackground = false, isAccrualEnabled = false) {
|
|
115
115
|
return {
|
|
116
116
|
payload: {
|
|
117
117
|
period,
|
|
118
118
|
refreshViewInBackground,
|
|
119
|
+
isAccrualEnabled,
|
|
119
120
|
},
|
|
120
121
|
};
|
|
121
122
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.35-
|
|
3
|
+
"version": "5.2.35-beta7MM",
|
|
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",
|