@zeniai/client-epic-state 4.20.1 → 4.20.2-beta0ND

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 (128) hide show
  1. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +19 -0
  2. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +2 -0
  3. package/lib/commonStateTypes/animations.d.ts +1 -1
  4. package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -2
  5. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  6. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +38 -0
  7. package/lib/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  8. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -1
  9. package/lib/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  10. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +37 -0
  11. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  12. package/lib/entity/tenant/tenantReducer.js +1 -0
  13. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  14. package/lib/entity/tenant/tenantSelector.js +9 -1
  15. package/lib/entity/tenant/tenantState.d.ts +1 -0
  16. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +4 -1
  17. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  18. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -0
  19. package/lib/entity/transaction/payloadTypes/transactionPayload.js +17 -1
  20. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +1 -0
  21. package/lib/entity/transaction/stateTypes/transaction.d.ts +5 -0
  22. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  23. package/lib/epic.d.ts +2 -1
  24. package/lib/epic.js +2 -1
  25. package/lib/esm/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +1 -0
  26. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  27. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  28. package/lib/esm/entity/tenant/tenantReducer.js +1 -0
  29. package/lib/esm/entity/tenant/tenantSelector.js +7 -0
  30. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  31. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +17 -1
  32. package/lib/esm/epic.js +2 -1
  33. package/lib/esm/index.js +10 -8
  34. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +82 -1
  35. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +8 -2
  36. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +29 -0
  37. package/lib/esm/view/classList/fetchClassListEpic.js +9 -2
  38. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  39. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  40. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  41. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +2 -2
  42. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
  43. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  44. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  45. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  46. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +17 -1
  47. package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  48. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  49. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +12 -4
  50. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
  51. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +12 -6
  52. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +18 -1
  53. package/lib/esm/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +17 -0
  54. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
  55. package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +20 -29
  56. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  57. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
  58. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  59. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  60. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  61. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  62. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  63. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  64. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +7 -4
  65. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  66. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  67. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  68. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  69. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  70. package/lib/index.d.ts +15 -11
  71. package/lib/index.js +44 -32
  72. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  73. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
  74. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
  75. package/lib/view/aiCfoView/aiCfoViewReducer.js +83 -2
  76. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
  77. package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
  78. package/lib/view/aiCfoView/aiCfoViewState.d.ts +15 -1
  79. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
  80. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +33 -0
  81. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  82. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  83. package/lib/view/classList/fetchClassListEpic.js +8 -1
  84. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -0
  85. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  86. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +1 -0
  87. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  88. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  89. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +1 -1
  90. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
  91. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  92. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  93. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  94. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -1
  95. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  96. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +18 -2
  97. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
  98. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  99. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  100. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +12 -4
  101. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
  102. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +11 -5
  103. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +5 -0
  104. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +20 -0
  105. package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.d.ts +9 -0
  106. package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +20 -0
  107. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
  108. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +20 -29
  109. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  110. package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  111. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  112. package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
  113. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  114. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  115. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  116. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  117. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  118. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  119. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  120. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +6 -3
  121. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
  122. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  123. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  124. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  125. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  126. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  127. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  128. package/package.json +1 -1
@@ -5,7 +5,7 @@ import { JEScheduledTransactionPayload } from '../../../entity/jeSchedules/jeSch
5
5
  import { JEScheduleTransactionKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
6
6
  import { ZeniAPIStatus } from '../../../responsePayload';
7
7
  import { AccountTypeRecommendationPayload } from '../../accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload';
8
- import { AccountSettingsLocalData, AccountSettingsState, JEScheduleLocalData, JESchedulesViewState } from '../types/jeSchedulesViewState';
8
+ import { AccountSettingsLocalData, AccountSettingsState, JEScheduleLocalData, JESchedulesViewState, JESchedulesViewUIState } from '../types/jeSchedulesViewState';
9
9
  export declare const accountSettingsInitialState: AccountSettingsState;
10
10
  export declare const initialState: JESchedulesViewState;
11
11
  export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/clearExpenseAutomationJESchedulesView">, clearJeAccountSettingsLocalData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/clearJeAccountSettingsLocalData">, clearJeScheduleLocalData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/clearJeScheduleLocalData">, fetchAccountSettingsListForAccountTypes: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/fetchAccountSettingsListForAccountTypes">, fetchJeSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
@@ -56,7 +56,7 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
56
56
  accountPayload: AccountMetadataPayload[];
57
57
  }, "expenseAutomationJESchedulesView/updateAccountSettingsListForAccountTypes">, updateAccountSettingsListForAccountTypesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
