@zeniai/client-epic-state 5.0.18-betaSS1 → 5.0.18

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,7 +1,7 @@
1
1
  import omit from 'lodash/omit';
2
2
  import orderBy from 'lodash/orderBy';
3
3
  import { reduceAnyFetchState } from '../../../commonStateTypes/reduceFetchState';
4
- import { LAST_SCHEDULE_DAY_OF_MONTH, toMonthYearPeriodId, } from '../../../commonStateTypes/timePeriod';
4
+ import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
5
5
  import { getAccountIdsForTypes } from '../../../entity/account/accountSelector';
6
6
  import { getJEScheduledTransactionByJEScheduleTransactionKey, } from '../../../entity/jeSchedules/jeSchedulesSelector';
7
7
  import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
@@ -23,33 +23,19 @@ function getJEScheduleSortAccessor(sortKey) {
23
23
  case 'depCategory':
24
24
  return (s) => s.jeCredit.account?.accountName?.toLowerCase();
25
25
  case 'scheduleCategory':
26
- return (s) => s.baseTransaction.account?.accountName?.toLowerCase();
26
+ return (s) => s.jeScheduleType;
27
27
  case 'startMonth':
28
28
  return (s) => s.startDate?.valueOf();
29
29
  case 'type':
30
- return (s) => s.jeScheduleType;
30
+ return (s) => s.baseTransaction.typeOfTransaction;
31
31
  case 'amortizationPeriod':
32
32
  return (s) => s.period;
33
33
  case 'jePostingDate':
34
- return (s) => s.lastDayOfMonth === true
35
- ? LAST_SCHEDULE_DAY_OF_MONTH
36
- : (s.dayOfPostingDate ?? null);
34
+ return (s) => s.dayOfPostingDate;
37
35
  case 'remainingMonths':
38
- return (s) => {
39
- const total = s.period ?? 0;
40
- const posted = Array.isArray(s.scheduledJournalEntry)
41
- ? s.scheduledJournalEntry.length
42
- : 0;
43
- return total - posted;
44
- };
36
+ return (s) => s.period;
45
37
  case 'runningBalance':
46
- return (s) => {
47
- const sje = s.scheduledJournalEntry;
48
- if (sje != null && !Array.isArray(sje)) {
49
- return sje.runningBalance?.amount ?? null;
50
- }
51
- return s.balanceAsOfToday?.amount ?? null;
52
- };
38
+ return (s) => s.balanceAsOfToday?.amount;
53
39
  case 'totalAmount':
54
40
  return (s) => s.baseTransaction.amount.amount;
55
41
  case 'transactionDate':
@@ -128,11 +114,6 @@ export function getExpenseAutomationJESchedulesView(state) {
128
114
  });
129
115
  });
130
116
  const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
131
- const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
132
- const pendingReviewSchedules = sortJEScheduledTransactions([
133
- ...jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'),
134
- ...validResolveForPending,
135
- ], sortKey, sortOrder);
136
117
  const allSteps = monthYearPeriodId != null
