@zeniai/client-epic-state 4.20.0 → 4.20.1-beta10ND

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 (126) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/commonStateTypes/coaBalance/additionalBalances/getSummationBalance.d.ts +1 -1
  3. package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -2
  4. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  5. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +38 -0
  6. package/lib/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  7. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -1
  8. package/lib/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  9. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +37 -0
  10. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  11. package/lib/entity/tenant/tenantReducer.js +1 -0
  12. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  13. package/lib/entity/tenant/tenantSelector.js +9 -1
  14. package/lib/entity/tenant/tenantState.d.ts +1 -0
  15. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +4 -1
  16. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  17. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -0
  18. package/lib/entity/transaction/payloadTypes/transactionPayload.js +17 -1
  19. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +1 -0
  20. package/lib/entity/transaction/stateTypes/transaction.d.ts +5 -0
  21. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  22. package/lib/epic.d.ts +2 -1
  23. package/lib/epic.js +2 -1
  24. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  25. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  26. package/lib/esm/entity/tenant/tenantReducer.js +1 -0
  27. package/lib/esm/entity/tenant/tenantSelector.js +7 -0
  28. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  29. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +17 -1
  30. package/lib/esm/epic.js +2 -1
  31. package/lib/esm/index.js +10 -8
  32. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +82 -1
  33. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +8 -2
  34. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +29 -0
  35. package/lib/esm/view/classList/fetchClassListEpic.js +9 -2
  36. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  37. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  38. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  39. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +2 -2
  40. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
  41. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  42. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  43. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  44. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +17 -1
  45. package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  46. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  47. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +12 -4
  48. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
  49. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +12 -6
  50. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +18 -1
  51. package/lib/esm/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +17 -0
  52. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +6 -8
  53. package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +132 -73
  54. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  55. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
  56. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  57. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  58. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  59. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  60. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  61. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  62. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +7 -4
  63. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  64. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  65. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  66. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  67. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  68. package/lib/index.d.ts +15 -11
  69. package/lib/index.js +44 -32
  70. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  71. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
  72. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
  73. package/lib/view/aiCfoView/aiCfoViewReducer.js +83 -2
  74. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
  75. package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
  76. package/lib/view/aiCfoView/aiCfoViewState.d.ts +18 -1
  77. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
  78. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +33 -0
  79. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  80. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  81. package/lib/view/classList/fetchClassListEpic.js +8 -1
  82. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -0
  83. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  84. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +1 -0
  85. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  86. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  87. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +1 -1
  88. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
  89. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  90. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  91. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  92. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -1
  93. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  94. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +18 -2
  95. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
  96. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  97. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  98. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +12 -4
  99. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
  100. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +11 -5
  101. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +5 -0
  102. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +20 -0
  103. package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.d.ts +9 -0
  104. package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +20 -0
  105. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +6 -8
  106. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +132 -73
  107. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  108. package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  109. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  110. package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
  111. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  112. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  113. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  114. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  115. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  116. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  117. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  118. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +6 -3
  119. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
  120. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  121. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  122. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  123. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  124. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  125. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  126. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import orderBy from 'lodash/orderBy';
2
+ import { reduceAnyFetchState } from '../../../commonStateTypes/reduceFetchState';
2
3
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
3
4
  import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
4
5
  import { getSupportedTransactionById, getSupportedTransactionsByIds, } from '../../../entity/transaction/transactionSelector';
@@ -7,7 +8,7 @@ import { getCompletedTransactionsCacheKey } from '../reducers/missingReceiptsVie
7
8
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
8
9
  import { isUnmatchedTabFileStatus, } from '../types/missingReceiptsViewState';
9
10
  export function getExpenseAutomationMissingReceiptsView(state) {
10
- const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
11
+ const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
11
12
  const currentTenant = getCurrentTenant(state);
12
13
  const { selectedPeriodByTenantId } = expenseAutomationViewState;
13
14
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
@@ -36,7 +37,7 @@ export function getExpenseAutomationMissingReceiptsView(state) {
36
37
  transaction.lines.length > 0 &&
37
38
  transaction.lines[0]
38
39
  ?.class != null
39
- ? transaction.lines[0].class.className.toLowerCase()
40
+ ? transaction.lines[0].class?.className.toLowerCase()
40
41
  : null;
41
42
  case 'vendor':
42
43
  default:
@@ -175,9 +176,16 @@ export function getExpenseAutomationMissingReceiptsView(state) {
175
176
  vendorLogo: result.vendorLogo ?? transaction?.logo?.href,
176
177
  };
177
178
  });