58
58
  status: ZeniAPIStatus;
59
- }, "expenseAutomationJESchedulesView/updateAccountSettingsListForAccountTypesFailure">, updateJeScheduleLocalDataById: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
59
+ }, "expenseAutomationJESchedulesView/updateAccountSettingsListForAccountTypesFailure">, updateJESchedulesUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<JESchedulesViewUIState>, "expenseAutomationJESchedulesView/updateJESchedulesUIState">, updateJeScheduleLocalDataById: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
60
60
  localData: Partial<JEScheduleLocalData>;
61
61
  scheduledJournalEntryID: ID;
62
62
  }, "expenseAutomationJESchedulesView/updateJeScheduleLocalDataById">, updateJeScheduleTransactionKeys: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleKeys: (`${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`)[], selectedPeriod: MonthYearPeriod], {
@@ -1,7 +1,7 @@
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.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.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;
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");
@@ -48,6 +48,8 @@ exports.initialState = {
48
48
  uiState: {
49
49
  searchString: '',
50
50
  scrollPosition: { scrollTop: 0, scrollLeft: undefined },
51
+ sortKey: 'startMonth',
52
+ sortOrder: 'descending',
51
53
  totalCount: 0,
52
54
  limit: 10,
53
55
  },
@@ -369,12 +371,26 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
369
371
  clearJeAccountSettingsLocalData(draft) {
370
372
  draft.accountSettings.localData = exports.accountSettingsInitialState.localData;
371
373
  },
374
+ updateJESchedulesUIState(draft, action) {
375
+ if (action.payload.sortKey != null) {
376
+ draft.uiState.sortKey = action.payload.sortKey;
377
+ }
378
+ if (action.payload.sortOrder != null) {
379
+ draft.uiState.sortOrder = action.payload.sortOrder;
380
+ }
381
+ if (action.payload.searchString != null) {
382
+ draft.uiState.searchString = action.payload.searchString;
383
+ }
384
+ if (action.payload.scrollPosition != null) {
385
+ draft.uiState.scrollPosition = action.payload.scrollPosition;
386
+ }
387
+ },
372
388
  clearExpenseAutomationJESchedulesView(draft) {
373
389
  Object.assign(draft, exports.initialState);
374
390
  },
375
391
  },
376
392
  });
377
- _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.updateJeScheduleLocalDataById = _a.updateJeScheduleLocalDataById, exports.updateJeScheduleTransactionKeys = _a.updateJeScheduleTransactionKeys, exports.updateRecommendationForAccountSettings = _a.updateRecommendationForAccountSettings, exports.updateRecommendationForAccountSettingsFailure = _a.updateRecommendationForAccountSettingsFailure;
393
+ _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;
378
394
  exports.default = expenseAutomationJESchedulesView.reducer;
