@zeniai/client-epic-state 5.1.43-betaRD4 → 5.1.44

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 (25) hide show
  1. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +0 -1
  2. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -1
  3. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +0 -1
  4. package/lib/entity/jeSchedules/jeSchedulesSelector.js +1 -2
  5. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +0 -1
  6. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +0 -1
  7. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +1 -2
  8. package/lib/esm/index.js +3 -3
  9. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +0 -5
  10. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +5 -19
  11. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +21 -9
  12. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +9 -35
  13. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -2
  14. package/lib/index.d.ts +4 -4
  15. package/lib/index.js +41 -44
  16. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +0 -5
  17. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +0 -1
  18. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  19. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +6 -20
  20. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +21 -9
  21. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +3 -20
  22. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +9 -35
  23. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +3 -6
  24. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -4
  25. package/package.json +1 -1
@@ -100,12 +100,12 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
100
100
  }
101
101
  }
102
102
  else {
103
- // reset the selected tab to "review" when visiing detail page and we are not refreshing in Background
103
+ // Visiting an account detail page selects it and opens review; background
104
+ // refresh (e.g. statement Pusher) must not change navigation selection.
104
105
  if (action.payload.refreshViewInBackground !== true) {
105
106
  draft.selectedTab = 'review';
107
+ draft.selectedAccountId = action.payload.accountId;
106
108
  }
107
- // select the account for which we are fetching
108
- draft.selectedAccountId = action.payload.accountId;
109
109
  const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod)];
110
110
  const { transactionFetchState } = accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId];
111
111
  if (transactionFetchState.fetchState !== 'Completed' ||
@@ -522,21 +522,33 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
522
522
  },
523
523
  parseStatementSuccess: (draft, action) => {
524
524
  const { accountId, selectedPeriod } = action.payload;
525
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseStatus = {
525
+ const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
526
+ if (accountRecon == null) {
527
+ return;
528
+ }
529
+ accountRecon.statementParseStatus = {
526
530
  fetchState: 'Completed',
527
531
  error: undefined,
528
532
  };
529
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseInProgress = false;
530
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementProcessingFailed = false;
533
+ accountRecon.statementParseInProgress = false;
534
+ accountRecon.statementProcessingFailed = false;
535
+ // Stop elapsed-time step simulation; keep dismissed flag so the
536
+ // app-level completion snackbar can still fire.
537
+ accountRecon.statementProcessingStartedAtMs = undefined;
538
+ accountRecon.statementProcessingTotalDurationSeconds = undefined;
531
539
  },
532
540
  parseStatementFailure: (draft, action) => {
533
541
  const { accountId, selectedPeriod } = action.payload;
534
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseStatus = {
542
+ const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
543
+ if (accountRecon == null) {
544
+ return;
545
+ }
546
+ accountRecon.statementParseStatus = {
535
547
  fetchState: 'Error',
536
548
  error: action.payload.error,
537
549
  };
538
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseInProgress = false;
539
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementProcessingFailed = true;
550
+ accountRecon.statementParseInProgress = false;
551
+ accountRecon.statementProcessingFailed = true;
540
552
  },
541
553
  reparseStatement: (draft, action) => {
542
554
  const { accountId, selectedPeriod } = action.payload;
@@ -10,24 +10,6 @@ import { UncategorizedAccounts } from '../../accountList/accountListSelector';
10
10
  import { JEAccountSettingsView } from '../selectorTypes/jeAccountSettingsViewSelectorTypes';
11
11
  import { JEScheduledTransactionWithFailedEntries } from '../selectors/jeSchedulesViewSelector';
12
12
  import { JEScheduleLocalData, JESchedulesViewUIState } from '../types/jeSchedulesViewState';
13
- export interface JEKpiSummary {
14
- aiAccountant: {
15
- amount: number;
16
- count: number;
17
- };
18
- manual: {
19
- amount: number;
20
- count: number;
21
- };
22
- needsReview: {
23
- amount: number;
24
- count: number;
25
- };
26
- total: {
27
- amount: number;
28
- count: number;
29
- };
30
- }
31
13
  export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
32
14
  accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
33
15
  accountSettingsView: JEAccountSettingsView;
@@ -36,11 +18,12 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
36
18
  allDepreciationAccountList: AccountBase[];
37
19
  allDepreciationAccountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
38
20
  classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
21
+ completedSchedules: JEScheduledTransaction[];
39
22
  completionStatus: CompletionStatusType;
40
- createdSchedules: JEScheduledTransaction[];
23
+ draftSchedules: JEScheduledTransaction[];
41
24
  ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
42
25
  jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
43
- kpiSummary: JEKpiSummary;
26
+ ongoingSchedules: JEScheduledTransaction[];
44
27
  pendingReviewSchedules: (JEScheduledTransaction | JEScheduledTransactionWithFailedEntries)[];
45
28
  postStatusById: Record<ID, FetchStateAndError>;
46
29
  refreshStatus: FetchStateAndError;
@@ -119,7 +119,11 @@ function getExpenseAutomationJESchedulesView(state) {
119
119
  const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
120
120
  failedJeScheduledTransaction.push(jeScheduleDetails);
121
121
  });
122
- const { sortKey, sortOrder, selectedJETypeFilter } = uiState;
122
+ const { sortKey, sortOrder } = uiState;
123
+ const draftSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'), sortKey, sortOrder);
124
+ const ongoingSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'ongoing'), sortKey, sortOrder);
125
+ const completedSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'completed' ||
126
+ schedule.status.code === 'marked_as_completed'), sortKey, sortOrder);
123
127
  const unsortedResolveSchedules = [];