179
+ const monthEndFetchState = monthYearPeriodId != null
180
+ ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
181
+ : { fetchState: 'Not-Started', error: undefined };
182
+ const reducedFetchStatus = reduceAnyFetchState([
183
+ { fetchState, error },
184
+ monthEndFetchState,
185
+ ]);
178
186
  return {
179
- fetchState,
180
- error,
187
+ fetchState: reducedFetchStatus.fetchState,
188
+ error: reducedFetchStatus.error,
181
189
  uploadReceiptStatusById,
182
190
  uiState,
183
191
  refreshStatus,
@@ -13,7 +13,7 @@ import { getAccountList, getNestedAccountListHierarchy, } from '../../accountLis
13
13
  import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
14
14
  import { initialActionFetchState, initialReconciliationTabsState, initialState, } from '../reducers/reconciliationViewReducer';
15
15
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
16
- export const getExpenseAutomationReconciliationView = createSelector((state) => state, (state) => 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) => {
16
+ export const getExpenseAutomationReconciliationView = createSelector((state) => state, (state) => 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) => {
17
17
  const { selectedPeriodByTenantId } = expenseAutomationViewState;
18
18
  const reconcileTabUiState = reconciliationViewState.reconTabsState.reconcile.uiState;
19
19
  const reviewTabUiState = reconciliationViewState.reconTabsState.review.uiState;
@@ -35,6 +35,13 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
35
35
  }
36
36
  return acc;
37
37
  }, []);