379
395
  const doUpdateRecommendationForAccountSettings = (draft, payload) => {
380
396
  const { prepaidExpensesRecommendations, fixedAssetsRecommendations, accruedExpensesRecommendations, } = (0, accountTypeRecommendationPayload_1.mapAccountTypeRecommendationPayloadToAccountRecommendationByType)(payload);
@@ -18,10 +18,12 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
18
18
  allDepreciationAccountList: AccountBase[];
19
19
  allDepreciationAccountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
20
20
  classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
21
+ completedSchedules: JEScheduledTransaction[];
21
22
  completionStatus: CompletionStatusType;
22
23
  draftSchedules: JEScheduledTransaction[];
23
24
  ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
24
25
  jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
26
+ ongoingSchedules: JEScheduledTransaction[];
25
27
  postStatusById: Record<ID, FetchStateAndError>;
26
28
  refreshStatus: FetchStateAndError;
27
29
  resolveSchedules: JEScheduledTransactionWithFailedEntries[];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getExpenseAutomationFluxAnalysisView = getExpenseAutomationFluxAnalysisView;
4
+ const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
4
5
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
5
6
  const accountSelector_1 = require("../../../entity/account/accountSelector");
6
7
  const classSelector_1 = require("../../../entity/class/classSelector");
@@ -9,7 +10,7 @@ const userSelector_1 = require("../../../entity/user/userSelector");
9
10
  const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
10
11
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
11
12
  function getExpenseAutomationFluxAnalysisView(state) {
12
- const { expenseAutomationFluxAnalysisViewState, monthEndCloseChecksState } = state;
13
+ const { expenseAutomationFluxAnalysisViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
13
14
  const { fetchState, error, refreshStatus, uiState, reviewOperatingExpenseIdsByPeriod, selectedSectionIdsByPeriod, groupsBySelectedPeriod, fluxAnalysisEntities, bulkReviewStatus, currency, totalBalancesAndVariance, } = expenseAutomationFluxAnalysisViewState;
14
15
  const fetchStateAndError = {
15
16
  fetchState,
@@ -94,10 +95,17 @@ function getExpenseAutomationFluxAnalysisView(state) {
94
95
  },
95
96
  };
96
97
  const completionStatus = fluxCompletionStatus != null ? fluxCompletionStatus : 'incomplete';
98
+ const monthEndFetchState = monthYearPeriodId != null
99
+ ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
100
+ : { fetchState: 'Not-Started', error: undefined };
101
+ const reducedFetchStatus = (0, reduceFetchState_1.reduceAnyFetchState)([
102
+ fetchStateAndError,
103
+ monthEndFetchState,
104
+ ]);
97
105
  return {
98
106
  sections,
99
107
  totalBalancesAndVariance,
100
- fetchStatus: fetchStateAndError,
108
+ fetchStatus: reducedFetchStatus,
101
109
  bulkReviewStatus,
102
110
  reviewOperatingExpensesIds,
103
111
  selectedSectionIds,
@@ -5,6 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getExpenseAutomationJESchedulesView = getExpenseAutomationJESchedulesView;
7
7
  const omit_1 = __importDefault(require("lodash/omit"));
8
+ const orderBy_1 = __importDefault(require("lodash/orderBy"));
9
+ const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
8
10
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
9
11
  const accountSelector_1 = require("../../../entity/account/accountSelector");
10
12
  const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
@@ -16,10 +18,48 @@ const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/
16
18
  const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
17
19
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
18
20
  const jeAccountSettingsViewSelector_1 = require("./jeAccountSettingsViewSelector");
21
+ function getJEScheduleSortAccessor(sortKey) {
22
+ switch (sortKey) {
23
+ case 'vendor':
24
+ return (s) => s.vendor.name?.toLowerCase();
25
+ case 'category':
26
+ return (s) => s.jeDebit.account?.accountName?.toLowerCase();
27
+ case 'class':
28
+ return (s) => s.jeDebit.accountingClass?.className?.toLowerCase();
29
+ case 'depCategory':
30
+ return (s) => s.jeCredit.account?.accountName?.toLowerCase();
31
+ case 'scheduleCategory':
32
+ return (s) => s.jeScheduleType;
33
+ case 'startMonth':
34
+ return (s) => s.startDate?.valueOf();
35
+ case 'type':
36
+ return (s) => s.baseTransaction.typeOfTransaction;
37
+ case 'amortizationPeriod':
38
+ return (s) => s.period;
39
+ case 'jePostingDate':
40
+ return (s) => s.dayOfPostingDate;
41
+ case 'remainingMonths':
42
+ return (s) => s.period;
43
+ case 'runningBalance':
44
+ return (s) => s.balanceAsOfToday?.amount;
45
+ case 'totalAmount':
46
+ return (s) => s.baseTransaction.amount.amount;
47
+ case 'transactionDate':
48
+ return (s) => s.baseTransaction.date.valueOf();
49
+ case 'memo':
50
+ return (s) => s.baseTransaction.memo?.toLowerCase();
51
+ default:
52
+ return (s) => s.startDate?.valueOf();
53
+ }
54
+ }
55
+ function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
56
+ const accessor = getJEScheduleSortAccessor(sortKey);
57
+ return (0, orderBy_1.default)(transactions, [accessor], [sortOrder === 'ascending' ? 'asc' : 'desc']);
58
+ }
19
59
  function getExpenseAutomationJESchedulesView(state) {
20
60
  const jeScheduledTransaction = [];
21
61
  const failedJeScheduledTransaction = [];
22
- const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, } = state;
62
+ const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
23
63
  const { jeScheduleTransactionKeysByPeriod, failedJeScheduleTransactionKeysByPeriod, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, } = expenseAutomationJESchedulesViewState;
24
64
  const accountSettingsView = (0, jeAccountSettingsViewSelector_1.getJEAccountSettingsView)(state);
25
65
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
@@ -65,18 +105,33 @@ function getExpenseAutomationJESchedulesView(state) {
65
105
  const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
66
106
  failedJeScheduledTransaction.push(jeScheduleDetails);
67
107
  });
68
- const draftSchedules = jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft');
69
- const resolveSchedules = [];
108
+ const { sortKey, sortOrder } = uiState;
109
+ const draftSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'), sortKey, sortOrder);
110
+ const ongoingSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'ongoing'), sortKey, sortOrder);
111
+ const completedSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'completed' ||
112
+ schedule.status.code === 'marked_as_completed'), sortKey, sortOrder);
113
+ const unsortedResolveSchedules = [];
70
114
  failedJeScheduledTransaction.forEach((schedule) => {
71
115
  schedule.scheduledJournalEntry.forEach((journalEntry) => {
72
- resolveSchedules.push({ ...schedule, scheduledJournalEntry: journalEntry });
116
+ unsortedResolveSchedules.push({
117
+ ...schedule,
118
+ scheduledJournalEntry: journalEntry,
119
+ });
73
120
  });
74
121
  });