137
118
  ? getAllSteps(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
138
119
  : [];
@@ -156,7 +137,6 @@ export function getExpenseAutomationJESchedulesView(state) {
156
137
  completedSchedules,
157
138
  draftSchedules,
158
139
  ongoingSchedules,
159
- pendingReviewSchedules,
160
140
  resolveSchedules: resolveSchedules,
161
141
  accountSettingsView,
162
142
  postStatusById: postStatusById,
@@ -47,13 +47,8 @@ const sortedJETransactionsView = (jeTransactions, sortKey, sortOrder) => {
47
47
  return jeTransaction.endDate != null
48
48
  ? jeTransaction.endDate.valueOf()
49
49
  : null;
50
- case 'months': {
51
- const total = jeTransaction.period ?? 0;
52
- const posted = Array.isArray(jeTransaction.scheduledJournalEntry)
53
- ? jeTransaction.scheduledJournalEntry.length
54
- : 0;
55
- return total - posted;
56
- }
50
+ case 'months':
51
+ return jeTransaction.period ?? null;
57
52
  case 'transactionType':
58
53
  return jeTransaction.baseTransaction.type.toLowerCase();
59
54
  case 'status':
@@ -24,7 +24,6 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
24
24
  ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
25
25
  jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
26
26
  ongoingSchedules: JEScheduledTransaction[];
27
- pendingReviewSchedules: (JEScheduledTransaction | JEScheduledTransactionWithFailedEntries)[];
28
27
  postStatusById: Record<ID, FetchStateAndError>;
29
28
  refreshStatus: FetchStateAndError;
30
29
  resolveSchedules: JEScheduledTransactionWithFailedEntries[];
@@ -29,33 +29,19 @@ function getJEScheduleSortAccessor(sortKey) {
29
29
  case 'depCategory':
30
30
  return (s) => s.jeCredit.account?.accountName?.toLowerCase();
31
31
  case 'scheduleCategory':
32
- return (s) => s.baseTransaction.account?.accountName?.toLowerCase();
32
+ return (s) => s.jeScheduleType;
33
33
  case 'startMonth':
34
34
  return (s) => s.startDate?.valueOf();
35
35
  case 'type':
36
- return (s) => s.jeScheduleType;
36
+ return (s) => s.baseTransaction.typeOfTransaction;
37
37
  case 'amortizationPeriod':
38
38
  return (s) => s.period;
39
39
  case 'jePostingDate':
40
- return (s) => s.lastDayOfMonth === true
41
- ? timePeriod_1.LAST_SCHEDULE_DAY_OF_MONTH
42
- : (s.dayOfPostingDate ?? null);
40
+ return (s) => s.dayOfPostingDate;
43
41
  case 'remainingMonths':
44
- return (s) => {
45
- const total = s.period ?? 0;
46
- const posted = Array.isArray(s.scheduledJournalEntry)
47
- ? s.scheduledJournalEntry.length
48
- : 0;
49
- return total - posted;
50
- };
42
+ return (s) => s.period;
51
43
  case 'runningBalance':
52
- return (s) => {
53
- const sje = s.scheduledJournalEntry;
54
- if (sje != null && !Array.isArray(sje)) {
55
- return sje.runningBalance?.amount ?? null;
56
- }
57
- return s.balanceAsOfToday?.amount ?? null;
58
- };
44
+ return (s) => s.balanceAsOfToday?.amount;
59
45
  case 'totalAmount':
60
46
  return (s) => s.baseTransaction.amount.amount;
61
47
  case 'transactionDate':
@@ -134,11 +120,6 @@ function getExpenseAutomationJESchedulesView(state) {
134
120
  });
135
121
  });
136
122
  const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
137
- const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
138
- const pendingReviewSchedules = sortJEScheduledTransactions([
139
- ...jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'),
140
- ...validResolveForPending,
141
- ], sortKey, sortOrder);
142
123
  const allSteps = monthYearPeriodId != null
143
124
  ? (0, expenseAutomationViewSelectorTypes_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
144
125
  : [];
@@ -162,7 +143,6 @@ function getExpenseAutomationJESchedulesView(state) {
162
143
  completedSchedules,
163
144
  draftSchedules,
164
145
  ongoingSchedules,
165
- pendingReviewSchedules,
166
146
  resolveSchedules: resolveSchedules,
167
147
  accountSettingsView,
168
148
  postStatusById: postStatusById,
@@ -53,13 +53,8 @@ const sortedJETransactionsView = (jeTransactions, sortKey, sortOrder) => {
53
53
  return jeTransaction.endDate != null
54
54
  ? jeTransaction.endDate.valueOf()
55
55
  : null;
56
- case 'months': {
57
- const total = jeTransaction.period ?? 0;
58
- const posted = Array.isArray(jeTransaction.scheduledJournalEntry)
59
- ? jeTransaction.scheduledJournalEntry.length
60
- : 0;
61
- return total - posted;
62
- }
56
+ case 'months':
57
+ return jeTransaction.period ?? null;
63
58
  case 'transactionType':
64
59
  return jeTransaction.baseTransaction.type.toLowerCase();
65
60
  case 'status':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.18-betaSS1",
3
+ "version": "5.0.18",
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",