@zeniai/client-epic-state 5.1.87 → 5.1.88-betaRD1

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.
Files changed (104) hide show
  1. package/lib/__testHelpers__/apiFailure.json +6 -0
  2. package/lib/entity/aiCfo/aiCfoState.d.ts +2 -2
  3. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +2 -0
  4. package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
  5. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +34 -1
  6. package/lib/entity/jeSchedules/jeSchedulesPayload.js +68 -0
  7. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
  8. package/lib/entity/jeSchedules/jeSchedulesReducer.js +24 -2
  9. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +10 -2
  10. package/lib/entity/jeSchedules/jeSchedulesSelector.js +28 -3
  11. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +41 -1
  12. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +12 -1
  13. package/lib/entity/jeSchedules/jeSchedulesTypes.js +40 -1
  14. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
  15. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  16. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
  17. package/lib/entity/vendor/__mocks__/vendorMock.d.ts +7 -0
  18. package/lib/entity/vendor/__mocks__/vendorMock.js +311 -0
  19. package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +8 -0
  20. package/lib/entity/vendor/__mocks__/vendorStateMocks.js +415 -0
  21. package/lib/epic.d.ts +6 -1
  22. package/lib/epic.js +8 -1
  23. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
  24. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +68 -1
  25. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +24 -2
  26. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +26 -2
  27. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +34 -0
  28. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  29. package/lib/esm/epic.js +8 -1
  30. package/lib/esm/index.js +12 -6
  31. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  32. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +34 -3
  33. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +81 -0
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +21 -0
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
  36. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +73 -0
  37. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
  38. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  39. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
  40. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +187 -28
  41. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  42. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
  43. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +260 -22
  44. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
  45. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +26 -0
  46. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +16 -0
  47. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +9 -1
  48. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +50 -1
  49. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +14 -1
  50. package/lib/index.d.ts +17 -12
  51. package/lib/index.js +83 -49
  52. package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.d.ts +11 -0
  53. package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +4659 -0
  54. package/lib/view/addressView/__mocks__/addressViewMocks.d.ts +35 -0
  55. package/lib/view/addressView/__mocks__/addressViewMocks.js +239 -0
  56. package/lib/view/addressView/__mocks__/json/createAddressResponse.json +23 -0
  57. package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +258 -0
  58. package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +418 -0
  59. package/lib/view/addressView/__mocks__/json/fetchAddressResponse.json +24 -0
  60. package/lib/view/addressView/__mocks__/json/updateAddressResponse.json +24 -0
  61. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  62. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -2
  63. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +32 -1
  64. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +8 -0
  65. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +85 -0
  66. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  67. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  68. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
  69. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
  70. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  71. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +77 -0
  72. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  73. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
  74. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  75. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  76. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +44 -2
  77. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
  78. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +49 -10
  79. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +189 -28
  80. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  81. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  82. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
  83. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  84. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +34 -8
  85. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
  86. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
  87. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +10 -1
  88. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +266 -21
  89. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  90. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +79 -8
  91. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  92. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.d.ts +7 -0
  93. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +30 -0
  94. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.d.ts +6 -0
  95. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +20 -0
  96. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewEpics.d.ts +2 -2
  97. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.d.ts +12 -0
  98. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +11 -0
  99. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.d.ts +21 -4
  100. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +51 -2
  101. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.d.ts +3 -0
  102. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +16 -2
  103. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewState.d.ts +13 -0
  104. package/package.json +1 -1
@@ -65,8 +65,8 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
65
65
  cotTrackingByTransactionId: COTTransactionTrackingByTransactionId;