122
+ const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
75
123
  const allSteps = monthYearPeriodId != null
76
124
  ? (0, expenseAutomationViewSelectorTypes_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
77
125
  : [];
78
126
  const jeCompletionStatus = allSteps.find((step) => step.step === 'je_schedules')?.completionStatus;
79
127
  const completionStatus = jeCompletionStatus != null ? jeCompletionStatus : 'incomplete';
128
+ const monthEndFetchState = monthYearPeriodId != null
129
+ ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
130
+ : { fetchState: 'Not-Started', error: undefined };
131
+ const reducedFetchStatus = (0, reduceFetchState_1.reduceAnyFetchState)([
132
+ { fetchState, error },
133
+ monthEndFetchState,
134
+ ]);
80
135
  return {
81
136
  uncategorizedAccounts,
82
137
  allDepreciationAccountList: filteredDepAccounts,
@@ -85,15 +140,17 @@ function getExpenseAutomationJESchedulesView(state) {
85
140
  allAccountList: filteredAccounts,
86
141
  accountListNestedAccountHierarchy,
87
142
  allClassList: allClasses,
143
+ completedSchedules,
88
144
  draftSchedules,
145
+ ongoingSchedules,
89
146
  resolveSchedules: resolveSchedules,
90
147
  accountSettingsView,
91
148
  postStatusById: postStatusById,
92
149
  ignoreStatusById: ignoreStatusById,
93
- fetchState: fetchState,
150
+ fetchState: reducedFetchStatus.fetchState,
94
151
  jeScheduleLocalDataById: jeScheduleLocalDataById,
95
152
  uiState: uiState,
96
- error: error,
153
+ error: reducedFetchStatus.error,
97
154
  refreshStatus,
98
155
  completionStatus,
99
156
  };
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getExpenseAutomationMissingReceiptsView = getExpenseAutomationMissingReceiptsView;
7
7
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
8
+ const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
8
9
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
9
10
  const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
10
11
  const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
@@ -13,7 +14,7 @@ const missingReceiptsViewReducer_1 = require("../reducers/missingReceiptsViewRed
13
14
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
14
15
  const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
15
16
  function getExpenseAutomationMissingReceiptsView(state) {
16
- const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
17
+ const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
17
18
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
18
19
  const { selectedPeriodByTenantId } = expenseAutomationViewState;
19
20
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
@@ -42,7 +43,7 @@ function getExpenseAutomationMissingReceiptsView(state) {
42
43
  transaction.lines.length > 0 &&
43
44
  transaction.lines[0]
44
45
  ?.class != null
45
- ? transaction.lines[0].class.className.toLowerCase()
46
+ ? transaction.lines[0].class?.className.toLowerCase()
46
47
  : null;
47
48
  case 'vendor':
48
49
  default:
@@ -181,9 +182,16 @@ function getExpenseAutomationMissingReceiptsView(state) {
181
182
  vendorLogo: result.vendorLogo ?? transaction?.logo?.href,
182
183
  };
183
184
  });
185
+ const monthEndFetchState = monthYearPeriodId != null
186
+ ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
187
+ : { fetchState: 'Not-Started', error: undefined };
188
+ const reducedFetchStatus = (0, reduceFetchState_1.reduceAnyFetchState)([
189
+ { fetchState, error },
190
+ monthEndFetchState,
191
+ ]);
184
192
  return {
185
- fetchState,
186
- error,
193
+ fetchState: reducedFetchStatus.fetchState,
194
+ error: reducedFetchStatus.error,
187
195
  uploadReceiptStatusById,
188
196
  uiState,
189
197
  refreshStatus,
@@ -19,7 +19,7 @@ const accountListSelector_1 = require("../../accountList/accountListSelector");
19
19
  const classListSelector_1 = require("../../classList/classListSelector");
20
20
  const reconciliationViewReducer_1 = require("../reducers/reconciliationViewReducer");
21
21
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
22
- exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((state) => state, (state) => (0, tenantSelector_1.getCurrentTenant)(state), (state) => state.expenseAutomationReconciliationViewState, (state) => state.expenseAutomationViewState, (state) => state.plaidAccountViewState, (state) => state.accountListState, (state) => state.accountState, (state) => state.classListState, (state) => state.classState, (state) => state.monthEndCloseChecksState, (state) => state.vendorState, (state, currentTenant, reconciliationViewState, expenseAutomationViewState, plaidAccountViewState, accountListState, accountState, classListState, classState, monthEndCloseChecksState, vendorState) => {
22
+ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((state) => state, (state) => (0, tenantSelector_1.getCurrentTenant)(state), (state) => state.expenseAutomationReconciliationViewState, (state) => state.expenseAutomationViewState, (state) => state.plaidAccountViewState, (state) => state.accountListState, (state) => state.accountState, (state) => state.classListState, (state) => state.classState, (state) => state.monthEndCloseChecksState, (state) => state.vendorState, (state) => state.monthEndCloseChecksViewState, (state, currentTenant, reconciliationViewState, expenseAutomationViewState, plaidAccountViewState, accountListState, accountState, classListState, classState, monthEndCloseChecksState, vendorState, monthEndCloseChecksViewState) => {
23
23
  const { selectedPeriodByTenantId } = expenseAutomationViewState;
24
24
  const reconcileTabUiState = reconciliationViewState.reconTabsState.reconcile.uiState;
25
25
  const reviewTabUiState = reconciliationViewState.reconTabsState.review.uiState;
@@ -41,6 +41,13 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
41
41
  }
42
42
  return acc;
43
43
  }, []);
44
+ const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : null;
45
+ const monthEndFetchState = monthYearPeriodId != null
46
+ ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? {
47
+ fetchState: 'Not-Started',
48
+ error: undefined,
49
+ })
50
+ : { fetchState: 'Not-Started', error: undefined };
44
51
  if (accountReconForMonthYearPeriod == null) {
45
52
  return {
46
53
  bankAccounts: [],
@@ -50,10 +57,13 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
50
57
  classListNestedAccountHierarchy: [],
51
58
  allAccountList: [],
52
59
  allClassList: [],
53
- fetchStatus: {
54
- fetchState: reconciliationViewState.fetchState,
55
- error: reconciliationViewState.error,
56
- },
60
+ fetchStatus: (0, reduceFetchState_1.reduceAnyFetchState)([
61
+ {
62
+ fetchState: reconciliationViewState.fetchState,
63
+ error: reconciliationViewState.error,
64
+ },
65
+ monthEndFetchState,
66
+ ]),
57
67
  plaidConnectionDetails: plaidAccountViewState['expense_automation_reconcile']
58
68
  .plaidConnectionDetails,
59
69
  completionStatus: 'incomplete',
@@ -276,10 +286,13 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
276
286
  bankAccounts: uniqueBankAccounts,
277
287
  creditCards: uniqueCreditCards,
278
288
  accountReconciliationsByAccountID: reconList,
279
- fetchStatus: {
280
- fetchState: reconciliationViewState.fetchState,
281
- error: reconciliationViewState.error,
282
- },
289
+ fetchStatus: (0, reduceFetchState_1.reduceAnyFetchState)([
290
+ {
291
+ fetchState: reconciliationViewState.fetchState,
292
+ error: reconciliationViewState.error,
293
+ },
294
+ monthEndFetchState,
295
+ ]),
283
296
  plaidConnectionDetails: plaidAccountViewState['expense_automation_reconcile']
284
297
  .plaidConnectionDetails,
285
298
  reconciliationTabsState: reconciliationViewState.reconTabsState,
@@ -14,7 +14,7 @@ const accountListSelector_1 = require("../../accountList/accountListSelector");
14
14
  const classListSelector_1 = require("../../classList/classListSelector");
15
15
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
16
16
  function getExpenseAutomationTransactionView(state) {
17
- const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
17
+ const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
18
18
  const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
19
19
  const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
20
20
  const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
@@ -47,10 +47,16 @@ function getExpenseAutomationTransactionView(state) {
47
47
  .filter((transaction) => transaction != null);
48
48
  const transactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, transactionIds);
49
49
  const transactionsWithCOT = transactions.map((transaction) => (0, transactionHelper_1.getTransactionWithCOT)(transaction));
50
- const fetchStatus = (0, reduceFetchState_1.reduceAllFetchState)([
51
- accountList,
52
- classList,
53
- expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
50
+ const monthEndFetchState = monthYearPeriodId != null
51
+ ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
52
+ : { fetchState: 'Not-Started', error: undefined };
53
+ const fetchStatus = (0, reduceFetchState_1.reduceAnyFetchState)([
54
+ (0, reduceFetchState_1.reduceAllFetchState)([
55
+ accountList,
56
+ classList,
57
+ expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
58
+ ]),
59
+ monthEndFetchState,
54
60
  ]);
55
61
  const totalCountByReview = expenseAutomationTransactionsViewState.transactionCategorizationView.review
56
62
  .uiState.totalCount;
@@ -1,16 +1,21 @@
1
1
  import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
2
  import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
3
3
  import { Recommendation } from '../../../commonStateTypes/recommendationBase';
4
+ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
4
5
  import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
5
6
  import { AccountBase } from '../../../entity/account/accountState';
6
7
  import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
7
8
  import { VendorBase } from '../../../entity/vendor/vendorState';
9
+ export declare const toJEScheduleSortKey: (v: string) => "vendor" | "type" | "category" | "class" | "memo" | "transactionDate" | "totalAmount" | "runningBalance" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "jePostingDate" | "remainingMonths";
10
+ export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
8
11
  export interface JESchedulesViewUIState {
9
12
  scrollPosition: {
10
13
  scrollTop: number;
11
14
  scrollLeft?: number;
12
15
  } | undefined;
13
16
  searchString: string;
17
+ sortKey: JEScheduleSortKey;
18
+ sortOrder: SortOrder;
14
19
  totalCount: number;
15
20
  limit?: number;
16
21
  }
@@ -1,2 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toJEScheduleSortKey = void 0;
4
+ const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
+ const JE_SCHEDULE_SORT_KEYS = [
6
+ 'vendor',
7
+ 'category',
8
+ 'class',
9
+ 'depCategory',
10
+ 'scheduleCategory',
11
+ 'startMonth',
12
+ 'type',
13
+ 'amortizationPeriod',
14
+ 'jePostingDate',
15
+ 'remainingMonths',
16
+ 'runningBalance',
17
+ 'totalAmount',
18
+ 'transactionDate',
19
+ 'memo',
20
+ ];
21
+ const toJEScheduleSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_SORT_KEYS);
22
+ exports.toJEScheduleSortKey = toJEScheduleSortKey;
@@ -0,0 +1,9 @@
1
+ import { COABalanceTimeFrame } from '../../commonStateTypes/coaBalance/coaBalance';
2
+ import { COABalancesSlice } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
3
+ import { Month } from '../../commonStateTypes/timePeriod';
4
+ /**
5
+ * Empty `COABalancesSlice` for horizontal P&L-by-class section / calculated headers when
6
+ * enrichment has not produced balances yet, or for UI mapping fallbacks.
7
+ * Structure matches {@link enrichProfitAndLossByClassHorizontalReport} output.
8
+ */
9
+ export declare function getEmptyHorizontalSectionBalancesSlice(firstMonthOfFY: Month, timeframe?: COABalanceTimeFrame): COABalancesSlice;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEmptyHorizontalSectionBalancesSlice = getEmptyHorizontalSectionBalancesSlice;
4
+ /**
5
+ * Empty `COABalancesSlice` for horizontal P&L-by-class section / calculated headers when
6
+ * enrichment has not produced balances yet, or for UI mapping fallbacks.
7
+ * Structure matches {@link enrichProfitAndLossByClassHorizontalReport} output.
8
+ */
9
+ function getEmptyHorizontalSectionBalancesSlice(firstMonthOfFY, timeframe = 'month') {
10
+ return {
11
+ balances: [],
12
+ additionalBalances: [],
13
+ filter: {
14
+ firstMonthOfFY,
15
+ timeframe,
16
+ balancesRange: { numberOfPeriods: 0, orderBy: 'ascending_date' },
17
+ additionalBalances: [],
18
+ },
19
+ };
20
+ }
@@ -6,6 +6,7 @@ const getSummationBalance_1 = require("../../commonStateTypes/coaBalance/additio
6
6
  const currencyHelper_1 = require("../../commonStateTypes/currencyHelper");
7
7
  const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
8
8
  const sectionClassesViewSelector_1 = require("../../entity/sectionClassesViewV2/sectionClassesViewSelector");
9
+ const profitAndLossClassesByClassHorizontalSelectorTypes_1 = require("./profitAndLossClassesByClassHorizontalSelectorTypes");
9
10
  const profitAndLossHorizontalEnrichment_1 = require("./profitAndLossHorizontalEnrichment");
10
11
  exports.profitAndLossHorizontalIdsInOrder = [
11
12
  'income',
@@ -307,6 +308,7 @@ function buildHeaderBalances(classColumns, timeframe, selectedPeriod, currency)
307
308
  startDate,
308
309
  type: 'default',
309
310
  label: col.className,
311
+ id: col.classId,
310
312
  }));
311
313
  // Add a "Total" column
312
314
  balances.push({
@@ -316,6 +318,7 @@ function buildHeaderBalances(classColumns, timeframe, selectedPeriod, currency)
316
318
  startDate,
317
319
  type: 'default',
318
320
  label: 'Total',
321
+ id: profitAndLossClassesByClassHorizontalSelectorTypes_1.HORIZONTAL_CLASS_TOTAL_BALANCE_ID,
319
322
  });
320
323
  return balances;
321
324
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.enrichProfitAndLossByClassHorizontalReport = enrichProfitAndLossByClassHorizontalReport;
4
4
  const currencyHelper_1 = require("../../commonStateTypes/currencyHelper");
5
+ const horizontalSectionEmptyBalancesSlice_1 = require("./horizontalSectionEmptyBalancesSlice");
5
6
  const profitAndLossClassesByClassHorizontalSelectorTypes_1 = require("./profitAndLossClassesByClassHorizontalSelectorTypes");
6
7
  /**
7
8
  * Populates `sectionHeaderBalancesSlice`, and per-account `accountReportData`, so the
@@ -42,17 +43,17 @@ function enrichHorizontalSection(report, section) {
42
43
  };
43
44
  const siblingsPerRow = buildSiblingIndicesPerRow(section.accounts, parentIndices);
44
45
  const hasChildFlags = computeHorizontalHasChildFlags(parentIndices);
45
- for (let i = 0; i < section.accounts.length; i++) {
46
- const row = section.accounts[i];
46
+ for (let accountIndex = 0; accountIndex < section.accounts.length; accountIndex++) {
47
+ const row = section.accounts[accountIndex];
47
48
  // Same column order as `report.classColumns` (see `pivotSectionToHorizontal`).
48
- const classRowAmounts = row.classBalances.map((b) => b.balance.amount);
49
+ const classRowAmounts = row.classBalances.map((classBalance) => classBalance.balance.amount);
49
50
  row.accountReportData = {
50
51
  accountId: row.accountId,
51
52
  accountName: row.accountName,
52
53
  accountType: row.accountType,
53
54
  depth: row.depth,
54
55
  balancesInTimeframe: buildHorizontalClassColumnBalancesSlice(report, classRowAmounts, row.rowTotal.amount),
55
- horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, i, parentIndices, siblingsPerRow, hasChildFlags),
56
+ horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, accountIndex, parentIndices, siblingsPerRow, hasChildFlags),
56
57
  };
57
58
  }
58
59
  }
@@ -70,23 +71,13 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
70
71
  const currencyCode = firstHeader?.balance.currencyCode ?? fallback.currencyCode;
71
72
  const currencySymbol = firstHeader?.balance.currencySymbol ?? fallback.currencySymbol;
72
73
  const timeframe = firstHeader?.balanceTimeFrame ?? 'month';
73
- const emptySlice = {
74
- balances: [],
75
- additionalBalances: [],
76
- filter: {
77
- firstMonthOfFY: report.firstMonthOfFY,
78
- timeframe,
79
- balancesRange: { numberOfPeriods: 0, orderBy: 'ascending_date' },
80
- additionalBalances: [],
81
- },
82
- };
83
74
  if (report.selectedPeriod == null) {
84
- return emptySlice;
75
+ return (0, horizontalSectionEmptyBalancesSlice_1.getEmptyHorizontalSectionBalancesSlice)(report.firstMonthOfFY, timeframe);
85
76
  }
86
77
  const { startDate, endDate } = report.selectedPeriod;
87
- const balances = report.classColumns.map((col, i) => ({
78
+ const balances = report.classColumns.map((col, columnIndex) => ({
88
79
  balance: {
89
- amount: classAmounts[i] ?? 0,
80
+ amount: classAmounts[columnIndex] ?? 0,
90
81
  currencyCode,
91
82
  currencySymbol,
92
83
  },
@@ -137,22 +128,22 @@ function computeHorizontalAccountParentIndices(rows) {
137
128
  if (accountRow == null) {
138
129
  continue;
139
130
  }
140
- const d = accountRow.depth;
131
+ const depth = accountRow.depth;
141
132
  while (stack.length > 0) {
142
133
  const topRow = rows[stack[stack.length - 1]];
143
134
  if (topRow == null) {
144
135
  stack.pop();
145
136
  continue;
146
137
  }
147
- if (topRow.depth < d) {
138
+ if (topRow.depth < depth) {
148
139
  break;
149
140
  }
150
141
  stack.pop();
151
142
  }
152
- if (d > 2 && stack.length > 0) {
143
+ if (depth > 2 && stack.length > 0) {
153
144
  const peek = stack[stack.length - 1];
154
145
  const parentRow = rows[peek];
155
- if (parentRow != null && parentRow.depth === d - 1) {
146
+ if (parentRow != null && parentRow.depth === depth - 1) {
156
147
  parentIndex[rowIndex] = peek;
157
148
  }
158
149
  }
@@ -171,12 +162,12 @@ function buildSiblingIndicesPerRow(rows, parentIndices) {
171
162
  continue;
172
163
  }
173
164
  const key = `${parentRowIndex}:${accountRow.depth}`;
174
- let g = keyToIndices.get(key);
175
- if (g == null) {
176
- g = [];
177
- keyToIndices.set(key, g);
165
+ let siblingGroup = keyToIndices.get(key);
166
+ if (siblingGroup == null) {
167
+ siblingGroup = [];
168
+ keyToIndices.set(key, siblingGroup);
178
169
  }
179
- g.push(rowIndex);
170
+ siblingGroup.push(rowIndex);
180
171
  }
181
172
  const siblingsPerRow = new Array(accountRowCount);
182
173
  for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
@@ -244,14 +235,14 @@ function buildHorizontalTreeViewFromPrecomputed(dfsOrderedAccountRows, currentRo
244
235
  const hasChildrenFlag = hasChildFlags[currentRowIndex];
245
236
  const treeDepth = accountRow != null ? Math.max(0, accountRow.depth - 2) : 0;
246
237
  const hasChildren = hasChildrenFlag === true;
247
- const sibs = siblingIndices ?? [currentRowIndex];
238
+ const siblings = siblingIndices ?? [currentRowIndex];
248
239
  return {
249
240
  subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags),
250
241
  treeDepth,
251
242
  hasChildren,
252
- hasSiblings: sibs.length > 1,
243
+ hasSiblings: siblings.length > 1,
253
244
  isLeaf: !hasChildren,
254
- isLastNode: currentRowIndex === sibs[sibs.length - 1],
245
+ isLastNode: currentRowIndex === siblings[siblings.length - 1],
255
246
  };
256
247
  }
257
248
  function buildHorizontalAccountChildIndicesByParent(parentIndices) {
@@ -7,7 +7,7 @@ export declare const getScheduleListKey: (selectedCategory: ID, selectedTimefram
7
7
  export type ScheduleListKey = ReturnType<typeof getScheduleListKey>;
8
8
  export declare const toScheduleSubTabType: (v: string) => "completed" | "new" | "ongoing" | "all";
9
9
  export type ScheduleSubTabType = ReturnType<typeof toScheduleSubTabType>;
10
- declare const toScheduleSortKeyType: (v: string) => "months" | "amount" | "vendor" | "status" | "user" | "createTime" | "class" | "memo" | "balanceAsOfToday" | "transactionDate" | "transactionType" | "assetId" | "accruedExpenseCategory" | "scheduleCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "startMonth" | "endMonth";
10
+ declare const toScheduleSortKeyType: (v: string) => "months" | "amount" | "vendor" | "status" | "user" | "createTime" | "class" | "memo" | "balanceAsOfToday" | "transactionDate" | "transactionType" | "assetId" | "scheduleCategory" | "startMonth" | "accruedExpenseCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "endMonth";
11
11
  export declare type ScheduleListSortKey = ReturnType<typeof toScheduleSortKeyType>;
12
12
  export interface DownloadJEScheduleTabOptions {
13
13
  categoryId: ID;