124
128
  failedJeScheduledTransaction.forEach((schedule) => {
125
129
  schedule.scheduledJournalEntry.forEach((journalEntry) => {
@@ -132,40 +136,9 @@ function getExpenseAutomationJESchedulesView(state) {
132
136
  const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
133
137
  const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
134
138
  const pendingReviewSchedules = sortJEScheduledTransactions([
135
- ...jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft' &&
136
- (selectedJETypeFilter == null ||
137
- schedule.jeScheduleType === selectedJETypeFilter)),
139
+ ...jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'),
138
140
  ...validResolveForPending,
139
141
  ], sortKey, sortOrder);
140
- const createdSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => (schedule.status.code === 'ongoing' ||
141
- schedule.status.code === 'completed' ||
142
- schedule.status.code === 'marked_as_completed') &&
143
- (selectedJETypeFilter == null ||
144
- schedule.jeScheduleType === selectedJETypeFilter)), sortKey, sortOrder);
145
- // KPI summary — derived from unfiltered schedules so counts are always accurate
146
- const allSchedules = jeScheduledTransaction;
147
- const sumAmount = (schedules) => schedules.reduce((total, schedule) => total + (schedule.baseTransaction.amount.amount ?? 0), 0);
148
- const aiAccountantSchedules = allSchedules.filter((schedule) => schedule.confidenceScore != null);
149
- const pendingUnfiltered = allSchedules.filter((schedule) => schedule.status.code === 'draft');
150
- const kpiSummary = {
151
- aiAccountant: {
152
- count: aiAccountantSchedules.length,
153
- amount: sumAmount(aiAccountantSchedules),
154
- },
155
- manual: {
156
- count: allSchedules.filter((schedule) => schedule.confidenceScore == null)
157
- .length,
158
- amount: sumAmount(allSchedules.filter((schedule) => schedule.confidenceScore == null)),
159
- },
160
- needsReview: {
161
- count: pendingUnfiltered.length,
162
- amount: sumAmount(pendingUnfiltered),
163
- },
164
- total: {
165
- count: allSchedules.length,
166
- amount: sumAmount(allSchedules),
167
- },
168
- };
169
142
  const allSteps = monthYearPeriodId != null
170
143
  ? (0, expenseAutomationViewSelectorTypes_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
171
144
  : [];
@@ -186,8 +159,9 @@ function getExpenseAutomationJESchedulesView(state) {
186
159
  allAccountList: filteredAccounts,
187
160
  accountListNestedAccountHierarchy,
188
161
  allClassList: allClasses,
189
- createdSchedules,
190
- kpiSummary,
162
+ completedSchedules,
163
+ draftSchedules,
164
+ ongoingSchedules,
191
165
  pendingReviewSchedules,
192
166
  resolveSchedules: resolveSchedules,
193
167
  accountSettingsView,
@@ -8,18 +8,15 @@ import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSched
8
8
  import { VendorBase } from '../../../entity/vendor/vendorState';
9
9
  export declare const toJEScheduleSortKey: (v: string) => "vendor" | "type" | "category" | "class" | "memo" | "transactionDate" | "totalAmount" | "runningBalance" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "jePostingDate" | "remainingMonths";
10
10
  export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
11
- export declare const toJEPageTab: (v: string) => "schedules" | "historical_schedules";
12
- export type JEPageTab = ReturnType<typeof toJEPageTab>;
11
+ export declare const toJEScheduleMainTab: (v: string) => "completed" | "pending_review" | "ongoing";
12
+ export type JEScheduleMainTab = ReturnType<typeof toJEScheduleMainTab>;
13
13
  export interface JESchedulesViewUIState {
14
- createdGroupCollapsed: boolean;
15
- pendingGroupCollapsed: boolean;
16
14
  scrollPosition: {
17
15
  scrollTop: number;
18
16
  scrollLeft?: number;
19
17
  } | undefined;
20
18
  searchString: string;
21
- selectedJETypeFilter: ScheduleTypes | null;
22
- selectedPageTab: JEPageTab;
19
+ selectedMainTab: JEScheduleMainTab;
23
20
  sortKey: JEScheduleSortKey;
24
21
  sortOrder: SortOrder;
25
22
  totalCount: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toJEPageTab = exports.toJEScheduleSortKey = void 0;
3
+ exports.toJEScheduleMainTab = exports.toJEScheduleSortKey = void 0;
4
4
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
5
  const JE_SCHEDULE_SORT_KEYS = [
6
6
  'vendor',
@@ -20,6 +20,10 @@ const JE_SCHEDULE_SORT_KEYS = [
20
20
  ];
21
21
  const toJEScheduleSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_SORT_KEYS);
22
22
  exports.toJEScheduleSortKey = toJEScheduleSortKey;
23
- const JE_PAGE_TABS = ['schedules', 'historical_schedules'];
24
- const toJEPageTab = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_PAGE_TABS);
25
- exports.toJEPageTab = toJEPageTab;
23
+ const JE_SCHEDULE_MAIN_TABS = [
24
+ 'pending_review',
25
+ 'ongoing',
26
+ 'completed',
27
+ ];
28
+ const toJEScheduleMainTab = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_MAIN_TABS);
29
+ exports.toJEScheduleMainTab = toJEScheduleMainTab;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.43-betaRD4",
3
+ "version": "5.1.44",
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",