@zeniai/client-epic-state 5.1.61 → 5.1.62-betaRD2
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/coreEpics.js +3 -2
- package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +2 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +2 -0
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -0
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +11 -1
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
- package/lib/entity/notificationRegistry/notificationRegistryPayload.d.ts +18 -0
- package/lib/entity/notificationRegistry/notificationRegistryPayload.js +28 -0
- package/lib/entity/notificationRegistry/notificationRegistryReducer.d.ts +10 -0
- package/lib/entity/notificationRegistry/notificationRegistryReducer.js +50 -0
- package/lib/entity/notificationRegistry/notificationRegistrySelector.d.ts +2 -0
- package/lib/entity/notificationRegistry/notificationRegistrySelector.js +10 -0
- package/lib/entity/notificationRegistry/notificationRegistryState.d.ts +32 -0
- package/lib/entity/notificationRegistry/notificationRegistryState.js +10 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +3 -1
- package/lib/entity/tenant/clearAllEpic.js +4 -0
- package/lib/entity/tenant/tenantReducer.d.ts +4 -1
- package/lib/entity/tenant/tenantReducer.js +8 -2
- package/lib/entity/tenant/tenantSelector.d.ts +1 -0
- package/lib/entity/tenant/tenantSelector.js +4 -0
- package/lib/entity/transaction/scheduleTransactionHelper.d.ts +15 -0
- package/lib/entity/transaction/scheduleTransactionHelper.js +43 -0
- package/lib/epic.d.ts +9 -1
- package/lib/epic.js +9 -1
- package/lib/esm/coreEpics.js +3 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +2 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +11 -1
- package/lib/esm/entity/notificationRegistry/notificationRegistryPayload.js +24 -0
- package/lib/esm/entity/notificationRegistry/notificationRegistryReducer.js +46 -0
- package/lib/esm/entity/notificationRegistry/notificationRegistrySelector.js +6 -0
- package/lib/esm/entity/notificationRegistry/notificationRegistryState.js +5 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +4 -0
- package/lib/esm/entity/tenant/tenantReducer.js +7 -1
- package/lib/esm/entity/tenant/tenantSelector.js +3 -0
- package/lib/esm/entity/transaction/scheduleTransactionHelper.js +39 -0
- package/lib/esm/epic.js +9 -1
- package/lib/esm/index.js +14 -6
- package/lib/esm/reducer.js +6 -0
- package/lib/esm/view/companyView/companyViewReducer.js +68 -1
- package/lib/esm/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +2 -1
- package/lib/esm/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.js +56 -0
- package/lib/esm/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.js +37 -0
- package/lib/esm/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.js +73 -0
- package/lib/esm/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +2 -1
- package/lib/esm/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +2 -1
- package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +5 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +15 -2
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +21 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +152 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +126 -6
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +71 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +78 -11
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +3 -6
- package/lib/esm/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +116 -0
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesEndpoint.js +5 -0
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewPayload.js +36 -0
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewReducer.js +222 -0
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewSelector.js +25 -0
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewState.js +4 -0
- package/lib/esm/view/settingsView/epic/fetchNotificationSettingsEpic.js +34 -2
- package/lib/esm/view/settingsView/epic/saveNotificationSettingsEpic.js +2 -1
- package/lib/esm/view/settingsView/settingsViewHelpers.js +3 -2
- package/lib/index.d.ts +17 -8
- package/lib/index.js +85 -47
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/view/common/recurringViewHelper.d.ts +2 -2
- package/lib/view/companyView/companyViewReducer.d.ts +9 -1
- package/lib/view/companyView/companyViewReducer.js +70 -3
- package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +2 -1
- package/lib/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.d.ts +10 -0
- package/lib/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.js +60 -0
- package/lib/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.d.ts +11 -0
- package/lib/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.js +41 -0
- package/lib/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.d.ts +13 -0
- package/lib/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.js +77 -0
- package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +2 -1
- package/lib/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +2 -1
- package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +2 -0
- package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +5 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +14 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +48 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +43 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +158 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +36 -8
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +128 -7
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +25 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +29 -4
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +10 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +76 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +80 -11
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +53 -6
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -8
- package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.d.ts +40 -0
- package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +120 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesEndpoint.d.ts +2 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesEndpoint.js +9 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.d.ts +7 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.js +41 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.d.ts +30 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.js +226 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.d.ts +7 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.js +32 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesViewState.d.ts +14 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesViewState.js +8 -0
- package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +9 -1
- package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +34 -2
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +2 -1
- package/lib/view/settingsView/settingsViewHelpers.d.ts +1 -1
- package/lib/view/settingsView/settingsViewHelpers.js +3 -2
- package/lib/view/settingsView/settingsViewPayload.d.ts +4 -0
- package/lib/view/settingsView/settingsViewState.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateRecommendationForAccountSettingsFailure = exports.updateRecommendationForAccountSettings = exports.updateJeScheduleTransactionKeys = exports.updateJeScheduleLocalDataById = exports.updateJESchedulesUIState = exports.updateAccountSettingsListForAccountTypesFailure = exports.updateAccountSettingsListForAccountTypes = exports.saveAccountSettingsSuccess = exports.saveAccountSettingsLocalData = exports.saveAccountSettingsFailure = exports.saveAccountSettings = exports.retryJeScheduleSuccess = exports.retryJeScheduleFailure = exports.retryJeSchedule = exports.removeJeScheduleTransactionKey = exports.removeJeScheduleLocalDataById = exports.removeFailedJeScheduleTransactionKey = exports.initializeJeScheduleLocalData = exports.initializeAccountSettingsView = exports.ignoreRecommendedJeScheduleSuccess = exports.ignoreRecommendedJeScheduleFailure = exports.ignoreRecommendedJeSchedule = exports.fetchRecommendationForAccountSettings = exports.fetchJeSchedulesSuccess = exports.fetchJeSchedulesPage = exports.fetchJeSchedulesFailure = exports.fetchJeSchedules = exports.fetchAccountSettingsListForAccountTypes = exports.clearJeScheduleLocalData = exports.clearJeAccountSettingsLocalData = exports.clearExpenseAutomationJESchedulesView = exports.initialState = exports.accountSettingsInitialState = void 0;
|
|
4
|
+
exports.updateRecommendationForAccountSettingsFailure = exports.updateRecommendationForAccountSettings = exports.updateNewScheduleLocalData = exports.updateJeScheduleTransactionKeys = exports.updateJeScheduleLocalDataById = exports.updateJEScheduleTypeFilter = exports.updateJESchedulesUIState = exports.updateAccountSettingsListForAccountTypesFailure = exports.updateAccountSettingsListForAccountTypes = exports.toggleJEPendingGroupCollapsed = exports.toggleJECreatedGroupCollapsed = exports.searchTransactionsForNewScheduleSuccess = exports.searchTransactionsForNewScheduleFailure = exports.searchTransactionsForNewSchedule = exports.saveNewScheduleSuccess = exports.saveNewScheduleFailure = exports.saveNewSchedule = exports.saveAccountSettingsSuccess = exports.saveAccountSettingsLocalData = exports.saveAccountSettingsFailure = exports.saveAccountSettings = exports.retryJeScheduleSuccess = exports.retryJeScheduleFailure = exports.retryJeSchedule = exports.resetNewScheduleLocalData = exports.removeJeScheduleTransactionKey = exports.removeJeScheduleLocalDataById = exports.removeFailedJeScheduleTransactionKey = exports.initializeNewSchedule = exports.initializeJeScheduleLocalData = exports.initializeAccountSettingsView = exports.ignoreRecommendedJeScheduleSuccess = exports.ignoreRecommendedJeScheduleFailure = exports.ignoreRecommendedJeSchedule = exports.fetchRecommendationForAccountSettings = exports.fetchJeSchedulesSuccess = exports.fetchJeSchedulesPage = exports.fetchJeSchedulesFailure = exports.fetchJeSchedules = exports.fetchAccountSettingsListForAccountTypes = exports.clearSearchTransactionsForNewSchedule = exports.clearJeScheduleLocalData = exports.clearJeAccountSettingsLocalData = exports.clearExpenseAutomationJESchedulesView = exports.initialState = exports.searchTransactionsInitialState = exports.newScheduleInitialState = exports.getBaseNewScheduleLocalData = exports.accountSettingsInitialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const getNestedAccountIDHierarchyForReport_1 = require("../../../commonStateTypes/accountView/getNestedAccountIDHierarchyForReport");
|
|
7
7
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
8
8
|
const accountPayload_1 = require("../../../entity/account/accountPayload");
|
|
9
9
|
const jeSchedulesPayload_1 = require("../../../entity/jeSchedules/jeSchedulesPayload");
|
|
10
10
|
const accountTypeRecommendationPayload_1 = require("../../accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload");
|
|
11
|
+
const jeSchedulesViewState_1 = require("../types/jeSchedulesViewState");
|
|
11
12
|
exports.accountSettingsInitialState = {
|
|
12
13
|
localData: {
|
|
13
14
|
selectedPrepaidExpensesAccountIds: [],
|
|
@@ -39,6 +40,20 @@ exports.accountSettingsInitialState = {
|
|
|
39
40
|
accruedExpensesNestedAccountListHierarchy: [],
|
|
40
41
|
accruedExpensesRecommendations: [],
|
|
41
42
|
};
|
|
43
|
+
const getBaseNewScheduleLocalData = (scheduleType) => ({
|
|
44
|
+
scheduleType,
|
|
45
|
+
jeScheduleDetails: [],
|
|
46
|
+
});
|
|
47
|
+
exports.getBaseNewScheduleLocalData = getBaseNewScheduleLocalData;
|
|
48
|
+
exports.newScheduleInitialState = {
|
|
49
|
+
fixed_assets: (0, exports.getBaseNewScheduleLocalData)('fixed_assets'),
|
|
50
|
+
prepaid_expenses: (0, exports.getBaseNewScheduleLocalData)('prepaid_expenses'),
|
|
51
|
+
};
|
|
52
|
+
exports.searchTransactionsInitialState = {
|
|
53
|
+
searchResults: [],
|
|
54
|
+
fetchState: 'Not-Started',
|
|
55
|
+
error: undefined,
|
|
56
|
+
};
|
|
42
57
|
exports.initialState = {
|
|
43
58
|
jeScheduleTransactionKeysByPeriod: {},
|
|
44
59
|
failedJeScheduleTransactionKeysByPeriod: {},
|
|
@@ -46,9 +61,12 @@ exports.initialState = {
|
|
|
46
61
|
ignoreStatusById: {},
|
|
47
62
|
jeScheduleLocalDataById: {},
|
|
48
63
|
uiState: {
|
|
49
|
-
|
|
64
|
+
createdGroupCollapsed: false,
|
|
65
|
+
pendingGroupCollapsed: false,
|
|
50
66
|
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
51
|
-
|
|
67
|
+
searchString: '',
|
|
68
|
+
selectedJETypeFilter: null,
|
|
69
|
+
selectedPageTab: 'schedules',
|
|
52
70
|
sortKey: 'transactionDate',
|
|
53
71
|
sortOrder: 'descending',
|
|
54
72
|
totalCount: 0,
|
|
@@ -59,6 +77,13 @@ exports.initialState = {
|
|
|
59
77
|
error: undefined,
|
|
60
78
|
},
|
|
61
79
|
accountSettings: exports.accountSettingsInitialState,
|
|
80
|
+
newSchedule: {
|
|
81
|
+
newScheduleState: exports.newScheduleInitialState,
|
|
82
|
+
saveStatus: { fetchState: 'Not-Started', error: undefined },
|
|
83
|
+
searchTransactions: exports.searchTransactionsInitialState,
|
|
84
|
+
fetchState: 'Not-Started',
|
|
85
|
+
error: undefined,
|
|
86
|
+
},
|
|
62
87
|
fetchState: 'Not-Started',
|
|
63
88
|
error: undefined,
|
|
64
89
|
hasValidState() {
|
|
@@ -125,8 +150,8 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
125
150
|
else {
|
|
126
151
|
draft.fetchState = 'Error';
|
|
127
152
|
draft.error = status;
|
|
153
|
+
draft.jeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = [];
|
|
128
154
|
}
|
|
129
|
-
draft.jeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = [];
|
|
130
155
|
},
|
|
131
156
|
retryJeSchedule(draft, action) {
|
|
132
157
|
const { scheduledJournalEntryID } = action.payload;
|
|
@@ -372,6 +397,91 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
372
397
|
clearJeAccountSettingsLocalData(draft) {
|
|
373
398
|
draft.accountSettings.localData = exports.accountSettingsInitialState.localData;
|
|
374
399
|
},
|
|
400
|
+
initializeNewSchedule: {
|
|
401
|
+
prepare({ scheduleType, }) {
|
|
402
|
+
return { payload: { scheduleType } };
|
|
403
|
+
},
|
|
404
|
+
reducer() {
|
|
405
|
+
// Purely an epic-trigger action — the epic fans out the account/class
|
|
406
|
+
// list fetches plus resetNewScheduleLocalData.
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
resetNewScheduleLocalData: {
|
|
410
|
+
prepare({ scheduleType, }) {
|
|
411
|
+
return { payload: { scheduleType } };
|
|
412
|
+
},
|
|
413
|
+
reducer(draft, action) {
|
|
414
|
+
const { scheduleType } = action.payload;
|
|
415
|
+
draft.newSchedule.newScheduleState[scheduleType] =
|
|
416
|
+
(0, exports.getBaseNewScheduleLocalData)(scheduleType);
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
updateNewScheduleLocalData(draft, action) {
|
|
420
|
+
const { scheduleType, localData } = action.payload;
|
|
421
|
+
draft.newSchedule.newScheduleState[scheduleType] = {
|
|
422
|
+
...draft.newSchedule.newScheduleState[scheduleType],
|
|
423
|
+
...localData,
|
|
424
|
+
};
|
|
425
|
+
},
|
|
426
|
+
searchTransactionsForNewSchedule: {
|
|
427
|
+
prepare({ query }) {
|
|
428
|
+
return { payload: { query } };
|
|
429
|
+
},
|
|
430
|
+
reducer(draft, action) {
|
|
431
|
+
const trimmed = action.payload.query.trim();
|
|
432
|
+
// Cleared or too-short query: no API (see epic) — reset immediately.
|
|
433
|
+
if (trimmed.length < jeSchedulesViewState_1.MIN_NEW_SCHEDULE_SEARCH_LENGTH) {
|
|
434
|
+
draft.newSchedule.searchTransactions = exports.searchTransactionsInitialState;
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
draft.newSchedule.searchTransactions = {
|
|
438
|
+
...draft.newSchedule.searchTransactions,
|
|
439
|
+
searchString: action.payload.query,
|
|
440
|
+
fetchState: 'In-Progress',
|
|
441
|
+
};
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
searchTransactionsForNewScheduleSuccess(draft, action) {
|
|
445
|
+
draft.newSchedule.searchTransactions = {
|
|
446
|
+
...draft.newSchedule.searchTransactions,
|
|
447
|
+
searchResults: action.payload.searchResults,
|
|
448
|
+
fetchState: 'Completed',
|
|
449
|
+
error: undefined,
|
|
450
|
+
};
|
|
451
|
+
},
|
|
452
|
+
searchTransactionsForNewScheduleFailure(draft, action) {
|
|
453
|
+
draft.newSchedule.searchTransactions = {
|
|
454
|
+
...draft.newSchedule.searchTransactions,
|
|
455
|
+
fetchState: 'Error',
|
|
456
|
+
error: action.payload.status,
|
|
457
|
+
};
|
|
458
|
+
},
|
|
459
|
+
clearSearchTransactionsForNewSchedule(draft) {
|
|
460
|
+
draft.newSchedule.searchTransactions = exports.searchTransactionsInitialState;
|
|
461
|
+
},
|
|
462
|
+
saveNewSchedule: {
|
|
463
|
+
prepare({ scheduleType, }) {
|
|
464
|
+
return { payload: { scheduleType } };
|
|
465
|
+
},
|
|
466
|
+
reducer(draft) {
|
|
467
|
+
draft.newSchedule.saveStatus = {
|
|
468
|
+
fetchState: 'In-Progress',
|
|
469
|
+
error: undefined,
|
|
470
|
+
};
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
saveNewScheduleSuccess(draft) {
|
|
474
|
+
draft.newSchedule.saveStatus = {
|
|
475
|
+
fetchState: 'Completed',
|
|
476
|
+
error: undefined,
|
|
477
|
+
};
|
|
478
|
+
},
|
|
479
|
+
saveNewScheduleFailure(draft, action) {
|
|
480
|
+
draft.newSchedule.saveStatus = {
|
|
481
|
+
fetchState: 'Error',
|
|
482
|
+
error: action.payload.status,
|
|
483
|
+
};
|
|
484
|
+
},
|
|
375
485
|
updateJESchedulesUIState(draft, action) {
|
|
376
486
|
if (action.payload.sortKey != null) {
|
|
377
487
|
draft.uiState.sortKey = action.payload.sortKey;
|
|
@@ -385,16 +495,27 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
385
495
|
if (action.payload.scrollPosition != null) {
|
|
386
496
|
draft.uiState.scrollPosition = action.payload.scrollPosition;
|
|
387
497
|
}
|
|
388
|
-
if (action.payload.
|
|
389
|
-
draft.uiState.
|
|
498
|
+
if (action.payload.selectedPageTab != null) {
|
|
499
|
+
draft.uiState.selectedPageTab = action.payload.selectedPageTab;
|
|
390
500
|
}
|
|
391
501
|
},
|
|
502
|
+
updateJEScheduleTypeFilter(draft, action) {
|
|
503
|
+
draft.uiState.selectedJETypeFilter = action.payload;
|
|
504
|
+
},
|
|
505
|
+
toggleJEPendingGroupCollapsed(draft) {
|
|
506
|
+
draft.uiState.pendingGroupCollapsed =
|
|
507
|
+
!draft.uiState.pendingGroupCollapsed;
|
|
508
|
+
},
|
|
509
|
+
toggleJECreatedGroupCollapsed(draft) {
|
|
510
|
+
draft.uiState.createdGroupCollapsed =
|
|
511
|
+
!draft.uiState.createdGroupCollapsed;
|
|
512
|
+
},
|
|
392
513
|
clearExpenseAutomationJESchedulesView(draft) {
|
|
393
514
|
Object.assign(draft, exports.initialState);
|
|
394
515
|
},
|
|
395
516
|
},
|
|
396
517
|
});
|
|
397
|
-
_a = expenseAutomationJESchedulesView.actions, exports.clearExpenseAutomationJESchedulesView = _a.clearExpenseAutomationJESchedulesView, exports.clearJeAccountSettingsLocalData = _a.clearJeAccountSettingsLocalData, exports.clearJeScheduleLocalData = _a.clearJeScheduleLocalData, exports.fetchAccountSettingsListForAccountTypes = _a.fetchAccountSettingsListForAccountTypes, exports.fetchJeSchedules = _a.fetchJeSchedules, exports.fetchJeSchedulesFailure = _a.fetchJeSchedulesFailure, exports.fetchJeSchedulesPage = _a.fetchJeSchedulesPage, exports.fetchJeSchedulesSuccess = _a.fetchJeSchedulesSuccess, exports.fetchRecommendationForAccountSettings = _a.fetchRecommendationForAccountSettings, exports.ignoreRecommendedJeSchedule = _a.ignoreRecommendedJeSchedule, exports.ignoreRecommendedJeScheduleFailure = _a.ignoreRecommendedJeScheduleFailure, exports.ignoreRecommendedJeScheduleSuccess = _a.ignoreRecommendedJeScheduleSuccess, exports.initializeAccountSettingsView = _a.initializeAccountSettingsView, exports.initializeJeScheduleLocalData = _a.initializeJeScheduleLocalData, exports.removeFailedJeScheduleTransactionKey = _a.removeFailedJeScheduleTransactionKey, exports.removeJeScheduleLocalDataById = _a.removeJeScheduleLocalDataById, exports.removeJeScheduleTransactionKey = _a.removeJeScheduleTransactionKey, exports.retryJeSchedule = _a.retryJeSchedule, exports.retryJeScheduleFailure = _a.retryJeScheduleFailure, exports.retryJeScheduleSuccess = _a.retryJeScheduleSuccess, exports.saveAccountSettings = _a.saveAccountSettings, exports.saveAccountSettingsFailure = _a.saveAccountSettingsFailure, exports.saveAccountSettingsLocalData = _a.saveAccountSettingsLocalData, exports.saveAccountSettingsSuccess = _a.saveAccountSettingsSuccess, exports.updateAccountSettingsListForAccountTypes = _a.updateAccountSettingsListForAccountTypes, exports.updateAccountSettingsListForAccountTypesFailure = _a.updateAccountSettingsListForAccountTypesFailure, exports.updateJESchedulesUIState = _a.updateJESchedulesUIState, exports.updateJeScheduleLocalDataById = _a.updateJeScheduleLocalDataById, exports.updateJeScheduleTransactionKeys = _a.updateJeScheduleTransactionKeys, exports.updateRecommendationForAccountSettings = _a.updateRecommendationForAccountSettings, exports.updateRecommendationForAccountSettingsFailure = _a.updateRecommendationForAccountSettingsFailure;
|
|
518
|
+
_a = expenseAutomationJESchedulesView.actions, exports.clearExpenseAutomationJESchedulesView = _a.clearExpenseAutomationJESchedulesView, exports.clearJeAccountSettingsLocalData = _a.clearJeAccountSettingsLocalData, exports.clearJeScheduleLocalData = _a.clearJeScheduleLocalData, exports.clearSearchTransactionsForNewSchedule = _a.clearSearchTransactionsForNewSchedule, exports.fetchAccountSettingsListForAccountTypes = _a.fetchAccountSettingsListForAccountTypes, exports.fetchJeSchedules = _a.fetchJeSchedules, exports.fetchJeSchedulesFailure = _a.fetchJeSchedulesFailure, exports.fetchJeSchedulesPage = _a.fetchJeSchedulesPage, exports.fetchJeSchedulesSuccess = _a.fetchJeSchedulesSuccess, exports.fetchRecommendationForAccountSettings = _a.fetchRecommendationForAccountSettings, exports.ignoreRecommendedJeSchedule = _a.ignoreRecommendedJeSchedule, exports.ignoreRecommendedJeScheduleFailure = _a.ignoreRecommendedJeScheduleFailure, exports.ignoreRecommendedJeScheduleSuccess = _a.ignoreRecommendedJeScheduleSuccess, exports.initializeAccountSettingsView = _a.initializeAccountSettingsView, exports.initializeJeScheduleLocalData = _a.initializeJeScheduleLocalData, exports.initializeNewSchedule = _a.initializeNewSchedule, exports.removeFailedJeScheduleTransactionKey = _a.removeFailedJeScheduleTransactionKey, exports.removeJeScheduleLocalDataById = _a.removeJeScheduleLocalDataById, exports.removeJeScheduleTransactionKey = _a.removeJeScheduleTransactionKey, exports.resetNewScheduleLocalData = _a.resetNewScheduleLocalData, exports.retryJeSchedule = _a.retryJeSchedule, exports.retryJeScheduleFailure = _a.retryJeScheduleFailure, exports.retryJeScheduleSuccess = _a.retryJeScheduleSuccess, exports.saveAccountSettings = _a.saveAccountSettings, exports.saveAccountSettingsFailure = _a.saveAccountSettingsFailure, exports.saveAccountSettingsLocalData = _a.saveAccountSettingsLocalData, exports.saveAccountSettingsSuccess = _a.saveAccountSettingsSuccess, exports.saveNewSchedule = _a.saveNewSchedule, exports.saveNewScheduleFailure = _a.saveNewScheduleFailure, exports.saveNewScheduleSuccess = _a.saveNewScheduleSuccess, exports.searchTransactionsForNewSchedule = _a.searchTransactionsForNewSchedule, exports.searchTransactionsForNewScheduleFailure = _a.searchTransactionsForNewScheduleFailure, exports.searchTransactionsForNewScheduleSuccess = _a.searchTransactionsForNewScheduleSuccess, exports.toggleJECreatedGroupCollapsed = _a.toggleJECreatedGroupCollapsed, exports.toggleJEPendingGroupCollapsed = _a.toggleJEPendingGroupCollapsed, exports.updateAccountSettingsListForAccountTypes = _a.updateAccountSettingsListForAccountTypes, exports.updateAccountSettingsListForAccountTypesFailure = _a.updateAccountSettingsListForAccountTypesFailure, exports.updateJESchedulesUIState = _a.updateJESchedulesUIState, exports.updateJEScheduleTypeFilter = _a.updateJEScheduleTypeFilter, exports.updateJeScheduleLocalDataById = _a.updateJeScheduleLocalDataById, exports.updateJeScheduleTransactionKeys = _a.updateJeScheduleTransactionKeys, exports.updateNewScheduleLocalData = _a.updateNewScheduleLocalData, exports.updateRecommendationForAccountSettings = _a.updateRecommendationForAccountSettings, exports.updateRecommendationForAccountSettingsFailure = _a.updateRecommendationForAccountSettingsFailure;
|
|
398
519
|
exports.default = expenseAutomationJESchedulesView.reducer;
|
|
399
520
|
const doUpdateRecommendationForAccountSettings = (draft, payload) => {
|
|
400
521
|
const { prepaidExpensesRecommendations, fixedAssetsRecommendations, accruedExpensesRecommendations, } = (0, accountTypeRecommendationPayload_1.mapAccountTypeRecommendationPayloadToAccountRecommendationByType)(payload);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
|
+
import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
|
|
3
|
+
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
4
|
+
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
|
+
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
|
+
import { ClassBase } from '../../../entity/class/classState';
|
|
7
|
+
import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
8
|
+
import { SupportedTransaction } from '../../../entity/transaction/transactionState';
|
|
9
|
+
import { NewScheduleLocalData, NewScheduleLocalDataFixedAssets } from '../types/jeSchedulesViewState';
|
|
10
|
+
export interface NewScheduleSearchTransactionsView {
|
|
11
|
+
searchTransactionsFetchState: FetchStateAndError;
|
|
12
|
+
searchTransactionsResults: SupportedTransaction[];
|
|
13
|
+
selectableBaseTransactionIds: ID[];
|
|
14
|
+
searchTransactionsString?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface NewScheduleView extends SelectorView, NewScheduleSearchTransactionsView {
|
|
17
|
+
accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
18
|
+
allAccountList: AccountBase[];
|
|
19
|
+
allClassList: ClassBase[];
|
|
20
|
+
classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
|
|
21
|
+
newScheduleLocalData: NewScheduleLocalData | NewScheduleLocalDataFixedAssets;
|
|
22
|
+
scheduleType: ScheduleTypes;
|
|
23
|
+
allDepreciationAccountList?: AccountBase[];
|
|
24
|
+
allDepreciationAccountListNestedAccountHierarchy?: NestedAccountHierarchyForReport[];
|
|
25
|
+
}
|
|
@@ -5,11 +5,30 @@ import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndRep
|
|
|
5
5
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
6
|
import { ClassBase } from '../../../entity/class/classState';
|
|
7
7
|
import { JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
8
|
-
import { JEScheduleTransactionKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
8
|
+
import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
9
9
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
10
10
|
import { JEAccountSettingsView } from '../selectorTypes/jeAccountSettingsViewSelectorTypes';
|
|
11
|
+
import { NewScheduleView } from '../selectorTypes/jeNewScheduleViewSelectorTypes';
|
|
11
12
|
import { JEScheduledTransactionWithFailedEntries } from '../selectors/jeSchedulesViewSelector';
|
|
12
13
|
import { JEScheduleLocalData, JESchedulesViewUIState } from '../types/jeSchedulesViewState';
|
|
14
|
+
export interface JEKpiSummary {
|
|
15
|
+
aiAccountant: {
|
|
16
|
+
amount: number;
|
|
17
|
+
count: number;
|
|
18
|
+
};
|
|
19
|
+
manual: {
|
|
20
|
+
amount: number;
|
|
21
|
+
count: number;
|
|
22
|
+
};
|
|
23
|
+
needsReview: {
|
|
24
|
+
amount: number;
|
|
25
|
+
count: number;
|
|
26
|
+
};
|
|
27
|
+
total: {
|
|
28
|
+
amount: number;
|
|
29
|
+
count: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
13
32
|
export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
|
|
14
33
|
accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
15
34
|
accountSettingsView: JEAccountSettingsView;
|
|
@@ -18,13 +37,19 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
|
|
|
18
37
|
allDepreciationAccountList: AccountBase[];
|
|
19
38
|
allDepreciationAccountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
20
39
|
classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
|
|
21
|
-
completedSchedules: JEScheduledTransaction[];
|
|
22
40
|
completionStatus: CompletionStatusType;
|
|
23
|
-
|
|
41
|
+
createdSchedules: JEScheduledTransaction[];
|
|
42
|
+
createdTotal: number;
|
|
24
43
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
25
44
|
jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
|
|
26
|
-
|
|
45
|
+
jeScheduleTypeCounts: {
|
|
46
|
+
active: Record<ScheduleTypes, number>;
|
|
47
|
+
ongoing: Record<ScheduleTypes, number>;
|
|
48
|
+
};
|
|
49
|
+
kpiSummary: JEKpiSummary;
|
|
50
|
+
newScheduleView: NewScheduleView | undefined;
|
|
27
51
|
pendingReviewSchedules: (JEScheduledTransaction | JEScheduledTransactionWithFailedEntries)[];
|
|
52
|
+
pendingReviewTotal: number;
|
|
28
53
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
29
54
|
refreshStatus: FetchStateAndError;
|
|
30
55
|
resolveSchedules: JEScheduledTransactionWithFailedEntries[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RootState } from '../../../reducer';
|
|
2
|
+
import { NewScheduleSearchTransactionsView, NewScheduleView } from '../selectorTypes/jeNewScheduleViewSelectorTypes';
|
|
3
|
+
/**
|
|
4
|
+
* The Base Transaction search is shared across schedule types (one search
|
|
5
|
+
* box, not one per prepaid_expenses/fixed_assets) — split out from
|
|
6
|
+
* getNewScheduleView so a consumer can read it without supplying an
|
|
7
|
+
* otherwise-irrelevant scheduleType.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getNewScheduleSearchTransactionsView: (state: RootState) => NewScheduleSearchTransactionsView;
|
|
10
|
+
export declare const getNewScheduleView: (state: RootState, scheduleType: "fixed_assets" | "prepaid_expenses") => NewScheduleView;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNewScheduleView = exports.getNewScheduleSearchTransactionsView = void 0;
|
|
4
|
+
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
5
|
+
const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
|
|
6
|
+
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
7
|
+
const classListSelector_1 = require("../../classList/classListSelector");
|
|
8
|
+
const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper");
|
|
9
|
+
const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailSelector");
|
|
10
|
+
const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
|
|
11
|
+
const newScheduleLocalDataHelper_1 = require("../helpers/newScheduleLocalDataHelper");
|
|
12
|
+
/**
|
|
13
|
+
* The Base Transaction search is shared across schedule types (one search
|
|
14
|
+
* box, not one per prepaid_expenses/fixed_assets) — split out from
|
|
15
|
+
* getNewScheduleView so a consumer can read it without supplying an
|
|
16
|
+
* otherwise-irrelevant scheduleType.
|
|
17
|
+
*/
|
|
18
|
+
const getNewScheduleSearchTransactionsView = (state) => {
|
|
19
|
+
const { searchTransactions } = state.expenseAutomationJESchedulesViewState.newSchedule;
|
|
20
|
+
const searchTransactionsResults = (0, transactionSelector_1.getSupportedTransactionsByIds)(state.transactionState, searchTransactions.searchResults);
|
|
21
|
+
return {
|
|
22
|
+
searchTransactionsResults,
|
|
23
|
+
selectableBaseTransactionIds: searchTransactionsResults
|
|
24
|
+
.filter(newScheduleLocalDataHelper_1.isSupportedTransactionSelectableForNewSchedule)
|
|
25
|
+
.map((transaction) => transaction.id),
|
|
26
|
+
searchTransactionsFetchState: {
|
|
27
|
+
fetchState: searchTransactions.fetchState,
|
|
28
|
+
error: searchTransactions.error,
|
|
29
|
+
},
|
|
30
|
+
searchTransactionsString: searchTransactions.searchString,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
exports.getNewScheduleSearchTransactionsView = getNewScheduleSearchTransactionsView;
|
|
34
|
+
const getNewScheduleView = (state, scheduleType) => {
|
|
35
|
+
const { accountState, accountListState, classState, classListState } = state;
|
|
36
|
+
const { newSchedule } = state.expenseAutomationJESchedulesViewState;
|
|
37
|
+
const searchTransactionsView = (0, exports.getNewScheduleSearchTransactionsView)(state);
|
|
38
|
+
const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
|
|
39
|
+
const newScheduleAccountTypes = (0, scheduleDetailLocalDataHelper_1.getAccountsTypesForScheduleDetails)(scheduleType);
|
|
40
|
+
const newScheduleAccountIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, newScheduleAccountTypes);
|
|
41
|
+
const allAccountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, accountType.accountListKey);
|
|
42
|
+
const filteredAccounts = allAccountList.accounts.filter((account) => newScheduleAccountIds.includes(account.accountId));
|
|
43
|
+
const accountListNestedAccountHierarchy = (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)((0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountType.accountListKey), filteredAccounts.map((account) => account.accountId));
|
|
44
|
+
const allClassList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
45
|
+
const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
|
|
46
|
+
let allDepreciationAccountList;
|
|
47
|
+
let allDepreciationAccountListNestedAccountHierarchy;
|
|
48
|
+
if (scheduleType === 'fixed_assets') {
|
|
49
|
+
const depreciationCategoryIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, [
|
|
50
|
+
'fixed_assets',
|
|
51
|
+
'other_assets',
|
|
52
|
+
]);
|
|
53
|
+
const accountLabel = (0, scheduleListHelper_1.getAccountLabelForScheduleType)('fixed_assets');
|
|
54
|
+
const fixedAssetLabelAccountIds = accountLabel != null
|
|
55
|
+
? (0, accountListSelector_1.getAccountIdsForLabel)(accountListState, accountType.accountListKey, accountLabel)
|
|
56
|
+
: [];
|
|
57
|
+
allDepreciationAccountList = allAccountList.accounts.filter((account) => depreciationCategoryIds.includes(account.accountId) &&
|
|
58
|
+
!fixedAssetLabelAccountIds.includes(account.accountId));
|
|
59
|
+
allDepreciationAccountListNestedAccountHierarchy =
|
|
60
|
+
(0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)((0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountType.accountListKey), allDepreciationAccountList.map((account) => account.accountId));
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
scheduleType,
|
|
64
|
+
accountListNestedAccountHierarchy,
|
|
65
|
+
allAccountList: filteredAccounts,
|
|
66
|
+
allClassList: allClassList.classes,
|
|
67
|
+
allDepreciationAccountList,
|
|
68
|
+
allDepreciationAccountListNestedAccountHierarchy,
|
|
69
|
+
classListNestedAccountHierarchy,
|
|
70
|
+
newScheduleLocalData: newSchedule.newScheduleState[scheduleType],
|
|
71
|
+
...searchTransactionsView,
|
|
72
|
+
fetchState: newSchedule.fetchState,
|
|
73
|
+
error: newSchedule.error,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
exports.getNewScheduleView = getNewScheduleView;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JEScheduledTransaction, ScheduledJournalEntry } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
2
2
|
import { RootState } from '../../../reducer';
|
|
3
3
|
import { ExpenseAutomationJESchedulesViewSelector } from '../selectorTypes/jeSchedulesSelectorTypes';
|
|
4
|
+
export declare const isAiAccountantSchedule: (schedule: JEScheduledTransaction | JEScheduledTransactionWithFailedEntries) => boolean;
|
|
4
5
|
export declare function getExpenseAutomationJESchedulesView(state: RootState): ExpenseAutomationJESchedulesViewSelector;
|
|
5
6
|
export interface JEScheduledTransactionWithFailedEntries extends Omit<JEScheduledTransaction, 'scheduledJournalEntry'> {
|
|
6
7
|
scheduledJournalEntry: ScheduledJournalEntry;
|
|
@@ -3,6 +3,7 @@ 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;
|
|
6
7
|
exports.getExpenseAutomationJESchedulesView = getExpenseAutomationJESchedulesView;
|
|
7
8
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
8
9
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
@@ -10,6 +11,7 @@ const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState")
|
|
|
10
11
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
11
12
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
12
13
|
const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
|
|
14
|
+
const jeSchedulesTypes_1 = require("../../../entity/jeSchedules/jeSchedulesTypes");
|
|
13
15
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
14
16
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
15
17
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
@@ -18,6 +20,21 @@ const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/
|
|
|
18
20
|
const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
|
|
19
21
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
20
22
|
const jeAccountSettingsViewSelector_1 = require("./jeAccountSettingsViewSelector");
|
|
23
|
+
const jeNewScheduleViewSelector_1 = require("./jeNewScheduleViewSelector");
|
|
24
|
+
// Matches the AI-automation user addresses webc's schedule list row already
|
|
25
|
+
// checks (JEScheduleReadOnlyListRow/JEScheduleDraftListRow "Method" column,
|
|
26
|
+
// strings.ts aiBotEmail/botEmail) to determine whether a schedule was
|
|
27
|
+
// created by the AI accountant vs. a human.
|
|
28
|
+
const AI_BOT_EMAIL = 'ai@zeni.ai';
|
|
29
|
+
const BOT_EMAIL = 'bot@zeni.ai';
|
|
30
|
+
// Exported (rather than kept as a closure inside the selector) so it can be
|
|
31
|
+
// unit-tested directly — confidenceScore is a separate, more narrowly
|
|
32
|
+
// populated field that can be null on a schedule the bot user created,
|
|
33
|
+
// which previously caused these schedules to display as "AI Accountant" in
|
|
34
|
+
// the list but count under "Manual" in the KPI summary.
|
|
35
|
+
const isAiAccountantSchedule = (schedule) => schedule.createdByUser?.email === AI_BOT_EMAIL ||
|
|
36
|
+
schedule.createdByUser?.email === BOT_EMAIL;
|
|
37
|
+
exports.isAiAccountantSchedule = isAiAccountantSchedule;
|
|
21
38
|
function getJEScheduleSortAccessor(sortKey) {
|
|
22
39
|
switch (sortKey) {
|
|
23
40
|
case 'vendor':
|
|
@@ -59,7 +76,7 @@ function getJEScheduleSortAccessor(sortKey) {
|
|
|
59
76
|
case 'totalAmount':
|
|
60
77
|
return (s) => s.baseTransaction.amount.amount;
|
|
61
78
|
case 'transactionDate':
|
|
62
|
-
return (s) => s.
|
|
79
|
+
return (s) => s.createTime?.valueOf();
|
|
63
80
|
case 'memo':
|
|
64
81
|
return (s) => s.baseTransaction.memo?.toLowerCase();
|
|
65
82
|
default:
|
|
@@ -74,8 +91,12 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
74
91
|
const jeScheduledTransaction = [];
|
|
75
92
|
const failedJeScheduledTransaction = [];
|
|
76
93
|
const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
77
|
-
const { jeScheduleTransactionKeysByPeriod, failedJeScheduleTransactionKeysByPeriod, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, } = expenseAutomationJESchedulesViewState;
|
|
94
|
+
const { jeScheduleTransactionKeysByPeriod, failedJeScheduleTransactionKeysByPeriod, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, newSchedule, } = expenseAutomationJESchedulesViewState;
|
|
78
95
|
const accountSettingsView = (0, jeAccountSettingsViewSelector_1.getJEAccountSettingsView)(state);
|
|
96
|
+
const newScheduleView = newSchedule.selectedDetailScheduleType === 'fixed_assets' ||
|
|
97
|
+
newSchedule.selectedDetailScheduleType === 'prepaid_expenses'
|
|
98
|
+
? (0, jeNewScheduleViewSelector_1.getNewScheduleView)(state, newSchedule.selectedDetailScheduleType)
|
|
99
|
+
: undefined;
|
|
79
100
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
80
101
|
const { selectedPeriodByTenantId } = expenseAutomationViewState;
|
|
81
102
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
@@ -119,11 +140,7 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
119
140
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
120
141
|
failedJeScheduledTransaction.push(jeScheduleDetails);
|
|
121
142
|
});
|
|
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);
|
|
143
|
+
const { sortKey, sortOrder, selectedJETypeFilter } = uiState;
|
|
127
144
|
const unsortedResolveSchedules = [];
|
|
128
145
|
failedJeScheduledTransaction.forEach((schedule) => {
|
|
129
146
|
schedule.scheduledJournalEntry.forEach((journalEntry) => {
|
|
@@ -136,9 +153,42 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
136
153
|
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
|
|
137
154
|
const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
|
|
138
155
|
const pendingReviewSchedules = sortJEScheduledTransactions([
|
|
139
|
-
...jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'
|
|
156
|
+
...jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft' &&
|
|
157
|
+
(selectedJETypeFilter == null ||
|
|
158
|
+
schedule.jeScheduleType === selectedJETypeFilter)),
|
|
140
159
|
...validResolveForPending,
|
|
141
160
|
], sortKey, sortOrder);
|
|
161
|
+
const createdSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => (schedule.status.code === 'ongoing' ||
|
|
162
|
+
schedule.status.code === 'completed' ||
|
|
163
|
+
schedule.status.code === 'marked_as_completed') &&
|
|
164
|
+
(selectedJETypeFilter == null ||
|
|
165
|
+
schedule.jeScheduleType === selectedJETypeFilter)), sortKey, sortOrder);
|
|
166
|
+
// KPI summary — derived from unfiltered schedules so counts are always accurate
|
|
167
|
+
const allSchedules = jeScheduledTransaction;
|
|
168
|
+
const sumAmount = (schedules) => schedules.reduce((total, schedule) => total + (schedule.baseTransaction.amount.amount ?? 0), 0);
|
|
169
|
+
const pendingReviewTotal = sumAmount(pendingReviewSchedules);
|
|
170
|
+
const createdTotal = sumAmount(createdSchedules);
|
|
171
|
+
const aiAccountantSchedules = allSchedules.filter(exports.isAiAccountantSchedule);
|
|
172
|
+
const manualSchedules = allSchedules.filter((schedule) => !(0, exports.isAiAccountantSchedule)(schedule));
|
|
173
|
+
const pendingUnfiltered = allSchedules.filter((schedule) => schedule.status.code === 'draft');
|
|
174
|
+
const kpiSummary = {
|
|
175
|
+
aiAccountant: {
|
|
176
|
+
count: aiAccountantSchedules.length,
|
|
177
|
+
amount: sumAmount(aiAccountantSchedules),
|
|
178
|
+
},
|
|
179
|
+
manual: {
|
|
180
|
+
count: manualSchedules.length,
|
|
181
|
+
amount: sumAmount(manualSchedules),
|
|
182
|
+
},
|
|
183
|
+
needsReview: {
|
|
184
|
+
count: pendingUnfiltered.length,
|
|
185
|
+
amount: sumAmount(pendingUnfiltered),
|
|
186
|
+
},
|
|
187
|
+
total: {
|
|
188
|
+
count: allSchedules.length,
|
|
189
|
+
amount: sumAmount(allSchedules),
|
|
190
|
+
},
|
|
191
|
+
};
|
|
142
192
|
const allSteps = monthYearPeriodId != null
|
|
143
193
|
? (0, expenseAutomationViewSelectorTypes_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
|
|
144
194
|
: [];
|
|
@@ -151,6 +201,22 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
151
201
|
{ fetchState, error },
|
|
152
202
|
monthEndFetchState,
|
|
153
203
|
]);
|
|
204
|
+
const countByType = (schedules) => {
|
|
205
|
+
const counts = jeSchedulesTypes_1.ALL_SCHEDULES_TYPES.reduce((acc, type) => ({ ...acc, [type]: 0 }), {});
|
|
206
|
+
schedules.forEach((schedule) => {
|
|
207
|
+
if (schedule.jeScheduleType != null) {
|
|
208
|
+
counts[schedule.jeScheduleType] += 1;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
return counts;
|
|
212
|
+
};
|
|
213
|
+
const jeScheduleTypeCounts = {
|
|
214
|
+
active: countByType(allSchedules.filter((schedule) => schedule.status.code === 'draft' ||
|
|
215
|
+
schedule.status.code === 'ongoing' ||
|
|
216
|
+
schedule.status.code === 'completed' ||
|
|
217
|
+
schedule.status.code === 'marked_as_completed')),
|
|
218
|
+
ongoing: countByType(allSchedules.filter((schedule) => schedule.status.code === 'ongoing')),
|
|
219
|
+
};
|
|
154
220
|
return {
|
|
155
221
|
uncategorizedAccounts,
|
|
156
222
|
allDepreciationAccountList: filteredDepAccounts,
|
|
@@ -159,12 +225,15 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
159
225
|
allAccountList: filteredAccounts,
|
|
160
226
|
accountListNestedAccountHierarchy,
|
|
161
227
|
allClassList: allClasses,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
228
|
+
createdSchedules,
|
|
229
|
+
createdTotal,
|
|
230
|
+
jeScheduleTypeCounts,
|
|
231
|
+
kpiSummary,
|
|
165
232
|
pendingReviewSchedules,
|
|
233
|
+
pendingReviewTotal,
|
|
166
234
|
resolveSchedules: resolveSchedules,
|
|
167
235
|
accountSettingsView,
|
|
236
|
+
newScheduleView,
|
|
168
237
|
postStatusById: postStatusById,
|
|
169
238
|
ignoreStatusById: ignoreStatusById,
|
|
170
239
|
fetchState: reducedFetchStatus.fetchState,
|
|
@@ -1,22 +1,29 @@
|
|
|
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 { JEScheduleTransactionKey, ScheduleJournalEntryStatusCodeType, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
9
|
+
import { TransactionID } from '../../../entity/transaction/stateTypes/transaction';
|
|
8
10
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
9
|
-
|
|
11
|
+
import { ZeniDate } from '../../../zeniDayJS';
|
|
12
|
+
import { JETransactionLink } from '../../scheduleView/scheduleDetailView/scheduleDetailState';
|
|
13
|
+
export declare const toJEScheduleSortKey: (v: string) => "vendor" | "type" | "category" | "class" | "memo" | "transactionDate" | "totalAmount" | "runningBalance" | "jePostingDate" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "remainingMonths";
|
|
10
14
|
export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
|
|
11
|
-
export declare const
|
|
12
|
-
export type
|
|
15
|
+
export declare const toJEPageTab: (v: string) => "schedules" | "existing_schedules";
|
|
16
|
+
export type JEPageTab = ReturnType<typeof toJEPageTab>;
|
|
13
17
|
export interface JESchedulesViewUIState {
|
|
18
|
+
createdGroupCollapsed: boolean;
|
|
19
|
+
pendingGroupCollapsed: boolean;
|
|
14
20
|
scrollPosition: {
|
|
15
21
|
scrollTop: number;
|
|
16
22
|
scrollLeft?: number;
|
|
17
23
|
} | undefined;
|
|
18
24
|
searchString: string;
|
|
19
|
-
|
|
25
|
+
selectedJETypeFilter: ScheduleTypes | null;
|
|
26
|
+
selectedPageTab: JEPageTab;
|
|
20
27
|
sortKey: JEScheduleSortKey;
|
|
21
28
|
sortOrder: SortOrder;
|
|
22
29
|
totalCount: number;
|
|
@@ -37,10 +44,50 @@ export interface JESchedulesViewState extends FetchedState {
|
|
|
37
44
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
38
45
|
jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
|
|
39
46
|
jeScheduleTransactionKeysByPeriod: Record<MonthYearPeriodId, JEScheduleTransactionKey[]>;
|
|
47
|
+
newSchedule: NewJeScheduleState;
|
|
40
48
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
41
49
|
refreshStatus: FetchStateAndError;
|
|
42
50
|
uiState: JESchedulesViewUIState;
|
|
43
51
|
}
|
|
52
|
+
export interface NewJeDetailLocalData {
|
|
53
|
+
amount: Amount;
|
|
54
|
+
jeLink: JETransactionLink;
|
|
55
|
+
memo: string;
|
|
56
|
+
postingDate: ZeniDate;
|
|
57
|
+
postingStatus: ScheduleJournalEntryStatusCodeType;
|
|
58
|
+
runningBalance: Amount;
|
|
59
|
+
}
|
|
60
|
+
export interface NewScheduleLocalData {
|
|
61
|
+
jeScheduleDetails: NewJeDetailLocalData[];
|
|
62
|
+
scheduleType: ScheduleTypes;
|
|
63
|
+
lastDayOfMonth?: boolean;
|
|
64
|
+
selectedAccount?: ID;
|
|
65
|
+
selectedBaseTransactionId?: TransactionID;
|
|
66
|
+
selectedClass?: ID;
|
|
67
|
+
selectedDate?: ZeniDate;
|
|
68
|
+
selectedDayOfMonth?: ScheduleDaysOfMonth;
|
|
69
|
+
selectedJEScheduleKey?: JEScheduleTransactionKey;
|
|
70
|
+
selectedMonths?: number;
|
|
71
|
+
selectedVendor?: VendorBase;
|
|
72
|
+
}
|
|
73
|
+
export interface NewScheduleLocalDataFixedAssets extends NewScheduleLocalData {
|
|
74
|
+
assetId?: string;
|
|
75
|
+
selectedAccumulatedDepreciationCategory?: ID;
|
|
76
|
+
}
|
|
77
|
+
export interface SearchTransactionsState extends FetchStateAndError {
|
|
78
|
+
searchResults: ID[];
|
|
79
|
+
searchString?: string;
|
|
80
|
+
}
|
|
81
|
+
export declare const MIN_NEW_SCHEDULE_SEARCH_LENGTH = 2;
|
|
82
|
+
export interface NewJeScheduleState extends FetchStateAndError {
|
|
83
|
+
newScheduleState: {
|
|
84
|
+
fixed_assets: NewScheduleLocalDataFixedAssets;
|
|
85
|
+
prepaid_expenses: NewScheduleLocalData;
|
|
86
|
+
};
|
|
87
|
+
saveStatus: FetchStateAndError;
|
|
88
|
+
searchTransactions: SearchTransactionsState;
|
|
89
|
+
selectedDetailScheduleType?: ScheduleTypes;
|
|
90
|
+
}
|
|
44
91
|
export interface AccountSettingsLocalData {
|
|
45
92
|
previousAccruedExpensesAccount: AccountBase[];
|
|
46
93
|
previousFixedAssetsAccount: AccountBase[];
|