@zeniai/client-epic-state 5.1.71 → 5.1.72-betaRD1

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 (71) hide show
  1. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +2 -0
  2. package/lib/entity/jeSchedules/jeSchedulesPayload.js +2 -0
  3. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -0
  4. package/lib/entity/jeSchedules/jeSchedulesSelector.js +11 -1
  5. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
  6. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.d.ts +1 -0
  7. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +1 -0
  8. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -0
  9. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
  10. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  11. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
  12. package/lib/epic.d.ts +5 -1
  13. package/lib/epic.js +5 -1
  14. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +2 -0
  15. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +11 -1
  16. package/lib/esm/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +1 -0
  17. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  18. package/lib/esm/epic.js +5 -1
  19. package/lib/esm/index.js +12 -6
  20. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +23 -3
  21. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +21 -0
  22. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
  23. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +73 -0
  24. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
  25. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  26. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +133 -8
  27. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  28. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +70 -0
  29. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +110 -15
  30. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +3 -6
  31. package/lib/esm/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +13 -16
  32. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewPayload.js +7 -2
  33. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewReducer.js +55 -10
  34. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewSelector.js +23 -13
  35. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewState.js +1 -0
  36. package/lib/index.d.ts +13 -9
  37. package/lib/index.js +72 -48
  38. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -2
  39. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +21 -1
  40. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  41. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  42. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
  43. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
  44. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  45. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +77 -0
  46. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  47. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
  48. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  49. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  50. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +7 -1
  51. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +40 -9
  52. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +134 -8
  53. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +25 -0
  54. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  55. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +31 -7
  56. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +10 -0
  57. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +75 -0
  58. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +4 -1
  59. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +112 -14
  60. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +53 -6
  61. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -8
  62. package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.d.ts +2 -8
  63. package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +10 -13
  64. package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.d.ts +2 -1
  65. package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.js +7 -2
  66. package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.d.ts +6 -1
  67. package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.js +56 -11
  68. package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.js +23 -15
  69. package/lib/view/notificationPreferencesView/notificationPreferencesViewState.d.ts +1 -0
  70. package/lib/view/notificationPreferencesView/notificationPreferencesViewState.js +1 -0
  71. package/package.json +1 -1
