@zeniai/client-epic-state 5.0.81-betaJK7 → 5.0.81-betaML1
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/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
- package/lib/entity/account/accountSelector.d.ts +9 -0
- package/lib/entity/account/accountSelector.js +14 -1
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/sectionProjectView/sectionProjectView.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +2 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/task/taskPayload.d.ts +1 -3
- package/lib/entity/task/taskPayload.js +0 -2
- package/lib/entity/task/taskState.d.ts +0 -2
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
- package/lib/entity/tenant/clearAllEpic.js +2 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +4 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +18 -10
- package/lib/entity/transaction/stateTypes/transaction.d.ts +3 -0
- package/lib/epic.d.ts +3 -2
- package/lib/epic.js +3 -2
- package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
- package/lib/esm/entity/account/accountSelector.js +11 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/entity/task/taskPayload.js +0 -2
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -0
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +18 -10
- package/lib/esm/epic.js +3 -2
- package/lib/esm/index.js +8 -7
- package/lib/esm/reducer.js +3 -0
- package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewReducer.js +11 -26
- package/lib/esm/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +28 -37
- package/lib/esm/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
- package/lib/esm/view/createTransferEntry/createTransferEntryReducer.js +72 -0
- package/lib/esm/view/createTransferEntry/createTransferEntrySelector.js +64 -0
- package/lib/esm/view/createTransferEntry/createTransferEntryState.js +17 -0
- package/lib/esm/view/createTransferEntry/epics/createTransferEntryEpic.js +130 -0
- package/lib/esm/view/createTransferEntry/epics/fetchTransferAccountsEpic.js +36 -0
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +13 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +9 -1
- package/lib/esm/view/transactionDetail/epics/transactionDetailEpic.js +1 -1
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +6 -1
- package/lib/index.d.ts +9 -8
- package/lib/index.js +46 -37
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewPayload.d.ts +15 -13
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +4 -5
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.js +12 -27
- package/lib/view/companyTaskManagerView/companyTaskManagerViewState.d.ts +3 -3
- package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.d.ts +3 -1
- package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +28 -37
- package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -2
- package/lib/view/createTransferEntry/createTransferEntryReducer.d.ts +32 -0
- package/lib/view/createTransferEntry/createTransferEntryReducer.js +76 -0
- package/lib/view/createTransferEntry/createTransferEntrySelector.d.ts +39 -0
- package/lib/view/createTransferEntry/createTransferEntrySelector.js +69 -0
- package/lib/view/createTransferEntry/createTransferEntryState.d.ts +30 -0
- package/lib/view/createTransferEntry/createTransferEntryState.js +20 -0
- package/lib/view/createTransferEntry/epics/createTransferEntryEpic.d.ts +11 -0
- package/lib/view/createTransferEntry/epics/createTransferEntryEpic.js +134 -0
- package/lib/view/createTransferEntry/epics/fetchTransferAccountsEpic.d.ts +14 -0
- package/lib/view/createTransferEntry/epics/fetchTransferAccountsEpic.js +40 -0
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +3 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -2
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +4 -1
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +11 -2
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/lib/view/transactionDetail/epics/transactionDetailEpic.js +1 -1
- package/lib/view/transactionDetail/transactionDetailPayload.d.ts +1 -1
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +6 -1
- package/lib/view/transactionDetail/transactionDetailSelector.js +6 -1
- package/package.json +1 -1
- package/lib/esm/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewUIStateEpic.js +0 -16
- package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewUIStateEpic.d.ts +0 -6
- package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewUIStateEpic.js +0 -20
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
import { CompanyPayload } from '../../entity/company/companyPayload';
|
|
1
2
|
import { TaskPayload } from '../../entity/task/taskPayload';
|
|
3
|
+
import { UserPayload } from '../../entity/user/userPayload';
|
|
2
4
|
import { ZeniAPIResponse } from '../../responsePayload';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
interface QueryPayload {
|
|
6
|
+
entity_type: string;
|
|
7
|
+
limit: number;
|
|
8
|
+
page_token: string | null;
|
|
9
|
+
search_text: string;
|
|
10
|
+
sort_by: string;
|
|
11
|
+
sort_order: string;
|
|
7
12
|
}
|
|
8
13
|
export interface CompanyTaskManagerViewPayload {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
count: number;
|
|
15
|
-
from: number;
|
|
16
|
-
limit: number;
|
|
17
|
-
total: number;
|
|
14
|
+
companies: CompanyPayload[];
|
|
15
|
+
query: QueryPayload;
|
|
16
|
+
tasks: TaskPayload[];
|
|
17
|
+
total_count: number;
|
|
18
|
+
users: UserPayload[];
|
|
18
19
|
}
|
|
19
20
|
export type CompanyTaskManagerViewResponse = ZeniAPIResponse<CompanyTaskManagerViewPayload>;
|
|
21
|
+
export {};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
import { PageToken } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
1
2
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
|
-
import { CockpitFilters } from '../companyView/types/cockpitTypes';
|
|
3
3
|
import { CompanyTaskManagerViewPayload } from './companyTaskManagerViewPayload';
|
|
4
4
|
import { CompanyTaskManagerViewState, CompanyTaskManagerViewUIState, TaskManagerMetrics } from './companyTaskManagerViewState';
|
|
5
5
|
export declare const initialUIState: CompanyTaskManagerViewUIState;
|
|
6
6
|
export declare const initialState: CompanyTaskManagerViewState;
|
|
7
|
-
export declare const fetchCompanyTaskManagerView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
8
|
-
|
|
9
|
-
filters: CockpitFilters | undefined;
|
|
7
|
+
export declare const fetchCompanyTaskManagerView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[pageToken: PageToken, sortKey: "status" | "name" | "tags" | "createdBy" | "dueDate" | "priority" | "assignee" | "taskName", sortOrder: "ascending" | "descending", keepExistingListItems?: any, searchString?: string | undefined], {
|
|
8
|
+
pageToken: PageToken;
|
|
10
9
|
searchString: string | undefined;
|
|
11
10
|
sortKey: "status" | "name" | "tags" | "createdBy" | "dueDate" | "priority" | "assignee" | "taskName";
|
|
12
11
|
sortOrder: "ascending" | "descending";
|
|
@@ -15,6 +14,6 @@ export declare const fetchCompanyTaskManagerView: import("@reduxjs/toolkit").Act
|
|
|
15
14
|
data: CompanyTaskManagerViewPayload;
|
|
16
15
|
}, "companyTaskManagerView/updateCompanyTaskManagerViewOnSuccess">, updateCompanyTaskManagerViewOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], {
|
|
17
16
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
18
|
-
}, "companyTaskManagerView/updateCompanyTaskManagerViewOnFailure", never, never>, fetchTaskManagerMetrics: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"companyTaskManagerView/fetchTaskManagerMetrics">, updateTaskManagerMetrics: import("@reduxjs/toolkit").ActionCreatorWithPayload<TaskManagerMetrics, "companyTaskManagerView/updateTaskManagerMetrics">, updateTaskManagerMetricsOnFailure: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"companyTaskManagerView/updateTaskManagerMetricsOnFailure">, clearCompanyTaskManagerView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"companyTaskManagerView/clearCompanyTaskManagerView"
|
|
17
|
+
}, "companyTaskManagerView/updateCompanyTaskManagerViewOnFailure", never, never>, fetchTaskManagerMetrics: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"companyTaskManagerView/fetchTaskManagerMetrics">, updateTaskManagerMetrics: import("@reduxjs/toolkit").ActionCreatorWithPayload<TaskManagerMetrics, "companyTaskManagerView/updateTaskManagerMetrics">, updateTaskManagerMetricsOnFailure: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"companyTaskManagerView/updateTaskManagerMetricsOnFailure">, clearCompanyTaskManagerView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"companyTaskManagerView/clearCompanyTaskManagerView">;
|
|
19
18
|
declare const _default: import("redux").Reducer<CompanyTaskManagerViewState>;
|
|
20
19
|
export default _default;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.clearCompanyTaskManagerView = exports.updateTaskManagerMetricsOnFailure = exports.updateTaskManagerMetrics = exports.fetchTaskManagerMetrics = exports.updateCompanyTaskManagerViewOnFailure = exports.updateCompanyTaskManagerViewOnSuccess = exports.fetchCompanyTaskManagerView = exports.initialState = exports.initialUIState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
exports.initialUIState = {
|
|
7
7
|
filterText: '',
|
|
8
8
|
sortKey: 'dueDate',
|
|
9
9
|
sortOrder: 'descending',
|
|
10
|
-
|
|
11
|
-
filters: {},
|
|
10
|
+
pageToken: null,
|
|
12
11
|
};
|
|
13
12
|
const initialMetrics = {
|
|
14
13
|
closed: 0,
|
|
@@ -33,11 +32,10 @@ const companyTaskManagerView = (0, toolkit_1.createSlice)({
|
|
|
33
32
|
initialState: exports.initialState,
|
|
34
33
|
reducers: {
|
|
35
34
|
fetchCompanyTaskManagerView: {
|
|
36
|
-
prepare(
|
|
35
|
+
prepare(pageToken, sortKey, sortOrder, keepExistingListItems = true, searchString) {
|
|
37
36
|
return {
|
|
38
37
|
payload: {
|
|
39
|
-
|
|
40
|
-
filters,
|
|
38
|
+
pageToken,
|
|
41
39
|
searchString,
|
|
42
40
|
sortKey,
|
|
43
41
|
sortOrder,
|
|
@@ -46,10 +44,10 @@ const companyTaskManagerView = (0, toolkit_1.createSlice)({
|
|
|
46
44
|
};
|
|
47
45
|
},
|
|
48
46
|
reducer(draft, action) {
|
|
49
|
-
const {
|
|
47
|
+
const { pageToken, searchString, sortKey, sortOrder, keepExistingListItems, } = action.payload;
|
|
50
48
|
draft.uiState.sortKey = sortKey;
|
|
51
49
|
draft.uiState.sortOrder = sortOrder;
|
|
52
|
-
draft.uiState.
|
|
50
|
+
draft.uiState.pageToken = pageToken;
|
|
53
51
|
if (keepExistingListItems === false) {
|
|
54
52
|
draft.taskIds = [];
|
|
55
53
|
}
|
|
@@ -62,14 +60,15 @@ const companyTaskManagerView = (0, toolkit_1.createSlice)({
|
|
|
62
60
|
},
|
|
63
61
|
updateCompanyTaskManagerViewOnSuccess(draft, action) {
|
|
64
62
|
const { data } = action.payload;
|
|
65
|
-
const tasks = data
|
|
63
|
+
const { tasks, query, total_count } = data;
|
|
66
64
|
draft.fetchState = 'Completed';
|
|
67
65
|
draft.error = undefined;
|
|
68
66
|
draft.taskIds = [...draft.taskIds, ...tasks.map((task) => task.task_id)];
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
// consider total count only when fetching for first time
|
|
68
|
+
if (draft.uiState.filterText === '' && draft.uiState.pageToken == null) {
|
|
69
|
+
draft.totalTaskCount = total_count;
|
|
71
70
|
}
|
|
72
|
-
draft.uiState.
|
|
71
|
+
draft.uiState.pageToken = query.page_token;
|
|
73
72
|
},
|
|
74
73
|
updateCompanyTaskManagerViewOnFailure: {
|
|
75
74
|
reducer(draft, action) {
|
|
@@ -90,24 +89,10 @@ const companyTaskManagerView = (0, toolkit_1.createSlice)({
|
|
|
90
89
|
updateTaskManagerMetricsOnFailure(draft) {
|
|
91
90
|
draft.metricsFetchState = 'Error';
|
|
92
91
|
},
|
|
93
|
-
updateCompanyTaskManagerViewUIState(draft, action) {
|
|
94
|
-
if (action.payload.filters != null) {
|
|
95
|
-
draft.uiState.filters = action.payload.filters;
|
|
96
|
-
}
|
|
97
|
-
if (action.payload.filterText != null) {
|
|
98
|
-
draft.uiState.filterText = action.payload.filterText;
|
|
99
|
-
}
|
|
100
|
-
if (action.payload.sortKey != null) {
|
|
101
|
-
draft.uiState.sortKey = action.payload.sortKey;
|
|
102
|
-
}
|
|
103
|
-
if (action.payload.sortOrder != null) {
|
|
104
|
-
draft.uiState.sortOrder = action.payload.sortOrder;
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
92
|
clearCompanyTaskManagerView(draft) {
|
|
108
93
|
Object.assign(draft, exports.initialState);
|
|
109
94
|
},
|
|
110
95
|
},
|
|
111
96
|
});
|
|
112
|
-
_a = companyTaskManagerView.actions, exports.fetchCompanyTaskManagerView = _a.fetchCompanyTaskManagerView, exports.updateCompanyTaskManagerViewOnSuccess = _a.updateCompanyTaskManagerViewOnSuccess, exports.updateCompanyTaskManagerViewOnFailure = _a.updateCompanyTaskManagerViewOnFailure, exports.fetchTaskManagerMetrics = _a.fetchTaskManagerMetrics, exports.updateTaskManagerMetrics = _a.updateTaskManagerMetrics, exports.updateTaskManagerMetricsOnFailure = _a.updateTaskManagerMetricsOnFailure, exports.clearCompanyTaskManagerView = _a.clearCompanyTaskManagerView
|
|
97
|
+
_a = companyTaskManagerView.actions, exports.fetchCompanyTaskManagerView = _a.fetchCompanyTaskManagerView, exports.updateCompanyTaskManagerViewOnSuccess = _a.updateCompanyTaskManagerViewOnSuccess, exports.updateCompanyTaskManagerViewOnFailure = _a.updateCompanyTaskManagerViewOnFailure, exports.fetchTaskManagerMetrics = _a.fetchTaskManagerMetrics, exports.updateTaskManagerMetrics = _a.updateTaskManagerMetrics, exports.updateTaskManagerMetricsOnFailure = _a.updateTaskManagerMetricsOnFailure, exports.clearCompanyTaskManagerView = _a.clearCompanyTaskManagerView;
|
|
113
98
|
exports.default = companyTaskManagerView.reducer;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FetchState, FetchedState, ID } from '../../commonStateTypes/common';
|
|
2
2
|
import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
|
-
import {
|
|
3
|
+
import { PageToken } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
|
+
import { TaskManagerViewSortKey } from '../companyView/types/cockpitTypes';
|
|
4
5
|
export interface TaskManagerMetrics {
|
|
5
6
|
closed: number;
|
|
6
7
|
open: number;
|
|
@@ -8,9 +9,8 @@ export interface TaskManagerMetrics {
|
|
|
8
9
|
total: number;
|
|
9
10
|
}
|
|
10
11
|
export interface CompanyTaskManagerViewUIState {
|
|
11
|
-
filters: CockpitFilters;
|
|
12
12
|
filterText: string;
|
|
13
|
-
|
|
13
|
+
pageToken: PageToken;
|
|
14
14
|
sortKey: TaskManagerViewSortKey;
|
|
15
15
|
sortOrder: SortOrder;
|
|
16
16
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateCompanies } from '../../../entity/company/companyReducer';
|
|
3
4
|
import { updateTags } from '../../../entity/tag/tagReducer';
|
|
4
5
|
import { updateTasks } from '../../../entity/task/taskReducer';
|
|
6
|
+
import { updateAllUsers } from '../../../entity/user/userReducer';
|
|
5
7
|
import { RootState } from '../../../reducer';
|
|
6
8
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
9
|
import { fetchCompanyTaskManagerView, updateCompanyTaskManagerViewOnFailure, updateCompanyTaskManagerViewOnSuccess } from '../companyTaskManagerViewReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof fetchCompanyTaskManagerView> | ReturnType<typeof updateCompanyTaskManagerViewOnSuccess> | ReturnType<typeof updateTasks> | ReturnType<typeof updateTags> | ReturnType<typeof updateCompanyTaskManagerViewOnFailure>;
|
|
10
|
+
export type ActionType = ReturnType<typeof fetchCompanyTaskManagerView> | ReturnType<typeof updateCompanyTaskManagerViewOnSuccess> | ReturnType<typeof updateTasks> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateTags> | ReturnType<typeof updateCompanyTaskManagerViewOnFailure>;
|
|
9
11
|
export declare const fetchCompanyTaskManagerViewEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,35 +4,51 @@ exports.fetchCompanyTaskManagerViewEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const sortOrderPayload_1 = require("../../../commonPayloadTypes/sortOrderPayload");
|
|
7
|
+
const companyReducer_1 = require("../../../entity/company/companyReducer");
|
|
7
8
|
const tagReducer_1 = require("../../../entity/tag/tagReducer");
|
|
8
9
|
const taskReducer_1 = require("../../../entity/task/taskReducer");
|
|
10
|
+
const userReducer_1 = require("../../../entity/user/userReducer");
|
|
9
11
|
const responsePayload_1 = require("../../../responsePayload");
|
|
10
12
|
const companyTaskManagerViewReducer_1 = require("../companyTaskManagerViewReducer");
|
|
11
|
-
const
|
|
13
|
+
const toSortKeyPayload = (sortKey) => {
|
|
14
|
+
switch (sortKey) {
|
|
15
|
+
case 'taskName':
|
|
16
|
+
return 'name';
|
|
17
|
+
case 'dueDate':
|
|
18
|
+
return 'due_date';
|
|
19
|
+
case 'createdBy':
|
|
20
|
+
return 'created_by';
|
|
21
|
+
case 'name':
|
|
22
|
+
return 'company_name';
|
|
23
|
+
default:
|
|
24
|
+
return sortKey;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
12
27
|
const fetchCompanyTaskManagerViewEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyTaskManagerViewReducer_1.fetchCompanyTaskManagerView.match), (0, operators_1.switchMap)((action) => {
|
|
13
|
-
const {
|
|
28
|
+
const { pageToken, sortKey, sortOrder, searchString } = action.payload;
|
|
14
29
|
const queryValue = {
|
|
15
|
-
|
|
16
|
-
size: DEFAULT_PAGE_SIZE,
|
|
17
|
-
from: fromOffset,
|
|
18
|
-
global_search: searchString ?? '',
|
|
30
|
+
page_token: pageToken,
|
|
19
31
|
sort_by: toSortKeyPayload(sortKey),
|
|
20
32
|
sort_order: (0, sortOrderPayload_1.getSortOrder)(sortOrder),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
: {}),
|
|
33
|
+
search_text: searchString ?? '',
|
|
34
|
+
view: 'cockpit_task_manager_view',
|
|
24
35
|
};
|
|
25
36
|
return zeniAPI
|
|
26
|
-
.getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels/tasks
|
|
37
|
+
.getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels/tasks?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
|
|
27
38
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
28
39
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
29
|
-
const tasksList = response.data.
|
|
40
|
+
const tasksList = response.data.tasks;
|
|
30
41
|
const actions = [
|
|
31
42
|
(0, companyTaskManagerViewReducer_1.updateCompanyTaskManagerViewOnSuccess)({
|
|
32
43
|
data: response.data,
|
|
33
44
|
}),
|
|
34
45
|
(0, taskReducer_1.updateTasks)(tasksList),
|
|
35
|
-
(0,
|
|
46
|
+
(0, companyReducer_1.updateCompanies)({
|
|
47
|
+
payload: response.data.companies,
|
|
48
|
+
schema: {},
|
|
49
|
+
}),
|
|
50
|
+
(0, tagReducer_1.updateTags)(tasksList.map((task) => task.tags).flat()),
|
|
51
|
+
(0, userReducer_1.updateAllUsers)({ users: response.data.users }),
|
|
36
52
|
];
|
|
37
53
|
return (0, rxjs_1.from)(actions);
|
|
38
54
|
}
|
|
@@ -50,28 +66,3 @@ const fetchCompanyTaskManagerViewEpic = (actions$, _state$, zeniAPI) => actions$
|
|
|
50
66
|
}));
|
|
51
67
|
}));
|
|
52
68
|
exports.fetchCompanyTaskManagerViewEpic = fetchCompanyTaskManagerViewEpic;
|
|
53
|
-
const toSortKeyPayload = (sortKey) => {
|
|
54
|
-
switch (sortKey) {
|
|
55
|
-
case 'taskName':
|
|
56
|
-
return 'name';
|
|
57
|
-
case 'dueDate':
|
|
58
|
-
return 'due_date';
|
|
59
|
-
case 'createdBy':
|
|
60
|
-
return 'created_by';
|
|
61
|
-
case 'name':
|
|
62
|
-
return 'company_name';
|
|
63
|
-
default:
|
|
64
|
-
return sortKey;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
const toFilterByPayload = (filters) => {
|
|
68
|
-
if (filters.categories == null) {
|
|
69
|
-
return [];
|
|
70
|
-
}
|
|
71
|
-
return filters.categories.map((category) => ({
|
|
72
|
-
field: category.field ?? '',
|
|
73
|
-
operator: category.matchingOperator === 'equal' ? 'is' : 'is_not',
|
|
74
|
-
values: category.values.map((v) => String(v)),
|
|
75
|
-
join: category.valuesCombinationOperator === 'ALL' ? 'and' : 'or',
|
|
76
|
-
}));
|
|
77
|
-
};
|
|
@@ -24,7 +24,7 @@ const fetchAllCockpitViewsEpic = (actions$, state$) => actions$.pipe((0, operato
|
|
|
24
24
|
(0, reviewCompanyViewReducer_1.fetchReviewCompanyView)(),
|
|
25
25
|
(0, companyHealthMetricViewReducer_1.fetchCompanyHealthMetricView)(),
|
|
26
26
|
(0, companyViewReducer_1.fetchCompanyMetaData)(),
|
|
27
|
-
(0, companyTaskManagerViewReducer_1.fetchCompanyTaskManagerView)(
|
|
27
|
+
(0, companyTaskManagerViewReducer_1.fetchCompanyTaskManagerView)(null, 'dueDate', 'descending', false),
|
|
28
28
|
(0, companyHealthMetricConfigReducer_1.fetchCompanyHealthMetricConfig)(),
|
|
29
29
|
]);
|
|
30
30
|
}
|
|
@@ -77,7 +77,7 @@ const fetchAllCockpitViewsEpic = (actions$, state$) => actions$.pipe((0, operato
|
|
|
77
77
|
}
|
|
78
78
|
if (state.companyTaskManagerViewState.fetchState !== 'In-Progress' &&
|
|
79
79
|
state.companyTaskManagerViewState.hasValidState() === false) {
|
|
80
|
-
fetchActions.push((0, companyTaskManagerViewReducer_1.fetchCompanyTaskManagerView)(
|
|
80
|
+
fetchActions.push((0, companyTaskManagerViewReducer_1.fetchCompanyTaskManagerView)(null, 'dueDate', 'descending', false));
|
|
81
81
|
}
|
|
82
82
|
return (0, rxjs_1.from)(fetchActions);
|
|
83
83
|
}
|
|
@@ -18,12 +18,11 @@ export type ManagementViewFilterCategoryField = 'controllerUserIds' | 'customerS
|
|
|
18
18
|
export type SubscriptionViewFilterCategoryField = 'controllerUserIds' | 'statusCode' | 'recommendedActionCode' | 'subscriptionPlans' | 'subscriptionAddOns' | 'avg2MonthExpenses' | 'slabLowerLimit' | 'slabUpperLimit' | 'monthlyRecurringRevenue';
|
|
19
19
|
export type PortfolioViewFilterCategoryField = 'netBurnOrIncome' | 'cashPosition' | 'income' | 'expenses' | 'runway';
|
|
20
20
|
export type HealthMonitorViewFilterCategoryField = 'verticalProductServices' | 'runway' | 'netPromoterScore' | 'customerSatisfactionScore' | 'churnProbabilityPercentage' | 'controller' | 'customerSuccessManager' | 'lastReportSent' | 'subscriptionStartDate' | 'subscriptionRenewalDate' | 'externalProductServiceExposure' | 'companyEngagementMetricsUpdatedAt' | 'companyGroupId' | 'monthlyRecurringRevenue';
|
|
21
|
-
export type TaskManagerViewFilterCategoryField = 'assignee' | 'creationDate' | 'dueDate' | 'priority' | 'status' | 'tag';
|
|
22
21
|
export interface CockpitFilterCategory {
|
|
23
22
|
matchingOperator: 'equal' | 'not_equal';
|
|
24
23
|
values: FilterCategoryValueType[];
|
|
25
24
|
valuesCombinationOperator: 'ANY' | 'ALL';
|
|
26
|
-
field?: AiAccountantFilterCategoryField | ManagementViewFilterCategoryField | SubscriptionViewFilterCategoryField | PortfolioViewFilterCategoryField | HealthMonitorViewFilterCategoryField
|
|
25
|
+
field?: AiAccountantFilterCategoryField | ManagementViewFilterCategoryField | SubscriptionViewFilterCategoryField | PortfolioViewFilterCategoryField | HealthMonitorViewFilterCategoryField;
|
|
27
26
|
}
|
|
28
27
|
export interface CockpitFilters {
|
|
29
28
|
categories?: CockpitFilterCategory[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
3
|
+
import { TransactionType } from '../../entity/transaction/stateTypes/transactionType';
|
|
4
|
+
import { CreateTransferEntryState, TransferAccountsFetchType } from './createTransferEntryState';
|
|
5
|
+
export declare const initialState: CreateTransferEntryState;
|
|
6
|
+
export declare const fetchAccountsForTransferFlow: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
7
|
+
kind: TransferAccountsFetchType;
|
|
8
|
+
}, "createTransferEntry/fetchAccountsForTransferFlow">, updateAccountsForTransferFlow: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
|
+
accountIds: ID[];
|
|
10
|
+
kind: TransferAccountsFetchType;
|
|
11
|
+
}, "createTransferEntry/updateAccountsForTransferFlow">, updateAccountsForTransferFlowFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
12
|
+
kind: TransferAccountsFetchType;
|
|
13
|
+
}, "createTransferEntry/updateAccountsForTransferFlowFailure">, createTransferEntry: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
|
|
14
|
+
creditAccountIntegrationId: string;
|
|
15
|
+
debitAccountIntegrationId: string;
|
|
16
|
+
memo: string;
|
|
17
|
+
sourceTransactionType: TransactionType;
|
|
18
|
+
transactionId: ID;
|
|
19
|
+
transactionType: TransactionType;
|
|
20
|
+
}], {
|
|
21
|
+
creditAccountIntegrationId: string;
|
|
22
|
+
debitAccountIntegrationId: string;
|
|
23
|
+
memo: string;
|
|
24
|
+
sourceTransactionType: TransactionType;
|
|
25
|
+
transactionId: ID;
|
|
26
|
+
transactionType: TransactionType;
|
|
27
|
+
}, "createTransferEntry/createTransferEntry", never, never>, createTransferEntrySuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"createTransferEntry/createTransferEntrySuccess">, createTransferEntryFailure: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"createTransferEntry/createTransferEntryFailure">, resetCreateTransferEntryStatus: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"createTransferEntry/resetCreateTransferEntryStatus">, createTransferEntryReplacedTransaction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[previousTransactionId: TransactionID, newTransactionId: TransactionID], {
|
|
28
|
+
newTransactionId: TransactionID;
|
|
29
|
+
previousTransactionId: TransactionID;
|
|
30
|
+
}, "createTransferEntry/createTransferEntryReplacedTransaction", never, never>, clearTransferEntryRouteReplacement: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"createTransferEntry/clearTransferEntryRouteReplacement">, clearCreateTransferEntry: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"createTransferEntry/clearCreateTransferEntry">;
|
|
31
|
+
declare const _default: import("redux").Reducer<CreateTransferEntryState>;
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearCreateTransferEntry = exports.clearTransferEntryRouteReplacement = exports.createTransferEntryReplacedTransaction = exports.resetCreateTransferEntryStatus = exports.createTransferEntryFailure = exports.createTransferEntrySuccess = exports.createTransferEntry = exports.updateAccountsForTransferFlowFailure = exports.updateAccountsForTransferFlow = exports.fetchAccountsForTransferFlow = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const createTransferEntryState_1 = require("./createTransferEntryState");
|
|
7
|
+
exports.initialState = createTransferEntryState_1.initialCreateTransferEntryState;
|
|
8
|
+
const createTransferEntrySlice = (0, toolkit_1.createSlice)({
|
|
9
|
+
name: 'createTransferEntry',
|
|
10
|
+
initialState: exports.initialState,
|
|
11
|
+
reducers: {
|
|
12
|
+
fetchAccountsForTransferFlow(draft, action) {
|
|
13
|
+
draft.transferAccountsByType[action.payload.kind].fetchState =
|
|
14
|
+
'In-Progress';
|
|
15
|
+
},
|
|
16
|
+
updateAccountsForTransferFlow(draft, action) {
|
|
17
|
+
const slice = draft.transferAccountsByType[action.payload.kind];
|
|
18
|
+
slice.fetchState = 'Completed';
|
|
19
|
+
slice.accountIds = action.payload.accountIds;
|
|
20
|
+
},
|
|
21
|
+
updateAccountsForTransferFlowFailure(draft, action) {
|
|
22
|
+
draft.transferAccountsByType[action.payload.kind].fetchState = 'Error';
|
|
23
|
+
},
|
|
24
|
+
createTransferEntry: {
|
|
25
|
+
prepare(payload) {
|
|
26
|
+
return { payload };
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Defense-in-depth: clear any stale `lastTransferEntryReplacement` on a
|
|
30
|
+
* fresh dispatch so a second `createTransferEntry` never inherits the
|
|
31
|
+
* previous run's replacement signal (e.g. if the prior `timer(0)` cleanup
|
|
32
|
+
* never fired). Mirrors the host hook's `consumedReplacementRef` guard
|
|
33
|
+
* (see `useTransferEntryRouteReplacement` in zeni-web-app-ui).
|
|
34
|
+
*/
|
|
35
|
+
reducer(draft) {
|
|
36
|
+
draft.createTransferEntryStatus = 'In-Progress';
|
|
37
|
+
draft.lastTransferEntryReplacement = undefined;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
createTransferEntrySuccess(draft) {
|
|
41
|
+
draft.createTransferEntryStatus = 'Completed';
|
|
42
|
+
},
|
|
43
|
+
createTransferEntryFailure(draft) {
|
|
44
|
+
draft.createTransferEntryStatus = 'Error';
|
|
45
|
+
},
|
|
46
|
+
resetCreateTransferEntryStatus(draft) {
|
|
47
|
+
draft.createTransferEntryStatus = 'Not-Started';
|
|
48
|
+
},
|
|
49
|
+
createTransferEntryReplacedTransaction: {
|
|
50
|
+
prepare(previousTransactionId, newTransactionId) {
|
|
51
|
+
return { payload: { newTransactionId, previousTransactionId } };
|
|
52
|
+
},
|
|
53
|
+
reducer(draft, action) {
|
|
54
|
+
draft.lastTransferEntryReplacement = action.payload;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* One-shot acknowledgement: the host has consumed the route-replacement
|
|
59
|
+
* signal and navigated to the new transaction url, so we can drop the
|
|
60
|
+
* record. Re-dispatching is idempotent.
|
|
61
|
+
*/
|
|
62
|
+
clearTransferEntryRouteReplacement(draft) {
|
|
63
|
+
draft.lastTransferEntryReplacement = undefined;
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Full slice reset. Dispatched from `clearAllEpic` on tenant switch so
|
|
67
|
+
* stale per-tenant state (account-id pools, status, replacement signal)
|
|
68
|
+
* doesn't bleed across tenants.
|
|
69
|
+
*/
|
|
70
|
+
clearCreateTransferEntry(draft) {
|
|
71
|
+
Object.assign(draft, exports.initialState);
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
_a = createTransferEntrySlice.actions, exports.fetchAccountsForTransferFlow = _a.fetchAccountsForTransferFlow, exports.updateAccountsForTransferFlow = _a.updateAccountsForTransferFlow, exports.updateAccountsForTransferFlowFailure = _a.updateAccountsForTransferFlowFailure, exports.createTransferEntry = _a.createTransferEntry, exports.createTransferEntrySuccess = _a.createTransferEntrySuccess, exports.createTransferEntryFailure = _a.createTransferEntryFailure, exports.resetCreateTransferEntryStatus = _a.resetCreateTransferEntryStatus, exports.createTransferEntryReplacedTransaction = _a.createTransferEntryReplacedTransaction, exports.clearTransferEntryRouteReplacement = _a.clearTransferEntryRouteReplacement, exports.clearCreateTransferEntry = _a.clearCreateTransferEntry;
|
|
76
|
+
exports.default = createTransferEntrySlice.reducer;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AccountBase } from '../../entity/account/accountState';
|
|
2
|
+
import { RootState } from '../../reducer';
|
|
3
|
+
import { TransferEntryRouteReplacement } from './createTransferEntryState';
|
|
4
|
+
export declare function getCreateTransferEntryStatus(state: RootState): import("../..").FetchState;
|
|
5
|
+
export declare function getLastTransferEntryReplacement(state: RootState): TransferEntryRouteReplacement | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Shared resolver for the credit/debit dropdowns in the transfer drawer.
|
|
8
|
+
*
|
|
9
|
+
* Resolution policy (intentional):
|
|
10
|
+
* 1. Prefer the dedicated API fetch results (`transferEntryEligible` for the
|
|
11
|
+
* debit pool, `creditCardOnlyEligible` for the credit-card-payment credit
|
|
12
|
+
* pool).
|
|
13
|
+
* 2. If the dedicated fetch returns an empty list while the COA is loaded,
|
|
14
|
+
* fall back to the COA: the full account list for `transferEntryEligible`,
|
|
15
|
+
* and COA accounts filtered to `credit_card` for `creditCardOnlyEligible`.
|
|
16
|
+
* This keeps the dropdown populated for older tenants where the dedicated
|
|
17
|
+
* endpoints haven't been backfilled yet.
|
|
18
|
+
*
|
|
19
|
+
* Intent — what this selector deliberately does NOT do:
|
|
20
|
+
* - Does NOT distinguish "fetch in-flight" / "fetch errored" / "fetch returned
|
|
21
|
+
* empty" — all three collapse to the COA fallback. The product preference
|
|
22
|
+
* is "always show something selectable" over "show a spinner that may never
|
|
23
|
+
* resolve". Loading/error UI belongs in the view layer; if you need a
|
|
24
|
+
* spinner, observe the `fetchState` on `transferAccountsByType[kind]`
|
|
25
|
+
* separately rather than changing the resolution policy here.
|
|
26
|
+
* - Does NOT enforce "API result is authoritative even if empty" — a tenant
|
|
27
|
+
* whose dedicated endpoint is correctly returning `[]` (e.g. no eligible
|
|
28
|
+
* transfer destinations) will still see the COA. That trade-off is
|
|
29
|
+
* accepted because the alternative blocks the user from picking anything;
|
|
30
|
+
* the backend distinguishes "no result" from "endpoint not implemented" by
|
|
31
|
+
* surfacing an error response, which the view layer handles separately.
|
|
32
|
+
*
|
|
33
|
+
* Memoized with reselect so consuming view-models don't recompute on every
|
|
34
|
+
* unrelated state change.
|
|
35
|
+
*/
|
|
36
|
+
export declare const getResolvedTransferAccounts: (state: RootState) => {
|
|
37
|
+
creditCardTransferAccountsList: AccountBase[];
|
|
38
|
+
transferAccountsList: AccountBase[];
|
|
39
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getResolvedTransferAccounts = void 0;
|
|
4
|
+
exports.getCreateTransferEntryStatus = getCreateTransferEntryStatus;
|
|
5
|
+
exports.getLastTransferEntryReplacement = getLastTransferEntryReplacement;
|
|
6
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
|
+
const accountSelector_1 = require("../../entity/account/accountSelector");
|
|
8
|
+
const accountListSelector_1 = require("../accountList/accountListSelector");
|
|
9
|
+
function getCreateTransferEntryStatus(state) {
|
|
10
|
+
return state.createTransferEntryState.createTransferEntryStatus;
|
|
11
|
+
}
|
|
12
|
+
function getLastTransferEntryReplacement(state) {
|
|
13
|
+
return state.createTransferEntryState.lastTransferEntryReplacement;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Shared resolver for the credit/debit dropdowns in the transfer drawer.
|
|
17
|
+
*
|
|
18
|
+
* Resolution policy (intentional):
|
|
19
|
+
* 1. Prefer the dedicated API fetch results (`transferEntryEligible` for the
|
|
20
|
+
* debit pool, `creditCardOnlyEligible` for the credit-card-payment credit
|
|
21
|
+
* pool).
|
|
22
|
+
* 2. If the dedicated fetch returns an empty list while the COA is loaded,
|
|
23
|
+
* fall back to the COA: the full account list for `transferEntryEligible`,
|
|
24
|
+
* and COA accounts filtered to `credit_card` for `creditCardOnlyEligible`.
|
|
25
|
+
* This keeps the dropdown populated for older tenants where the dedicated
|
|
26
|
+
* endpoints haven't been backfilled yet.
|
|
27
|
+
*
|
|
28
|
+
* Intent — what this selector deliberately does NOT do:
|
|
29
|
+
* - Does NOT distinguish "fetch in-flight" / "fetch errored" / "fetch returned
|
|
30
|
+
* empty" — all three collapse to the COA fallback. The product preference
|
|
31
|
+
* is "always show something selectable" over "show a spinner that may never
|
|
32
|
+
* resolve". Loading/error UI belongs in the view layer; if you need a
|
|
33
|
+
* spinner, observe the `fetchState` on `transferAccountsByType[kind]`
|
|
34
|
+
* separately rather than changing the resolution policy here.
|
|
35
|
+
* - Does NOT enforce "API result is authoritative even if empty" — a tenant
|
|
36
|
+
* whose dedicated endpoint is correctly returning `[]` (e.g. no eligible
|
|
37
|
+
* transfer destinations) will still see the COA. That trade-off is
|
|
38
|
+
* accepted because the alternative blocks the user from picking anything;
|
|
39
|
+
* the backend distinguishes "no result" from "endpoint not implemented" by
|
|
40
|
+
* surfacing an error response, which the view layer handles separately.
|
|
41
|
+
*
|
|
42
|
+
* Memoized with reselect so consuming view-models don't recompute on every
|
|
43
|
+
* unrelated state change.
|
|
44
|
+
*/
|
|
45
|
+
exports.getResolvedTransferAccounts = (0, toolkit_1.createSelector)([
|
|
46
|
+
(state) => state.accountState,
|
|
47
|
+
(state) => state.accountListState,
|
|
48
|
+
(state) => state.createTransferEntryState.transferAccountsByType
|
|
49
|
+
.transferEntryEligible.accountIds,
|
|
50
|
+
(state) => state.createTransferEntryState.transferAccountsByType
|
|
51
|
+
.creditCardOnlyEligible.accountIds,
|
|
52
|
+
], (accountState, accountListState, transferEligibleIds, creditCardOnlyIds) => {
|
|
53
|
+
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
54
|
+
const transferEligibleFromApi = transferEligibleIds
|
|
55
|
+
.map((id) => (0, accountSelector_1.getAccountBaseForTransferAccounts)(accountState, id))
|
|
56
|
+
.filter((account) => account != null);
|
|
57
|
+
const coaFallbackAllAccounts = accountList.accounts
|
|
58
|
+
.map((a) => (0, accountSelector_1.getAccountBase)(accountState, a.accountId, 'account_list'))
|
|
59
|
+
.filter((account) => account != null);
|
|
60
|
+
const transferAccountsList = transferEligibleFromApi.length > 0
|
|
61
|
+
? transferEligibleFromApi
|
|
62
|
+
: coaFallbackAllAccounts;
|
|
63
|
+
const creditCardFromApi = creditCardOnlyIds
|
|
64
|
+
.map((id) => (0, accountSelector_1.getAccountBaseForCreditCardTransferAccounts)(accountState, id))
|
|
65
|
+
.filter((account) => account != null);
|
|
66
|
+
const coaFallbackCreditCards = coaFallbackAllAccounts.filter((a) => a.accountType === 'credit_card');
|
|
67
|
+
const creditCardTransferAccountsList = creditCardFromApi.length > 0 ? creditCardFromApi : coaFallbackCreditCards;
|
|
68
|
+
return { creditCardTransferAccountsList, transferAccountsList };
|
|
69
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FetchState, ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
3
|
+
/** Which pool `fetchAccountsForTransferFlow` / transfer-flow epic should load. */
|
|
4
|
+
export declare const TRANSFER_ACCOUNTS_FETCH_TYPE: readonly ["transferEntryEligible", "creditCardOnlyEligible"];
|
|
5
|
+
export type TransferAccountsFetchType = (typeof TRANSFER_ACCOUNTS_FETCH_TYPE)[number];
|
|
6
|
+
export interface TransferAccountsState {
|
|
7
|
+
accountIds: ID[];
|
|
8
|
+
fetchState: FetchState;
|
|
9
|
+
}
|
|
10
|
+
export type TransferEntryRouteReplacement = {
|
|
11
|
+
newTransactionId: TransactionID;
|
|
12
|
+
previousTransactionId: TransactionID;
|
|
13
|
+
};
|
|
14
|
+
export interface CreateTransferEntryState {
|
|
15
|
+
createTransferEntryStatus: FetchState;
|
|
16
|
+
/**
|
|
17
|
+
* Set when create-transfer returns a new transaction id (the source expense
|
|
18
|
+
* has been replaced by a new transfer/credit-card-payment row). The host
|
|
19
|
+
* navigates to the new url and then dispatches
|
|
20
|
+
* `clearTransferEntryRouteReplacement` to clear this one-shot signal.
|
|
21
|
+
*/
|
|
22
|
+
lastTransferEntryReplacement: TransferEntryRouteReplacement | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Per-type fetch state + account-id list for the dropdowns shown in the
|
|
25
|
+
* transfer drawer (eligible accounts for `transfer`, credit-card-only
|
|
26
|
+
* accounts for `credit_card_payment`).
|
|
27
|
+
*/
|
|
28
|
+
transferAccountsByType: Record<TransferAccountsFetchType, TransferAccountsState>;
|
|
29
|
+
}
|
|
30
|
+
export declare const initialCreateTransferEntryState: CreateTransferEntryState;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initialCreateTransferEntryState = exports.TRANSFER_ACCOUNTS_FETCH_TYPE = void 0;
|
|
4
|
+
/** Which pool `fetchAccountsForTransferFlow` / transfer-flow epic should load. */
|
|
5
|
+
exports.TRANSFER_ACCOUNTS_FETCH_TYPE = [
|
|
6
|
+
'transferEntryEligible',
|
|
7
|
+
'creditCardOnlyEligible',
|
|
8
|
+
];
|
|
9
|
+
const initialTransferAccountsState = {
|
|
10
|
+
accountIds: [],
|
|
11
|
+
fetchState: 'Not-Started',
|
|
12
|
+
};
|
|
13
|
+
exports.initialCreateTransferEntryState = {
|
|
14
|
+
createTransferEntryStatus: 'Not-Started',
|
|
15
|
+
lastTransferEntryReplacement: undefined,
|
|
16
|
+
transferAccountsByType: {
|
|
17
|
+
transferEntryEligible: initialTransferAccountsState,
|
|
18
|
+
creditCardOnlyEligible: initialTransferAccountsState,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
|
+
import { removeTransaction, updateTransaction } from '../../../entity/transaction/transactionReducer';
|
|
5
|
+
import { RootState } from '../../../reducer';
|
|
6
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
|
+
import { removeTransactionFromAllTabs } from '../../expenseAutomationView/reducers/transactionsViewReducer';
|
|
8
|
+
import { initializeTransactionDetailLocalData, removeTransactionDetail } from '../../transactionDetail/transactionDetailReducer';
|
|
9
|
+
import { clearTransferEntryRouteReplacement, createTransferEntry, createTransferEntryFailure, createTransferEntryReplacedTransaction, createTransferEntrySuccess, resetCreateTransferEntryStatus } from '../createTransferEntryReducer';
|
|
10
|
+
export type ActionType = ReturnType<typeof openSnackbar> | ReturnType<typeof createTransferEntry> | ReturnType<typeof createTransferEntrySuccess> | ReturnType<typeof createTransferEntryFailure> | ReturnType<typeof removeTransactionFromAllTabs> | ReturnType<typeof resetCreateTransferEntryStatus> | ReturnType<typeof createTransferEntryReplacedTransaction> | ReturnType<typeof clearTransferEntryRouteReplacement> | ReturnType<typeof updateTransaction> | ReturnType<typeof initializeTransactionDetailLocalData> | ReturnType<typeof removeTransaction> | ReturnType<typeof removeTransactionDetail>;
|
|
11
|
+
export declare const createTransferEntryEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|