@zeniai/client-epic-state 5.1.87 → 5.1.88-betaRD0

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 (104) hide show
  1. package/lib/__testHelpers__/apiFailure.json +6 -0
  2. package/lib/entity/aiCfo/aiCfoState.d.ts +2 -2
  3. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +2 -0
  4. package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
  5. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +34 -1
  6. package/lib/entity/jeSchedules/jeSchedulesPayload.js +68 -0
  7. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
  8. package/lib/entity/jeSchedules/jeSchedulesReducer.js +24 -2
  9. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +10 -2
  10. package/lib/entity/jeSchedules/jeSchedulesSelector.js +28 -3
  11. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +41 -1
  12. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +12 -1
  13. package/lib/entity/jeSchedules/jeSchedulesTypes.js +40 -1
  14. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
  15. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  16. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
  17. package/lib/entity/vendor/__mocks__/vendorMock.d.ts +7 -0
  18. package/lib/entity/vendor/__mocks__/vendorMock.js +311 -0
  19. package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +8 -0
  20. package/lib/entity/vendor/__mocks__/vendorStateMocks.js +415 -0
  21. package/lib/epic.d.ts +6 -1
  22. package/lib/epic.js +8 -1
  23. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
  24. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +68 -1
  25. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +24 -2
  26. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +26 -2
  27. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +34 -0
  28. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  29. package/lib/esm/epic.js +8 -1
  30. package/lib/esm/index.js +12 -6
  31. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  32. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +34 -3
  33. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +81 -0
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +21 -0
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
  36. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +73 -0
  37. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
  38. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  39. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
  40. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +187 -28
  41. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  42. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +102 -0
  43. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +260 -22
  44. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
  45. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +26 -0
  46. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +16 -0
  47. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +9 -1
  48. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +50 -1
  49. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +14 -1
  50. package/lib/index.d.ts +17 -12
  51. package/lib/index.js +83 -49
  52. package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.d.ts +11 -0
  53. package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +4659 -0
  54. package/lib/view/addressView/__mocks__/addressViewMocks.d.ts +35 -0
  55. package/lib/view/addressView/__mocks__/addressViewMocks.js +239 -0
  56. package/lib/view/addressView/__mocks__/json/createAddressResponse.json +23 -0
  57. package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +258 -0
  58. package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +418 -0
  59. package/lib/view/addressView/__mocks__/json/fetchAddressResponse.json +24 -0
  60. package/lib/view/addressView/__mocks__/json/updateAddressResponse.json +24 -0
  61. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  62. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -2
  63. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +32 -1
  64. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +8 -0
  65. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +85 -0
  66. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  67. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  68. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
  69. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
  70. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  71. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +77 -0
  72. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  73. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
  74. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  75. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  76. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +44 -2
  77. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
  78. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +49 -10
  79. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +189 -28
  80. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  81. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  82. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +40 -0
  83. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  84. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +34 -8
  85. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +20 -0
  86. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +108 -0
  87. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +10 -1
  88. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +266 -21
  89. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  90. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +79 -8
  91. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  92. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.d.ts +7 -0
  93. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +30 -0
  94. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.d.ts +6 -0
  95. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +20 -0
  96. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewEpics.d.ts +2 -2
  97. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.d.ts +12 -0
  98. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +11 -0
  99. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.d.ts +21 -4
  100. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +51 -2
  101. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.d.ts +3 -0
  102. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +16 -2
  103. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewState.d.ts +13 -0
  104. package/package.json +1 -1
