@zeniai/client-epic-state 5.2.10 → 5.2.11-betaAM1
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/jeScheduleHelper.d.ts +1 -0
- package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +86 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +172 -0
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +101 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +88 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
- package/lib/epic.d.ts +14 -1
- package/lib/epic.js +26 -0
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +172 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +78 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/esm/epic.js +26 -0
- package/lib/esm/index.js +19 -9
- package/lib/esm/reducer.js +3 -0
- package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
- package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
- package/lib/esm/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
- package/lib/esm/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
- package/lib/esm/view/companyMonthEndReportView/monthEndTemplateData.js +32 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +46 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +7 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +50 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
- package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +104 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +136 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +157 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +111 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +33 -0
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
- package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +35 -0
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +260 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +314 -29
- package/lib/esm/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +162 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +297 -22
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +22 -0
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -5
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
- package/lib/index.d.ts +25 -14
- package/lib/index.js +119 -51
- package/lib/reducer.d.ts +1 -0
- package/lib/reducer.js +3 -0
- package/lib/rootStateTypes.d.ts +2 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +8 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +6 -2
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +2 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
- package/lib/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
- package/lib/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
- package/lib/view/companyMonthEndReportView/monthEndTemplateData.d.ts +16 -0
- package/lib/view/companyMonthEndReportView/monthEndTemplateData.js +36 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +50 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +11 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +54 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +48 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +48 -0
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +21 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +108 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +140 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +13 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +164 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +65 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +115 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +37 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +66 -0
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +40 -0
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +72 -3
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +53 -0
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +264 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +91 -12
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +316 -29
- 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/actualMatchingViewSelectorTypes.d.ts +58 -0
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +36 -7
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +9 -0
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +172 -0
- package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +305 -21
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +76 -0
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +27 -0
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +11 -7
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
- package/package.json +1 -1
|
@@ -3,22 +3,151 @@ 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.isRenderableOneTimeAccrual = isRenderableOneTimeAccrual;
|
|
8
|
+
exports.getJEScheduleRowType = getJEScheduleRowType;
|
|
9
|
+
exports.isPendingReviewRow = isPendingReviewRow;
|
|
10
|
+
exports.isExistingTabRow = isExistingTabRow;
|
|
11
|
+
exports.isAccruedScheduleRow = isAccruedScheduleRow;
|
|
12
|
+
exports.isOneTimeAccrualRow = isOneTimeAccrualRow;
|
|
6
13
|
exports.getExpenseAutomationJESchedulesView = getExpenseAutomationJESchedulesView;
|
|
14
|
+
exports.getExpenseAutomationJEOneTimeAccrualDetailView = getExpenseAutomationJEOneTimeAccrualDetailView;
|
|
7
15
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
8
16
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
9
17
|
const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
|
|
10
18
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
11
19
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
20
|
+
const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper");
|
|
12
21
|
const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
|
|
22
|
+
const jeSchedulesTypes_1 = require("../../../entity/jeSchedules/jeSchedulesTypes");
|
|
13
23
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
14
24
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
15
25
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
16
26
|
const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper");
|
|
17
27
|
const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailSelector");
|
|
18
28
|
const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
|
|
29
|
+
const jeSchedulesViewState_1 = require("../types/jeSchedulesViewState");
|
|
19
30
|
const getAllStepsHelper_1 = require("./getAllStepsHelper");
|
|
20
31
|
const jeAccountSettingsViewSelector_1 = require("./jeAccountSettingsViewSelector");
|
|
32
|
+
const jeNewScheduleViewSelector_1 = require("./jeNewScheduleViewSelector");
|
|
33
|
+
// Matches the AI-automation user addresses webc's schedule list row already
|
|
34
|
+
// checks (JEScheduleReadOnlyListRow/JEScheduleDraftListRow "Method" column,
|
|
35
|
+
// strings.ts aiBotEmail/botEmail) to determine whether a schedule was
|
|
36
|
+
// created by the AI accountant vs. a human.
|
|
37
|
+
const AI_BOT_EMAIL = 'ai@zeni.ai';
|
|
38
|
+
const BOT_EMAIL = 'bot@zeni.ai';
|
|
39
|
+
// A one-time accrual has no jeScheduleType of its own — it is not a JE schedule. It is still an
|
|
40
|
+
// accrued expense, so it counts and filters under that type on the page's type tabs.
|
|
41
|
+
const ONE_TIME_ACCRUAL_SCHEDULE_TYPE = 'accrued_expenses';
|
|
42
|
+
// Which of the two list buckets an accrual belongs in. `draft` still needs a human to post it;
|
|
43
|
+
// everything else is already on the books or in a transient claim.
|
|
44
|
+
const ONE_TIME_ACCRUAL_REVIEW_STATUSES = [
|
|
45
|
+
'draft',
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* `posting_blocked` is written by the posting Cron when a JE fails to post. It is an internal
|
|
49
|
+
* failure state with no human action attached, so it is dropped here rather than hidden at render
|
|
50
|
+
* time — filtering in the view would leave the group counts and KPI totals counting rows nobody
|
|
51
|
+
* can see. The expense-automation endpoint applies no status filter on the close-period path, so
|
|
52
|
+
* these rows do arrive.
|
|
53
|
+
*/
|
|
54
|
+
function isRenderableOneTimeAccrual(accrual) {
|
|
55
|
+
return accrual.accrualStatus !== 'posting_blocked';
|
|
56
|
+
}
|
|
57
|
+
function getJEScheduleRowType(schedule) {
|
|
58
|
+
return isOneTimeAccrualRow(schedule)
|
|
59
|
+
? ONE_TIME_ACCRUAL_SCHEDULE_TYPE
|
|
60
|
+
: schedule.jeScheduleType;
|
|
61
|
+
}
|
|
62
|
+
function isPendingReviewRow(schedule) {
|
|
63
|
+
return isOneTimeAccrualRow(schedule)
|
|
64
|
+
? ONE_TIME_ACCRUAL_REVIEW_STATUSES.includes(schedule.accrualStatus)
|
|
65
|
+
: schedule.status.code === 'draft';
|
|
66
|
+
}
|
|
67
|
+
// Belongs on the Existing Schedules tab. For an accrual the endpoint has already filtered to
|
|
68
|
+
// posted, so this only has to agree with that rather than re-derive it.
|
|
69
|
+
function isExistingTabRow(schedule) {
|
|
70
|
+
return isOneTimeAccrualRow(schedule)
|
|
71
|
+
? schedule.accrualStatus === 'posted'
|
|
72
|
+
: schedule.status.code === 'ongoing';
|
|
73
|
+
}
|
|
74
|
+
// Exported (rather than kept as a closure inside the selector) so it can be
|
|
75
|
+
// unit-tested directly — confidenceScore is a separate, more narrowly
|
|
76
|
+
// populated field that can be null on a schedule the bot user created,
|
|
77
|
+
// which previously caused these schedules to display as "AI Accountant" in
|
|
78
|
+
// the list but count under "Manual" in the KPI summary.
|
|
79
|
+
const isAiAccountantSchedule = (schedule) => {
|
|
80
|
+
// A one-time accrual records who made it as `origin`, which is authoritative — no email
|
|
81
|
+
// sniffing needed, and the JE bot is often absent from the user entity entirely.
|
|
82
|
+
if (isOneTimeAccrualRow(schedule)) {
|
|
83
|
+
return schedule.origin === 'agent';
|
|
84
|
+
}
|
|
85
|
+
return (schedule.createdByUser?.email === AI_BOT_EMAIL ||
|
|
86
|
+
schedule.createdByUser?.email === BOT_EMAIL);
|
|
87
|
+
};
|
|
88
|
+
exports.isAiAccountantSchedule = isAiAccountantSchedule;
|
|
89
|
+
// Accrued schedules are structurally distinct — no baseTransaction, carrying recurringAmount and
|
|
90
|
+
// memo in its place — so anything reading baseTransaction has to branch on this first.
|
|
91
|
+
//
|
|
92
|
+
// Discriminates on jeAccruedScheduleKey, which only JEAccruedSchedule carries. jeScheduleType
|
|
93
|
+
// cannot be used: it is a data field present on BOTH row shapes, so an accrued-typed row that
|
|
94
|
+
// arrived through the prepaid/fixed DTO (failed_je_postings, legacy fetches) would be
|
|
95
|
+
// misclassified and then crash on recurringAmount / jeAccruedScheduleKey.
|
|
96
|
+
function isAccruedScheduleRow(schedule) {
|
|
97
|
+
return 'jeAccruedScheduleKey' in schedule;
|
|
98
|
+
}
|
|
99
|
+
// Same structural approach as isAccruedScheduleRow, and for the same reason: jeOneTimeAccrualKey
|
|
100
|
+
// exists only on this shape. Note the two guards are NOT interchangeable — a one-time accrual is
|
|
101
|
+
// not an accrued *schedule*, and routing it into the accrued branch would read recurringAmount,
|
|
102
|
+
// render postedCount/lifecycleTotal as a lifecycle and startDate–endDate as a period, none of
|
|
103
|
+
// which it has.
|
|
104
|
+
function isOneTimeAccrualRow(schedule) {
|
|
105
|
+
return 'jeOneTimeAccrualKey' in schedule;
|
|
106
|
+
}
|
|
107
|
+
function getScheduleAmount(schedule) {
|
|
108
|
+
if (isOneTimeAccrualRow(schedule)) {
|
|
109
|
+
return schedule.estimatedAmount.amount;
|
|
110
|
+
}
|
|
111
|
+
if (isAccruedScheduleRow(schedule)) {
|
|
112
|
+
return schedule.recurringAmount.amount;
|
|
113
|
+
}
|
|
114
|
+
return schedule.baseTransaction.amount.amount;
|
|
115
|
+
}
|
|
116
|
+
// A one-time accrual shares almost no sortable field with a schedule, so it gets its own accessor
|
|
117
|
+
// rather than a guard on each of the dozen cases below. Keys with no meaning for a single-month
|
|
118
|
+
// accrual -- amortizationPeriod, remainingMonths, runningBalance, jePostingDate, scheduleCategory --
|
|
119
|
+
// deliberately fall through to undefined, which sorts them together at one end.
|
|
120
|
+
function getOneTimeAccrualSortValue(accrual, sortKey) {
|
|
121
|
+
switch (sortKey) {
|
|
122
|
+
case 'vendor':
|
|
123
|
+
return accrual.vendorName.toLowerCase();
|
|
124
|
+
case 'category':
|
|
125
|
+
return accrual.jeDebitAccountName?.toLowerCase();
|
|
126
|
+
case 'class':
|
|
127
|
+
return accrual.jeDebitAccountingClassName?.toLowerCase();
|
|
128
|
+
case 'depCategory':
|
|
129
|
+
return accrual.jeCreditAccountName?.toLowerCase();
|
|
130
|
+
case 'type':
|
|
131
|
+
return ONE_TIME_ACCRUAL_SCHEDULE_TYPE;
|
|
132
|
+
case 'totalAmount':
|
|
133
|
+
return accrual.estimatedAmount.amount;
|
|
134
|
+
case 'transactionDate':
|
|
135
|
+
return accrual.postingDate?.valueOf();
|
|
136
|
+
case 'memo':
|
|
137
|
+
return accrual.memo.toLowerCase();
|
|
138
|
+
case 'startMonth':
|
|
139
|
+
return accrual.serviceMonth;
|
|
140
|
+
default:
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
21
144
|
function getJEScheduleSortAccessor(sortKey) {
|
|
145
|
+
const scheduleAccessor = getScheduleRowSortAccessor(sortKey);
|
|
146
|
+
return (schedule) => isOneTimeAccrualRow(schedule)
|
|
147
|
+
? getOneTimeAccrualSortValue(schedule, sortKey)
|
|
148
|
+
: scheduleAccessor(schedule);
|
|
149
|
+
}
|
|
150
|
+
function getScheduleRowSortAccessor(sortKey) {
|
|
22
151
|
switch (sortKey) {
|
|
23
152
|
case 'vendor':
|
|
24
153
|
return (s) => s.vendor.name?.toLowerCase();
|
|
@@ -29,7 +158,9 @@ function getJEScheduleSortAccessor(sortKey) {
|
|
|
29
158
|
case 'depCategory':
|
|
30
159
|
return (s) => s.jeCredit.account?.accountName?.toLowerCase();
|
|
31
160
|
case 'scheduleCategory':
|
|
32
|
-
return (s) => s
|
|
161
|
+
return (s) => isAccruedScheduleRow(s)
|
|
162
|
+
? undefined
|
|
163
|
+
: s.baseTransaction.account?.accountName?.toLowerCase();
|
|
33
164
|
case 'startMonth':
|
|
34
165
|
return (s) => s.startDate?.valueOf();
|
|
35
166
|
case 'type':
|
|
@@ -57,11 +188,13 @@ function getJEScheduleSortAccessor(sortKey) {
|
|
|
57
188
|
return s.balanceAsOfToday?.amount ?? null;
|
|
58
189
|
};
|
|
59
190
|
case 'totalAmount':
|
|
60
|
-
return (s) => s
|
|
191
|
+
return (s) => getScheduleAmount(s);
|
|
61
192
|
case 'transactionDate':
|
|
62
|
-
return (s) => s.
|
|
193
|
+
return (s) => s.createTime?.valueOf();
|
|
63
194
|
case 'memo':
|
|
64
|
-
return (s) => s
|
|
195
|
+
return (s) => isAccruedScheduleRow(s)
|
|
196
|
+
? s.memo.toLowerCase()
|
|
197
|
+
: s.baseTransaction.memo?.toLowerCase();
|
|
65
198
|
default:
|
|
66
199
|
return (s) => s.startDate?.valueOf();
|
|
67
200
|
}
|
|
@@ -73,9 +206,15 @@ function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
|
|
|
73
206
|
function getExpenseAutomationJESchedulesView(state) {
|
|
74
207
|
const jeScheduledTransaction = [];
|
|
75
208
|
const failedJeScheduledTransaction = [];
|
|
209
|
+
const accruedSchedules = [];
|
|
210
|
+
const oneTimeAccruals = [];
|
|
76
211
|
const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
77
|
-
const {
|
|
212
|
+
const { jeScheduleTransactionKeysByPeriodAndTab, jeScheduleAccruedKeysByPeriodAndTab, jeScheduleOneTimeAccrualKeysByPeriodAndTab, failedJeScheduleTransactionKeysByPeriodAndTab, jeScheduleLocalDataById, postStatusById, ignoreStatusById, revertStatusById, oneTimeAccrualActionStatusById, uiState, error, fetchState, refreshStatus, newSchedule, } = expenseAutomationJESchedulesViewState;
|
|
78
213
|
const accountSettingsView = (0, jeAccountSettingsViewSelector_1.getJEAccountSettingsView)(state);
|
|
214
|
+
const newScheduleView = newSchedule.selectedDetailScheduleType === 'fixed_assets' ||
|
|
215
|
+
newSchedule.selectedDetailScheduleType === 'prepaid_expenses'
|
|
216
|
+
? (0, jeNewScheduleViewSelector_1.getNewScheduleView)(state, newSchedule.selectedDetailScheduleType)
|
|
217
|
+
: undefined;
|
|
79
218
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
80
219
|
const { selectedPeriodByTenantId } = expenseAutomationViewState;
|
|
81
220
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
@@ -103,27 +242,48 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
103
242
|
const filteredDepAccountListNestedAccountHierarchy = (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)(depAccountListNestedAccountHierarchy, filteredDepAccounts.map((account) => account.accountId));
|
|
104
243
|
const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
|
|
105
244
|
const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : null;
|
|
106
|
-
const
|
|
107
|
-
?
|
|
108
|
-
: null;
|
|
109
|
-
const failedJeScheduleTransactionKeysForSelectedPeriod = monthYearPeriodId != null
|
|
110
|
-
? failedJeScheduleTransactionKeysByPeriod[monthYearPeriodId]
|
|
245
|
+
const selectedPeriodTabKey = monthYearPeriodId != null
|
|
246
|
+
? (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(uiState.selectedPageTab, monthYearPeriodId)
|
|
111
247
|
: null;
|
|
112
|
-
const
|
|
113
|
-
|
|
248
|
+
const jeScheduleTransactionKeysForSelectedTab = selectedPeriodTabKey != null
|
|
249
|
+
? jeScheduleTransactionKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
250
|
+
: undefined;
|
|
251
|
+
const failedJeScheduleTransactionKeysForSelectedTab = selectedPeriodTabKey != null
|
|
252
|
+
? failedJeScheduleTransactionKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
253
|
+
: undefined;
|
|
254
|
+
// Distinguishes "this tab has never been fetched for this period" from "fetched and genuinely
|
|
255
|
+
// empty". Without it the page cannot tell a first visit from a real empty state, and renders an
|
|
256
|
+
// empty table where it should render a skeleton.
|
|
257
|
+
const hasLoadedForSelectedTab = jeScheduleTransactionKeysForSelectedTab != null;
|
|
258
|
+
const jeScheduleTransactionKeys = jeScheduleTransactionKeysForSelectedTab ?? [];
|
|
259
|
+
const failedJeScheduleTransactionKeys = failedJeScheduleTransactionKeysForSelectedTab ?? [];
|
|
260
|
+
const jeScheduleAccruedKeys = (selectedPeriodTabKey != null
|
|
261
|
+
? jeScheduleAccruedKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
262
|
+
: undefined) ?? [];
|
|
263
|
+
const jeScheduleOneTimeAccrualKeys = (selectedPeriodTabKey != null
|
|
264
|
+
? jeScheduleOneTimeAccrualKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
265
|
+
: undefined) ?? [];
|
|
266
|
+
jeScheduleOneTimeAccrualKeys.forEach((jeOneTimeAccrualKey) => {
|
|
267
|
+
const accrual = (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(jeOneTimeAccrualKey, state.jeSchedulesState);
|
|
268
|
+
if (accrual != null && isRenderableOneTimeAccrual(accrual)) {
|
|
269
|
+
oneTimeAccruals.push(accrual);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
114
272
|
jeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
115
273
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
116
274
|
jeScheduledTransaction.push(jeScheduleDetails);
|
|
117
275
|
});
|
|
276
|
+
jeScheduleAccruedKeys.forEach((jeAccruedScheduleKey) => {
|
|
277
|
+
const accruedScheduleDetails = (0, jeSchedulesSelector_1.getJEAccruedScheduleByJEScheduleKey)(jeAccruedScheduleKey, state);
|
|
278
|
+
if (accruedScheduleDetails != null) {
|
|
279
|
+
accruedSchedules.push(accruedScheduleDetails);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
118
282
|
failedJeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
119
283
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
120
284
|
failedJeScheduledTransaction.push(jeScheduleDetails);
|
|
121
285
|
});
|
|
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);
|
|
286
|
+
const { sortKey, sortOrder, selectedJETypeFilter } = uiState;
|
|
127
287
|
const unsortedResolveSchedules = [];
|
|
128
288
|
failedJeScheduledTransaction.forEach((schedule) => {
|
|
129
289
|
schedule.scheduledJournalEntry.forEach((journalEntry) => {
|
|
@@ -135,10 +295,90 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
135
295
|
});
|
|
136
296
|
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
|
|
137
297
|
const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
|
|
298
|
+
const matchesTypeFilter = (schedule) => selectedJETypeFilter == null ||
|
|
299
|
+
getJEScheduleRowType(schedule) === selectedJETypeFilter;
|
|
300
|
+
const isCreatedStatus = (schedule) => {
|
|
301
|
+
// An accrual is "created" once it is not review work: posted, reversing, reversed, or in a
|
|
302
|
+
// transient posting claim.
|
|
303
|
+
if (isOneTimeAccrualRow(schedule)) {
|
|
304
|
+
return !isPendingReviewRow(schedule);
|
|
305
|
+
}
|
|
306
|
+
return (schedule.status.code === 'ongoing' ||
|
|
307
|
+
schedule.status.code === 'completed' ||
|
|
308
|
+
schedule.status.code === 'marked_as_completed');
|
|
309
|
+
};
|
|
310
|
+
const allScheduleRows = [
|
|
311
|
+
...jeScheduledTransaction,
|
|
312
|
+
...accruedSchedules,
|
|
313
|
+
...oneTimeAccruals,
|
|
314
|
+
];
|
|
138
315
|
const pendingReviewSchedules = sortJEScheduledTransactions([
|
|
139
|
-
...
|
|
316
|
+
...allScheduleRows.filter((schedule) => isPendingReviewRow(schedule) && matchesTypeFilter(schedule)),
|
|
140
317
|
...validResolveForPending,
|
|
141
318
|
], sortKey, sortOrder);
|
|
319
|
+
const createdSchedules = sortJEScheduledTransactions(allScheduleRows.filter((schedule) => isCreatedStatus(schedule) && matchesTypeFilter(schedule)), sortKey, sortOrder);
|
|
320
|
+
// KPI summary — derived from unfiltered schedules so counts are always accurate
|
|
321
|
+
const allSchedules = allScheduleRows;
|
|
322
|
+
const sumAmount = (schedules) => schedules.reduce((total, schedule) => total + (getScheduleAmount(schedule) ?? 0), 0);
|
|
323
|
+
const pendingReviewTotal = sumAmount(pendingReviewSchedules);
|
|
324
|
+
const createdTotal = sumAmount(createdSchedules);
|
|
325
|
+
const aiAccountantSchedules = allSchedules.filter(exports.isAiAccountantSchedule);
|
|
326
|
+
const manualSchedules = allSchedules.filter((schedule) => !(0, exports.isAiAccountantSchedule)(schedule));
|
|
327
|
+
const pendingUnfiltered = allSchedules.filter((schedule) => isPendingReviewRow(schedule));
|
|
328
|
+
const kpiSummary = {
|
|
329
|
+
aiAccountant: {
|
|
330
|
+
count: aiAccountantSchedules.length,
|
|
331
|
+
amount: sumAmount(aiAccountantSchedules),
|
|
332
|
+
},
|
|
333
|
+
manual: {
|
|
334
|
+
count: manualSchedules.length,
|
|
335
|
+
amount: sumAmount(manualSchedules),
|
|
336
|
+
},
|
|
337
|
+
needsReview: {
|
|
338
|
+
count: pendingUnfiltered.length,
|
|
339
|
+
amount: sumAmount(pendingUnfiltered),
|
|
340
|
+
},
|
|
341
|
+
total: {
|
|
342
|
+
count: allSchedules.length,
|
|
343
|
+
amount: sumAmount(allSchedules),
|
|
344
|
+
},
|
|
345
|
+
};
|
|
346
|
+
// Each tab's badge counts from that tab's own bucket. A tab that has not been fetched yet
|
|
347
|
+
// reports undefined rather than 0, so the UI can hide the badge instead of asserting "none".
|
|
348
|
+
const scheduleCountsByTab = {};
|
|
349
|
+
jeSchedulesViewState_1.ALL_JE_PAGE_TABS.forEach((pageTab) => {
|
|
350
|
+
if (pageTab === 'actual_matching') {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
const periodTabKey = monthYearPeriodId != null
|
|
354
|
+
? (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(pageTab, monthYearPeriodId)
|
|
355
|
+
: null;
|
|
356
|
+
const transactionKeys = periodTabKey != null
|
|
357
|
+
? jeScheduleTransactionKeysByPeriodAndTab[periodTabKey]
|
|
358
|
+
: undefined;
|
|
359
|
+
if (transactionKeys == null) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
const accruedKeys = (periodTabKey != null
|
|
363
|
+
? jeScheduleAccruedKeysByPeriodAndTab[periodTabKey]
|
|
364
|
+
: undefined) ?? [];
|
|
365
|
+
const oneTimeAccrualKeys = (periodTabKey != null
|
|
366
|
+
? jeScheduleOneTimeAccrualKeysByPeriodAndTab[periodTabKey]
|
|
367
|
+
: undefined) ?? [];
|
|
368
|
+
const rowsForTab = [
|
|
369
|
+
...transactionKeys.map((transactionKey) => (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(transactionKey, state)),
|
|
370
|
+
...accruedKeys
|
|
371
|
+
.map((accruedKey) => (0, jeSchedulesSelector_1.getJEAccruedScheduleByJEScheduleKey)(accruedKey, state))
|
|
372
|
+
.filter((accruedRow) => accruedRow != null),
|
|
373
|
+
...oneTimeAccrualKeys
|
|
374
|
+
.map((accrualKey) => (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(accrualKey, state.jeSchedulesState))
|
|
375
|
+
.filter((accrualRow) => accrualRow != null && isRenderableOneTimeAccrual(accrualRow)),
|
|
376
|
+
];
|
|
377
|
+
scheduleCountsByTab[pageTab] =
|
|
378
|
+
pageTab === 'existing_schedules'
|
|
379
|
+
? rowsForTab.filter((row) => isExistingTabRow(row)).length
|
|
380
|
+
: rowsForTab.filter((row) => isPendingReviewRow(row) || isCreatedStatus(row)).length;
|
|
381
|
+
});
|
|
142
382
|
const allSteps = monthYearPeriodId != null
|
|
143
383
|
? (0, getAllStepsHelper_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
|
|
144
384
|
: [];
|
|
@@ -151,6 +391,20 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
151
391
|
{ fetchState, error },
|
|
152
392
|
monthEndFetchState,
|
|
153
393
|
]);
|
|
394
|
+
const countByType = (schedules) => {
|
|
395
|
+
const counts = jeSchedulesTypes_1.ALL_SCHEDULES_TYPES.reduce((acc, type) => ({ ...acc, [type]: 0 }), {});
|
|
396
|
+
schedules.forEach((schedule) => {
|
|
397
|
+
const scheduleType = getJEScheduleRowType(schedule);
|
|
398
|
+
if (scheduleType != null) {
|
|
399
|
+
counts[scheduleType] += 1;
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
return counts;
|
|
403
|
+
};
|
|
404
|
+
const jeScheduleTypeCounts = {
|
|
405
|
+
active: countByType(allSchedules.filter((schedule) => isPendingReviewRow(schedule) || isCreatedStatus(schedule))),
|
|
406
|
+
ongoing: countByType(allSchedules.filter((schedule) => isExistingTabRow(schedule))),
|
|
407
|
+
};
|
|
154
408
|
return {
|
|
155
409
|
uncategorizedAccounts,
|
|
156
410
|
allDepreciationAccountList: filteredDepAccounts,
|
|
@@ -159,14 +413,21 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
159
413
|
allAccountList: filteredAccounts,
|
|
160
414
|
accountListNestedAccountHierarchy,
|
|
161
415
|
allClassList: allClasses,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
416
|
+
createdSchedules,
|
|
417
|
+
createdTotal,
|
|
418
|
+
hasLoadedForSelectedTab,
|
|
419
|
+
jeScheduleTypeCounts,
|
|
420
|
+
scheduleCountsByTab,
|
|
421
|
+
kpiSummary,
|
|
165
422
|
pendingReviewSchedules,
|
|
423
|
+
pendingReviewTotal,
|
|
166
424
|
resolveSchedules: resolveSchedules,
|
|
167
425
|
accountSettingsView,
|
|
426
|
+
newScheduleView,
|
|
168
427
|
postStatusById: postStatusById,
|
|
169
428
|
ignoreStatusById: ignoreStatusById,
|
|
429
|
+
revertStatusById: revertStatusById,
|
|
430
|
+
oneTimeAccrualActionStatusById: oneTimeAccrualActionStatusById,
|
|
170
431
|
fetchState: reducedFetchStatus.fetchState,
|
|
171
432
|
jeScheduleLocalDataById: jeScheduleLocalDataById,
|
|
172
433
|
uiState: uiState,
|
|
@@ -175,3 +436,26 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
175
436
|
completionStatus,
|
|
176
437
|
};
|
|
177
438
|
}
|
|
439
|
+
/**
|
|
440
|
+
* One accrual plus the status of its promote / ignore request, for the detail screen.
|
|
441
|
+
*
|
|
442
|
+
* `accrual` is undefined on a cold load — a refresh or a shared link, where the list has never run
|
|
443
|
+
* — so the screen dispatches `fetchOneTimeAccrual` and waits on `detailFetchState`. The two states
|
|
444
|
+
* are separate on purpose: `actionFetchState` drives the row spinner and the post-revert navigation,
|
|
445
|
+
* and a page load must not look like an action that just finished.
|
|
446
|
+
*/
|
|
447
|
+
function getExpenseAutomationJEOneTimeAccrualDetailView(state, accrualId) {
|
|
448
|
+
return {
|
|
449
|
+
accrual: (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)((0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(accrualId), state.jeSchedulesState),
|
|
450
|
+
actionFetchState: state.expenseAutomationJESchedulesViewState
|
|
451
|
+
.oneTimeAccrualActionStatusById[accrualId] ?? {
|
|
452
|
+
fetchState: 'Not-Started',
|
|
453
|
+
error: undefined,
|
|
454
|
+
},
|
|
455
|
+
detailFetchState: state.expenseAutomationJESchedulesViewState
|
|
456
|
+
.oneTimeAccrualFetchStatusById[accrualId] ?? {
|
|
457
|
+
fetchState: 'Not-Started',
|
|
458
|
+
error: undefined,
|
|
459
|
+
},
|
|
460
|
+
};
|
|
461
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
|
+
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
|
+
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
4
|
+
import { JEOneTimeAccrualKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
5
|
+
export declare const toActualMatchingSortKey: (v: string) => "type" | "date" | "vendor" | "category" | "class" | "amount" | "lifecycle";
|
|
6
|
+
export type ActualMatchingSortKey = ReturnType<typeof toActualMatchingSortKey>;
|
|
7
|
+
export declare const MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 10;
|
|
8
|
+
export declare const MATCH_ACCRUAL_SEARCH_LIMIT = 50;
|
|
9
|
+
export declare const MATCH_SEARCH_DEBOUNCE_MS = 300;
|
|
10
|
+
export declare const toMatchAndReverseResultStatus: (v: string) => "error" | "reversed" | "noop" | "conflict" | "claim_lost";
|
|
11
|
+
export type MatchAndReverseResultStatus = ReturnType<typeof toMatchAndReverseResultStatus>;
|
|
12
|
+
export interface ActualMatchingViewUIState {
|
|
13
|
+
scrollPosition: {
|
|
14
|
+
scrollTop: number;
|
|
15
|
+
scrollLeft?: number;
|
|
16
|
+
} | undefined;
|
|
17
|
+
searchString: string;
|
|
18
|
+
sortKey: ActualMatchingSortKey;
|
|
19
|
+
sortOrder: SortOrder;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Sibling of Missing Receipts `MatchCandidate`. Confirm needs `lineId` and
|
|
23
|
+
* `transactionIntegrationId` on every row — those fields are required here.
|
|
24
|
+
*/
|
|
25
|
+
export interface ActualMatchingTransactionSearchResult {
|
|
26
|
+
amount: number;
|
|
27
|
+
currencyCode: string;
|
|
28
|
+
currencySymbol: string;
|
|
29
|
+
lineId: string;
|
|
30
|
+
transactionDate: string;
|
|
31
|
+
transactionId: ID;
|
|
32
|
+
transactionIntegrationId: string;
|
|
33
|
+
transactionType: string;
|
|
34
|
+
vendorName: string;
|
|
35
|
+
accountId?: ID;
|
|
36
|
+
accountName?: string;
|
|
37
|
+
transactionMemo?: string;
|
|
38
|
+
vendorId?: ID;
|
|
39
|
+
}
|
|
40
|
+
export interface MatchAndReverseResult {
|
|
41
|
+
accrualId: ID;
|
|
42
|
+
status: MatchAndReverseResultStatus;
|
|
43
|
+
reason?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface MatchAndReverseAccrualsParams {
|
|
46
|
+
accrualIds: ID[];
|
|
47
|
+
lineId: string;
|
|
48
|
+
transactionId: ID;
|
|
49
|
+
transactionIntegrationId: string;
|
|
50
|
+
transactionType: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ActualMatchingTransactionSearchState extends FetchStateAndError {
|
|
53
|
+
isLoadingMore: boolean;
|
|
54
|
+
nextPageToken: string | null;
|
|
55
|
+
query: string;
|
|
56
|
+
results: ActualMatchingTransactionSearchResult[];
|
|
57
|
+
}
|
|
58
|
+
export interface ActualMatchingAccrualSearchState extends FetchStateAndError {
|
|
59
|
+
isLoadingMore: boolean;
|
|
60
|
+
nextPageToken: string | null;
|
|
61
|
+
query: string;
|
|
62
|
+
results: JEOneTimeAccrualKey[];
|
|
63
|
+
}
|
|
64
|
+
export interface ActualMatchingMatchModalState {
|
|
65
|
+
accrualSearch: ActualMatchingAccrualSearchState;
|
|
66
|
+
confirmStatus: FetchStateAndError;
|
|
67
|
+
isOpen: boolean;
|
|
68
|
+
transactionSearch: ActualMatchingTransactionSearchState;
|
|
69
|
+
lastBatchResults?: MatchAndReverseResult[];
|
|
70
|
+
}
|
|
71
|
+
export interface ActualMatchingViewState extends FetchedState {
|
|
72
|
+
accrualKeysByPeriod: Record<MonthYearPeriodId, JEOneTimeAccrualKey[]>;
|
|
73
|
+
matchModal: ActualMatchingMatchModalState;
|
|
74
|
+
refreshStatus: FetchStateAndError;
|
|
75
|
+
uiState: ActualMatchingViewUIState;
|
|
76
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toMatchAndReverseResultStatus = exports.MATCH_SEARCH_DEBOUNCE_MS = exports.MATCH_ACCRUAL_SEARCH_LIMIT = exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = exports.toActualMatchingSortKey = void 0;
|
|
4
|
+
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
|
+
const ACTUAL_MATCHING_SORT_KEYS = [
|
|
6
|
+
'vendor',
|
|
7
|
+
'date',
|
|
8
|
+
'amount',
|
|
9
|
+
'category',
|
|
10
|
+
'class',
|
|
11
|
+
'type',
|
|
12
|
+
'lifecycle',
|
|
13
|
+
];
|
|
14
|
+
const toActualMatchingSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, ACTUAL_MATCHING_SORT_KEYS);
|
|
15
|
+
exports.toActualMatchingSortKey = toActualMatchingSortKey;
|
|
16
|
+
exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 10;
|
|
17
|
+
exports.MATCH_ACCRUAL_SEARCH_LIMIT = 50;
|
|
18
|
+
exports.MATCH_SEARCH_DEBOUNCE_MS = 300;
|
|
19
|
+
const MATCH_AND_REVERSE_RESULT_STATUSES = [
|
|
20
|
+
'reversed',
|
|
21
|
+
'noop',
|
|
22
|
+
'conflict',
|
|
23
|
+
'claim_lost',
|
|
24
|
+
'error',
|
|
25
|
+
];
|
|
26
|
+
const toMatchAndReverseResultStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, MATCH_AND_REVERSE_RESULT_STATUSES);
|
|
27
|
+
exports.toMatchAndReverseResultStatus = toMatchAndReverseResultStatus;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const toCompletedSubTab: (v: string) => "
|
|
1
|
+
export declare const toCompletedSubTab: (v: string) => "manual" | "all" | "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,22 +1,31 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
|
+
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
3
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
3
4
|
import { Recommendation } from '../../../commonStateTypes/recommendationBase';
|
|
4
5
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
5
|
-
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
6
|
+
import { MonthYearPeriodId, ScheduleDaysOfMonth } from '../../../commonStateTypes/timePeriod';
|
|
6
7
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
7
|
-
import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
8
|
+
import { JEOneTimeAccrualKey, JEScheduleKey, JEScheduleTransactionKey, ScheduleJournalEntryStatusCodeType, ScheduleTransactionID, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
8
9
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
9
|
-
|
|
10
|
+
import { ZeniDate } from '../../../zeniDayJS';
|
|
11
|
+
import { JETransactionLink } from '../../scheduleView/scheduleDetailView/scheduleDetailState';
|
|
12
|
+
export declare const toJEScheduleSortKey: (v: string) => "type" | "vendor" | "category" | "class" | "memo" | "jePostingDate" | "runningBalance" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "remainingMonths" | "totalAmount" | "transactionDate";
|
|
10
13
|
export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
|
|
11
|
-
export declare const
|
|
12
|
-
export type
|
|
14
|
+
export declare const toJEPageTab: (v: string) => "schedules" | "actual_matching" | "existing_schedules";
|
|
15
|
+
export type JEPageTab = ReturnType<typeof toJEPageTab>;
|
|
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;
|
|
13
19
|
export interface JESchedulesViewUIState {
|
|
20
|
+
createdGroupCollapsed: boolean;
|
|
21
|
+
pendingGroupCollapsed: boolean;
|
|
14
22
|
scrollPosition: {
|
|
15
23
|
scrollTop: number;
|
|
16
24
|
scrollLeft?: number;
|
|
17
25
|
} | undefined;
|
|
18
26
|
searchString: string;
|
|
19
|
-
|
|
27
|
+
selectedJETypeFilter: ScheduleTypes | null;
|
|
28
|
+
selectedPageTab: JEPageTab;
|
|
20
29
|
sortKey: JEScheduleSortKey;
|
|
21
30
|
sortOrder: SortOrder;
|
|
22
31
|
totalCount: number;
|
|
@@ -33,14 +42,79 @@ export interface JEScheduleLocalData {
|
|
|
33
42
|
}
|
|
34
43
|
export interface JESchedulesViewState extends FetchedState {
|
|
35
44
|
accountSettings: AccountSettingsState;
|
|
36
|
-
|
|
45
|
+
failedJeScheduleTransactionKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleTransactionKey[]>;
|
|
37
46
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
47
|
+
jeScheduleAccruedKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleKey[]>;
|
|
38
48
|
jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
|
|
39
|
-
|
|
49
|
+
jeScheduleOneTimeAccrualKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEOneTimeAccrualKey[]>;
|
|
50
|
+
jeScheduleTransactionKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleTransactionKey[]>;
|
|
51
|
+
newSchedule: NewJeScheduleState;
|
|
52
|
+
oneTimeAccrualActionStatusById: Record<ID, FetchStateAndError>;
|
|
53
|
+
oneTimeAccrualFetchStatusById: Record<ID, FetchStateAndError>;
|
|
40
54
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
41
55
|
refreshStatus: FetchStateAndError;
|
|
56
|
+
revertStatusById: Record<JEScheduleKey | JEScheduleTransactionKey, FetchStateAndError>;
|
|
42
57
|
uiState: JESchedulesViewUIState;
|
|
43
58
|
}
|
|
59
|
+
export interface NewJeDetailLocalData {
|
|
60
|
+
amount: Amount;
|
|
61
|
+
jeLink: JETransactionLink;
|
|
62
|
+
memo: string;
|
|
63
|
+
postingDate: ZeniDate;
|
|
64
|
+
postingStatus: ScheduleJournalEntryStatusCodeType;
|
|
65
|
+
runningBalance: Amount;
|
|
66
|
+
}
|
|
67
|
+
export interface NewScheduleLocalData {
|
|
68
|
+
jeScheduleDetails: NewJeDetailLocalData[];
|
|
69
|
+
scheduleType: ScheduleTypes;
|
|
70
|
+
lastDayOfMonth?: boolean;
|
|
71
|
+
selectedAccount?: ID;
|
|
72
|
+
selectedBaseTransactionId?: ScheduleTransactionID;
|
|
73
|
+
selectedClass?: ID;
|
|
74
|
+
selectedDate?: ZeniDate;
|
|
75
|
+
selectedDayOfMonth?: ScheduleDaysOfMonth;
|
|
76
|
+
selectedJEScheduleKey?: JEScheduleTransactionKey;
|
|
77
|
+
selectedMonths?: number;
|
|
78
|
+
selectedVendor?: VendorBase;
|
|
79
|
+
}
|
|
80
|
+
export interface NewScheduleLocalDataFixedAssets extends NewScheduleLocalData {
|
|
81
|
+
assetId?: string;
|
|
82
|
+
selectedAccumulatedDepreciationCategory?: ID;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The form values for creating a one-time accrual. Not stored in the slice — a one-time accrual is
|
|
86
|
+
* created in a single POST with no draft/resume step, so this is passed straight through the action
|
|
87
|
+
* to the payload builder.
|
|
88
|
+
*/
|
|
89
|
+
export interface NewOneTimeAccrualLocalData {
|
|
90
|
+
amount: number;
|
|
91
|
+
creditAccountId: ID;
|
|
92
|
+
debitAccountId: ID;
|
|
93
|
+
memo: string;
|
|
94
|
+
reverseNextMonth: boolean;
|
|
95
|
+
serviceMonth: ZeniDate;
|
|
96
|
+
vendorId: ID;
|
|
97
|
+
vendorName: string;
|
|
98
|
+
creditAccountName?: string;
|
|
99
|
+
debitAccountName?: string;
|
|
100
|
+
debitClassId?: ID;
|
|
101
|
+
debitClassName?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface SearchTransactionsState extends FetchStateAndError {
|
|
104
|
+
searchResults: JEScheduleTransactionKey[];
|
|
105
|
+
searchString?: string;
|
|
106
|
+
}
|
|
107
|
+
export declare const MIN_NEW_SCHEDULE_SEARCH_LENGTH = 2;
|
|
108
|
+
export interface NewJeScheduleState extends FetchStateAndError {
|
|
109
|
+
createOneTimeAccrualStatus: FetchStateAndError;
|
|
110
|
+
newScheduleState: {
|
|
111
|
+
fixed_assets: NewScheduleLocalDataFixedAssets;
|
|
112
|
+
prepaid_expenses: NewScheduleLocalData;
|
|
113
|
+
};
|
|
114
|
+
saveStatus: FetchStateAndError;
|
|
115
|
+
searchTransactions: SearchTransactionsState;
|
|
116
|
+
selectedDetailScheduleType?: ScheduleTypes;
|
|
117
|
+
}
|
|
44
118
|
export interface AccountSettingsLocalData {
|
|
45
119
|
previousAccruedExpensesAccount: AccountBase[];
|
|
46
120
|
previousFixedAssetsAccount: AccountBase[];
|
|
@@ -57,6 +131,7 @@ export interface AccountSettingsState {
|
|
|
57
131
|
fixedAssetsAccountIdList: ID[];
|
|
58
132
|
fixedAssetsNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
|
|
59
133
|
fixedAssetsRecommendations: Recommendation[];
|
|
134
|
+
hasLoadedAccountSettings: boolean;
|
|
60
135
|
localData: AccountSettingsLocalData;
|
|
61
136
|
prepaidExpensesAccountIdList: ID[];
|
|
62
137
|
prepaidExpensesNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
|