@zeniai/client-epic-state 5.1.54-betaRD2 → 5.1.54
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/entity/jeSchedules/jeSchedulesPayload.d.ts +0 -2
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +0 -4
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +1 -11
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +0 -2
- package/lib/epic.d.ts +1 -2
- package/lib/epic.js +1 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +0 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +1 -11
- package/lib/esm/epic.js +1 -2
- package/lib/esm/index.js +3 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -15
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +6 -20
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +10 -58
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -2
- package/lib/index.d.ts +4 -4
- package/lib/index.js +41 -44
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +1 -14
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +0 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +7 -21
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +4 -27
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +10 -58
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +3 -6
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -4
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
|
@@ -5,29 +5,11 @@ import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndRep
|
|
|
5
5
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
6
|
import { ClassBase } from '../../../entity/class/classState';
|
|
7
7
|
import { JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
8
|
-
import { JEScheduleTransactionKey
|
|
8
|
+
import { JEScheduleTransactionKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
9
9
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
10
10
|
import { JEAccountSettingsView } from '../selectorTypes/jeAccountSettingsViewSelectorTypes';
|
|
11
11
|
import { JEScheduledTransactionWithFailedEntries } from '../selectors/jeSchedulesViewSelector';
|
|
12
12
|
import { JEScheduleLocalData, JESchedulesViewUIState } from '../types/jeSchedulesViewState';
|
|
13
|
-
export interface JEKpiSummary {
|
|
14
|
-
aiAccountant: {
|
|
15
|
-
amount: number;
|
|
16
|
-
count: number;
|
|
17
|
-
};
|
|
18
|
-
manual: {
|
|
19
|
-
amount: number;
|
|
20
|
-
count: number;
|
|
21
|
-
};
|
|
22
|
-
needsReview: {
|
|
23
|
-
amount: number;
|
|
24
|
-
count: number;
|
|
25
|
-
};
|
|
26
|
-
total: {
|
|
27
|
-
amount: number;
|
|
28
|
-
count: number;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
13
|
export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
|
|
32
14
|
accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
33
15
|
accountSettingsView: JEAccountSettingsView;
|
|
@@ -36,18 +18,13 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
|
|
|
36
18
|
allDepreciationAccountList: AccountBase[];
|
|
37
19
|
allDepreciationAccountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
38
20
|
classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
|
|
21
|
+
completedSchedules: JEScheduledTransaction[];
|
|
39
22
|
completionStatus: CompletionStatusType;
|
|
40
|
-
|
|
41
|
-
createdTotal: number;
|
|
23
|
+
draftSchedules: JEScheduledTransaction[];
|
|
42
24
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
43
25
|
jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
|
|
44
|
-
|
|
45
|
-
active: Record<ScheduleTypes, number>;
|
|
46
|
-
ongoing: Record<ScheduleTypes, number>;
|
|
47
|
-
};
|
|
48
|
-
kpiSummary: JEKpiSummary;
|
|
26
|
+
ongoingSchedules: JEScheduledTransaction[];
|
|
49
27
|
pendingReviewSchedules: (JEScheduledTransaction | JEScheduledTransactionWithFailedEntries)[];
|
|
50
|
-
pendingReviewTotal: number;
|
|
51
28
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
52
29
|
refreshStatus: FetchStateAndError;
|
|
53
30
|
resolveSchedules: JEScheduledTransactionWithFailedEntries[];
|
|
@@ -10,7 +10,6 @@ const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState")
|
|
|
10
10
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
11
11
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
12
12
|
const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
|
|
13
|
-
const jeSchedulesTypes_1 = require("../../../entity/jeSchedules/jeSchedulesTypes");
|
|
14
13
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
15
14
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
16
15
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
@@ -60,7 +59,7 @@ function getJEScheduleSortAccessor(sortKey) {
|
|
|
60
59
|
case 'totalAmount':
|
|
61
60
|
return (s) => s.baseTransaction.amount.amount;
|
|
62
61
|
case 'transactionDate':
|
|
63
|
-
return (s) => s.
|
|
62
|
+
return (s) => s.baseTransaction.date.valueOf();
|
|
64
63
|
case 'memo':
|
|
65
64
|
return (s) => s.baseTransaction.memo?.toLowerCase();
|
|
66
65
|
default:
|
|
@@ -120,7 +119,11 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
120
119
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
121
120
|
failedJeScheduledTransaction.push(jeScheduleDetails);
|
|
122
121
|
});
|
|
123
|
-
const { sortKey, sortOrder
|
|
122
|
+
const { sortKey, sortOrder } = uiState;
|
|
123
|
+
const draftSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'), sortKey, sortOrder);
|
|
124
|
+
const ongoingSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'ongoing'), sortKey, sortOrder);
|
|
125
|
+
const completedSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'completed' ||
|
|
126
|
+
schedule.status.code === 'marked_as_completed'), sortKey, sortOrder);
|
|
124
127
|
const unsortedResolveSchedules = [];
|
|
125
128
|
failedJeScheduledTransaction.forEach((schedule) => {
|
|
126
129
|
schedule.scheduledJournalEntry.forEach((journalEntry) => {
|
|
@@ -133,42 +136,9 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
133
136
|
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
|
|
134
137
|
const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
|
|
135
138
|
const pendingReviewSchedules = sortJEScheduledTransactions([
|
|
136
|
-
...jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'
|
|
137
|
-
(selectedJETypeFilter == null ||
|
|
138
|
-
schedule.jeScheduleType === selectedJETypeFilter)),
|
|
139
|
+
...jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'),
|
|
139
140
|
...validResolveForPending,
|
|
140
141
|
], sortKey, sortOrder);
|
|
141
|
-
const createdSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => (schedule.status.code === 'ongoing' ||
|
|
142
|
-
schedule.status.code === 'completed' ||
|
|
143
|
-
schedule.status.code === 'marked_as_completed') &&
|
|
144
|
-
(selectedJETypeFilter == null ||
|
|
145
|
-
schedule.jeScheduleType === selectedJETypeFilter)), sortKey, sortOrder);
|
|
146
|
-
// KPI summary — derived from unfiltered schedules so counts are always accurate
|
|
147
|
-
const allSchedules = jeScheduledTransaction;
|
|
148
|
-
const sumAmount = (schedules) => schedules.reduce((total, schedule) => total + (schedule.baseTransaction.amount.amount ?? 0), 0);
|
|
149
|
-
const pendingReviewTotal = sumAmount(pendingReviewSchedules);
|
|
150
|
-
const createdTotal = sumAmount(createdSchedules);
|
|
151
|
-
const aiAccountantSchedules = allSchedules.filter((schedule) => schedule.confidenceScore != null);
|
|
152
|
-
const pendingUnfiltered = allSchedules.filter((schedule) => schedule.status.code === 'draft');
|
|
153
|
-
const kpiSummary = {
|
|
154
|
-
aiAccountant: {
|
|
155
|
-
count: aiAccountantSchedules.length,
|
|
156
|
-
amount: sumAmount(aiAccountantSchedules),
|
|
157
|
-
},
|
|
158
|
-
manual: {
|
|
159
|
-
count: allSchedules.filter((schedule) => schedule.confidenceScore == null)
|
|
160
|
-
.length,
|
|
161
|
-
amount: sumAmount(allSchedules.filter((schedule) => schedule.confidenceScore == null)),
|
|
162
|
-
},
|
|
163
|
-
needsReview: {
|
|
164
|
-
count: pendingUnfiltered.length,
|
|
165
|
-
amount: sumAmount(pendingUnfiltered),
|
|
166
|
-
},
|
|
167
|
-
total: {
|
|
168
|
-
count: allSchedules.length,
|
|
169
|
-
amount: sumAmount(allSchedules),
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
142
|
const allSteps = monthYearPeriodId != null
|
|
173
143
|
? (0, expenseAutomationViewSelectorTypes_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
|
|
174
144
|
: [];
|
|
@@ -181,22 +151,6 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
181
151
|
{ fetchState, error },
|
|
182
152
|
monthEndFetchState,
|
|
183
153
|
]);
|
|
184
|
-
const countByType = (schedules) => {
|
|
185
|
-
const counts = jeSchedulesTypes_1.ALL_SCHEDULES_TYPES.reduce((acc, type) => ({ ...acc, [type]: 0 }), {});
|
|
186
|
-
schedules.forEach((schedule) => {
|
|
187
|
-
if (schedule.jeScheduleType != null) {
|
|
188
|
-
counts[schedule.jeScheduleType] += 1;
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
return counts;
|
|
192
|
-
};
|
|
193
|
-
const jeScheduleTypeCounts = {
|
|
194
|
-
active: countByType(allSchedules.filter((schedule) => schedule.status.code === 'draft' ||
|
|
195
|
-
schedule.status.code === 'ongoing' ||
|
|
196
|
-
schedule.status.code === 'completed' ||
|
|
197
|
-
schedule.status.code === 'marked_as_completed')),
|
|
198
|
-
ongoing: countByType(allSchedules.filter((schedule) => schedule.status.code === 'ongoing')),
|
|
199
|
-
};
|
|
200
154
|
return {
|
|
201
155
|
uncategorizedAccounts,
|
|
202
156
|
allDepreciationAccountList: filteredDepAccounts,
|
|
@@ -205,12 +159,10 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
205
159
|
allAccountList: filteredAccounts,
|
|
206
160
|
accountListNestedAccountHierarchy,
|
|
207
161
|
allClassList: allClasses,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
kpiSummary,
|
|
162
|
+
completedSchedules,
|
|
163
|
+
draftSchedules,
|
|
164
|
+
ongoingSchedules,
|
|
212
165
|
pendingReviewSchedules,
|
|
213
|
-
pendingReviewTotal,
|
|
214
166
|
resolveSchedules: resolveSchedules,
|
|
215
167
|
accountSettingsView,
|
|
216
168
|
postStatusById: postStatusById,
|
|
@@ -8,18 +8,15 @@ import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSched
|
|
|
8
8
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
9
9
|
export declare const toJEScheduleSortKey: (v: string) => "vendor" | "type" | "category" | "class" | "memo" | "transactionDate" | "totalAmount" | "runningBalance" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "jePostingDate" | "remainingMonths";
|
|
10
10
|
export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
|
|
11
|
-
export declare const
|
|
12
|
-
export type
|
|
11
|
+
export declare const toJEScheduleMainTab: (v: string) => "completed" | "pending_review" | "ongoing";
|
|
12
|
+
export type JEScheduleMainTab = ReturnType<typeof toJEScheduleMainTab>;
|
|
13
13
|
export interface JESchedulesViewUIState {
|
|
14
|
-
createdGroupCollapsed: boolean;
|
|
15
|
-
pendingGroupCollapsed: boolean;
|
|
16
14
|
scrollPosition: {
|
|
17
15
|
scrollTop: number;
|
|
18
16
|
scrollLeft?: number;
|
|
19
17
|
} | undefined;
|
|
20
18
|
searchString: string;
|
|
21
|
-
|
|
22
|
-
selectedPageTab: JEPageTab;
|
|
19
|
+
selectedMainTab: JEScheduleMainTab;
|
|
23
20
|
sortKey: JEScheduleSortKey;
|
|
24
21
|
sortOrder: SortOrder;
|
|
25
22
|
totalCount: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.toJEScheduleMainTab = exports.toJEScheduleSortKey = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
5
|
const JE_SCHEDULE_SORT_KEYS = [
|
|
6
6
|
'vendor',
|
|
@@ -20,6 +20,10 @@ const JE_SCHEDULE_SORT_KEYS = [
|
|
|
20
20
|
];
|
|
21
21
|
const toJEScheduleSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_SORT_KEYS);
|
|
22
22
|
exports.toJEScheduleSortKey = toJEScheduleSortKey;
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const JE_SCHEDULE_MAIN_TABS = [
|
|
24
|
+
'pending_review',
|
|
25
|
+
'ongoing',
|
|
26
|
+
'completed',
|
|
27
|
+
];
|
|
28
|
+
const toJEScheduleMainTab = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_MAIN_TABS);
|
|
29
|
+
exports.toJEScheduleMainTab = toJEScheduleMainTab;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.54
|
|
3
|
+
"version": "5.1.54",
|
|
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",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { EMPTY, of } from 'rxjs';
|
|
2
|
-
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { convertToPeriod, toAbsoluteDay, } from '../../../../commonStateTypes/timePeriod';
|
|
4
|
-
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
|
-
import { fetchJeSchedulesPage, updateJESchedulesUIState, } from '../../reducers/jeSchedulesViewReducer';
|
|
6
|
-
export const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe(filter(updateJESchedulesUIState.match), filter((action) => action.payload.selectedPageTab != null), mergeMap(() => {
|
|
7
|
-
const state = state$.value;
|
|
8
|
-
const { fetchState, refreshStatus } = state.expenseAutomationJESchedulesViewState;
|
|
9
|
-
if (fetchState === 'In-Progress' ||
|
|
10
|
-
refreshStatus.fetchState === 'In-Progress') {
|
|
11
|
-
return EMPTY;
|
|
12
|
-
}
|
|
13
|
-
const currentTenant = getCurrentTenant(state);
|
|
14
|
-
const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
|
|
15
|
-
const period = convertToPeriod(selectedPeriod);
|
|
16
|
-
const timePeriodStart = toAbsoluteDay(period.start);
|
|
17
|
-
const timePeriodEnd = toAbsoluteDay(period.end);
|
|
18
|
-
if (timePeriodStart == null || timePeriodEnd == null) {
|
|
19
|
-
return EMPTY;
|
|
20
|
-
}
|
|
21
|
-
return of(fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, true));
|
|
22
|
-
}));
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../reducer';
|
|
4
|
-
import { fetchJeSchedulesPage, updateJESchedulesUIState } from '../../reducers/jeSchedulesViewReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof updateJESchedulesUIState>;
|
|
6
|
-
export declare const switchJESchedulesTabEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.switchJESchedulesTabEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
-
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
|
-
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
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)(() => {
|
|
10
|
-
const state = state$.value;
|
|
11
|
-
const { fetchState, refreshStatus } = state.expenseAutomationJESchedulesViewState;
|
|
12
|
-
if (fetchState === 'In-Progress' ||
|
|
13
|
-
refreshStatus.fetchState === 'In-Progress') {
|
|
14
|
-
return rxjs_1.EMPTY;
|
|
15
|
-
}
|
|
16
|
-
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
17
|
-
const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
|
|
18
|
-
const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
|
|
19
|
-
const timePeriodStart = (0, timePeriod_1.toAbsoluteDay)(period.start);
|
|
20
|
-
const timePeriodEnd = (0, timePeriod_1.toAbsoluteDay)(period.end);
|
|
21
|
-
if (timePeriodStart == null || timePeriodEnd == null) {
|
|
22
|
-
return rxjs_1.EMPTY;
|
|
23
|
-
}
|
|
24
|
-
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, true));
|
|
25
|
-
}));
|
|
26
|
-
exports.switchJESchedulesTabEpic = switchJESchedulesTabEpic;
|