@@ -0,0 +1,73 @@
1
+ import { EMPTY, from, merge, of } from 'rxjs';
2
+ import { catchError, debounceTime, filter, mergeMap, switchMap, } from 'rxjs/operators';
3
+ import { getJEScheduleTransactionKey } from '../../../../../entity/jeSchedules/jeSchedulesTypes';
4
+ import { toTransactionType } from '../../../../../entity/transaction/stateTypes/transactionType';
5
+ import { updateScheduleTransactions } from '../../../../../entity/transaction/transactionReducer';
6
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
7
+ import { searchTransactionsForNewSchedule, searchTransactionsForNewScheduleFailure, searchTransactionsForNewScheduleSuccess, } from '../../../reducers/jeSchedulesViewReducer';
8
+ import { MIN_NEW_SCHEDULE_SEARCH_LENGTH } from '../../../types/jeSchedulesViewState';
9
+ /** Dropdown-sized result set — no pagination for Base Transaction search. */
10
+ const NEW_SCHEDULE_SEARCH_PAGE_SIZE = 10;
11
+ /** Fallback when the backend sends a null currency for a search result. */
12
+ const DEFAULT_CURRENCY_CODE = 'USD';
13
+ const DEFAULT_CURRENCY_SYMBOL = '$';
14
+ export const searchTransactionsForNewScheduleEpic = (actions$, _state$, zeniAPI) => {
15
+ const searchActions$ = actions$.pipe(filter(searchTransactionsForNewSchedule.match));
16
+ /** No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP. */
17
+ const newSearchTooShortOrClear$ = searchActions$.pipe(filter((action) => action.payload.query.trim().length < MIN_NEW_SCHEDULE_SEARCH_LENGTH));
18
+ const newSearchDebounced$ = searchActions$.pipe(filter((action) => action.payload.query.trim().length >= MIN_NEW_SCHEDULE_SEARCH_LENGTH), debounceTime(300));
19
+ return merge(newSearchTooShortOrClear$, newSearchDebounced$).pipe(switchMap((action) => {
20
+ const query = action.payload.query.trim();
21
+ if (query.length < MIN_NEW_SCHEDULE_SEARCH_LENGTH) {
22
+ return EMPTY;
23
+ }
24
+ const queryParam = {
25
+ page_size: NEW_SCHEDULE_SEARCH_PAGE_SIZE,
26
+ search_text: query,
27
+ je_schedule_type: action.payload.scheduleType,
28
+ };
29
+ return zeniAPI
30
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/base_transaction_search?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
31
+ .pipe(mergeMap((response) => {
32
+ if (isSuccessResponse(response) && response.data != null) {
33
+ const { transactions } = response.data;
34
+ const transactionsPerCurrency = {};
35
+ transactions.forEach((transaction) => {
36
+ const { currency_code, currency_symbol } = transaction;
37
+ const currencyCode = currency_code ?? DEFAULT_CURRENCY_CODE;
38
+ const existing = transactionsPerCurrency[currencyCode];
39
+ transactionsPerCurrency[currencyCode] =
40
+ existing != null
41
+ ? {
42
+ currencySymbol: existing.currencySymbol,
43
+ transactions: [...existing.transactions, transaction],
44
+ }
45
+ : {
46
+ currencySymbol: currency_code == null
47
+ ? DEFAULT_CURRENCY_SYMBOL
48
+ : currency_symbol,
49
+ transactions: [transaction],
50
+ };
51
+ });
52
+ const actionsOut = Object.keys(transactionsPerCurrency).map((currencyCode) => {
53
+ const perCurrency = transactionsPerCurrency[currencyCode];
54
+ return updateScheduleTransactions(perCurrency.transactions, currencyCode, perCurrency.currencySymbol, 'merge');
55
+ });
56
+ actionsOut.push(searchTransactionsForNewScheduleSuccess({
57
+ searchResults: transactions.map((transaction) => getJEScheduleTransactionKey({
58
+ id: transaction.transaction_id,
59
+ type: toTransactionType(transaction.transaction_type),
60
+ lineId: transaction.line_id,
61
+ })),
62
+ }));
63
+ return from(actionsOut);
64
+ }
65
+ return of(searchTransactionsForNewScheduleFailure({
66
+ status: response.status,
67
+ }));
68
+ }), catchError((error) => of(searchTransactionsForNewScheduleFailure({
69
+ status: createZeniAPIStatus('Unexpected Error', 'Search transactions for new schedule errored: ' +
70
+ JSON.stringify(error)),
71
+ }))));
72
+ }));
73
+ };
@@ -0,0 +1,22 @@
1
+ import { EMPTY, of } from 'rxjs';
2
+ import { filter, mergeMap } from 'rxjs/operators';
3
+ import { convertToPeriod, toAbsoluteDay, } from '../../../../commonStateTypes/timePeriod';
4
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
+ import { fetchJeSchedulesPage, updateJESchedulesUIState, } from '../../reducers/jeSchedulesViewReducer';
6
+ export const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe(filter(updateJESchedulesUIState.match), filter((action) => action.payload.selectedPageTab != null), mergeMap(() => {
7
+ const state = state$.value;
8
+ const { fetchState, refreshStatus } = state.expenseAutomationJESchedulesViewState;
9
+ if (fetchState === 'In-Progress' ||
10
+ refreshStatus.fetchState === 'In-Progress') {
11
+ return EMPTY;
12
+ }
13
+ const currentTenant = getCurrentTenant(state);
14
+ const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
15
+ const period = convertToPeriod(selectedPeriod);
16
+ const timePeriodStart = toAbsoluteDay(period.start);
17
+ const timePeriodEnd = toAbsoluteDay(period.end);
18
+ if (timePeriodStart == null || timePeriodEnd == null) {
19
+ return EMPTY;
20
+ }
21
+ return of(fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, true));
22
+ }));
@@ -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
+ };
@@ -1,5 +1,60 @@
1
1
  import { DEFAULT_DATE_FORMAT } from '../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
