@zeniai/client-epic-state 5.2.79-betaGS4 → 5.2.79-betaGS5

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.
@@ -1,6 +1,18 @@
1
1
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
2
+ import { getAccountIdsForTypes } from '../../../entity/account/accountSelector';
2
3
  import { getJEOneTimeAccrualByKey, } from '../../../entity/jeSchedules/jeSchedulesSelector';
4
+ import { getAccountList } from '../../accountList/accountListSelector';
5
+ import { getAccountsTypesForScheduleEpics } from '../../scheduleView/scheduleListView/scheduleListHelper';
3
6
  import { getSelectedMonthYearForCurrentTenant } from './actualMatchingViewSelector';
7
+ const EXPENSE_ACCOUNT_TYPES = [
8
+ 'cogs',
9
+ 'expenses',
10
+ 'other_expense',
11
+ ];
12
+ function getExpenseAccounts(state) {
13
+ const expenseAccountIds = new Set(getAccountIdsForTypes(state.accountState, EXPENSE_ACCOUNT_TYPES));
14
+ return getAccountList(state.accountState, state.accountListState, getAccountsTypesForScheduleEpics().accountListKey).accounts.filter((account) => expenseAccountIds.has(account.accountId));
15
+ }
4
16
  const hasCompensation = (accrual) => accrual.compensation != null;
5
17
  export function toCompensationRow(accrual, cycle) {
6
18
  const { compensation } = accrual;
@@ -81,6 +93,7 @@ export function getExpenseAutomationCompensationView(state) {
81
93
  pendingReview,
82
94
  skipped,
83
95
  cyclesWithoutStub,
96
+ expenseAccounts: getExpenseAccounts(state),
84
97
  kpiSummary: buildCompensationKpiSummary(autoPosted, pendingReview),
85
98
  uiState,
86
99
  createStatus,
@@ -1,5 +1,6 @@
1
1
  import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
+ import { AccountBase } from '../../../entity/account/accountState';
3
4
  import { JEOneTimeAccrual } from '../../../entity/jeSchedules/jeSchedulesSelector';
4
5
  import { CompensationAccrualDetails } from '../../../entity/jeSchedules/jeSchedulesState';
5
6
  import { PayCadenceType } from '../../../entity/jeSchedules/jeSchedulesTypes';
@@ -33,6 +34,7 @@ export interface ExpenseAutomationCompensationViewSelector extends SelectorView
33
34
  cycles: PayrollCycle[];
34
35
  cyclesFetchState: FetchStateAndError;
35
36
  cyclesWithoutStub: PayrollCycle[];
37
+ expenseAccounts: AccountBase[];
36
38
  hasLoadedForSelectedPeriod: boolean;
37
39
  kpiSummary: CompensationKpiSummary;
38
40
  pendingReview: CompensationRow[];
@@ -4,8 +4,20 @@ exports.toCompensationRow = toCompensationRow;
4
4
  exports.buildCompensationKpiSummary = buildCompensationKpiSummary;
5
5
  exports.getExpenseAutomationCompensationView = getExpenseAutomationCompensationView;
6
6
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
7
+ const accountSelector_1 = require("../../../entity/account/accountSelector");
7
8
  const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
9
+ const accountListSelector_1 = require("../../accountList/accountListSelector");
10
+ const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
8
11
  const actualMatchingViewSelector_1 = require("./actualMatchingViewSelector");
12
+ const EXPENSE_ACCOUNT_TYPES = [
13
+ 'cogs',
14
+ 'expenses',
15
+ 'other_expense',
16
+ ];
17
+ function getExpenseAccounts(state) {
18
+ const expenseAccountIds = new Set((0, accountSelector_1.getAccountIdsForTypes)(state.accountState, EXPENSE_ACCOUNT_TYPES));
19
+ return (0, accountListSelector_1.getAccountList)(state.accountState, state.accountListState, (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)().accountListKey).accounts.filter((account) => expenseAccountIds.has(account.accountId));
20
+ }
9
21
  const hasCompensation = (accrual) => accrual.compensation != null;
10
22
  function toCompensationRow(accrual, cycle) {
11
23
  const { compensation } = accrual;
@@ -86,6 +98,7 @@ function getExpenseAutomationCompensationView(state) {
86
98
  pendingReview,
87
99
  skipped,
88
100
  cyclesWithoutStub,
101
+ expenseAccounts: getExpenseAccounts(state),
89
102
  kpiSummary: buildCompensationKpiSummary(autoPosted, pendingReview),
90
103
  uiState,
91
104
  createStatus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.79-betaGS4",
3
+ "version": "5.2.79-betaGS5",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",