38
+ const monthYearPeriodId = selectedPeriod != null ? toMonthYearPeriodId(selectedPeriod) : null;
39
+ const monthEndFetchState = monthYearPeriodId != null
40
+ ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? {
41
+ fetchState: 'Not-Started',
42
+ error: undefined,
43
+ })
44
+ : { fetchState: 'Not-Started', error: undefined };
38
45
  if (accountReconForMonthYearPeriod == null) {
39
46
  return {
40
47
  bankAccounts: [],
@@ -44,10 +51,13 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
44
51
  classListNestedAccountHierarchy: [],
45
52
  allAccountList: [],
46
53
  allClassList: [],
47
- fetchStatus: {
48
- fetchState: reconciliationViewState.fetchState,
49
- error: reconciliationViewState.error,
50
- },
54
+ fetchStatus: reduceAnyFetchState([
55
+ {
56
+ fetchState: reconciliationViewState.fetchState,
57
+ error: reconciliationViewState.error,
58
+ },
59
+ monthEndFetchState,
60
+ ]),
51
61
  plaidConnectionDetails: plaidAccountViewState['expense_automation_reconcile']
52
62
  .plaidConnectionDetails,
53
63
  completionStatus: 'incomplete',
@@ -270,10 +280,13 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
270
280
  bankAccounts: uniqueBankAccounts,
271
281
  creditCards: uniqueCreditCards,
272
282
  accountReconciliationsByAccountID: reconList,
273
- fetchStatus: {
274
- fetchState: reconciliationViewState.fetchState,
275
- error: reconciliationViewState.error,
276
- },
283
+ fetchStatus: reduceAnyFetchState([
284
+ {
285
+ fetchState: reconciliationViewState.fetchState,
286
+ error: reconciliationViewState.error,
287
+ },
288
+ monthEndFetchState,
289
+ ]),
277
290
  plaidConnectionDetails: plaidAccountViewState['expense_automation_reconcile']
278
291
  .plaidConnectionDetails,
279
292
  reconciliationTabsState: reconciliationViewState.reconTabsState,
@@ -1,5 +1,5 @@
1
1
  import omit from 'lodash/omit';
2
- import { reduceAllFetchState } from '../../../commonStateTypes/reduceFetchState';
2
+ import { reduceAllFetchState, reduceAnyFetchState, } from '../../../commonStateTypes/reduceFetchState';
3
3
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
4
4
  import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
5
5
  import { getTransactionWithCOT } from '../../../entity/transaction/transactionHelper';
@@ -8,7 +8,7 @@ import { getAccountList, getNestedAccountListHierarchy, getUncategorizedAccounts
8
8
  import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
9
9
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
10
10
  export function getExpenseAutomationTransactionView(state) {
11
- const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
11
+ const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
12
12
  const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
13
13
  const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
14
14
  const uncategorizedIncomeExpense = getUncategorizedAccounts(accountState, accountListState, 'accountList');
@@ -41,10 +41,16 @@ export function getExpenseAutomationTransactionView(state) {
41
41
  .filter((transaction) => transaction != null);
42
42
  const transactions = getSupportedTransactionsByIds(transactionState, transactionIds);
43
43
  const transactionsWithCOT = transactions.map((transaction) => getTransactionWithCOT(transaction));
44
- const fetchStatus = reduceAllFetchState([
45
- accountList,
46
- classList,
47
- expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
44
+ const monthEndFetchState = monthYearPeriodId != null
45
+ ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
46
+ : { fetchState: 'Not-Started', error: undefined };
47
+ const fetchStatus = reduceAnyFetchState([
48
+ reduceAllFetchState([
49
+ accountList,
50
+ classList,
51
+ expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
52
+ ]),
53
+ monthEndFetchState,
48
54
  ]);
49
55
  const totalCountByReview = expenseAutomationTransactionsViewState.transactionCategorizationView.review
50
56
  .uiState.totalCount;
@@ -1 +1,18 @@
1
- export {};
1
+ import { stringToUnion } from '../../../commonStateTypes/stringToUnion';
2
+ const JE_SCHEDULE_SORT_KEYS = [
3
+ 'vendor',
4
+ 'category',
5
+ 'class',
6
+ 'depCategory',
7
+ 'scheduleCategory',
8
+ 'startMonth',
9
+ 'type',
10
+ 'amortizationPeriod',
11
+ 'jePostingDate',
12
+ 'remainingMonths',
13
+ 'runningBalance',
14
+ 'totalAmount',
15
+ 'transactionDate',
16
+ 'memo',
17
+ ];
18
+ export const toJEScheduleSortKey = (v) => stringToUnion(v, JE_SCHEDULE_SORT_KEYS);
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Empty `COABalancesSlice` for horizontal P&L-by-class section / calculated headers when
3
+ * enrichment has not produced balances yet, or for UI mapping fallbacks.
4
+ * Structure matches {@link enrichProfitAndLossByClassHorizontalReport} output.
5
+ */
6
+ export function getEmptyHorizontalSectionBalancesSlice(firstMonthOfFY, timeframe = 'month') {
7
+ return {
8
+ balances: [],
9
+ additionalBalances: [],
10
+ filter: {
11
+ firstMonthOfFY,
12
+ timeframe,
13
+ balancesRange: { numberOfPeriods: 0, orderBy: 'ascending_date' },
14
+ additionalBalances: [],
15
+ },
16
+ };
17
+ }
@@ -3,6 +3,7 @@ import { getSummationFreeRangeTotalBalance } from '../../commonStateTypes/coaBal
3
3
  import { defaultCustomerCurrency } from '../../commonStateTypes/currencyHelper';
4
4
  import { reduceFetchStateParallelTimeframes } from '../../commonStateTypes/reduceFetchState';
5
5
  import { getSectionClassesViewReport } from '../../entity/sectionClassesViewV2/sectionClassesViewSelector';
6
+ import { HORIZONTAL_CLASS_TOTAL_BALANCE_ID, } from './profitAndLossClassesByClassHorizontalSelectorTypes';
6
7
  import { enrichProfitAndLossByClassHorizontalReport } from './profitAndLossHorizontalEnrichment';
7
8
  export const profitAndLossHorizontalIdsInOrder = [
8
9
  'income',
@@ -49,16 +50,11 @@ export const getProfitAndLossClassesHorizontalView = (filter, accountState, clas
49
50
  const calculatedSections = {};
50
51
  let reportCurrency = defaultCustomerCurrency;
51
52
  if (fetchState.fetchState === 'Completed' && selectedPeriod != null) {
52
- // Get section reports using existing selector infrastructure
53
- const sectionReports = {};
54
- HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
55
- sectionReports[sectionId] = getSectionClassesViewReport(accountState, classState, sectionsState, { reportId, sectionId }, filter);
56
- });
57
53
  reportCurrency =
58
54
  profitAndLossClassesViewState.currency ?? defaultCustomerCurrency;
59
- // Pivot each section from class→account to account→class
55
+ // Fetch each section and pivot class→account to account→class in one pass
60
56
  HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
61
- const sectionReport = sectionReports[sectionId];
57
+ const sectionReport = getSectionClassesViewReport(accountState, classState, sectionsState, { reportId, sectionId }, filter);
62
58
  if (sectionReport != null) {
63
59
  sections[sectionId] = pivotSectionToHorizontal(sectionReport, classColumns, SECTION_TITLES[sectionId] ?? sectionId, reportCurrency);
64
60
  }
@@ -261,7 +257,7 @@ function sumBalancesInSlice(balances) {
261
257
  if (balances.length === 0) {
262
258
  return 0;
263
259
  }
264
- const summed = getSummationFreeRangeTotalBalance([...balances]);
260
+ const summed = getSummationFreeRangeTotalBalance(balances);
265
261
  return summed?.balance.amount ?? 0;
266
262
  }
267
263
  /**
@@ -308,6 +304,7 @@ function buildHeaderBalances(classColumns, timeframe, selectedPeriod, currency)
308
304
  startDate,
309
305
  type: 'default',
310
306
  label: col.className,
307
+ id: col.classId,
311
308
  }));
312
309
  // Add a "Total" column
313
310
  balances.push({
@@ -317,6 +314,7 @@ function buildHeaderBalances(classColumns, timeframe, selectedPeriod, currency)
317
314
  startDate,
318
315
  type: 'default',
319
316
  label: 'Total',
317
+ id: HORIZONTAL_CLASS_TOTAL_BALANCE_ID,
320
318
  });
321
319
  return balances;
322
320
  }
@@ -1,4 +1,5 @@
1
1
  import { defaultCustomerCurrency } from '../../commonStateTypes/currencyHelper';
2
+ import { getEmptyHorizontalSectionBalancesSlice } from './horizontalSectionEmptyBalancesSlice';
2
3
  import { HORIZONTAL_CLASS_TOTAL_BALANCE_ID, } from './profitAndLossClassesByClassHorizontalSelectorTypes';
3
4
  /**
4
5
  * Populates `sectionHeaderBalancesSlice`, and per-account `accountReportData`, so the
@@ -25,30 +26,31 @@ function enrichHorizontalSection(report, section) {
25
26
  return total?.balance.amount ?? 0;
26
27
  });
27
28
  section.sectionHeaderBalancesSlice = buildHorizontalClassColumnBalancesSlice(report, classAmounts, section.sectionTotal.amount);
28
- const childrenRowIndicesByParent = buildHorizontalAccountChildIndicesByParent(section.accounts);
29
+ const parentIndices = computeHorizontalAccountParentIndices(section.accounts);
30
+ const childrenRowIndicesByParent = buildHorizontalAccountChildIndicesByParent(parentIndices);
29
31
  const childrenRecord = {};
30
32
  childrenRowIndicesByParent.forEach((childIndices, parentIndex) => {
31
33
  childrenRecord[parentIndex] = childIndices;
32
34
  });
33
35
  section.treeLayout = {
34
36
  rootAccountRowIndices: section.accounts
35
- .map((_, i) => findHorizontalAccountParentIndex(section.accounts, i) === -1 ? i : -1)
37
+ .map((_, i) => (parentIndices[i] === -1 ? i : -1))
36
38
  .filter((i) => i >= 0),
37
39
  childrenRowIndicesByParent: childrenRecord,
38
40
  };
39
- for (let i = 0; i < section.accounts.length; i++) {
40
- const row = section.accounts[i];
41
- const classRowAmounts = report.classColumns.map((col) => {
42
- const cb = row.classBalances.find((b) => b.classId === col.classId);
43
- return cb?.balance.amount ?? 0;
44
- });
41
+ const siblingsPerRow = buildSiblingIndicesPerRow(section.accounts, parentIndices);
42
+ const hasChildFlags = computeHorizontalHasChildFlags(parentIndices);
43
+ for (let accountIndex = 0; accountIndex < section.accounts.length; accountIndex++) {
44
+ const row = section.accounts[accountIndex];
45
+ // Same column order as `report.classColumns` (see `pivotSectionToHorizontal`).
46
+ const classRowAmounts = row.classBalances.map((classBalance) => classBalance.balance.amount);
45
47
  row.accountReportData = {
46
48
  accountId: row.accountId,
47
49
  accountName: row.accountName,
48
50
  accountType: row.accountType,
49
51
  depth: row.depth,
50
52
  balancesInTimeframe: buildHorizontalClassColumnBalancesSlice(report, classRowAmounts, row.rowTotal.amount),
51
- horizontalTreeView: buildHorizontalTreeView(section.accounts, i),
53
+ horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, accountIndex, parentIndices, siblingsPerRow, hasChildFlags),
52
54
  };
53
55
  }
54
56
  }
@@ -66,23 +68,14 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
66
68
  const currencyCode = firstHeader?.balance.currencyCode ?? fallback.currencyCode;
67
69
  const currencySymbol = firstHeader?.balance.currencySymbol ?? fallback.currencySymbol;
68
70
  const timeframe = firstHeader?.balanceTimeFrame ?? 'month';
69
- const emptySlice = {
70
- balances: [],
71
- additionalBalances: [],
72
- filter: {
73
- firstMonthOfFY: report.firstMonthOfFY,
74
- timeframe,
75
- balancesRange: { numberOfPeriods: 0, orderBy: 'ascending_date' },
76
- additionalBalances: [],
77
- },
78
- };
71
+ const emptySlice = getEmptyHorizontalSectionBalancesSlice(report.firstMonthOfFY, timeframe);
79
72
  if (report.selectedPeriod == null) {
80
73
  return emptySlice;
81
74
  }
82
75
  const { startDate, endDate } = report.selectedPeriod;
83
- const balances = report.classColumns.map((col, i) => ({
76
+ const balances = report.classColumns.map((col, columnIndex) => ({
84
77
  balance: {
85
- amount: classAmounts[i] ?? 0,
78
+ amount: classAmounts[columnIndex] ?? 0,
86
79
  currencyCode,
87
80
  currencySymbol,
88
81
  },
@@ -120,64 +113,143 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
120
113
  },
121
114
  };
122
115
  }
123
- function findHorizontalAccountParentIndex(dfsOrderedAccountRows, childRowIndex) {
124
- const childDepth = dfsOrderedAccountRows[childRowIndex].depth;
125
- if (childDepth <= 2) {
126
- return -1;
127
- }
128
- for (let earlierRowIndex = childRowIndex - 1; earlierRowIndex >= 0; earlierRowIndex--) {
129
- const earlierDepth = dfsOrderedAccountRows[earlierRowIndex].depth;
130
- if (earlierDepth < childDepth) {
131
- if (earlierDepth === childDepth - 1) {
132
- return earlierRowIndex;
116
+ /**
117
+ * Parent index per DFS row — O(n). Matches the scan in the former
118
+ * `findHorizontalAccountParentIndex` (depth &lt;= 2 rows have no parent).
119
+ */
120
+ function computeHorizontalAccountParentIndices(rows) {
121
+ const accountRowCount = rows.length;
122
+ const parentIndex = new Array(accountRowCount).fill(-1);
123
+ const stack = [];
124
+ for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
125
+ const accountRow = rows[rowIndex];
126
+ if (accountRow == null) {
127
+ continue;
128
+ }
129
+ const depth = accountRow.depth;
130
+ while (stack.length > 0) {
131
+ const topRow = rows[stack[stack.length - 1]];
132
+ if (topRow == null) {
133
+ stack.pop();
134
+ continue;
135
+ }
136
+ if (topRow.depth < depth) {
137
+ break;
138
+ }
139
+ stack.pop();
140
+ }
141
+ if (depth > 2 && stack.length > 0) {
142
+ const peek = stack[stack.length - 1];
143
+ const parentRow = rows[peek];
144
+ if (parentRow != null && parentRow.depth === depth - 1) {
145
+ parentIndex[rowIndex] = peek;
133
146
  }
134
- return -1;
135
147
  }
148
+ stack.push(rowIndex);
136
149
  }
137
- return -1;
150
+ return parentIndex;
138
151
  }
139
- function getHorizontalAccountSiblingIndices(dfsOrderedAccountRows, rowIndex) {
140
- const parentRowIndex = findHorizontalAccountParentIndex(dfsOrderedAccountRows, rowIndex);
141
- const rowDepth = dfsOrderedAccountRows[rowIndex].depth;
142
- const siblings = [];
143
- for (let i = 0; i < dfsOrderedAccountRows.length; i++) {
144
- if (dfsOrderedAccountRows[i].depth === rowDepth &&
145
- findHorizontalAccountParentIndex(dfsOrderedAccountRows, i) ===
146
- parentRowIndex) {
147
- siblings.push(i);
152
+ /** Sibling row indices (same parent + depth), in traversal order — O(n). */
153
+ function buildSiblingIndicesPerRow(rows, parentIndices) {
154
+ const accountRowCount = rows.length;
155
+ const keyToIndices = new Map();
156
+ for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
157
+ const parentRowIndex = parentIndices[rowIndex];
158
+ const accountRow = rows[rowIndex];
159
+ if (parentRowIndex == null || accountRow == null) {
160
+ continue;
161
+ }
162
+ const key = `${parentRowIndex}:${accountRow.depth}`;
163
+ let siblingGroup = keyToIndices.get(key);
164
+ if (siblingGroup == null) {
165
+ siblingGroup = [];
166
+ keyToIndices.set(key, siblingGroup);
167
+ }
168
+ siblingGroup.push(rowIndex);
169
+ }
170
+ const siblingsPerRow = new Array(accountRowCount);
171
+ for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
172
+ const parentRowIndex = parentIndices[rowIndex];
173
+ const accountRow = rows[rowIndex];
174
+ if (parentRowIndex == null || accountRow == null) {
175
+ siblingsPerRow[rowIndex] = [rowIndex];
176
+ continue;
148
177
  }
178
+ const key = `${parentRowIndex}:${accountRow.depth}`;
179
+ const group = keyToIndices.get(key);
180
+ siblingsPerRow[rowIndex] = group != null ? group : [rowIndex];
149
181
  }
150
- return siblings;
182
+ return siblingsPerRow;
151
183
  }
152
- function horizontalAccountHasChildRows(dfsOrderedAccountRows, parentRowIndex) {
153
- return dfsOrderedAccountRows.some((_, rowIndex) => findHorizontalAccountParentIndex(dfsOrderedAccountRows, rowIndex) ===
154
- parentRowIndex);
184
+ function computeHorizontalHasChildFlags(parentIndices) {
185
+ const rowCount = parentIndices.length;
186
+ const flags = new Array(rowCount).fill(false);
187
+ for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
188
+ const parentRowIndex = parentIndices[rowIndex];
189
+ if (parentRowIndex != null &&
190
+ parentRowIndex >= 0 &&
191
+ parentRowIndex < rowCount) {
192
+ flags[parentRowIndex] = true;
193
+ }
194
+ }
195
+ return flags;
155
196
  }
156
- function buildHorizontalSubAccountAncestorMetadata(dfsOrderedAccountRows, currentRowIndex) {
157
- const ancestorRowIndicesRootToLeaf = [];
197
+ function buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags) {
198
+ const chain = [];
158
199
  let walkRowIndex = currentRowIndex;
159
200
  while (walkRowIndex >= 0) {
160
- ancestorRowIndicesRootToLeaf.unshift(walkRowIndex);
161
- walkRowIndex = findHorizontalAccountParentIndex(dfsOrderedAccountRows, walkRowIndex);
201
+ chain.unshift(walkRowIndex);
202
+ const parentRowIndex = parentIndices[walkRowIndex];
203
+ if (parentRowIndex == null) {
204
+ break;
205
+ }
206
+ walkRowIndex = parentRowIndex;
162
207
  }
163
- return ancestorRowIndicesRootToLeaf.map((rowIndex) => {
164
- const siblingIndices = getHorizontalAccountSiblingIndices(dfsOrderedAccountRows, rowIndex);
208
+ return chain.map((rowIndex) => {
209
+ const accountRow = dfsOrderedAccountRows[rowIndex];
210
+ const siblingIndices = siblingsPerRow[rowIndex];
211
+ const hasChild = hasChildFlags[rowIndex];
212
+ if (accountRow == null || siblingIndices == null) {
213
+ return {
214
+ depth: 0,
215
+ hasSibling: false,
216
+ hasChildren: hasChild === true,
217
+ isLastNode: true,
218
+ name: '',
219
+ };
220
+ }
165
221
  return {
166
- depth: dfsOrderedAccountRows[rowIndex].depth - 2,
222
+ depth: accountRow.depth - 2,
167
223
  hasSibling: siblingIndices.length > 1,
168
- hasChildren: horizontalAccountHasChildRows(dfsOrderedAccountRows, rowIndex),
224
+ hasChildren: hasChild === true,
169
225
  isLastNode: rowIndex === siblingIndices[siblingIndices.length - 1],
170
- name: dfsOrderedAccountRows[rowIndex].accountName,
226
+ name: accountRow.accountName,
171
227
  };
172
228
  });
173
229
  }
174
- function buildHorizontalAccountChildIndicesByParent(dfsOrderedAccountRows) {
230
+ function buildHorizontalTreeViewFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags) {
231
+ const siblingIndices = siblingsPerRow[currentRowIndex];
232
+ const accountRow = dfsOrderedAccountRows[currentRowIndex];
233
+ const hasChildrenFlag = hasChildFlags[currentRowIndex];
234
+ const treeDepth = accountRow != null ? Math.max(0, accountRow.depth - 2) : 0;
235
+ const hasChildren = hasChildrenFlag === true;
236
+ const siblings = siblingIndices ?? [currentRowIndex];
237
+ return {
238
+ subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags),
239
+ treeDepth,
240
+ hasChildren,
241
+ hasSiblings: siblings.length > 1,
242
+ isLeaf: !hasChildren,
243
+ isLastNode: currentRowIndex === siblings[siblings.length - 1],
244
+ };
245
+ }
246
+ function buildHorizontalAccountChildIndicesByParent(parentIndices) {
175
247
  const childIndicesByParentRowIndex = new Map();
176
- for (let rowIndex = 0; rowIndex < dfsOrderedAccountRows.length; rowIndex++) {
177
- const parentRowIndex = findHorizontalAccountParentIndex(dfsOrderedAccountRows, rowIndex);
178
- if (parentRowIndex >= 0) {
248
+ for (let rowIndex = 0; rowIndex < parentIndices.length; rowIndex++) {
249
+ const parentRowIndex = parentIndices[rowIndex];
250
+ if (parentRowIndex != null && parentRowIndex >= 0) {
179
251
  let childRowIndices = childIndicesByParentRowIndex.get(parentRowIndex);
180
- if (childRowIndices === undefined) {
252
+ if (childRowIndices == null) {
181
253
  childRowIndices = [];
182
254
  childIndicesByParentRowIndex.set(parentRowIndex, childRowIndices);
183
255
  }
@@ -186,16 +258,3 @@ function buildHorizontalAccountChildIndicesByParent(dfsOrderedAccountRows) {
186
258
  }
187
259
  return childIndicesByParentRowIndex;
188
260
  }
189
- function buildHorizontalTreeView(dfsOrderedAccountRows, currentRowIndex) {
190
- const treeDepth = Math.max(0, dfsOrderedAccountRows[currentRowIndex].depth - 2);
191
- const siblingIndices = getHorizontalAccountSiblingIndices(dfsOrderedAccountRows, currentRowIndex);
192
- const hasChildren = horizontalAccountHasChildRows(dfsOrderedAccountRows, currentRowIndex);
193
- return {
194
- subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadata(dfsOrderedAccountRows, currentRowIndex),
195
- treeDepth,
196
- hasChildren,
197
- hasSiblings: siblingIndices.length > 1,
198
- isLeaf: !hasChildren,
199
- isLastNode: currentRowIndex === siblingIndices[siblingIndices.length - 1],
200
- };
201
- }
@@ -416,6 +416,14 @@ export const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions)
416
416
  transactionsWithNoSortKeyValue.push(transaction);
417
417
  }
418
418
  break;
419
+ case 'invoiceNumber':
420
+ if (transaction.documentId != null) {
421
+ transactionsWithSortKeyValue.push(transaction);
422
+ }
423
+ else {
424
+ transactionsWithNoSortKeyValue.push(transaction);
425
+ }
426
+ break;
419
427
  case 'dueDate':
420
428
  if (currentTab === 'draft') {
421
429
  if (Boolean(transaction.dueDate) === true) {
@@ -518,6 +526,8 @@ export const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions)
518
526
  return transaction.totalAmountInUSD?.amount ?? 0;
519
527
  case 'paymentMethod':
520
528
  return transaction.billPayInfo.billPaymentMethodType.name;
529
+ case 'invoiceNumber':
530
+ return transaction.documentId;
521
531
  }
522
532
  }, getColumnWiseSortOrder(sortOrder));
523
533
  return [
@@ -43,6 +43,7 @@ const ALL_BILL_PAY_SORT_KEYS = [
43
43
  'invoiceDate',
44
44
  'name',
45
45
  'paymentMethod',
46
+ 'invoiceNumber',
46
47
  ];
47
48
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
48
49
  const toBillPaySortKeyType = (v) => stringToUnion(v, ALL_BILL_PAY_SORT_KEYS);
@@ -2,6 +2,7 @@ import recordGet from 'lodash/get';
2
2
  import { reduceFetchState } from '../../../../commonStateTypes/reduceFetchState';
3
3
  import { getContactsByIds } from '../../../../entity/billPay/contact/contactSelector';
4
4
  import { getPaymentAccountsByPaymentAccountIds } from '../../../../entity/paymentAccount/paymentAccountSelector';
5
+ import { getIsAccountingClassesEnabled } from '../../../../entity/tenant/tenantSelector';
5
6
  import { getVendorByVendorId } from '../../../../entity/vendor/vendorSelector';
6
7
  import { getAccountList } from '../../../accountList/accountListSelector';
7
8
  import { getAllFundingAccounts, } from '../../commonSetup/setupViewSelector';
@@ -73,11 +74,14 @@ export const getReviewPageBillDetail = (state, billId) => {
73
74
  }
74
75
  }
75
76
  if (sourceBillDetail != null) {
76
- sourceBillDetailFetchState = reduceFetchState([
77
+ const fetchStateList = [
77
78
  sourceBillDetail.fetchStatus,
78
79
  accountListState.byReportId['billPayAccountList'],
79
- classListState,
80
- ]).fetchState;
80
+ ];
81
+ if (getIsAccountingClassesEnabled(state)) {
82
+ fetchStateList.push(classListState);
83
+ }
84
+ sourceBillDetailFetchState = reduceFetchState(fetchStateList).fetchState;
81
85
  }
82
86
  }
83
87
  else {
@@ -3,6 +3,7 @@ import cloneDeep from 'lodash/cloneDeep';
3
3
  import { reduceAllFetchState, reduceAnyFetchState, } from '../../../../commonStateTypes/reduceFetchState';
4
4
  import { getApprovalRulesByIds } from '../../../../entity/approvalRule/approvalRuleSelector';
5
5
  import { getClassesByIds } from '../../../../entity/class/classSelector';
6
+ import { getIsAccountingClassesEnabled } from '../../../../entity/tenant/tenantSelector';
6
7
  import { getUserByUserId } from '../../../../entity/user/userSelector';
7
8
  import { getUserRoleByUserId } from '../../../../entity/userRole/userRoleSelector';
8
9
  export const getBillPaySetupApproverView = createSelector((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (billPaySetupApproverViewState, approvalRuleState, userState) => {
@@ -44,7 +45,7 @@ export const getBillPaySetupApproverView = createSelector((state) => state.billP
44
45
  newApprovalRuleId,
45
46
  };
46
47
  });
47
- export const getBillPaySetupApproverUpdateDataView = createSelector((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => state.userRoleState, (billPaySetupApproverViewState, approvalRuleState, userState, classState, classListState, userRoleState) => {
48
+ export const getBillPaySetupApproverUpdateDataView = createSelector((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => state.userRoleState, (state) => getIsAccountingClassesEnabled(state), (billPaySetupApproverViewState, approvalRuleState, userState, classState, classListState, userRoleState, isAccountingClassesEnabled) => {
48
49
  const { affectedEntityIds, approvalRuleIds, approverListState, billPaySetupApproverViewUpdateData, fetchState, error, listeningToPusherEvent, } = billPaySetupApproverViewState;
49
50
  const { approverIds, attributes } = approverListState;
50
51
  const allApprovalRules = getApprovalRulesByIds(approvalRuleState, approvalRuleIds);
@@ -92,10 +93,9 @@ export const getBillPaySetupApproverUpdateDataView = createSelector((state) => s
92
93
  allAttributes,
93
94
  filteredAttributes,
94
95
  billPaySetupApproverViewUpdateData,
95
- approverListFetchStatus: reduceAllFetchState([
96
- approverListState.fetchStatus,
97
- classListState,
98
- ]),
96
+ approverListFetchStatus: isAccountingClassesEnabled
97
+ ? reduceAllFetchState([approverListState.fetchStatus, classListState])
98
+ : approverListState.fetchStatus,
99
99
  fetchState,
100
100
  allAccountingClasses,
101
101
  error,
@@ -1,22 +1,27 @@
1
1
  import { concat, from } from 'rxjs';
2
2
  import { filter, mergeMap } from 'rxjs/operators';
3
+ import { getIsAccountingClassesEnabled } from '../../../../../entity/tenant/tenantSelector';
3
4
  import { fetchClassList } from '../../../../classList/classListReducer';
4
5
  import { fetchBillPayApproversDetails, fetchBillPayApproversList, } from '../billPaySetupApproverViewReducer';
5
6
  export const fetchBillPayApproversDetailsEpic = (actions$, state$) => actions$.pipe(filter(fetchBillPayApproversDetails.match), mergeMap((action) => {
6
7
  const { cacheOverride, includeUserRoles } = action.payload;
7
8
  const { billPaySetupApproverViewState, classListState } = state$.value;
8
9
  const { approverListState } = billPaySetupApproverViewState;
10
+ const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state$.value);
9
11
  const actions = [];
10
12
  if (cacheOverride === true) {
11
13
  actions.push(fetchBillPayApproversList(cacheOverride, includeUserRoles));
12
- actions.push(fetchClassList());
14
+ if (isAccountingClassesEnabled) {
15
+ actions.push(fetchClassList());
16
+ }
13
17
  }
14
18
  else {
15
19
  if (billPaySetupApproverViewState.hasValidState() === false &&
16
20
  approverListState.fetchStatus.fetchState !== 'In-Progress') {
17
21
  actions.push(fetchBillPayApproversList(true, includeUserRoles));
18
22
  }
19
- if (classListState.hasValidState() === false &&
23
+ if (isAccountingClassesEnabled &&
24
+ classListState.hasValidState() === false &&
20
25
  classListState.fetchState !== 'In-Progress') {
21
26
  actions.push(fetchClassList());
22
27
  }