2
+ import { getClassList } from '../../classList/classListSelector';
2
3
  import { mapScheduleTransactionToBaseScheduleTransactionPayload, mapVendorToVendorPayload, } from '../../scheduleView/scheduleDetailView/scheduleDetailPayload';
4
+ const BALANCE_SHEET_CLASS_LABEL = 'balance_sheet';
5
+ const SERVICE_MONTH_FORMAT = 'YYYY-MM';
6
+ /**
7
+ * The credit line is the accrued liability, which always sits on the balance sheet — the
8
+ * recurring accrued path resolves the same class the same way (see
9
+ * prepareNewScheduleAccruedDetailPayload). Omitted rather than sent empty when the tenant has
10
+ * no balance_sheet class, since the API treats the field as optional.
11
+ */
12
+ export const prepareCreateOneTimeAccrualPayload = (state, localData) => {
13
+ const { classListState, classState } = state;
14
+ const balanceSheetClass = getClassList(classState, classListState).classes.find((accountingClass) => accountingClass.labels?.includes(BALANCE_SHEET_CLASS_LABEL) === true);
15
+ // reverse_next_month alone decides reversal_policy server-side, so reversal_policy is
16
+ // deliberately not sent — the API documents it only as an alternate way to say on_bill_match,
17
+ // and sending both would be two sources of truth for one toggle.
18
+ const reversalFields = localData.reverseNextMonth
19
+ ? {
20
+ reverse_next_month: true,
21
+ expected_reversal_date: getExpectedReversalDate(localData.serviceMonth).format(DEFAULT_DATE_FORMAT),
22
+ }
23
+ : { reverse_next_month: false };
24
+ return {
25
+ vendor_id: localData.vendorId,
26
+ vendor_name: localData.vendorName,
27
+ service_month: localData.serviceMonth.format(SERVICE_MONTH_FORMAT),
28
+ amount: localData.amount,
29
+ memo: localData.memo,
30
+ je_debit_account_id: localData.debitAccountId,
31
+ je_credit_account_id: localData.creditAccountId,
32
+ ...(localData.debitAccountName != null
33
+ ? { je_debit_account_name: localData.debitAccountName }
34
+ : {}),
35
+ ...(localData.creditAccountName != null
36
+ ? { je_credit_account_name: localData.creditAccountName }
37
+ : {}),
38
+ ...(localData.debitClassId != null
39
+ ? { je_debit_accounting_class_id: localData.debitClassId }
40
+ : {}),
41
+ ...(localData.debitClassName != null
42
+ ? { je_debit_accounting_class_name: localData.debitClassName }
43
+ : {}),
44
+ ...(balanceSheetClass != null
45
+ ? {
46
+ je_credit_accounting_class_id: balanceSheetClass.classId,
47
+ je_credit_accounting_class_name: balanceSheetClass.className,
48
+ }
49
+ : {}),
50
+ ...reversalFields,
51
+ };
52
+ };
53
+ /**
54
+ * The API defaults this to the 1st of the month after service_month. We send it explicitly so the
55
+ * date the form promised the user is the date that gets stored.
56
+ */
57
+ export const getExpectedReversalDate = (serviceMonth) => serviceMonth.add(1, 'month').startOf('month');
3
58
  export const prepareIgnoreSchedulePayload = (scheduleType, jeScheduleTransaction, state) => {
4
59
  const { vendorState } = state;
5
60
  const { vendor, currencyCode, currencySymbol, baseTransaction, status, balanceAsOfToday, period, startDate, endDate, jeCredit, jeDebit, } = jeScheduleTransaction;
@@ -2,9 +2,16 @@ 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 { generateJEOneTimeAccrualKey } from '../../../entity/jeSchedules/jeScheduleHelper';
6
+ import { getJEScheduleKey, getJEScheduleTransactionDetailKeyPayload, } from '../../../entity/jeSchedules/jeSchedulesPayload';
6
7
  import { clearAll } from '../../../rootActions';
7
8
  import { mapAccountTypeRecommendationPayloadToAccountRecommendationByType, } from '../../accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload';
9
+ import { MIN_NEW_SCHEDULE_SEARCH_LENGTH, getJESchedulePeriodTabKey, } from '../types/jeSchedulesViewState';
10
+ function removeKeyFromEveryTabSlot(keysByPeriodAndTab, keyToRemove) {
11
+ for (const periodTabKey of Object.keys(keysByPeriodAndTab)) {
12
+ keysByPeriodAndTab[periodTabKey] = keysByPeriodAndTab[periodTabKey].filter((jeScheduleKey) => jeScheduleKey !== keyToRemove);
13
+ }
14
+ }
8
15
  export const accountSettingsInitialState = {
9
16
  localData: {
10
17
  selectedPrepaidExpensesAccountIds: [],
@@ -36,16 +43,34 @@ export const accountSettingsInitialState = {
36
43
  accruedExpensesNestedAccountListHierarchy: [],
37
44
  accruedExpensesRecommendations: [],
38
45
  };
46
+ export const getBaseNewScheduleLocalData = (scheduleType) => ({
47
+ scheduleType,
48
+ jeScheduleDetails: [],
49
+ });
50
+ export const newScheduleInitialState = {
51
+ fixed_assets: getBaseNewScheduleLocalData('fixed_assets'),
52
+ prepaid_expenses: getBaseNewScheduleLocalData('prepaid_expenses'),
53
+ };
54
+ export const searchTransactionsInitialState = {
55
+ searchResults: [],
56
+ fetchState: 'Not-Started',
57
+ error: undefined,
58
+ };
39
59
  export const initialState = {
40
- jeScheduleTransactionKeysByPeriod: {},
41
- failedJeScheduleTransactionKeysByPeriod: {},
60
+ jeScheduleTransactionKeysByPeriodAndTab: {},
61
+ jeScheduleAccruedKeysByPeriodAndTab: {},
62
+ jeScheduleOneTimeAccrualKeysByPeriodAndTab: {},
63
+ failedJeScheduleTransactionKeysByPeriodAndTab: {},
42
64
  postStatusById: {},
43
65
  ignoreStatusById: {},
44
66
  jeScheduleLocalDataById: {},
45
67
  uiState: {
46
- searchString: '',
68
+ createdGroupCollapsed: false,
69
+ pendingGroupCollapsed: false,
47
70
  scrollPosition: { scrollTop: 0, scrollLeft: undefined },
48
- selectedMainTab: 'pending_review',
71
+ searchString: '',
72
+ selectedJETypeFilter: null,
73
+ selectedPageTab: 'schedules',
49
74
  sortKey: 'transactionDate',
50
75
  sortOrder: 'descending',
51
76
  totalCount: 0,
@@ -56,6 +81,14 @@ export const initialState = {
56
81
  error: undefined,
57
82
  },
58
83
  accountSettings: accountSettingsInitialState,
84
+ newSchedule: {
85
+ createOneTimeAccrualStatus: { fetchState: 'Not-Started', error: undefined },
86
+ newScheduleState: newScheduleInitialState,
87
+ saveStatus: { fetchState: 'Not-Started', error: undefined },
88
+ searchTransactions: searchTransactionsInitialState,
89
+ fetchState: 'Not-Started',
90
+ error: undefined,
91
+ },
59
92
  fetchState: 'Not-Started',
60
93
  error: undefined,
61
94
  hasValidState() {
@@ -100,9 +133,12 @@ const expenseAutomationJESchedulesView = createSlice({
100
133
  },
101
134
  },
102
135
  fetchJeSchedulesSuccess(draft, action) {
103
- const { jeSchedules, selectedPeriod, failedJeSchedules, refreshViewInBackground, } = action.payload;
136
+ const { jeSchedules, selectedPeriod, selectedPageTab, failedJeSchedules, accruedJeSchedules, oneTimeAccruals, refreshViewInBackground, } = action.payload;
137
+ const periodTabKey = getJESchedulePeriodTabKey(selectedPageTab, toMonthYearPeriodId(selectedPeriod));
104
138
  const jeScheduleTransactionKeys = jeSchedules.map((schedules) => getJEScheduleTransactionDetailKeyPayload(schedules.base_transaction));
105
139
  const failedJeScheduleTransactionKeys = failedJeSchedules.map((schedules) => getJEScheduleTransactionDetailKeyPayload(schedules.base_transaction));
140
+ const jeScheduleAccruedKeys = accruedJeSchedules.map((schedule) => getJEScheduleKey(schedule));
141
+ const jeScheduleOneTimeAccrualKeys = oneTimeAccruals.map((accrual) => generateJEOneTimeAccrualKey(accrual._id));
106
142
  if (refreshViewInBackground === true &&
107
143
  draft.refreshStatus.fetchState === 'In-Progress') {
108
144
  draft.refreshStatus = { fetchState: 'Completed', error: undefined };
@@ -111,19 +147,28 @@ const expenseAutomationJESchedulesView = createSlice({
111
147
  draft.fetchState = 'Completed';
112
148
  draft.error = undefined;
113
149
  }
114
- draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = jeScheduleTransactionKeys;
115
- draft.failedJeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = failedJeScheduleTransactionKeys;
150
+ draft.jeScheduleTransactionKeysByPeriodAndTab[periodTabKey] =
151
+ jeScheduleTransactionKeys;
152
+ draft.jeScheduleAccruedKeysByPeriodAndTab[periodTabKey] =
153
+ jeScheduleAccruedKeys;
154
+ draft.jeScheduleOneTimeAccrualKeysByPeriodAndTab[periodTabKey] =
155
+ jeScheduleOneTimeAccrualKeys;
156
+ draft.failedJeScheduleTransactionKeysByPeriodAndTab[periodTabKey] =
157
+ failedJeScheduleTransactionKeys;
116
158
  },
117
159
  fetchJeSchedulesFailure(draft, action) {
118
- const { status, selectedPeriod } = action.payload;
160
+ const { status, selectedPeriod, selectedPageTab } = action.payload;
161
+ const periodTabKey = getJESchedulePeriodTabKey(selectedPageTab, toMonthYearPeriodId(selectedPeriod));
119
162
  if (draft.refreshStatus.fetchState === 'In-Progress') {
120
163
  draft.refreshStatus = { fetchState: 'Error', error: status };
121
164
  }
122
165
  else {
123
166
  draft.fetchState = 'Error';
124
167
  draft.error = status;
168
+ draft.jeScheduleTransactionKeysByPeriodAndTab[periodTabKey] = [];
169
+ draft.jeScheduleAccruedKeysByPeriodAndTab[periodTabKey] = [];
170
+ draft.jeScheduleOneTimeAccrualKeysByPeriodAndTab[periodTabKey] = [];
125
171
  }
126
- draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = [];
127
172
  },
128
173
  retryJeSchedule(draft, action) {
129
174
  const { scheduledJournalEntryID } = action.payload;
@@ -211,17 +256,18 @@ const expenseAutomationJESchedulesView = createSlice({
211
256
  };
212
257
  },
213
258
  updateJeScheduleTransactionKeys: {
214
- prepare(jeScheduleKeys, selectedPeriod) {
259
+ prepare(jeScheduleKeys, selectedPeriod, selectedPageTab) {
215
260
  return {
216
261
  payload: {
217
262
  jeScheduleKeys: jeScheduleKeys,
218
263
  selectedPeriod: selectedPeriod,
264
+ selectedPageTab: selectedPageTab,
219
265
  },
220
266
  };
221
267
  },
222
268
  reducer(draft, action) {
223
- const { selectedPeriod, jeScheduleKeys } = action.payload;
224
- draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = jeScheduleKeys;
269
+ const { selectedPeriod, selectedPageTab, jeScheduleKeys } = action.payload;
270
+ draft.jeScheduleTransactionKeysByPeriodAndTab[getJESchedulePeriodTabKey(selectedPageTab, toMonthYearPeriodId(selectedPeriod))] = jeScheduleKeys;
225
271
  },
226
272
  },
227
273
  removeJeScheduleTransactionKey: {
@@ -234,12 +280,10 @@ const expenseAutomationJESchedulesView = createSlice({
234
280
  };
235
281
  },
236
282
  reducer(draft, action) {
237
- const { selectedPeriod, jeScheduleKey } = action.payload;
238
- const prevData = [
239
- ...(draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] ?? []),
240
- ];
241
- const filteredKeys = prevData.filter((jeKey) => jeKey !== jeScheduleKey);
242
- draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = filteredKeys;
283
+ const { jeScheduleKey } = action.payload;
284
+ // Dropped from every tab's slot, not just the visible one: once a schedule is ignored or
285
+ // resolved it must not reappear when the user switches tabs and hits a cached list.
286
+ removeKeyFromEveryTabSlot(draft.jeScheduleTransactionKeysByPeriodAndTab, jeScheduleKey);
243
287
  },
244
288
  },
245
289
  removeFailedJeScheduleTransactionKey: {
@@ -252,12 +296,8 @@ const expenseAutomationJESchedulesView = createSlice({
252
296
  };
253
297
  },
254
298
  reducer(draft, action) {
255
- const { selectedPeriod, failedJeScheduleKey } = action.payload;
256
- const prevData = [
257
- ...(draft.failedJeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] ?? []),
258
- ];
259
- const filteredKeys = prevData.filter((jeKey) => jeKey !== failedJeScheduleKey);
260
- draft.failedJeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = filteredKeys;
299
+ const { failedJeScheduleKey } = action.payload;
300
+ removeKeyFromEveryTabSlot(draft.failedJeScheduleTransactionKeysByPeriodAndTab, failedJeScheduleKey);
261
301
  },
262
302
  },
263
303
  initializeJeScheduleLocalData: {
@@ -369,6 +409,114 @@ const expenseAutomationJESchedulesView = createSlice({
369
409
  clearJeAccountSettingsLocalData(draft) {
370
410
  draft.accountSettings.localData = accountSettingsInitialState.localData;
371
411
  },
412
+ initializeNewSchedule: {
413
+ prepare({ scheduleType, }) {
414
+ return { payload: { scheduleType } };
415
+ },
416
+ reducer() {
417
+ // Purely an epic-trigger action — the epic fans out the account/class
418
+ // list fetches plus resetNewScheduleLocalData.
419
+ },
420
+ },
421
+ resetNewScheduleLocalData: {
422
+ prepare({ scheduleType, }) {
423
+ return { payload: { scheduleType } };
424
+ },
425
+ reducer(draft, action) {
426
+ const { scheduleType } = action.payload;
427
+ draft.newSchedule.newScheduleState[scheduleType] =
428
+ getBaseNewScheduleLocalData(scheduleType);
429
+ },
430
+ },
431
+ updateNewScheduleLocalData(draft, action) {
432
+ const { scheduleType, localData } = action.payload;
433
+ draft.newSchedule.newScheduleState[scheduleType] = {
434
+ ...draft.newSchedule.newScheduleState[scheduleType],
435
+ ...localData,
436
+ };
437
+ },
438
+ searchTransactionsForNewSchedule: {
439
+ prepare({ query, scheduleType, }) {
440
+ return { payload: { query, scheduleType } };
441
+ },
442
+ reducer(draft, action) {
443
+ const trimmed = action.payload.query.trim();
444
+ // Cleared or too-short query: no API (see epic) — reset immediately.
445
+ if (trimmed.length < MIN_NEW_SCHEDULE_SEARCH_LENGTH) {
446
+ draft.newSchedule.searchTransactions = searchTransactionsInitialState;
447
+ return;
448
+ }
449
+ draft.newSchedule.searchTransactions = {
450
+ ...draft.newSchedule.searchTransactions,
451
+ searchString: action.payload.query,
452
+ fetchState: 'In-Progress',
453
+ };
454
+ },
455
+ },
456
+ searchTransactionsForNewScheduleSuccess(draft, action) {
457
+ draft.newSchedule.searchTransactions = {
458
+ ...draft.newSchedule.searchTransactions,
459
+ searchResults: action.payload.searchResults,
460
+ fetchState: 'Completed',
461
+ error: undefined,
462
+ };
463
+ },
464
+ searchTransactionsForNewScheduleFailure(draft, action) {
465
+ draft.newSchedule.searchTransactions = {
466
+ ...draft.newSchedule.searchTransactions,
467
+ fetchState: 'Error',
468
+ error: action.payload.status,
469
+ };
470
+ },
471
+ clearSearchTransactionsForNewSchedule(draft) {
472
+ draft.newSchedule.searchTransactions = searchTransactionsInitialState;
473
+ },
474
+ saveNewSchedule: {
475
+ prepare({ scheduleType, }) {
476
+ return { payload: { scheduleType } };
477
+ },
478
+ reducer(draft) {
479
+ draft.newSchedule.saveStatus = {
480
+ fetchState: 'In-Progress',
481
+ error: undefined,
482
+ };
483
+ },
484
+ },
485
+ saveNewScheduleSuccess(draft) {
486
+ draft.newSchedule.saveStatus = {
487
+ fetchState: 'Completed',
488
+ error: undefined,
489
+ };
490
+ },
491
+ saveNewScheduleFailure(draft, action) {
492
+ draft.newSchedule.saveStatus = {
493
+ fetchState: 'Error',
494
+ error: action.payload.status,
495
+ };
496
+ },
497
+ createOneTimeAccrual: {
498
+ prepare(localData) {
499
+ return { payload: { localData } };
500
+ },
501
+ reducer(draft) {
502
+ draft.newSchedule.createOneTimeAccrualStatus = {
503
+ fetchState: 'In-Progress',
504
+ error: undefined,
505
+ };
506
+ },
507
+ },
508
+ createOneTimeAccrualSuccess(draft) {
509
+ draft.newSchedule.createOneTimeAccrualStatus = {
510
+ fetchState: 'Completed',
511
+ error: undefined,
512
+ };
513
+ },
514
+ createOneTimeAccrualFailure(draft, action) {
515
+ draft.newSchedule.createOneTimeAccrualStatus = {
516
+ fetchState: 'Error',
517
+ error: action.payload.status,
518
+ };
519
+ },
372
520
  updateJESchedulesUIState(draft, action) {
373
521
  if (action.payload.sortKey != null) {
374
522
  draft.uiState.sortKey = action.payload.sortKey;
@@ -382,10 +530,21 @@ const expenseAutomationJESchedulesView = createSlice({
382
530
  if (action.payload.scrollPosition != null) {
383
531
  draft.uiState.scrollPosition = action.payload.scrollPosition;
384
532
  }
385
- if (action.payload.selectedMainTab != null) {
386
- draft.uiState.selectedMainTab = action.payload.selectedMainTab;
533
+ if (action.payload.selectedPageTab != null) {
534
+ draft.uiState.selectedPageTab = action.payload.selectedPageTab;
387
535
  }
388
536
  },
537
+ updateJEScheduleTypeFilter(draft, action) {
538
+ draft.uiState.selectedJETypeFilter = action.payload;
539
+ },
540
+ toggleJEPendingGroupCollapsed(draft) {
541
+ draft.uiState.pendingGroupCollapsed =
542
+ !draft.uiState.pendingGroupCollapsed;
543
+ },
544
+ toggleJECreatedGroupCollapsed(draft) {
545
+ draft.uiState.createdGroupCollapsed =
546
+ !draft.uiState.createdGroupCollapsed;
547
+ },
389
548
  clearExpenseAutomationJESchedulesView(draft) {
390
549
  Object.assign(draft, initialState);
391
550
  },
@@ -396,7 +555,7 @@ const expenseAutomationJESchedulesView = createSlice({
396
555
  });
397
556
  },
398
557
  });
399
- 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;
558
+ export const { clearExpenseAutomationJESchedulesView, clearJeAccountSettingsLocalData, clearJeScheduleLocalData, clearSearchTransactionsForNewSchedule, createOneTimeAccrual, createOneTimeAccrualFailure, createOneTimeAccrualSuccess, 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;
400
559
  export default expenseAutomationJESchedulesView.reducer;
401
560
  const doUpdateRecommendationForAccountSettings = (draft, payload) => {
402
561
  const { prepaidExpensesRecommendations, fixedAssetsRecommendations, accruedExpensesRecommendations, } = mapAccountTypeRecommendationPayloadToAccountRecommendationByType(payload);