@@ -0,0 +1,140 @@
1
+ import { toAmount } from '../../../commonStateTypes/amount';
2
+ import { DEFAULT_DATE_FORMAT } from '../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
3
+ import { MONTH_YEAR_FORMAT } from '../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
4
+ import { LAST_SCHEDULE_DAY_OF_MONTH } from '../../../commonStateTypes/timePeriod';
5
+ import { getPostingDateAndStatusForIndex } from '../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper';
6
+ import { mapScheduleTransactionToBaseScheduleTransactionPayload, } from '../../scheduleView/scheduleDetailView/scheduleDetailPayload';
7
+ const getNewScheduleMemo = (vendorName, schedulePostingDate, currentPeriod, totalPeriod, assetId) => {
8
+ const addAsset = assetId != null && assetId !== '' ? ` - ${assetId}` : '';
9
+ return `${vendorName} - ${schedulePostingDate.format(MONTH_YEAR_FORMAT)} (${currentPeriod} of ${totalPeriod})${addAsset}`;
10
+ };
11
+ /**
12
+ * Computes the month-by-month JE schedule breakdown for a brand-new schedule
13
+ * (no linked transaction yet) — replicates createNewSchedulesHelper's math
14
+ * (scheduleDetailLocalDataHelper.ts) exactly: lump-sum total split evenly
15
+ * across months with the rounding remainder absorbed by the last month, and a
16
+ * running balance that decrements each month and is forced to exactly 0 on
17
+ * the last row.
18
+ */
19
+ export const computeNewScheduleJeDetails = (localData, totalAmount, vendorName) => {
20
+ const period = localData.selectedMonths;
21
+ const startingMonth = localData.selectedDate;
22
+ if (startingMonth == null || period == null) {
23
+ return [];
24
+ }
25
+ const assetId = 'assetId' in localData ? localData.assetId : undefined;
26
+ const averageAmount = Math.abs(Math.round((totalAmount.amount / period) * 100) / 100);
27
+ const lastMonthAmount = Math.abs(Math.round((Math.abs(totalAmount.amount) - averageAmount * (period - 1)) * 100) / 100);
28
+ let runningBalance = Math.abs(totalAmount.amount);
29
+ const negativeNumbers = totalAmount.amount < 0 || runningBalance < 0;
30
+ const newJeDetails = [];
31
+ for (let index = 0; index < period; index++) {
32
+ if (runningBalance > averageAmount) {
33
+ runningBalance = Math.round((runningBalance - averageAmount) * 100) / 100;
34
+ }
35
+ else {
36
+ runningBalance = 0;
37
+ }
38
+ const amount = index === period - 1 ? lastMonthAmount : averageAmount;
39
+ runningBalance = index === period - 1 ? 0 : runningBalance;
40
+ const schedulePostingDate = startingMonth.add(index, 'month');
41
+ const { postingDate, postingStatus } = getPostingDateAndStatusForIndex(schedulePostingDate.month(), schedulePostingDate.year(), localData.lastDayOfMonth === true
42
+ ? undefined
43
+ : localData.selectedDayOfMonth);
44
+ newJeDetails.push({
45
+ postingDate,
46
+ amount: toAmount(negativeNumbers ? -amount : amount, totalAmount.currencyCode, totalAmount.currencySymbol),
47
+ runningBalance: toAmount(negativeNumbers ? -runningBalance : runningBalance, totalAmount.currencyCode, totalAmount.currencySymbol),
48
+ postingStatus,
49
+ memo: getNewScheduleMemo(vendorName, schedulePostingDate, index + 1, period, assetId),
50
+ jeLink: { type: 'unknown' },
51
+ });
52
+ }
53
+ return newJeDetails;
54
+ };
55
+ const mapNewJeDetailsToScheduledJournalEntryPayload = (jeScheduleDetails) => jeScheduleDetails.map((journalEntry) => ({
56
+ status: {
57
+ code: journalEntry.postingStatus,
58
+ label: journalEntry.postingStatus,
59
+ },
60
+ transaction_memo: journalEntry.memo,
61
+ third_party_id: journalEntry.jeLink.thirdPartyTransactionId ?? null,
62
+ expected_post_date: journalEntry.postingDate.format(DEFAULT_DATE_FORMAT),
63
+ amount: journalEntry.amount.amount,
64
+ balance: journalEntry.runningBalance.amount,
65
+ // Brand-new schedule — there is no prior scheduled-journal-entry history
66
+ // to cross-reference (unlike the legacy edit flow's equivalent mapper).
67
+ scheduled_journal_entry_id: null,
68
+ actual_post_date: null,
69
+ is_platform_generated: null,
70
+ je_schedule_id: null,
71
+ update_time: null,
72
+ create_time: null,
73
+ }));
74
+ /**
75
+ * Builds a savable schedule payload directly from a Base Transaction search
76
+ * result and the New Schedule form's local data — bypassing the legacy
77
+ * getJEScheduledTransactionByJEScheduleTransactionKey selector entirely,
78
+ * since that selector throws unless the entity has already round-tripped
79
+ * through a real GET /1.0/schedules/:id. A brand-new schedule has no such
80
+ * history, so this reads only from data already in hand (the selected
81
+ * transaction/line plus what the user filled into the form).
82
+ */
83
+ export const prepareNewSchedulePayload = (transaction, localData, scheduleType) => {
84
+ if (transaction.thirdPartyTransactionId == null ||
85
+ transaction.thirdPartyTransactionId === '') {
86
+ return { ok: false, reason: 'missing_third_party_id' };
87
+ }
88
+ const scheduleTransaction = transaction;
89
+ const vendorId = localData.selectedVendor?.id ?? transaction.vendorId ?? '';
90
+ const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
91
+ if (vendorId === '' || vendorName === '') {
92
+ return { ok: false, reason: 'missing_vendor' };
93
+ }
94
+ const vendor = {
95
+ vendor_id: vendorId,
96
+ vendor_name: vendorName,
97
+ };
98
+ const jeScheduleDetails = computeNewScheduleJeDetails(localData, scheduleTransaction.amount, vendorName);
99
+ const postingDate = localData.selectedDayOfMonth ??
100
+ (localData.lastDayOfMonth === true ? LAST_SCHEDULE_DAY_OF_MONTH : null);
101
+ const firstJEScheduleDate = jeScheduleDetails.length > 0
102
+ ? jeScheduleDetails[0].postingDate.format(DEFAULT_DATE_FORMAT)
103
+ : null;
104
+ const lastJEScheduleDate = jeScheduleDetails.length > 0
105
+ ? jeScheduleDetails[jeScheduleDetails.length - 1].postingDate.format(DEFAULT_DATE_FORMAT)
106
+ : null;
107
+ const isFixedAssets = scheduleType === 'fixed_assets';
108
+ const assetId = 'assetId' in localData ? localData.assetId : undefined;
109
+ const selectedAccumulatedDepreciationCategory = 'selectedAccumulatedDepreciationCategory' in localData
110
+ ? localData.selectedAccumulatedDepreciationCategory
111
+ : undefined;
112
+ const status = { code: 'new', label: 'New' };
113
+ const jeSchedulePayload = {
114
+ status,
115
+ vendor,
116
+ currency_code: scheduleTransaction.currency.currencyCode,
117
+ currency_symbol: scheduleTransaction.currency.currencySymbol,
118
+ period: localData.selectedMonths ?? null,
119
+ je_schedule_type: scheduleType,
120
+ posting_date: postingDate,
121
+ balance: scheduleTransaction.amount.amount,
122
+ start_date: firstJEScheduleDate,
123
+ end_date: lastJEScheduleDate,
124
+ je_credit_accounting_class_id: scheduleTransaction.classBase?.classId ?? null,
125
+ je_credit_account_id: isFixedAssets
126
+ ? (selectedAccumulatedDepreciationCategory ?? null)
127
+ : scheduleTransaction.account.accountId,
128
+ je_debit_account_id: localData.selectedAccount ?? null,
129
+ je_debit_accounting_class_id: localData.selectedClass ?? null,
130
+ other_attributes: assetId != null ? { asset_id: assetId } : {},
131
+ base_transaction: mapScheduleTransactionToBaseScheduleTransactionPayload(scheduleTransaction),
132
+ };
133
+ return {
134
+ ok: true,
135
+ payload: {
136
+ je_schedules: [jeSchedulePayload],
137
+ scheduled_journal_entries: mapNewJeDetailsToScheduledJournalEntryPayload(jeScheduleDetails),
138
+ },
139
+ };
140
+ };
@@ -2,8 +2,9 @@ import { createSlice } from '@reduxjs/toolkit';
2
2
  import { geNestedAccountIDHierarchyForReport } from '../../../commonStateTypes/accountView/getNestedAccountIDHierarchyForReport';
