@zeniai/client-epic-state 5.2.14 → 5.2.15

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 (132) hide show
  1. package/lib/entity/accountRecon/accountReconReducer.d.ts +2 -1
  2. package/lib/entity/accountRecon/accountReconReducer.js +22 -10
  3. package/lib/entity/accountRecon/accountReconSelector.d.ts +1 -0
  4. package/lib/entity/accountRecon/accountReconSelector.js +1 -0
  5. package/lib/entity/approvalRule/approvalRuleConflict.d.ts +13 -0
  6. package/lib/entity/approvalRule/approvalRuleConflict.js +16 -1
  7. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +1 -0
  8. package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
  9. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +78 -1
  10. package/lib/entity/jeSchedules/jeSchedulesPayload.js +183 -4
  11. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
  12. package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  13. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
  14. package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
  15. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +123 -1
  16. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
  17. package/lib/entity/jeSchedules/jeSchedulesTypes.js +96 -1
  18. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  19. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  20. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
  21. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  22. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
  23. package/lib/epic.d.ts +10 -1
  24. package/lib/epic.js +18 -0
  25. package/lib/esm/entity/accountRecon/accountReconReducer.js +22 -10
  26. package/lib/esm/entity/accountRecon/accountReconSelector.js +1 -0
  27. package/lib/esm/entity/approvalRule/approvalRuleConflict.js +16 -1
  28. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
  29. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +183 -5
  30. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  31. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
  32. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +86 -0
  33. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  34. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  35. package/lib/esm/epic.js +18 -0
  36. package/lib/esm/index.js +16 -10
  37. package/lib/esm/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +2 -2
  38. package/lib/esm/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.js +54 -0
  39. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +1 -1
  40. package/lib/esm/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +3 -6
  41. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  42. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  43. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
  44. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
  45. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  46. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +104 -0
  47. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  48. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +138 -0
  49. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
  50. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +180 -0
  51. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +111 -0
  52. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +28 -0
  53. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  54. package/lib/esm/view/expenseAutomationView/helpers/reconciliationHelpers.js +12 -0
  55. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
  56. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +319 -29
  57. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +20 -2
  58. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  59. package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  60. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
  61. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +327 -22
  62. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
  63. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  64. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  65. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  66. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +20 -1
  67. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +20 -1
  68. package/lib/index.d.ts +18 -13
  69. package/lib/index.js +92 -47
  70. package/lib/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.d.ts +10 -2
  71. package/lib/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +1 -1
  72. package/lib/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.d.ts +9 -0
  73. package/lib/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.js +58 -0
  74. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +1 -1
  75. package/lib/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +3 -6
  76. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  77. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  78. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
  79. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
  80. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +21 -0
  81. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
  82. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  83. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +9 -0
  84. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +108 -0
  85. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  86. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
  87. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +9 -0
  88. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +142 -0
  89. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  90. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
  91. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +13 -0
  92. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +187 -0
  93. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +65 -0
  94. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +115 -0
  95. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  96. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +32 -0
  97. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  98. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  99. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +6 -0
  100. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +13 -0
  101. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  102. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +86 -3
  103. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
  104. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +4 -0
  105. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +93 -12
  106. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +321 -29
  107. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  108. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +6 -1
  109. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +22 -4
  110. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  111. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
  112. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
  113. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  114. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +41 -7
  115. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  116. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
  117. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
  118. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
  119. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +335 -21
  120. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  121. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
  122. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  123. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  124. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  125. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  126. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
  127. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  128. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +20 -1
  129. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelectorTypes.d.ts +3 -0
  130. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +20 -1
  131. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelectorTypes.d.ts +3 -0
  132. package/package.json +1 -1
@@ -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 });
@@ -1,15 +1,39 @@
1
+ import { Amount } from '../../../commonStateTypes/amount';
1
2
  import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
3
  import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
3
4
  import { CompletionStatusType, FetchStateAndError, ID } from '../../../commonStateTypes/common';
4
5
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
5
6
  import { AccountBase } from '../../../entity/account/accountState';
6
7
  import { ClassBase } from '../../../entity/class/classState';