66
66
  }, "expenseAutomationTransactionsView/updateTransactionCategorization", never, never>, updateCurrentSelectedTransactionCategorizationTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSelectedTab: "review" | "autoCategorized"], {
67
67
  newSelectedTab: "review" | "autoCategorized";
68
- }, "expenseAutomationTransactionsView/updateCurrentSelectedTransactionCategorizationTab", never, never>, updateTransactionCategorizationCompletedSubTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSubTab: "all" | "manual" | "ai_accountant"], {
69
- newSubTab: "all" | "manual" | "ai_accountant";
68
+ }, "expenseAutomationTransactionsView/updateCurrentSelectedTransactionCategorizationTab", never, never>, updateTransactionCategorizationCompletedSubTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSubTab: "manual" | "all" | "ai_accountant"], {
69
+ newSubTab: "manual" | "all" | "ai_accountant";
70
70
  }, "expenseAutomationTransactionsView/updateTransactionCategorizationCompletedSubTab", never, never>, updateTransactionCategorizationSaveStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
71
71
  selectedTab: "review" | "autoCategorized";
72
72
  fetchState: FetchState;
@@ -0,0 +1,42 @@
1
+ import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
+ import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
3
+ import { FetchStateAndError } 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 { ScheduleTransaction } from '../../../entity/transaction/stateTypes/scheduleTransaction';
9
+ import { NewScheduleLocalData, NewScheduleLocalDataFixedAssets } from '../types/jeSchedulesViewState';
10
+ export interface NewScheduleSearchTransactionsView {
11
+ searchTransactionsFetchState: FetchStateAndError;
12
+ searchTransactionsResults: ScheduleTransaction[];
13
+ searchTransactionsString?: string;
14
+ }
15
+ /**
16
+ * Accounts and request status for both accrual creation forms — the one-time accrual and the
17
+ * recurring accrued schedule. Deliberately not NewScheduleView: neither has a base transaction to
18
+ * search, and both need a second account hierarchy (the accrued liability) that no schedule type
19
+ * has. A one-time accrual additionally has no local-data slot in newScheduleState, since it is not
20
+ * a schedule type at all.
21
+ */
22
+ export interface NewAccrualAccountsView {
23
+ accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
24
+ accruedAccountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
25
+ accruedScheduleSaveStatus: FetchStateAndError;
26
+ allAccountList: AccountBase[];
27
+ allAccruedExpenseList: AccountBase[];
28
+ allClassList: ClassBase[];
29
+ classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
30
+ createStatus: FetchStateAndError;
31
+ }
32
+ export interface NewScheduleView extends SelectorView, NewScheduleSearchTransactionsView {
33
+ accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
34
+ allAccountList: AccountBase[];
35
+ allClassList: ClassBase[];
36
+ classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
37
+ newScheduleLocalData: NewScheduleLocalData | NewScheduleLocalDataFixedAssets;
38
+ saveStatus: FetchStateAndError;
39
+ scheduleType: ScheduleTypes;
40
+ allDepreciationAccountList?: AccountBase[];
41
+ allDepreciationAccountListNestedAccountHierarchy?: NestedAccountHierarchyForReport[];
42
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,12 +4,30 @@ import { CompletionStatusType, FetchStateAndError, ID } from '../../../commonSta
4
4
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
5
5
  import { AccountBase } from '../../../entity/account/accountState';
6
6
  import { ClassBase } from '../../../entity/class/classState';
7
- import { JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
8
- import { JEScheduleTransactionKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
7
+ import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
9
8
  import { UncategorizedAccounts } from '../../accountList/accountListSelector';
10
9
  import { JEAccountSettingsView } from '../selectorTypes/jeAccountSettingsViewSelectorTypes';
11
- import { JEScheduledTransactionWithFailedEntries } from '../selectors/jeSchedulesViewSelector';
12
- import { JEScheduleLocalData, JESchedulesViewUIState } from '../types/jeSchedulesViewState';
10
+ import { NewScheduleView } from '../selectorTypes/jeNewScheduleViewSelectorTypes';
11
+ import { JEScheduleRow, JEScheduledTransactionWithFailedEntries } from '../selectors/jeSchedulesViewSelector';
12
+ import { JEPageTab, JEScheduleLocalData, JESchedulesViewUIState } from '../types/jeSchedulesViewState';
13
+ export interface JEKpiSummary {
14
+ aiAccountant: {
15
+ amount: number;
16
+ count: number;
17
+ };
18
+ manual: {
19
+ amount: number;
20
+ count: number;
21
+ };
22
+ needsReview: {
23
+ amount: number;
24
+ count: number;
25
+ };
26
+ total: {
27
+ amount: number;
28
+ count: number;
29
+ };
30
+ }
13
31
  export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
14
32
  accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
15
33
  accountSettingsView: JEAccountSettingsView;
@@ -18,16 +36,24 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
18
36
  allDepreciationAccountList: AccountBase[];
19
37
  allDepreciationAccountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
20
38
  classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
21
- completedSchedules: JEScheduledTransaction[];
22
39
  completionStatus: CompletionStatusType;
23
- draftSchedules: JEScheduledTransaction[];
40
+ createdSchedules: JEScheduleRow[];
41
+ createdTotal: number;
42
+ hasLoadedForSelectedTab: boolean;
24
43
  ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
25
44
  jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
26
- ongoingSchedules: JEScheduledTransaction[];
27
- pendingReviewSchedules: (JEScheduledTransaction | JEScheduledTransactionWithFailedEntries)[];
45
+ jeScheduleTypeCounts: {
46
+ active: Record<ScheduleTypes, number>;
47
+ ongoing: Record<ScheduleTypes, number>;
48
+ };
49
+ kpiSummary: JEKpiSummary;
50
+ newScheduleView: NewScheduleView | undefined;
51
+ pendingReviewSchedules: JEScheduleRow[];
52
+ pendingReviewTotal: number;
28
53
  postStatusById: Record<ID, FetchStateAndError>;
29
54
  refreshStatus: FetchStateAndError;
30
55
  resolveSchedules: JEScheduledTransactionWithFailedEntries[];
56
+ scheduleCountsByTab: Partial<Record<JEPageTab, number>>;
31
57
  uiState: JESchedulesViewUIState;
32
58
  uncategorizedAccounts: UncategorizedAccounts;
33
59
  }
@@ -0,0 +1,21 @@
1
+ import { RootState } from '../../../reducer';
2
+ import { NewAccrualAccountsView, 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
+ /**
11
+ * Account + class options and request status shared by both accrual creation forms — the one-time
12
+ * accrual and the recurring accrued schedule.
13
+ *
14
+ * getAccountsTypesForScheduleDetails('accrued_expenses') deliberately includes
15
+ * other_current_liabilities, because the accrued liability accounts live there —
16
+ * so the debit list has to subtract them back out, and the credit list keeps only
17
+ * them. Mirrors getScheduleAccruedDetailView, which is the form this one is
18
+ * modelled on.
19
+ */
20
+ export declare const getNewAccrualAccountsView: (state: RootState) => NewAccrualAccountsView;
21
+ export declare const getNewScheduleView: (state: RootState, scheduleType: "fixed_assets" | "prepaid_expenses") => NewScheduleView;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNewScheduleView = exports.getNewAccrualAccountsView = 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
+ /**
12
+ * The Base Transaction search is shared across schedule types (one search
13
+ * box, not one per prepaid_expenses/fixed_assets) — split out from
14
+ * getNewScheduleView so a consumer can read it without supplying an
15
+ * otherwise-irrelevant scheduleType.
16
+ */
17
+ const getNewScheduleSearchTransactionsView = (state) => {
18
+ const { searchTransactions } = state.expenseAutomationJESchedulesViewState.newSchedule;
19
+ const searchTransactionsResults = searchTransactions.searchResults
20
+ .map((key) => (0, transactionSelector_1.getScheduleTransactionById)(state.transactionState, key))
21
+ .filter((transaction) => transaction != null);
22
+ return {
23
+ searchTransactionsResults,
24
+ searchTransactionsFetchState: {
25
+ fetchState: searchTransactions.fetchState,
26
+ error: searchTransactions.error,
27
+ },
28
+ searchTransactionsString: searchTransactions.searchString,
29
+ };
30
+ };
31
+ exports.getNewScheduleSearchTransactionsView = getNewScheduleSearchTransactionsView;
32
+ const ACCRUED_EXPENSE_ACCOUNT_LABELS = ['accrued_expenses'];
33
+ /**
34
+ * Account + class options and request status shared by both accrual creation forms — the one-time
35
+ * accrual and the recurring accrued schedule.
36
+ *
37
+ * getAccountsTypesForScheduleDetails('accrued_expenses') deliberately includes
38
+ * other_current_liabilities, because the accrued liability accounts live there —
39
+ * so the debit list has to subtract them back out, and the credit list keeps only
40
+ * them. Mirrors getScheduleAccruedDetailView, which is the form this one is
41
+ * modelled on.
42
+ */
43
+ const getNewAccrualAccountsView = (state) => {
44
+ const { accountState, accountListState, classState, classListState } = state;
45
+ const { newSchedule } = state.expenseAutomationJESchedulesViewState;
46
+ const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
47
+ const accrualAccountIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, (0, scheduleDetailLocalDataHelper_1.getAccountsTypesForScheduleDetails)('accrued_expenses'));
48
+ const accruedCategoryIds = (0, accountSelector_1.getAccountIdsForLabels)(accountState, ACCRUED_EXPENSE_ACCOUNT_LABELS);
49
+ const allAccountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, accountType.accountListKey);
50
+ const nestedAccountHierarchy = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountType.accountListKey);
51
+ const debitAccounts = allAccountList.accounts.filter((account) => accrualAccountIds.includes(account.accountId) &&
52
+ !accruedCategoryIds.includes(account.accountId));
53
+ const creditAccounts = allAccountList.accounts.filter((account) => accruedCategoryIds.includes(account.accountId));
54
+ const allClassList = (0, classListSelector_1.getClassList)(classState, classListState);
55
+ return {
56
+ accountListNestedAccountHierarchy: (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)(nestedAccountHierarchy, debitAccounts.map((account) => account.accountId)),
57
+ accruedAccountListNestedAccountHierarchy: (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)(nestedAccountHierarchy, creditAccounts.map((account) => account.accountId)),
58
+ allAccountList: debitAccounts,
59
+ allAccruedExpenseList: creditAccounts,
60
+ allClassList: allClassList.classes,
61
+ classListNestedAccountHierarchy: (0, classListSelector_1.getNestedClassListHierarchy)(classListState),
62
+ createStatus: newSchedule.createOneTimeAccrualStatus,
63
+ // The recurring accrued schedule saves through the accrued detail epics that the Vendor tab
64
+ // already uses, so its status is that slice's updateStatus rather than anything new here.
65
+ accruedScheduleSaveStatus: state.scheduleAccruedDetailState.updateStatus,
66
+ };
67
+ };
68
+ exports.getNewAccrualAccountsView = getNewAccrualAccountsView;
69
+ const getNewScheduleView = (state, scheduleType) => {
70
+ const { accountState, accountListState, classState, classListState } = state;
71
+ const { newSchedule } = state.expenseAutomationJESchedulesViewState;
72
+ const searchTransactionsView = (0, exports.getNewScheduleSearchTransactionsView)(state);
73
+ const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
74
+ const newScheduleAccountTypes = (0, scheduleDetailLocalDataHelper_1.getAccountsTypesForScheduleDetails)(scheduleType);
75
+ const newScheduleAccountIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, newScheduleAccountTypes);
76
+ const allAccountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, accountType.accountListKey);
77
+ const filteredAccounts = allAccountList.accounts.filter((account) => newScheduleAccountIds.includes(account.accountId));
78
+ const accountListNestedAccountHierarchy = (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)((0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountType.accountListKey), filteredAccounts.map((account) => account.accountId));
79
+ const allClassList = (0, classListSelector_1.getClassList)(classState, classListState);
80
+ const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
81
+ let allDepreciationAccountList;
82
+ let allDepreciationAccountListNestedAccountHierarchy;
83
+ if (scheduleType === 'fixed_assets') {
84
+ const depreciationCategoryIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, [
85
+ 'fixed_assets',
86
+ 'other_assets',
87
+ ]);
88
+ const accountLabel = (0, scheduleListHelper_1.getAccountLabelForScheduleType)('fixed_assets');
89
+ const fixedAssetLabelAccountIds = accountLabel != null
90
+ ? (0, accountListSelector_1.getAccountIdsForLabel)(accountListState, accountType.accountListKey, accountLabel)
91
+ : [];
92
+ allDepreciationAccountList = allAccountList.accounts.filter((account) => depreciationCategoryIds.includes(account.accountId) &&
93
+ !fixedAssetLabelAccountIds.includes(account.accountId));
94
+ allDepreciationAccountListNestedAccountHierarchy =
95
+ (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)((0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountType.accountListKey), allDepreciationAccountList.map((account) => account.accountId));
96
+ }
97
+ return {
98
+ scheduleType,
99
+ accountListNestedAccountHierarchy,
100
+ allAccountList: filteredAccounts,
101
+ allClassList: allClassList.classes,
102
+ allDepreciationAccountList,
103
+ allDepreciationAccountListNestedAccountHierarchy,
104
+ classListNestedAccountHierarchy,
105
+ newScheduleLocalData: newSchedule.newScheduleState[scheduleType],
106
+ saveStatus: newSchedule.saveStatus,
107
+ ...searchTransactionsView,
108
+ fetchState: newSchedule.fetchState,
109
+ error: newSchedule.error,
110
+ };
111
+ };
112
+ exports.getNewScheduleView = getNewScheduleView;
@@ -1,7 +1,16 @@
1
- import { JEScheduledTransaction, ScheduledJournalEntry } from '../../../entity/jeSchedules/jeSchedulesSelector';
1
+ import { JEAccruedSchedule, JEOneTimeAccrual, JEScheduledTransaction, ScheduledJournalEntry } from '../../../entity/jeSchedules/jeSchedulesSelector';
2
+ import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
2
3
  import { RootState } from '../../../reducer';
