@zeniai/client-epic-state 4.13.56 → 4.13.57
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/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -2
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +51 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +1 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +3 -2
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
- package/package.json +1 -1
|
@@ -8,10 +8,10 @@ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
|
8
8
|
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
9
9
|
const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
|
|
10
10
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
11
|
-
const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchJeSchedules.match), (0, operators_1.
|
|
11
|
+
const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchJeSchedules.match), (0, operators_1.mergeMap)((action) => {
|
|
12
12
|
const state = state$.value;
|
|
13
13
|
const { expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
|
|
14
|
-
const { period } = action.payload;
|
|
14
|
+
const { period, refreshViewInBackground } = action.payload;
|
|
15
15
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
16
16
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
17
17
|
const queryParam = {
|
|
@@ -35,6 +35,7 @@ const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
|
|
|
35
35
|
...response.data.failed_je_postings.je_schedules,
|
|
36
36
|
],
|
|
37
37
|
selectedPeriod: selectedPeriod,
|
|
38
|
+
refreshViewInBackground: refreshViewInBackground,
|
|
38
39
|
}));
|
|
39
40
|
return (0, rxjs_1.from)(updateActions);
|
|
40
41
|
}
|
|
@@ -27,12 +27,61 @@ function getExpenseAutomationView(state) {
|
|
|
27
27
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
28
28
|
const { currentSelectedView, selectedPeriodByTenantId, selectedTransactionCategorizationTab, } = expenseAutomationViewState;
|
|
29
29
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
30
|
+
let currentSelectedViewFetchState = {
|
|
31
|
+
fetchState: 'Not-Started',
|
|
32
|
+
error: undefined,
|
|
33
|
+
};
|
|
34
|
+
let currentSelectedViewBackgroundRefreshFetchState = {
|
|
35
|
+
fetchState: 'Not-Started',
|
|
36
|
+
error: undefined,
|
|
37
|
+
};
|
|
30
38
|
const monthEndCloseChecksView = (0, monthEndCloseChecksViewSelector_1.getMonthEndCloseChecksViewByTenantId)(state, currentTenant.tenantId);
|
|
31
39
|
const missingReceipts = (0, missingReceiptsSelector_1.getExpenseAutomationMissingReceiptsView)(state);
|
|
32
40
|
const fluxAnalysis = (0, fluxAnalysisViewSelector_1.getExpenseAutomationFluxAnalysisView)(state);
|
|
33
41
|
const monthEndInsights = (0, companyMonthEndReportViewSelector_1.getCompanyMonthEndReportSelectorView)(state, currentTenant.companyId, loggedInUser);
|
|
34
42
|
const expenseAutomationTransactionsViewState = (0, transactionCategorizationSelector_1.getExpenseAutomationTransactionView)(state, selectedTransactionCategorizationTab);
|
|
35
43
|
const jeSchedules = (0, jeSchedulesViewSelector_1.getExpenseAutomationJESchedulesView)(state);
|
|
44
|
+
switch (currentSelectedView) {
|
|
45
|
+
case 'flux_analysis':
|
|
46
|
+
currentSelectedViewFetchState = fluxAnalysis.fetchStatus;
|
|
47
|
+
currentSelectedViewBackgroundRefreshFetchState =
|
|
48
|
+
fluxAnalysis.refreshStatus;
|
|
49
|
+
break;
|
|
50
|
+
case 'je_schedules':
|
|
51
|
+
currentSelectedViewFetchState = {
|
|
52
|
+
fetchState: jeSchedules.fetchState,
|
|
53
|
+
error: jeSchedules.error,
|
|
54
|
+
};
|
|
55
|
+
currentSelectedViewBackgroundRefreshFetchState =
|
|
56
|
+
jeSchedules.refreshStatus;
|
|
57
|
+
break;
|
|
58
|
+
case 'missing_receipts':
|
|
59
|
+
currentSelectedViewFetchState = {
|
|
60
|
+
fetchState: missingReceipts.fetchState,
|
|
61
|
+
error: missingReceipts.error,
|
|
62
|
+
};
|
|
63
|
+
currentSelectedViewBackgroundRefreshFetchState =
|
|
64
|
+
missingReceipts.refreshStatus;
|
|
65
|
+
break;
|
|
66
|
+
case 'transaction_categorization':
|
|
67
|
+
currentSelectedViewFetchState = {
|
|
68
|
+
fetchState: expenseAutomationTransactionsViewState.fetchState,
|
|
69
|
+
error: expenseAutomationTransactionsViewState.error,
|
|
70
|
+
};
|
|
71
|
+
currentSelectedViewBackgroundRefreshFetchState =
|
|
72
|
+
expenseAutomationTransactionsViewState.refreshStatus;
|
|
73
|
+
break;
|
|
74
|
+
case 'month_end_insights':
|
|
75
|
+
currentSelectedViewFetchState = {
|
|
76
|
+
fetchState: monthEndInsights.fetchState,
|
|
77
|
+
error: monthEndInsights.error,
|
|
78
|
+
};
|
|
79
|
+
currentSelectedViewBackgroundRefreshFetchState = {
|
|
80
|
+
fetchState: 'Not-Started',
|
|
81
|
+
error: undefined,
|
|
82
|
+
};
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
36
85
|
const fetchStateVariables = [
|
|
37
86
|
expenseAutomationMissingReceiptsViewState,
|
|
38
87
|
expenseAutomationJESchedulesViewState,
|
|
@@ -94,6 +143,8 @@ function getExpenseAutomationView(state) {
|
|
|
94
143
|
jeSchedules,
|
|
95
144
|
transactionView: expenseAutomationTransactionsViewState,
|
|
96
145
|
missingReceipts,
|
|
146
|
+
currentSelectedViewFetchState,
|
|
147
|
+
currentSelectedViewBackgroundRefreshFetchState,
|
|
97
148
|
fluxAnalysis,
|
|
98
149
|
fetchState: reducedFetchStatus.fetchState,
|
|
99
150
|
error: undefined,
|
|
@@ -15,6 +15,7 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
|
|
|
15
15
|
jeSchedules: JEScheduledTransactionPayload[];
|
|
16
16
|
failedJeSchedules: JEScheduledTransactionPayload[];
|
|
17
17
|
selectedPeriod: MonthYearPeriod;
|
|
18
|
+
refreshViewInBackground: boolean;
|
|
18
19
|
}, string>, fetchJeSchedulesPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
|
|
19
20
|
period: TimePeriod;
|
|
20
21
|
refreshViewInBackground: any;
|
|
@@ -67,7 +67,7 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
fetchJeSchedulesSuccess(draft, action) {
|
|
70
|
-
const { jeSchedules, selectedPeriod, failedJeSchedules } = action.payload;
|
|
70
|
+
const { jeSchedules, selectedPeriod, failedJeSchedules, refreshViewInBackground, } = action.payload;
|
|
71
71
|
const jeScheduleTransactionKeys = jeSchedules.map((schedules) => {
|
|
72
72
|
const transactionID = (0, transactionIDPayload_1.toTransactionID)(schedules.base_transaction);
|
|
73
73
|
return (0, transactionDetailState_1.getZeniTransactionDetailKey)(transactionID);
|
|
@@ -76,7 +76,8 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
76
76
|
const transactionID = (0, transactionIDPayload_1.toTransactionID)(schedules.base_transaction);
|
|
77
77
|
return (0, transactionDetailState_1.getZeniTransactionDetailKey)(transactionID);
|
|
78
78
|
});
|
|
79
|
-
if (
|
|
79
|
+
if (refreshViewInBackground === true &&
|
|
80
|
+
draft.refreshStatus.fetchState === 'In-Progress') {
|
|
80
81
|
draft.refreshStatus = { fetchState: 'Completed', error: undefined };
|
|
81
82
|
}
|
|
82
83
|
else {
|
package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export interface ExpenseAutomationViewSelector extends SelectorView {
|
|
|
32
32
|
monthEndInsights?: CompanyMonthEndReportSelectorView;
|
|
33
33
|
saveStatus: FetchStateAndError;
|
|
34
34
|
updateStatus: FetchStateAndError;
|
|
35
|
+
currentSelectedViewFetchState: FetchStateAndError;
|
|
36
|
+
currentSelectedViewBackgroundRefreshFetchState: FetchStateAndError;
|
|
35
37
|
allSteps: ExpenseAutomationStepDetails[];
|
|
36
38
|
completionStatus: CompletionStatusType;
|
|
37
39
|
auditSummary?: MonthEndAuditSummary;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.57",
|
|
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
|
"types": "lib/index.d.ts",
|