7
- import { JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
8
- import { JEScheduleTransactionKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
8
+ import { JEScheduleKey, JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
9
9
  import { UncategorizedAccounts } from '../../accountList/accountListSelector';
10
10
  import { JEAccountSettingsView } from '../selectorTypes/jeAccountSettingsViewSelectorTypes';
11
11
  import { JEScheduledTransactionWithFailedEntries } from '../selectors/jeScheduledTransactionWithFailedEntries';
12
- import { JEScheduleLocalData, JESchedulesViewUIState } from '../types/jeSchedulesViewState';
12
+ import { NewScheduleView } from '../selectorTypes/jeNewScheduleViewSelectorTypes';
13
+ import { JEScheduleRow } from '../selectors/jeSchedulesViewSelector';
14
+ import { JEPageTab, JEScheduleLocalData, JESchedulesViewUIState } from '../types/jeSchedulesViewState';
15
+ /**
16
+ * Amount rather than a bare number: the KPI strip formats these for display, and a number carries
17
+ * no currency, which is what made the tiles print a hardcoded dollar sign.
18
+ */
19
+ export interface JEKpiSummary {
20
+ aiAccountant: {
21
+ amount: Amount;
22
+ count: number;
23
+ };
24
+ manual: {
25
+ amount: Amount;
26
+ count: number;
27
+ };
28
+ needsReview: {
29
+ amount: Amount;
30
+ count: number;
31
+ };
32
+ total: {
33
+ amount: Amount;
34
+ count: number;
35
+ };
36
+ }
13
37
  export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
14
38
  accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
15
39
  accountSettingsView: JEAccountSettingsView;
@@ -18,16 +42,26 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
18
42
  allDepreciationAccountList: AccountBase[];
19
43
  allDepreciationAccountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
20
44
  classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
21
- completedSchedules: JEScheduledTransaction[];
22
45
  completionStatus: CompletionStatusType;
23
- draftSchedules: JEScheduledTransaction[];
46
+ createdSchedules: JEScheduleRow[];
47
+ createdTotal: number;
48
+ hasLoadedForSelectedTab: boolean;
24
49
  ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
25
50
  jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
26
- ongoingSchedules: JEScheduledTransaction[];
27
- pendingReviewSchedules: (JEScheduledTransaction | JEScheduledTransactionWithFailedEntries)[];
51
+ jeScheduleTypeCounts: {
52
+ active: Record<ScheduleTypes, number>;
53
+ ongoing: Record<ScheduleTypes, number>;
54
+ };
55
+ kpiSummary: JEKpiSummary;
56
+ newScheduleView: NewScheduleView | undefined;
57
+ oneTimeAccrualActionStatusById: Record<ID, FetchStateAndError>;
58
+ pendingReviewSchedules: JEScheduleRow[];
59
+ pendingReviewTotal: number;
28
60
  postStatusById: Record<ID, FetchStateAndError>;
29
61
  refreshStatus: FetchStateAndError;
30
62
  resolveSchedules: JEScheduledTransactionWithFailedEntries[];
63
+ revertStatusById: Record<JEScheduleKey | JEScheduleTransactionKey, FetchStateAndError>;
64
+ scheduleCountsByTab: Partial<Record<JEPageTab, number>>;
31
65
  uiState: JESchedulesViewUIState;
32
66
  uncategorizedAccounts: UncategorizedAccounts;
33
67
  }
@@ -25,6 +25,7 @@ exports.getJEAccountSettingsView = (0, toolkit_1.createSelector)((state) => stat
25
25
  fixedAssetsAccountHierarchy: jeAccountMappingState.fixedAssetsNestedAccountListHierarchy,
26
26
  accruedExpensesAccountHierarchy: jeAccountMappingState.accruedExpensesNestedAccountListHierarchy,
27
27
  fetchState: fetchState.fetchState,
28
+ hasLoaded: jeAccountMappingState.hasLoadedAccountSettings,
28
29
  saveState,
29
30
  };
30
31
  });
@@ -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,3 +1,37 @@
1
+ import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
+ import { JEAccruedSchedule, JEOneTimeAccrual, JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
3
+ import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
1
4
  import { RootState } from '../../../rootStateTypes';
2
5
  import { ExpenseAutomationJESchedulesViewSelector } from '../selectorTypes/jeSchedulesSelectorTypes';
6
+ import { JEScheduledTransactionWithFailedEntries } from './jeScheduledTransactionWithFailedEntries';
7
+ /**
8
+ * `posting_blocked` is written by the posting Cron when a JE fails to post. It is an internal
9
+ * failure state with no human action attached, so it is dropped here rather than hidden at render
10
+ * time — filtering in the view would leave the group counts and KPI totals counting rows nobody
11
+ * can see. The expense-automation endpoint applies no status filter on the close-period path, so
12
+ * these rows do arrive.
13
+ */
14
+ export declare function isRenderableOneTimeAccrual(accrual: JEOneTimeAccrual): boolean;
15
+ export declare function getJEScheduleRowType(schedule: JEScheduleRow): ScheduleTypes | undefined;
16
+ export declare function isPendingReviewRow(schedule: JEScheduleRow): boolean;
17
+ export declare function isExistingTabRow(schedule: JEScheduleRow): boolean;
18
+ export declare const isAiAccountantSchedule: (schedule: JEScheduleRow) => boolean;
19
+ export declare function isAccruedScheduleRow(schedule: JEScheduleRow): schedule is JEAccruedSchedule;
20
+ export declare function isOneTimeAccrualRow(schedule: JEScheduleRow): schedule is JEOneTimeAccrual;
3
21
  export declare function getExpenseAutomationJESchedulesView(state: RootState): ExpenseAutomationJESchedulesViewSelector;
22
+ export type JEScheduleRow = JEAccruedSchedule | JEOneTimeAccrual | JEScheduledTransaction | JEScheduledTransactionWithFailedEntries;
23
+ export type JEScheduleRowWithoutOneTimeAccrual = Exclude<JEScheduleRow, JEOneTimeAccrual>;
24
+ export interface ExpenseAutomationJEOneTimeAccrualDetailView {
25
+ actionFetchState: FetchStateAndError;
26
+ detailFetchState: FetchStateAndError;
27
+ accrual?: JEOneTimeAccrual;
28
+ }
29
+ /**
30
+ * One accrual plus the status of its promote / ignore request, for the detail screen.
31
+ *
32
+ * `accrual` is undefined on a cold load — a refresh or a shared link, where the list has never run
33
+ * — so the screen dispatches `fetchOneTimeAccrual` and waits on `detailFetchState`. The two states
34
+ * are separate on purpose: `actionFetchState` drives the row spinner and the post-revert navigation,
35
+ * and a page load must not look like an action that just finished.
36
+ */
37
+ export declare function getExpenseAutomationJEOneTimeAccrualDetailView(state: RootState, accrualId: ID): ExpenseAutomationJEOneTimeAccrualDetailView;