3
4
  import { ExpenseAutomationJESchedulesViewSelector } from '../selectorTypes/jeSchedulesSelectorTypes';
5
+ export declare function getJEScheduleRowType(schedule: JEScheduleRow): ScheduleTypes | undefined;
6
+ export declare function isPendingReviewRow(schedule: JEScheduleRow): boolean;
7
+ export declare function isExistingTabRow(schedule: JEScheduleRow): boolean;
8
+ export declare const isAiAccountantSchedule: (schedule: JEScheduleRow) => boolean;
9
+ export declare function isAccruedScheduleRow(schedule: JEScheduleRow): schedule is JEAccruedSchedule;
10
+ export declare function isOneTimeAccrualRow(schedule: JEScheduleRow): schedule is JEOneTimeAccrual;
4
11
  export declare function getExpenseAutomationJESchedulesView(state: RootState): ExpenseAutomationJESchedulesViewSelector;
5
12
  export interface JEScheduledTransactionWithFailedEntries extends Omit<JEScheduledTransaction, 'scheduledJournalEntry'> {
6
13
  scheduledJournalEntry: ScheduledJournalEntry;
7
14
  }
15
+ export type JEScheduleRow = JEAccruedSchedule | JEOneTimeAccrual | JEScheduledTransaction | JEScheduledTransactionWithFailedEntries;
16
+ export type JEScheduleRowWithoutOneTimeAccrual = Exclude<JEScheduleRow, JEOneTimeAccrual>;