3
3
  import { toMonthYearPeriodId, } from '../../../commonStateTypes/timePeriod';
4
4
  import { mapAccountBasePayloadToAccountBase, mapAccountMetadataPayloadToAccountMetadata, } from '../../../entity/account/accountPayload';
5
- import { getJEScheduleTransactionDetailKeyPayload, } from '../../../entity/jeSchedules/jeSchedulesPayload';
5
+ import { getJEScheduleKey, getJEScheduleTransactionDetailKeyPayload, } from '../../../entity/jeSchedules/jeSchedulesPayload';
6
6
  import { mapAccountTypeRecommendationPayloadToAccountRecommendationByType, } from '../../accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload';
7
+ import { MIN_NEW_SCHEDULE_SEARCH_LENGTH, } from '../types/jeSchedulesViewState';
7
8
  export const accountSettingsInitialState = {
8
9
  localData: {
9
10
  selectedPrepaidExpensesAccountIds: [],
@@ -35,16 +36,33 @@ export const accountSettingsInitialState = {
35
36
  accruedExpensesNestedAccountListHierarchy: [],
36
37
  accruedExpensesRecommendations: [],
37
38
  };
39
+ export const getBaseNewScheduleLocalData = (scheduleType) => ({
40
+ scheduleType,
41
+ jeScheduleDetails: [],
42
+ });
43
+ export const newScheduleInitialState = {
44
+ fixed_assets: getBaseNewScheduleLocalData('fixed_assets'),
45
+ prepaid_expenses: getBaseNewScheduleLocalData('prepaid_expenses'),
46
+ };
47
+ export const searchTransactionsInitialState = {
48
+ searchResults: [],
49
+ fetchState: 'Not-Started',
50
+ error: undefined,
51
+ };
38
52
  export const initialState = {
39
53
  jeScheduleTransactionKeysByPeriod: {},
54
+ jeScheduleAccruedKeysByPeriod: {},
40
55
  failedJeScheduleTransactionKeysByPeriod: {},
41
56
  postStatusById: {},
42
57
  ignoreStatusById: {},
43
58
  jeScheduleLocalDataById: {},
44
59
  uiState: {
45
- searchString: '',
60
+ createdGroupCollapsed: false,
61
+ pendingGroupCollapsed: false,
46
62
  scrollPosition: { scrollTop: 0, scrollLeft: undefined },
47
- selectedMainTab: 'pending_review',
63
+ searchString: '',
64
+ selectedJETypeFilter: null,
65
+ selectedPageTab: 'schedules',
48
66
  sortKey: 'transactionDate',
49
67
  sortOrder: 'descending',
50
68
  totalCount: 0,
@@ -55,6 +73,13 @@ export const initialState = {
55
73
  error: undefined,
56
74
  },
57
75
  accountSettings: accountSettingsInitialState,
76
+ newSchedule: {
77
+ newScheduleState: newScheduleInitialState,
78
+ saveStatus: { fetchState: 'Not-Started', error: undefined },
79
+ searchTransactions: searchTransactionsInitialState,
80
+ fetchState: 'Not-Started',
81
+ error: undefined,
82
+ },
58
83
  fetchState: 'Not-Started',
59
84
  error: undefined,
60
85
  hasValidState() {
@@ -99,9 +124,10 @@ const expenseAutomationJESchedulesView = createSlice({
99
124
  },
100
125
  },
101
126
  fetchJeSchedulesSuccess(draft, action) {
102
- const { jeSchedules, selectedPeriod, failedJeSchedules, refreshViewInBackground, } = action.payload;
127
+ const { jeSchedules, selectedPeriod, failedJeSchedules, accruedJeSchedules, refreshViewInBackground, } = action.payload;
103
128
  const jeScheduleTransactionKeys = jeSchedules.map((schedules) => getJEScheduleTransactionDetailKeyPayload(schedules.base_transaction));
104
129
  const failedJeScheduleTransactionKeys = failedJeSchedules.map((schedules) => getJEScheduleTransactionDetailKeyPayload(schedules.base_transaction));
130
+ const jeScheduleAccruedKeys = accruedJeSchedules.map((schedule) => getJEScheduleKey(schedule));
105
131
  if (refreshViewInBackground === true &&
106
132
  draft.refreshStatus.fetchState === 'In-Progress') {
107
133
  draft.refreshStatus = { fetchState: 'Completed', error: undefined };
@@ -111,6 +137,8 @@ const expenseAutomationJESchedulesView = createSlice({
111
137
  draft.error = undefined;
112
138
  }
113
139
  draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = jeScheduleTransactionKeys;
140
+ draft.jeScheduleAccruedKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] =
141
+ jeScheduleAccruedKeys;
114
142
  draft.failedJeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = failedJeScheduleTransactionKeys;
115
143
  },
116
144
  fetchJeSchedulesFailure(draft, action) {
@@ -121,8 +149,9 @@ const expenseAutomationJESchedulesView = createSlice({
121
149
  else {
122
150
  draft.fetchState = 'Error';
123
151
  draft.error = status;
152
+ draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = [];
153
+ draft.jeScheduleAccruedKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = [];
124
154
  }
125
- draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = [];
126
155
  },
127
156
  retryJeSchedule(draft, action) {
128
157
  const { scheduledJournalEntryID } = action.payload;
@@ -368,6 +397,91 @@ const expenseAutomationJESchedulesView = createSlice({
368
397
  clearJeAccountSettingsLocalData(draft) {
369
398
  draft.accountSettings.localData = accountSettingsInitialState.localData;
370
399
  },
400
+ initializeNewSchedule: {
401
+ prepare({ scheduleType, }) {
402
+ return { payload: { scheduleType } };
403
+ },
404
+ reducer() {
405
+ // Purely an epic-trigger action — the epic fans out the account/class
406
+ // list fetches plus resetNewScheduleLocalData.
407
+ },
408
+ },
409
+ resetNewScheduleLocalData: {
410
+ prepare({ scheduleType, }) {
411
+ return { payload: { scheduleType } };
412
+ },
413
+ reducer(draft, action) {
414
+ const { scheduleType } = action.payload;
415
+ draft.newSchedule.newScheduleState[scheduleType] =
416
+ getBaseNewScheduleLocalData(scheduleType);
417
+ },
418
+ },
419
+ updateNewScheduleLocalData(draft, action) {
420
+ const { scheduleType, localData } = action.payload;
421
+ draft.newSchedule.newScheduleState[scheduleType] = {
422
+ ...draft.newSchedule.newScheduleState[scheduleType],
423
+ ...localData,
424
+ };
425
+ },
426
+ searchTransactionsForNewSchedule: {
427
+ prepare({ query, scheduleType, }) {
428
+ return { payload: { query, scheduleType } };
429
+ },
430
+ reducer(draft, action) {
431
+ const trimmed = action.payload.query.trim();
432
+ // Cleared or too-short query: no API (see epic) — reset immediately.
433
+ if (trimmed.length < MIN_NEW_SCHEDULE_SEARCH_LENGTH) {
434
+ draft.newSchedule.searchTransactions = searchTransactionsInitialState;
435
+ return;
436
+ }
437
+ draft.newSchedule.searchTransactions = {
438
+ ...draft.newSchedule.searchTransactions,
439
+ searchString: action.payload.query,
440
+ fetchState: 'In-Progress',
441
+ };
442
+ },
443
+ },
444
+ searchTransactionsForNewScheduleSuccess(draft, action) {
445
+ draft.newSchedule.searchTransactions = {
446
+ ...draft.newSchedule.searchTransactions,
447
+ searchResults: action.payload.searchResults,
448
+ fetchState: 'Completed',
449
+ error: undefined,
450
+ };
451
+ },
452
+ searchTransactionsForNewScheduleFailure(draft, action) {
453
+ draft.newSchedule.searchTransactions = {
454
+ ...draft.newSchedule.searchTransactions,
455
+ fetchState: 'Error',
456
+ error: action.payload.status,
457
+ };
458
+ },
459
+ clearSearchTransactionsForNewSchedule(draft) {
460
+ draft.newSchedule.searchTransactions = searchTransactionsInitialState;
461
+ },
462
+ saveNewSchedule: {
463
+ prepare({ scheduleType, }) {
464
+ return { payload: { scheduleType } };
465
+ },
466
+ reducer(draft) {
467
+ draft.newSchedule.saveStatus = {
468
+ fetchState: 'In-Progress',
469
+ error: undefined,
470
+ };
471
+ },
472
+ },
473
+ saveNewScheduleSuccess(draft) {
474
+ draft.newSchedule.saveStatus = {
475
+ fetchState: 'Completed',
476
+ error: undefined,
477
+ };
478
+ },
479
+ saveNewScheduleFailure(draft, action) {
480
+ draft.newSchedule.saveStatus = {
481
+ fetchState: 'Error',
482
+ error: action.payload.status,
483
+ };
484
+ },
371
485
  updateJESchedulesUIState(draft, action) {
372
486
  if (action.payload.sortKey != null) {
373
487
  draft.uiState.sortKey = action.payload.sortKey;
@@ -381,16 +495,27 @@ const expenseAutomationJESchedulesView = createSlice({
381
495
  if (action.payload.scrollPosition != null) {
382
496
  draft.uiState.scrollPosition = action.payload.scrollPosition;
383
497
  }
384
- if (action.payload.selectedMainTab != null) {
385
- draft.uiState.selectedMainTab = action.payload.selectedMainTab;
498
+ if (action.payload.selectedPageTab != null) {
499
+ draft.uiState.selectedPageTab = action.payload.selectedPageTab;
386
500
  }
387
501
  },
502
+ updateJEScheduleTypeFilter(draft, action) {
503
+ draft.uiState.selectedJETypeFilter = action.payload;
504
+ },
505
+ toggleJEPendingGroupCollapsed(draft) {
506
+ draft.uiState.pendingGroupCollapsed =
507
+ !draft.uiState.pendingGroupCollapsed;
508
+ },
509
+ toggleJECreatedGroupCollapsed(draft) {
510
+ draft.uiState.createdGroupCollapsed =
511
+ !draft.uiState.createdGroupCollapsed;
512
+ },
388
513
  clearExpenseAutomationJESchedulesView(draft) {
389
514
  Object.assign(draft, initialState);
390
515
  },
391
516
  },
392
517
  });
393
- export const { clearExpenseAutomationJESchedulesView, clearJeAccountSettingsLocalData, clearJeScheduleLocalData, fetchAccountSettingsListForAccountTypes, fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesPage, fetchJeSchedulesSuccess, fetchRecommendationForAccountSettings, ignoreRecommendedJeSchedule, ignoreRecommendedJeScheduleFailure, ignoreRecommendedJeScheduleSuccess, initializeAccountSettingsView, initializeJeScheduleLocalData, removeFailedJeScheduleTransactionKey, removeJeScheduleLocalDataById, removeJeScheduleTransactionKey, retryJeSchedule, retryJeScheduleFailure, retryJeScheduleSuccess, saveAccountSettings, saveAccountSettingsFailure, saveAccountSettingsLocalData, saveAccountSettingsSuccess, updateAccountSettingsListForAccountTypes, updateAccountSettingsListForAccountTypesFailure, updateJESchedulesUIState, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, updateRecommendationForAccountSettings, updateRecommendationForAccountSettingsFailure, } = expenseAutomationJESchedulesView.actions;
518
+ export const { clearExpenseAutomationJESchedulesView, clearJeAccountSettingsLocalData, clearJeScheduleLocalData, clearSearchTransactionsForNewSchedule, fetchAccountSettingsListForAccountTypes, fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesPage, fetchJeSchedulesSuccess, fetchRecommendationForAccountSettings, ignoreRecommendedJeSchedule, ignoreRecommendedJeScheduleFailure, ignoreRecommendedJeScheduleSuccess, initializeAccountSettingsView, initializeJeScheduleLocalData, initializeNewSchedule, removeFailedJeScheduleTransactionKey, removeJeScheduleLocalDataById, removeJeScheduleTransactionKey, resetNewScheduleLocalData, retryJeSchedule, retryJeScheduleFailure, retryJeScheduleSuccess, saveAccountSettings, saveAccountSettingsFailure, saveAccountSettingsLocalData, saveAccountSettingsSuccess, saveNewSchedule, saveNewScheduleFailure, saveNewScheduleSuccess, searchTransactionsForNewSchedule, searchTransactionsForNewScheduleFailure, searchTransactionsForNewScheduleSuccess, toggleJECreatedGroupCollapsed, toggleJEPendingGroupCollapsed, updateAccountSettingsListForAccountTypes, updateAccountSettingsListForAccountTypesFailure, updateJESchedulesUIState, updateJEScheduleTypeFilter, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, updateNewScheduleLocalData, updateRecommendationForAccountSettings, updateRecommendationForAccountSettingsFailure, } = expenseAutomationJESchedulesView.actions;
394
519
  export default expenseAutomationJESchedulesView.reducer;
395
520
  const doUpdateRecommendationForAccountSettings = (draft, payload) => {
396
521
  const { prepaidExpensesRecommendations, fixedAssetsRecommendations, accruedExpensesRecommendations, } = mapAccountTypeRecommendationPayloadToAccountRecommendationByType(payload);
@@ -0,0 +1,70 @@
1
+ import { getAccountIdsForTypes } from '../../../entity/account/accountSelector';
2
+ import { getScheduleTransactionById } from '../../../entity/transaction/transactionSelector';
3
+ import { getAccountIdsForLabel, getAccountList, getNestedAccountListHierarchy, } from '../../accountList/accountListSelector';
4
+ import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
5
+ import { getAccountsTypesForScheduleDetails } from '../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper';
6
+ import { filterNestedAccountHierarchyById } from '../../scheduleView/scheduleDetailView/scheduleDetailSelector';
7
+ import { getAccountLabelForScheduleType, getAccountsTypesForScheduleEpics, } from '../../scheduleView/scheduleListView/scheduleListHelper';
8
+ /**
9
+ * The Base Transaction search is shared across schedule types (one search
10
+ * box, not one per prepaid_expenses/fixed_assets) — split out from
11
+ * getNewScheduleView so a consumer can read it without supplying an
12
+ * otherwise-irrelevant scheduleType.
13
+ */
14
+ export const getNewScheduleSearchTransactionsView = (state) => {
15
+ const { searchTransactions } = state.expenseAutomationJESchedulesViewState.newSchedule;
16
+ const searchTransactionsResults = searchTransactions.searchResults
17
+ .map((key) => getScheduleTransactionById(state.transactionState, key))
18
+ .filter((transaction) => transaction != null);
19
+ return {
20
+ searchTransactionsResults,
21
+ searchTransactionsFetchState: {
22
+ fetchState: searchTransactions.fetchState,
23
+ error: searchTransactions.error,
24
+ },
25
+ searchTransactionsString: searchTransactions.searchString,
26
+ };
27
+ };
28
+ export const getNewScheduleView = (state, scheduleType) => {
29
+ const { accountState, accountListState, classState, classListState } = state;
30
+ const { newSchedule } = state.expenseAutomationJESchedulesViewState;
31
+ const searchTransactionsView = getNewScheduleSearchTransactionsView(state);
32
+ const accountType = getAccountsTypesForScheduleEpics();
33
+ const newScheduleAccountTypes = getAccountsTypesForScheduleDetails(scheduleType);
34
+ const newScheduleAccountIds = getAccountIdsForTypes(accountState, newScheduleAccountTypes);
35
+ const allAccountList = getAccountList(accountState, accountListState, accountType.accountListKey);
36
+ const filteredAccounts = allAccountList.accounts.filter((account) => newScheduleAccountIds.includes(account.accountId));
37
+ const accountListNestedAccountHierarchy = filterNestedAccountHierarchyById(getNestedAccountListHierarchy(accountListState, accountType.accountListKey), filteredAccounts.map((account) => account.accountId));
38
+ const allClassList = getClassList(classState, classListState);
39
+ const classListNestedAccountHierarchy = getNestedClassListHierarchy(classListState);
40
+ let allDepreciationAccountList;
41
+ let allDepreciationAccountListNestedAccountHierarchy;
42
+ if (scheduleType === 'fixed_assets') {
43
+ const depreciationCategoryIds = getAccountIdsForTypes(accountState, [
44
+ 'fixed_assets',
45
+ 'other_assets',
46
+ ]);
47
+ const accountLabel = getAccountLabelForScheduleType('fixed_assets');
48
+ const fixedAssetLabelAccountIds = accountLabel != null
49
+ ? getAccountIdsForLabel(accountListState, accountType.accountListKey, accountLabel)
50
+ : [];
51
+ allDepreciationAccountList = allAccountList.accounts.filter((account) => depreciationCategoryIds.includes(account.accountId) &&
52
+ !fixedAssetLabelAccountIds.includes(account.accountId));
53
+ allDepreciationAccountListNestedAccountHierarchy =
54
+ filterNestedAccountHierarchyById(getNestedAccountListHierarchy(accountListState, accountType.accountListKey), allDepreciationAccountList.map((account) => account.accountId));
55
+ }
56
+ return {
57
+ scheduleType,
58
+ accountListNestedAccountHierarchy,
59
+ allAccountList: filteredAccounts,
60
+ allClassList: allClassList.classes,
61
+ allDepreciationAccountList,
62
+ allDepreciationAccountListNestedAccountHierarchy,
63
+ classListNestedAccountHierarchy,
64
+ newScheduleLocalData: newSchedule.newScheduleState[scheduleType],
65
+ saveStatus: newSchedule.saveStatus,
66
+ ...searchTransactionsView,
67
+ fetchState: newSchedule.fetchState,
68
+ error: newSchedule.error,
69
+ };
70
+ };
@@ -3,7 +3,8 @@ import orderBy from 'lodash/orderBy';
3
3
  import { reduceAnyFetchState } from '../../../commonStateTypes/reduceFetchState';
4
4
  import { LAST_SCHEDULE_DAY_OF_MONTH, toMonthYearPeriodId, } from '../../../commonStateTypes/timePeriod';
5
5
  import { getAccountIdsForTypes } from '../../../entity/account/accountSelector';
6
- import { getJEScheduledTransactionByJEScheduleTransactionKey, } from '../../../entity/jeSchedules/jeSchedulesSelector';
6
+ import { getJEAccruedScheduleByJEScheduleKey, getJEScheduledTransactionByJEScheduleTransactionKey, } from '../../../entity/jeSchedules/jeSchedulesSelector';
7
+ import { ALL_SCHEDULES_TYPES, } from '../../../entity/jeSchedules/jeSchedulesTypes';
7
8
  import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
8
9
  import { getAccountIdsForLabel, getAccountList, getNestedAccountListHierarchy, getUncategorizedAccounts, } from '../../accountList/accountListSelector';
9
10
  import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
@@ -12,6 +13,31 @@ import { filterNestedAccountHierarchyById } from '../../scheduleView/scheduleDet
12
13
  import { getAccountLabelForScheduleType, getAccountsTypesForScheduleList, } from '../../scheduleView/scheduleListView/scheduleListHelper';
13
14
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
14
15
  import { getJEAccountSettingsView } from './jeAccountSettingsViewSelector';
16
+ import { getNewScheduleView } from './jeNewScheduleViewSelector';
17
+ // Matches the AI-automation user addresses webc's schedule list row already
18
+ // checks (JEScheduleReadOnlyListRow/JEScheduleDraftListRow "Method" column,
19
+ // strings.ts aiBotEmail/botEmail) to determine whether a schedule was
20
+ // created by the AI accountant vs. a human.
21
+ const AI_BOT_EMAIL = 'ai@zeni.ai';
22
+ const BOT_EMAIL = 'bot@zeni.ai';
23
+ // Exported (rather than kept as a closure inside the selector) so it can be
24
+ // unit-tested directly — confidenceScore is a separate, more narrowly
25
+ // populated field that can be null on a schedule the bot user created,
26
+ // which previously caused these schedules to display as "AI Accountant" in
27
+ // the list but count under "Manual" in the KPI summary.
28
+ export const isAiAccountantSchedule = (schedule) => schedule.createdByUser?.email === AI_BOT_EMAIL ||
29
+ schedule.createdByUser?.email === BOT_EMAIL;
30
+ // Accrued schedules are structurally distinct — no baseTransaction, carrying recurringAmount and
31
+ // memo in its place — so anything reading baseTransaction has to branch on this first.
32
+ export function isAccruedScheduleRow(schedule) {
33
+ return schedule.jeScheduleType === 'accrued_expenses';
34
+ }
35
+ function getScheduleAmount(schedule) {
36
+ if (isAccruedScheduleRow(schedule)) {
37
+ return schedule.recurringAmount.amount;
38
+ }
39
+ return schedule.baseTransaction.amount.amount;
40
+ }
15
41
  function getJEScheduleSortAccessor(sortKey) {
16
42
  switch (sortKey) {
17
43
  case 'vendor':
@@ -23,7 +49,9 @@ function getJEScheduleSortAccessor(sortKey) {
23
49
  case 'depCategory':
24
50
  return (s) => s.jeCredit.account?.accountName?.toLowerCase();
25
51
  case 'scheduleCategory':
26
- return (s) => s.baseTransaction.account?.accountName?.toLowerCase();
52
+ return (s) => isAccruedScheduleRow(s)
53
+ ? undefined
54
+ : s.baseTransaction.account?.accountName?.toLowerCase();
27
55
  case 'startMonth':
28
56
  return (s) => s.startDate?.valueOf();
29
57
  case 'type':
@@ -51,11 +79,13 @@ function getJEScheduleSortAccessor(sortKey) {
51
79
  return s.balanceAsOfToday?.amount ?? null;
52
80
  };
53
81
  case 'totalAmount':
54
- return (s) => s.baseTransaction.amount.amount;
82
+ return (s) => getScheduleAmount(s);
55
83
  case 'transactionDate':
56
- return (s) => s.baseTransaction.date.valueOf();
84
+ return (s) => s.createTime?.valueOf();
57
85
  case 'memo':
58
- return (s) => s.baseTransaction.memo?.toLowerCase();
86
+ return (s) => isAccruedScheduleRow(s)
87
+ ? s.memo.toLowerCase()
88
+ : s.baseTransaction.memo?.toLowerCase();
59
89
  default:
60
90
  return (s) => s.startDate?.valueOf();
61
91
  }
@@ -67,9 +97,14 @@ function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
67
97
  export function getExpenseAutomationJESchedulesView(state) {
68
98
  const jeScheduledTransaction = [];
69
99
  const failedJeScheduledTransaction = [];
100
+ const accruedSchedules = [];
70
101
  const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
71
- const { jeScheduleTransactionKeysByPeriod, failedJeScheduleTransactionKeysByPeriod, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, } = expenseAutomationJESchedulesViewState;
102
+ const { jeScheduleTransactionKeysByPeriod, jeScheduleAccruedKeysByPeriod, failedJeScheduleTransactionKeysByPeriod, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, newSchedule, } = expenseAutomationJESchedulesViewState;
72
103
  const accountSettingsView = getJEAccountSettingsView(state);
104
+ const newScheduleView = newSchedule.selectedDetailScheduleType === 'fixed_assets' ||
105
+ newSchedule.selectedDetailScheduleType === 'prepaid_expenses'
106
+ ? getNewScheduleView(state, newSchedule.selectedDetailScheduleType)
107
+ : undefined;
73
108
  const currentTenant = getCurrentTenant(state);
74
109
  const { selectedPeriodByTenantId } = expenseAutomationViewState;
75
110
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
@@ -105,19 +140,24 @@ export function getExpenseAutomationJESchedulesView(state) {
105
140
  : null;
106
141
  const jeScheduleTransactionKeys = jeScheduleTransactionKeysForSelectedPeriod ?? [];
107
142
  const failedJeScheduleTransactionKeys = failedJeScheduleTransactionKeysForSelectedPeriod ?? [];
143
+ const jeScheduleAccruedKeys = (monthYearPeriodId != null
144
+ ? jeScheduleAccruedKeysByPeriod[monthYearPeriodId]
145
+ : null) ?? [];
108
146
  jeScheduleTransactionKeys.forEach((jeScheduleKey) => {
109
147
  const jeScheduleDetails = getJEScheduledTransactionByJEScheduleTransactionKey(jeScheduleKey, state);
110
148
  jeScheduledTransaction.push(jeScheduleDetails);
111
149
  });
150
+ jeScheduleAccruedKeys.forEach((jeAccruedScheduleKey) => {
151
+ const accruedScheduleDetails = getJEAccruedScheduleByJEScheduleKey(jeAccruedScheduleKey, state);
152
+ if (accruedScheduleDetails != null) {
153
+ accruedSchedules.push(accruedScheduleDetails);
154
+ }
155
+ });
112
156
  failedJeScheduleTransactionKeys.forEach((jeScheduleKey) => {
113
157
  const jeScheduleDetails = getJEScheduledTransactionByJEScheduleTransactionKey(jeScheduleKey, state);
114
158
  failedJeScheduledTransaction.push(jeScheduleDetails);
115
159
  });
116
- const { sortKey, sortOrder } = uiState;
117
- const draftSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'), sortKey, sortOrder);
118
- const ongoingSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'ongoing'), sortKey, sortOrder);
119
- const completedSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'completed' ||
120
- schedule.status.code === 'marked_as_completed'), sortKey, sortOrder);
160
+ const { sortKey, sortOrder, selectedJETypeFilter } = uiState;
121
161
  const unsortedResolveSchedules = [];
122
162
  failedJeScheduledTransaction.forEach((schedule) => {
123
163
  schedule.scheduledJournalEntry.forEach((journalEntry) => {
@@ -129,10 +169,46 @@ export function getExpenseAutomationJESchedulesView(state) {
129
169
  });
130
170
  const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
131
171
  const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
172
+ const matchesTypeFilter = (schedule) => selectedJETypeFilter == null ||
173
+ schedule.jeScheduleType === selectedJETypeFilter;
174
+ const isCreatedStatus = (schedule) => schedule.status.code === 'ongoing' ||
175
+ schedule.status.code === 'completed' ||
176
+ schedule.status.code === 'marked_as_completed';
177
+ const allScheduleRows = [
178
+ ...jeScheduledTransaction,
179
+ ...accruedSchedules,
180
+ ];
132
181
  const pendingReviewSchedules = sortJEScheduledTransactions([
133
- ...jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'),
182
+ ...allScheduleRows.filter((schedule) => schedule.status.code === 'draft' && matchesTypeFilter(schedule)),
134
183
  ...validResolveForPending,
135
184
  ], sortKey, sortOrder);
185
+ const createdSchedules = sortJEScheduledTransactions(allScheduleRows.filter((schedule) => isCreatedStatus(schedule) && matchesTypeFilter(schedule)), sortKey, sortOrder);
186
+ // KPI summary — derived from unfiltered schedules so counts are always accurate
187
+ const allSchedules = allScheduleRows;
188
+ const sumAmount = (schedules) => schedules.reduce((total, schedule) => total + (getScheduleAmount(schedule) ?? 0), 0);
189
+ const pendingReviewTotal = sumAmount(pendingReviewSchedules);
190
+ const createdTotal = sumAmount(createdSchedules);
191
+ const aiAccountantSchedules = allSchedules.filter(isAiAccountantSchedule);
192
+ const manualSchedules = allSchedules.filter((schedule) => !isAiAccountantSchedule(schedule));
193
+ const pendingUnfiltered = allSchedules.filter((schedule) => schedule.status.code === 'draft');
194
+ const kpiSummary = {
195
+ aiAccountant: {
196
+ count: aiAccountantSchedules.length,
197
+ amount: sumAmount(aiAccountantSchedules),
198
+ },
199
+ manual: {
200
+ count: manualSchedules.length,
201
+ amount: sumAmount(manualSchedules),
202
+ },
203
+ needsReview: {
204
+ count: pendingUnfiltered.length,
205
+ amount: sumAmount(pendingUnfiltered),
206
+ },
207
+ total: {
208
+ count: allSchedules.length,
209
+ amount: sumAmount(allSchedules),
210
+ },
211
+ };
136
212
  const allSteps = monthYearPeriodId != null
137
213
  ? getAllSteps(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
138
214
  : [];
@@ -145,6 +221,22 @@ export function getExpenseAutomationJESchedulesView(state) {
145
221
  { fetchState, error },
146
222
  monthEndFetchState,
147
223
  ]);
224
+ const countByType = (schedules) => {
225
+ const counts = ALL_SCHEDULES_TYPES.reduce((acc, type) => ({ ...acc, [type]: 0 }), {});
226
+ schedules.forEach((schedule) => {
227
+ if (schedule.jeScheduleType != null) {
228
+ counts[schedule.jeScheduleType] += 1;
229
+ }
230
+ });
231
+ return counts;
232
+ };
233
+ const jeScheduleTypeCounts = {
234
+ active: countByType(allSchedules.filter((schedule) => schedule.status.code === 'draft' ||
235
+ schedule.status.code === 'ongoing' ||
236
+ schedule.status.code === 'completed' ||
237
+ schedule.status.code === 'marked_as_completed')),
238
+ ongoing: countByType(allSchedules.filter((schedule) => schedule.status.code === 'ongoing')),
239
+ };
148
240
  return {
149
241
  uncategorizedAccounts,
150
242
  allDepreciationAccountList: filteredDepAccounts,
@@ -153,12 +245,15 @@ export function getExpenseAutomationJESchedulesView(state) {
153
245
  allAccountList: filteredAccounts,
154
246
  accountListNestedAccountHierarchy,
155
247
  allClassList: allClasses,
156
- completedSchedules,
157
- draftSchedules,
158
- ongoingSchedules,
248
+ createdSchedules,
249
+ createdTotal,
250
+ jeScheduleTypeCounts,
251
+ kpiSummary,
159
252
  pendingReviewSchedules,
253
+ pendingReviewTotal,
160
254
  resolveSchedules: resolveSchedules,
161
255
  accountSettingsView,
256
+ newScheduleView,
162
257
  postStatusById: postStatusById,
163
258
  ignoreStatusById: ignoreStatusById,
164
259
  fetchState: reducedFetchStatus.fetchState,
@@ -16,9 +16,6 @@ const JE_SCHEDULE_SORT_KEYS = [
16
16
  'memo',
17
17
  ];
18
18
  export const toJEScheduleSortKey = (v) => stringToUnion(v, JE_SCHEDULE_SORT_KEYS);
19
- const JE_SCHEDULE_MAIN_TABS = [
20
- 'pending_review',
21
- 'ongoing',
22
- 'completed',
23
- ];
24
- export const toJEScheduleMainTab = (v) => stringToUnion(v, JE_SCHEDULE_MAIN_TABS);
19
+ const JE_PAGE_TABS = ['schedules', 'existing_schedules'];
20
+ export const toJEPageTab = (v) => stringToUnion(v, JE_PAGE_TABS);
21
+ export const MIN_NEW_SCHEDULE_SEARCH_LENGTH = 2;