@zeniai/client-epic-state 5.1.85-betaRD3 → 5.1.86-beta2UT
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/aiCfo/aiCfoState.d.ts +2 -2
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -2
- package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -34
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -68
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -24
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -10
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -28
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -41
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -12
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -40
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/tenant/tenantReducer.js +1 -0
- package/lib/entity/tenant/tenantSelector.d.ts +1 -0
- package/lib/entity/tenant/tenantSelector.js +12 -0
- package/lib/entity/tenant/tenantState.d.ts +1 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
- package/lib/epic.d.ts +1 -5
- package/lib/epic.js +1 -5
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -68
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -24
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -26
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -34
- package/lib/esm/entity/tenant/tenantReducer.js +1 -0
- package/lib/esm/entity/tenant/tenantSelector.js +11 -0
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/esm/epic.js +1 -5
- package/lib/esm/index.js +6 -12
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -34
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +28 -163
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -260
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
- package/lib/index.d.ts +12 -16
- package/lib/index.js +50 -76
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +1 -32
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -8
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +10 -45
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +28 -164
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +8 -34
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +1 -10
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -266
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -59
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -21
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -73
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -70
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -77
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -25
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -10
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -75
|
@@ -65,8 +65,8 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
65
65
|
cotTrackingByTransactionId: COTTransactionTrackingByTransactionId;
|
|
66
66
|
}, "expenseAutomationTransactionsView/updateTransactionCategorization", never, never>, updateCurrentSelectedTransactionCategorizationTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSelectedTab: "review" | "autoCategorized"], {
|
|
67
67
|
newSelectedTab: "review" | "autoCategorized";
|
|
68
|
-
}, "expenseAutomationTransactionsView/updateCurrentSelectedTransactionCategorizationTab", never, never>, updateTransactionCategorizationCompletedSubTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSubTab: "
|
|
69
|
-
newSubTab: "
|
|
68
|
+
}, "expenseAutomationTransactionsView/updateCurrentSelectedTransactionCategorizationTab", never, never>, updateTransactionCategorizationCompletedSubTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSubTab: "all" | "manual" | "ai_accountant"], {
|
|
69
|
+
newSubTab: "all" | "manual" | "ai_accountant";
|
|
70
70
|
}, "expenseAutomationTransactionsView/updateTransactionCategorizationCompletedSubTab", never, never>, updateTransactionCategorizationSaveStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
|
|
71
71
|
selectedTab: "review" | "autoCategorized";
|
|
72
72
|
fetchState: FetchState;
|
|
@@ -4,30 +4,12 @@ import { CompletionStatusType, FetchStateAndError, ID } from '../../../commonSta
|
|
|
4
4
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
5
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
6
|
import { ClassBase } from '../../../entity/class/classState';
|
|
7
|
-
import {
|
|
7
|
+
import { JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
8
|
+
import { JEScheduleTransactionKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
8
9
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
9
10
|
import { JEAccountSettingsView } from '../selectorTypes/jeAccountSettingsViewSelectorTypes';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { JEPageTab, 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
|
-
}
|
|
11
|
+
import { JEScheduledTransactionWithFailedEntries } from '../selectors/jeSchedulesViewSelector';
|
|
12
|
+
import { JEScheduleLocalData, JESchedulesViewUIState } from '../types/jeSchedulesViewState';
|
|
31
13
|
export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
|
|
32
14
|
accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
33
15
|
accountSettingsView: JEAccountSettingsView;
|
|
@@ -36,24 +18,16 @@ 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;
|
|
42
|
-
hasLoadedForSelectedTab: boolean;
|
|
23
|
+
draftSchedules: JEScheduledTransaction[];
|
|
43
24
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
44
25
|
jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
ongoing: Record<ScheduleTypes, number>;
|
|
48
|
-
};
|
|
49
|
-
kpiSummary: JEKpiSummary;
|
|
50
|
-
newScheduleView: NewScheduleView | undefined;
|
|
51
|
-
pendingReviewSchedules: JEScheduleRow[];
|
|
52
|
-
pendingReviewTotal: number;
|
|
26
|
+
ongoingSchedules: JEScheduledTransaction[];
|
|
27
|
+
pendingReviewSchedules: (JEScheduledTransaction | JEScheduledTransactionWithFailedEntries)[];
|
|
53
28
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
54
29
|
refreshStatus: FetchStateAndError;
|
|
55
30
|
resolveSchedules: JEScheduledTransactionWithFailedEntries[];
|
|
56
|
-
scheduleCountsByTab: Partial<Record<JEPageTab, number>>;
|
|
57
31
|
uiState: JESchedulesViewUIState;
|
|
58
32
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
59
33
|
}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
1
|
+
import { JEScheduledTransaction, ScheduledJournalEntry } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
3
2
|
import { RootState } from '../../../reducer';
|
|
4
3
|
import { ExpenseAutomationJESchedulesViewSelector } from '../selectorTypes/jeSchedulesSelectorTypes';
|
|
5
|
-
export declare function getJEScheduleRowType(schedule: JEScheduleRow): ScheduleTypes | undefined;
|
|
6
|
-
export declare function isPendingReviewRow(schedule: JEScheduleRow): boolean;
|
|
7
|
-
export declare function isExistingTabRow(schedule: JEScheduleRow): boolean;
|
|
8
|
-
export declare const isAiAccountantSchedule: (schedule: JEScheduleRow) => boolean;
|
|
9
|
-
export declare function isAccruedScheduleRow(schedule: JEScheduleRow): schedule is JEAccruedSchedule;
|
|
10
|
-
export declare function isOneTimeAccrualRow(schedule: JEScheduleRow): schedule is JEOneTimeAccrual;
|
|
11
4
|
export declare function getExpenseAutomationJESchedulesView(state: RootState): ExpenseAutomationJESchedulesViewSelector;
|
|
12
5
|
export interface JEScheduledTransactionWithFailedEntries extends Omit<JEScheduledTransaction, 'scheduledJournalEntry'> {
|
|
13
6
|
scheduledJournalEntry: ScheduledJournalEntry;
|
|
14
7
|
}
|
|
15
|
-
export type JEScheduleRow = JEAccruedSchedule | JEOneTimeAccrual | JEScheduledTransaction | JEScheduledTransactionWithFailedEntries;
|
|
16
|
-
export type JEScheduleRowWithoutOneTimeAccrual = Exclude<JEScheduleRow, JEOneTimeAccrual>;
|
|
@@ -3,12 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isAiAccountantSchedule = void 0;
|
|
7
|
-
exports.getJEScheduleRowType = getJEScheduleRowType;
|
|
8
|
-
exports.isPendingReviewRow = isPendingReviewRow;
|
|
9
|
-
exports.isExistingTabRow = isExistingTabRow;
|
|
10
|
-
exports.isAccruedScheduleRow = isAccruedScheduleRow;
|
|
11
|
-
exports.isOneTimeAccrualRow = isOneTimeAccrualRow;
|
|
12
6
|
exports.getExpenseAutomationJESchedulesView = getExpenseAutomationJESchedulesView;
|
|
13
7
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
14
8
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
@@ -16,7 +10,6 @@ const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState")
|
|
|
16
10
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
17
11
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
18
12
|
const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
|
|
19
|
-
const jeSchedulesTypes_1 = require("../../../entity/jeSchedules/jeSchedulesTypes");
|
|
20
13
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
21
14
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
22
15
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
@@ -24,119 +17,8 @@ const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDeta
|
|
|
24
17
|
const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailSelector");
|
|
25
18
|
const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
|
|
26
19
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
27
|
-
const jeSchedulesViewState_1 = require("../types/jeSchedulesViewState");
|
|
28
20
|
const jeAccountSettingsViewSelector_1 = require("./jeAccountSettingsViewSelector");
|
|
29
|
-
const jeNewScheduleViewSelector_1 = require("./jeNewScheduleViewSelector");
|
|
30
|
-
// Matches the AI-automation user addresses webc's schedule list row already
|
|
31
|
-
// checks (JEScheduleReadOnlyListRow/JEScheduleDraftListRow "Method" column,
|
|
32
|
-
// strings.ts aiBotEmail/botEmail) to determine whether a schedule was
|
|
33
|
-
// created by the AI accountant vs. a human.
|
|
34
|
-
const AI_BOT_EMAIL = 'ai@zeni.ai';
|
|
35
|
-
const BOT_EMAIL = 'bot@zeni.ai';
|
|
36
|
-
// A one-time accrual has no jeScheduleType of its own — it is not a JE schedule. It is still an
|
|
37
|
-
// accrued expense, so it counts and filters under that type on the page's type tabs.
|
|
38
|
-
const ONE_TIME_ACCRUAL_SCHEDULE_TYPE = 'accrued_expenses';
|
|
39
|
-
// Which of the two list buckets an accrual belongs in. `draft` still needs a human to post it and
|
|
40
|
-
// `posting_blocked` needs attention, so both are review work; everything else is already on the
|
|
41
|
-
// books or in a transient claim.
|
|
42
|
-
const ONE_TIME_ACCRUAL_REVIEW_STATUSES = [
|
|
43
|
-
'draft',
|
|
44
|
-
'posting_blocked',
|
|
45
|
-
];
|
|
46
|
-
function getJEScheduleRowType(schedule) {
|
|
47
|
-
return isOneTimeAccrualRow(schedule)
|
|
48
|
-
? ONE_TIME_ACCRUAL_SCHEDULE_TYPE
|
|
49
|
-
: schedule.jeScheduleType;
|
|
50
|
-
}
|
|
51
|
-
function isPendingReviewRow(schedule) {
|
|
52
|
-
return isOneTimeAccrualRow(schedule)
|
|
53
|
-
? ONE_TIME_ACCRUAL_REVIEW_STATUSES.includes(schedule.accrualStatus)
|
|
54
|
-
: schedule.status.code === 'draft';
|
|
55
|
-
}
|
|
56
|
-
// Belongs on the Existing Schedules tab. For an accrual the endpoint has already filtered to
|
|
57
|
-
// posted, so this only has to agree with that rather than re-derive it.
|
|
58
|
-
function isExistingTabRow(schedule) {
|
|
59
|
-
return isOneTimeAccrualRow(schedule)
|
|
60
|
-
? schedule.accrualStatus === 'posted'
|
|
61
|
-
: schedule.status.code === 'ongoing';
|
|
62
|
-
}
|
|
63
|
-
// Exported (rather than kept as a closure inside the selector) so it can be
|
|
64
|
-
// unit-tested directly — confidenceScore is a separate, more narrowly
|
|
65
|
-
// populated field that can be null on a schedule the bot user created,
|
|
66
|
-
// which previously caused these schedules to display as "AI Accountant" in
|
|
67
|
-
// the list but count under "Manual" in the KPI summary.
|
|
68
|
-
const isAiAccountantSchedule = (schedule) => {
|
|
69
|
-
// A one-time accrual records who made it as `origin`, which is authoritative — no email
|
|
70
|
-
// sniffing needed, and the JE bot is often absent from the user entity entirely.
|
|
71
|
-
if (isOneTimeAccrualRow(schedule)) {
|
|
72
|
-
return schedule.origin === 'agent';
|
|
73
|
-
}
|
|
74
|
-
return (schedule.createdByUser?.email === AI_BOT_EMAIL ||
|
|
75
|
-
schedule.createdByUser?.email === BOT_EMAIL);
|
|
76
|
-
};
|
|
77
|
-
exports.isAiAccountantSchedule = isAiAccountantSchedule;
|
|
78
|
-
// Accrued schedules are structurally distinct — no baseTransaction, carrying recurringAmount and
|
|
79
|
-
// memo in its place — so anything reading baseTransaction has to branch on this first.
|
|
80
|
-
//
|
|
81
|
-
// Discriminates on jeAccruedScheduleKey, which only JEAccruedSchedule carries. jeScheduleType
|
|
82
|
-
// cannot be used: it is a data field present on BOTH row shapes, so an accrued-typed row that
|
|
83
|
-
// arrived through the prepaid/fixed DTO (failed_je_postings, legacy fetches) would be
|
|
84
|
-
// misclassified and then crash on recurringAmount / jeAccruedScheduleKey.
|
|
85
|
-
function isAccruedScheduleRow(schedule) {
|
|
86
|
-
return 'jeAccruedScheduleKey' in schedule;
|
|
87
|
-
}
|
|
88
|
-
// Same structural approach as isAccruedScheduleRow, and for the same reason: jeOneTimeAccrualKey
|
|
89
|
-
// exists only on this shape. Note the two guards are NOT interchangeable — a one-time accrual is
|
|
90
|
-
// not an accrued *schedule*, and routing it into the accrued branch would read recurringAmount,
|
|
91
|
-
// render postedCount/lifecycleTotal as a lifecycle and startDate–endDate as a period, none of
|
|
92
|
-
// which it has.
|
|
93
|
-
function isOneTimeAccrualRow(schedule) {
|
|
94
|
-
return 'jeOneTimeAccrualKey' in schedule;
|
|
95
|
-
}
|
|
96
|
-
function getScheduleAmount(schedule) {
|
|
97
|
-
if (isOneTimeAccrualRow(schedule)) {
|
|
98
|
-
return schedule.estimatedAmount.amount;
|
|
99
|
-
}
|
|
100
|
-
if (isAccruedScheduleRow(schedule)) {
|
|
101
|
-
return schedule.recurringAmount.amount;
|
|
102
|
-
}
|
|
103
|
-
return schedule.baseTransaction.amount.amount;
|
|
104
|
-
}
|
|
105
|
-
// A one-time accrual shares almost no sortable field with a schedule, so it gets its own accessor
|
|
106
|
-
// rather than a guard on each of the dozen cases below. Keys with no meaning for a single-month
|
|
107
|
-
// accrual -- amortizationPeriod, remainingMonths, runningBalance, jePostingDate, scheduleCategory --
|
|
108
|
-
// deliberately fall through to undefined, which sorts them together at one end.
|
|
109
|
-
function getOneTimeAccrualSortValue(accrual, sortKey) {
|
|
110
|
-
switch (sortKey) {
|
|
111
|
-
case 'vendor':
|
|
112
|
-
return accrual.vendorName.toLowerCase();
|
|
113
|
-
case 'category':
|
|
114
|
-
return accrual.jeDebitAccountName?.toLowerCase();
|
|
115
|
-
case 'class':
|
|
116
|
-
return accrual.jeDebitAccountingClassName?.toLowerCase();
|
|
117
|
-
case 'depCategory':
|
|
118
|
-
return accrual.jeCreditAccountName?.toLowerCase();
|
|
119
|
-
case 'type':
|
|
120
|
-
return ONE_TIME_ACCRUAL_SCHEDULE_TYPE;
|
|
121
|
-
case 'totalAmount':
|
|
122
|
-
return accrual.estimatedAmount.amount;
|
|
123
|
-
case 'transactionDate':
|
|
124
|
-
return accrual.postingDate?.valueOf();
|
|
125
|
-
case 'memo':
|
|
126
|
-
return accrual.memo.toLowerCase();
|
|
127
|
-
case 'startMonth':
|
|
128
|
-
return accrual.serviceMonth;
|
|
129
|
-
default:
|
|
130
|
-
return undefined;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
21
|
function getJEScheduleSortAccessor(sortKey) {
|
|
134
|
-
const scheduleAccessor = getScheduleRowSortAccessor(sortKey);
|
|
135
|
-
return (schedule) => isOneTimeAccrualRow(schedule)
|
|
136
|
-
? getOneTimeAccrualSortValue(schedule, sortKey)
|
|
137
|
-
: scheduleAccessor(schedule);
|
|
138
|
-
}
|
|
139
|
-
function getScheduleRowSortAccessor(sortKey) {
|
|
140
22
|
switch (sortKey) {
|
|
141
23
|
case 'vendor':
|
|
142
24
|
return (s) => s.vendor.name?.toLowerCase();
|
|
@@ -147,9 +29,7 @@ function getScheduleRowSortAccessor(sortKey) {
|
|
|
147
29
|
case 'depCategory':
|
|
148
30
|
return (s) => s.jeCredit.account?.accountName?.toLowerCase();
|
|
149
31
|
case 'scheduleCategory':
|
|
150
|
-
return (s) =>
|
|
151
|
-
? undefined
|
|
152
|
-
: s.baseTransaction.account?.accountName?.toLowerCase();
|
|
32
|
+
return (s) => s.baseTransaction.account?.accountName?.toLowerCase();
|
|
153
33
|
case 'startMonth':
|
|
154
34
|
return (s) => s.startDate?.valueOf();
|
|
155
35
|
case 'type':
|
|
@@ -177,13 +57,11 @@ function getScheduleRowSortAccessor(sortKey) {
|
|
|
177
57
|
return s.balanceAsOfToday?.amount ?? null;
|
|
178
58
|
};
|
|
179
59
|
case 'totalAmount':
|
|
180
|
-
return (s) =>
|
|
60
|
+
return (s) => s.baseTransaction.amount.amount;
|
|
181
61
|
case 'transactionDate':
|
|
182
|
-
return (s) => s.
|
|
62
|
+
return (s) => s.baseTransaction.date.valueOf();
|
|
183
63
|
case 'memo':
|
|
184
|
-
return (s) =>
|
|
185
|
-
? s.memo.toLowerCase()
|
|
186
|
-
: s.baseTransaction.memo?.toLowerCase();
|
|
64
|
+
return (s) => s.baseTransaction.memo?.toLowerCase();
|
|
187
65
|
default:
|
|
188
66
|
return (s) => s.startDate?.valueOf();
|
|
189
67
|
}
|
|
@@ -195,15 +73,9 @@ function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
|
|
|
195
73
|
function getExpenseAutomationJESchedulesView(state) {
|
|
196
74
|
const jeScheduledTransaction = [];
|
|
197
75
|
const failedJeScheduledTransaction = [];
|
|
198
|
-
const accruedSchedules = [];
|
|
199
|
-
const oneTimeAccruals = [];
|
|
200
76
|
const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
201
|
-
const {
|
|
77
|
+
const { jeScheduleTransactionKeysByPeriod, failedJeScheduleTransactionKeysByPeriod, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, } = expenseAutomationJESchedulesViewState;
|
|
202
78
|
const accountSettingsView = (0, jeAccountSettingsViewSelector_1.getJEAccountSettingsView)(state);
|
|
203
|
-
const newScheduleView = newSchedule.selectedDetailScheduleType === 'fixed_assets' ||
|
|
204
|
-
newSchedule.selectedDetailScheduleType === 'prepaid_expenses'
|
|
205
|
-
? (0, jeNewScheduleViewSelector_1.getNewScheduleView)(state, newSchedule.selectedDetailScheduleType)
|
|
206
|
-
: undefined;
|
|
207
79
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
208
80
|
const { selectedPeriodByTenantId } = expenseAutomationViewState;
|
|
209
81
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
@@ -231,48 +103,27 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
231
103
|
const filteredDepAccountListNestedAccountHierarchy = (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)(depAccountListNestedAccountHierarchy, filteredDepAccounts.map((account) => account.accountId));
|
|
232
104
|
const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
|
|
233
105
|
const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : null;
|
|
234
|
-
const
|
|
235
|
-
?
|
|
106
|
+
const jeScheduleTransactionKeysForSelectedPeriod = monthYearPeriodId != null
|
|
107
|
+
? jeScheduleTransactionKeysByPeriod[monthYearPeriodId]
|
|
236
108
|
: null;
|
|
237
|
-
const
|
|
238
|
-
?
|
|
239
|
-
:
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
: undefined;
|
|
243
|
-
// Distinguishes "this tab has never been fetched for this period" from "fetched and genuinely
|
|
244
|
-
// empty". Without it the page cannot tell a first visit from a real empty state, and renders an
|
|
245
|
-
// empty table where it should render a skeleton.
|
|
246
|
-
const hasLoadedForSelectedTab = jeScheduleTransactionKeysForSelectedTab != null;
|
|
247
|
-
const jeScheduleTransactionKeys = jeScheduleTransactionKeysForSelectedTab ?? [];
|
|
248
|
-
const failedJeScheduleTransactionKeys = failedJeScheduleTransactionKeysForSelectedTab ?? [];
|
|
249
|
-
const jeScheduleAccruedKeys = (selectedPeriodTabKey != null
|
|
250
|
-
? jeScheduleAccruedKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
251
|
-
: undefined) ?? [];
|
|
252
|
-
const jeScheduleOneTimeAccrualKeys = (selectedPeriodTabKey != null
|
|
253
|
-
? jeScheduleOneTimeAccrualKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
254
|
-
: undefined) ?? [];
|
|
255
|
-
jeScheduleOneTimeAccrualKeys.forEach((jeOneTimeAccrualKey) => {
|
|
256
|
-
const accrual = (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(jeOneTimeAccrualKey, state.jeSchedulesState);
|
|
257
|
-
if (accrual != null) {
|
|
258
|
-
oneTimeAccruals.push(accrual);
|
|
259
|
-
}
|
|
260
|
-
});
|
|
109
|
+
const failedJeScheduleTransactionKeysForSelectedPeriod = monthYearPeriodId != null
|
|
110
|
+
? failedJeScheduleTransactionKeysByPeriod[monthYearPeriodId]
|
|
111
|
+
: null;
|
|
112
|
+
const jeScheduleTransactionKeys = jeScheduleTransactionKeysForSelectedPeriod ?? [];
|
|
113
|
+
const failedJeScheduleTransactionKeys = failedJeScheduleTransactionKeysForSelectedPeriod ?? [];
|
|
261
114
|
jeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
262
115
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
263
116
|
jeScheduledTransaction.push(jeScheduleDetails);
|
|
264
117
|
});
|
|
265
|
-
jeScheduleAccruedKeys.forEach((jeAccruedScheduleKey) => {
|
|
266
|
-
const accruedScheduleDetails = (0, jeSchedulesSelector_1.getJEAccruedScheduleByJEScheduleKey)(jeAccruedScheduleKey, state);
|
|
267
|
-
if (accruedScheduleDetails != null) {
|
|
268
|
-
accruedSchedules.push(accruedScheduleDetails);
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
118
|
failedJeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
272
119
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
273
120
|
failedJeScheduledTransaction.push(jeScheduleDetails);
|
|
274
121
|
});
|
|
275
|
-
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);
|
|
276
127
|
const unsortedResolveSchedules = [];
|
|
277
128
|
failedJeScheduledTransaction.forEach((schedule) => {
|
|
278
129
|
schedule.scheduledJournalEntry.forEach((journalEntry) => {
|
|
@@ -284,87 +135,10 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
284
135
|
});
|
|
285
136
|
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
|
|
286
137
|
const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
|
|
287
|
-
const matchesTypeFilter = (schedule) => selectedJETypeFilter == null ||
|
|
288
|
-
getJEScheduleRowType(schedule) === selectedJETypeFilter;
|
|
289
|
-
const isCreatedStatus = (schedule) => {
|
|
290
|
-
// An accrual is "created" once it is not review work: posted, reversing, reversed, or in a
|
|
291
|
-
// transient posting claim.
|
|
292
|
-
if (isOneTimeAccrualRow(schedule)) {
|
|
293
|
-
return !isPendingReviewRow(schedule);
|
|
294
|
-
}
|
|
295
|
-
return (schedule.status.code === 'ongoing' ||
|
|
296
|
-
schedule.status.code === 'completed' ||
|
|
297
|
-
schedule.status.code === 'marked_as_completed');
|
|
298
|
-
};
|
|
299
|
-
const allScheduleRows = [
|
|
300
|
-
...jeScheduledTransaction,
|
|
301
|
-
...accruedSchedules,
|
|
302
|
-
...oneTimeAccruals,
|
|
303
|
-
];
|
|
304
138
|
const pendingReviewSchedules = sortJEScheduledTransactions([
|
|
305
|
-
...
|
|
139
|
+
...jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'),
|
|
306
140
|
...validResolveForPending,
|
|
307
141
|
], sortKey, sortOrder);
|
|
308
|
-
const createdSchedules = sortJEScheduledTransactions(allScheduleRows.filter((schedule) => isCreatedStatus(schedule) && matchesTypeFilter(schedule)), sortKey, sortOrder);
|
|
309
|
-
// KPI summary — derived from unfiltered schedules so counts are always accurate
|
|
310
|
-
const allSchedules = allScheduleRows;
|
|
311
|
-
const sumAmount = (schedules) => schedules.reduce((total, schedule) => total + (getScheduleAmount(schedule) ?? 0), 0);
|
|
312
|
-
const pendingReviewTotal = sumAmount(pendingReviewSchedules);
|
|
313
|
-
const createdTotal = sumAmount(createdSchedules);
|
|
314
|
-
const aiAccountantSchedules = allSchedules.filter(exports.isAiAccountantSchedule);
|
|
315
|
-
const manualSchedules = allSchedules.filter((schedule) => !(0, exports.isAiAccountantSchedule)(schedule));
|
|
316
|
-
const pendingUnfiltered = allSchedules.filter((schedule) => isPendingReviewRow(schedule));
|
|
317
|
-
const kpiSummary = {
|
|
318
|
-
aiAccountant: {
|
|
319
|
-
count: aiAccountantSchedules.length,
|
|
320
|
-
amount: sumAmount(aiAccountantSchedules),
|
|
321
|
-
},
|
|
322
|
-
manual: {
|
|
323
|
-
count: manualSchedules.length,
|
|
324
|
-
amount: sumAmount(manualSchedules),
|
|
325
|
-
},
|
|
326
|
-
needsReview: {
|
|
327
|
-
count: pendingUnfiltered.length,
|
|
328
|
-
amount: sumAmount(pendingUnfiltered),
|
|
329
|
-
},
|
|
330
|
-
total: {
|
|
331
|
-
count: allSchedules.length,
|
|
332
|
-
amount: sumAmount(allSchedules),
|
|
333
|
-
},
|
|
334
|
-
};
|
|
335
|
-
// Each tab's badge counts from that tab's own bucket. A tab that has not been fetched yet
|
|
336
|
-
// reports undefined rather than 0, so the UI can hide the badge instead of asserting "none".
|
|
337
|
-
const scheduleCountsByTab = {};
|
|
338
|
-
jeSchedulesViewState_1.ALL_JE_PAGE_TABS.forEach((pageTab) => {
|
|
339
|
-
const periodTabKey = monthYearPeriodId != null
|
|
340
|
-
? (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(pageTab, monthYearPeriodId)
|
|
341
|
-
: null;
|
|
342
|
-
const transactionKeys = periodTabKey != null
|
|
343
|
-
? jeScheduleTransactionKeysByPeriodAndTab[periodTabKey]
|
|
344
|
-
: undefined;
|
|
345
|
-
if (transactionKeys == null) {
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
const accruedKeys = (periodTabKey != null
|
|
349
|
-
? jeScheduleAccruedKeysByPeriodAndTab[periodTabKey]
|
|
350
|
-
: undefined) ?? [];
|
|
351
|
-
const oneTimeAccrualKeys = (periodTabKey != null
|
|
352
|
-
? jeScheduleOneTimeAccrualKeysByPeriodAndTab[periodTabKey]
|
|
353
|
-
: undefined) ?? [];
|
|
354
|
-
const rowsForTab = [
|
|
355
|
-
...transactionKeys.map((transactionKey) => (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(transactionKey, state)),
|
|
356
|
-
...accruedKeys
|
|
357
|
-
.map((accruedKey) => (0, jeSchedulesSelector_1.getJEAccruedScheduleByJEScheduleKey)(accruedKey, state))
|
|
358
|
-
.filter((accruedRow) => accruedRow != null),
|
|
359
|
-
...oneTimeAccrualKeys
|
|
360
|
-
.map((accrualKey) => (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(accrualKey, state.jeSchedulesState))
|
|
361
|
-
.filter((accrualRow) => accrualRow != null),
|
|
362
|
-
];
|
|
363
|
-
scheduleCountsByTab[pageTab] =
|
|
364
|
-
pageTab === 'existing_schedules'
|
|
365
|
-
? rowsForTab.filter((row) => isExistingTabRow(row)).length
|
|
366
|
-
: rowsForTab.filter((row) => isPendingReviewRow(row) || isCreatedStatus(row)).length;
|
|
367
|
-
});
|
|
368
142
|
const allSteps = monthYearPeriodId != null
|
|
369
143
|
? (0, expenseAutomationViewSelectorTypes_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
|
|
370
144
|
: [];
|
|
@@ -377,20 +151,6 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
377
151
|
{ fetchState, error },
|
|
378
152
|
monthEndFetchState,
|
|
379
153
|
]);
|
|
380
|
-
const countByType = (schedules) => {
|
|
381
|
-
const counts = jeSchedulesTypes_1.ALL_SCHEDULES_TYPES.reduce((acc, type) => ({ ...acc, [type]: 0 }), {});
|
|
382
|
-
schedules.forEach((schedule) => {
|
|
383
|
-
const scheduleType = getJEScheduleRowType(schedule);
|
|
384
|
-
if (scheduleType != null) {
|
|
385
|
-
counts[scheduleType] += 1;
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
return counts;
|
|
389
|
-
};
|
|
390
|
-
const jeScheduleTypeCounts = {
|
|
391
|
-
active: countByType(allSchedules.filter((schedule) => isPendingReviewRow(schedule) || isCreatedStatus(schedule))),
|
|
392
|
-
ongoing: countByType(allSchedules.filter((schedule) => isExistingTabRow(schedule))),
|
|
393
|
-
};
|
|
394
154
|
return {
|
|
395
155
|
uncategorizedAccounts,
|
|
396
156
|
allDepreciationAccountList: filteredDepAccounts,
|
|
@@ -399,17 +159,12 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
399
159
|
allAccountList: filteredAccounts,
|
|
400
160
|
accountListNestedAccountHierarchy,
|
|
401
161
|
allClassList: allClasses,
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
jeScheduleTypeCounts,
|
|
406
|
-
scheduleCountsByTab,
|
|
407
|
-
kpiSummary,
|
|
162
|
+
completedSchedules,
|
|
163
|
+
draftSchedules,
|
|
164
|
+
ongoingSchedules,
|
|
408
165
|
pendingReviewSchedules,
|
|
409
|
-
pendingReviewTotal,
|
|
410
166
|
resolveSchedules: resolveSchedules,
|
|
411
167
|
accountSettingsView,
|
|
412
|
-
newScheduleView,
|
|
413
168
|
postStatusById: postStatusById,
|
|
414
169
|
ignoreStatusById: ignoreStatusById,
|
|
415
170
|
fetchState: reducedFetchStatus.fetchState,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const toCompletedSubTab: (v: string) => "
|
|
1
|
+
export declare const toCompletedSubTab: (v: string) => "all" | "manual" | "ai_accountant";
|
|
2
2
|
export type CompletedSubTab = ReturnType<typeof toCompletedSubTab>;
|
|
3
3
|
/**
|
|
4
4
|
* "No sub-tab filter" sentinel — single source of truth for the default
|
|
@@ -1,31 +1,22 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
|
-
import { Amount } from '../../../commonStateTypes/amount';
|
|
3
2
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
4
3
|
import { Recommendation } from '../../../commonStateTypes/recommendationBase';
|
|
5
4
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
6
|
-
import { MonthYearPeriodId
|
|
5
|
+
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
7
6
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
8
|
-
import {
|
|
7
|
+
import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
9
8
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
10
|
-
|
|
11
|
-
import { JETransactionLink } from '../../scheduleView/scheduleDetailView/scheduleDetailState';
|
|
12
|
-
export declare const toJEScheduleSortKey: (v: string) => "type" | "vendor" | "category" | "class" | "memo" | "transactionDate" | "totalAmount" | "runningBalance" | "jePostingDate" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "remainingMonths";
|
|
9
|
+
export declare const toJEScheduleSortKey: (v: string) => "type" | "vendor" | "category" | "class" | "memo" | "transactionDate" | "totalAmount" | "runningBalance" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "jePostingDate" | "remainingMonths";
|
|
13
10
|
export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
|
|
14
|
-
export declare const
|
|
15
|
-
export type
|
|
16
|
-
export declare const ALL_JE_PAGE_TABS: readonly JEPageTab[];
|
|
17
|
-
export type JESchedulePeriodTabKey = `${JEPageTab}_${MonthYearPeriodId}`;
|
|
18
|
-
export declare const getJESchedulePeriodTabKey: (selectedPageTab: JEPageTab, monthYearPeriodId: MonthYearPeriodId) => JESchedulePeriodTabKey;
|
|
11
|
+
export declare const toJEScheduleMainTab: (v: string) => "completed" | "pending_review" | "ongoing";
|
|
12
|
+
export type JEScheduleMainTab = ReturnType<typeof toJEScheduleMainTab>;
|
|
19
13
|
export interface JESchedulesViewUIState {
|
|
20
|
-
createdGroupCollapsed: boolean;
|
|
21
|
-
pendingGroupCollapsed: boolean;
|
|
22
14
|
scrollPosition: {
|
|
23
15
|
scrollTop: number;
|
|
24
16
|
scrollLeft?: number;
|
|
25
17
|
} | undefined;
|
|
26
18
|
searchString: string;
|
|
27
|
-
|
|
28
|
-
selectedPageTab: JEPageTab;
|
|
19
|
+
selectedMainTab: JEScheduleMainTab;
|
|
29
20
|
sortKey: JEScheduleSortKey;
|
|
30
21
|
sortOrder: SortOrder;
|
|
31
22
|
totalCount: number;
|
|
@@ -42,56 +33,14 @@ export interface JEScheduleLocalData {
|
|
|
42
33
|
}
|
|
43
34
|
export interface JESchedulesViewState extends FetchedState {
|
|
44
35
|
accountSettings: AccountSettingsState;
|
|
45
|
-
|
|
36
|
+
failedJeScheduleTransactionKeysByPeriod: Record<MonthYearPeriodId, JEScheduleTransactionKey[]>;
|
|
46
37
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
47
|
-
jeScheduleAccruedKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleKey[]>;
|
|
48
38
|
jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
|
|
49
|
-
|
|
50
|
-
jeScheduleTransactionKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleTransactionKey[]>;
|
|
51
|
-
newSchedule: NewJeScheduleState;
|
|
39
|
+
jeScheduleTransactionKeysByPeriod: Record<MonthYearPeriodId, JEScheduleTransactionKey[]>;
|
|
52
40
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
53
41
|
refreshStatus: FetchStateAndError;
|
|
54
42
|
uiState: JESchedulesViewUIState;
|
|
55
43
|
}
|
|
56
|
-
export interface NewJeDetailLocalData {
|
|
57
|
-
amount: Amount;
|
|
58
|
-
jeLink: JETransactionLink;
|
|
59
|
-
memo: string;
|
|
60
|
-
postingDate: ZeniDate;
|
|
61
|
-
postingStatus: ScheduleJournalEntryStatusCodeType;
|
|
62
|
-
runningBalance: Amount;
|
|
63
|
-
}
|
|
64
|
-
export interface NewScheduleLocalData {
|
|
65
|
-
jeScheduleDetails: NewJeDetailLocalData[];
|
|
66
|
-
scheduleType: ScheduleTypes;
|
|
67
|
-
lastDayOfMonth?: boolean;
|
|
68
|
-
selectedAccount?: ID;
|
|
69
|
-
selectedBaseTransactionId?: ScheduleTransactionID;
|
|
70
|
-
selectedClass?: ID;
|
|
71
|
-
selectedDate?: ZeniDate;
|
|
72
|
-
selectedDayOfMonth?: ScheduleDaysOfMonth;
|
|
73
|
-
selectedJEScheduleKey?: JEScheduleTransactionKey;
|
|
74
|
-
selectedMonths?: number;
|
|
75
|
-
selectedVendor?: VendorBase;
|
|
76
|
-
}
|
|
77
|
-
export interface NewScheduleLocalDataFixedAssets extends NewScheduleLocalData {
|
|
78
|
-
assetId?: string;
|
|
79
|
-
selectedAccumulatedDepreciationCategory?: ID;
|
|
80
|
-
}
|
|
81
|
-
export interface SearchTransactionsState extends FetchStateAndError {
|
|
82
|
-
searchResults: JEScheduleTransactionKey[];
|
|
83
|
-
searchString?: string;
|
|
84
|
-
}
|
|
85
|
-
export declare const MIN_NEW_SCHEDULE_SEARCH_LENGTH = 2;
|
|
86
|
-
export interface NewJeScheduleState extends FetchStateAndError {
|
|
87
|
-
newScheduleState: {
|
|
88
|
-
fixed_assets: NewScheduleLocalDataFixedAssets;
|
|
89
|
-
prepaid_expenses: NewScheduleLocalData;
|
|
90
|
-
};
|
|
91
|
-
saveStatus: FetchStateAndError;
|
|
92
|
-
searchTransactions: SearchTransactionsState;
|
|
93
|
-
selectedDetailScheduleType?: ScheduleTypes;
|
|
94
|
-
}
|
|
95
44
|
export interface AccountSettingsLocalData {
|
|
96
45
|
previousAccruedExpensesAccount: AccountBase[];
|
|
97
46
|
previousFixedAssetsAccount: AccountBase[];
|
|
@@ -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,10 +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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
exports.
|
|
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.
|
|
3
|
+
"version": "5.1.86-beta2UT",
|
|
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",
|
package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { fetchAccountList } from '../../../../accountList/accountListReducer';
|
|
4
|
-
import { fetchClassList } from '../../../../classList/classListReducer';
|
|
5
|
-
import { getAccountsTypesForScheduleEpics } from '../../../../scheduleView/scheduleListView/scheduleListHelper';
|
|
6
|
-
import { clearSearchTransactionsForNewSchedule, initializeNewSchedule, resetNewScheduleLocalData, } from '../../../reducers/jeSchedulesViewReducer';
|
|
7
|
-
export const initializeNewScheduleEpic = (actions$, state$) => actions$.pipe(filter(initializeNewSchedule.match), mergeMap((action) => {
|
|
8
|
-
const newScheduleActions = [];
|
|
9
|
-
const accountType = getAccountsTypesForScheduleEpics();
|
|
10
|
-
const { accountListState, classListState } = state$.value;
|
|
11
|
-
if (accountListState.byReportId[accountType.accountListKey]?.fetchState ===
|
|
12
|
-
'Not-Started') {
|
|
13
|
-
newScheduleActions.push(fetchAccountList(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
|
|
14
|
-
}
|
|
15
|
-
if (classListState.fetchState === 'Not-Started') {
|
|
16
|
-
newScheduleActions.push(fetchClassList());
|
|
17
|
-
}
|
|
18
|
-
newScheduleActions.push(resetNewScheduleLocalData({ scheduleType: action.payload.scheduleType }));
|
|
19
|
-
newScheduleActions.push(clearSearchTransactionsForNewSchedule());
|
|
20
|
-
return from(newScheduleActions);
|
|
21
|
-
}));
|