@zeniai/client-epic-state 5.2.7-betaRD1 → 5.2.8
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.
- package/lib/entity/invoicing/invoicingCommonPayload.d.ts +22 -0
- package/lib/entity/invoicing/invoicingCommonPayload.js +51 -10
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
- package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -66
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -135
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -79
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -88
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
- package/lib/epic.d.ts +1 -9
- package/lib/epic.js +0 -16
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +51 -10
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -135
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -78
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/esm/epic.js +0 -16
- package/lib/esm/index.js +8 -14
- package/lib/esm/view/accountList/accountListReducer.js +0 -1
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -306
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -294
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +2 -1
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +27 -3
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +7 -3
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
- package/lib/index.d.ts +12 -17
- package/lib/index.js +47 -91
- package/lib/view/accountList/accountListReducer.js +0 -1
- package/lib/view/accountList/accountListState.d.ts +1 -1
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -72
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -91
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -308
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -36
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -302
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -82
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +1 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +9 -1
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +30 -4
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +11 -4
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +7 -3
- package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
- package/package.json +1 -1
- package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
- package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
- package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
- package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
- package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
- package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -81
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -139
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -106
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -20
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -85
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -12
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -146
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -64
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -110
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
|
@@ -128,6 +128,23 @@ export function toInvoicingQboCustomerMatchingMode(value) {
|
|
|
128
128
|
throw new Error(`Unknown InvoicingQboCustomerMatchingMode: ${value}`);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* The id for one mapping slot, from whichever shape the backend sent. The object
|
|
133
|
+
* form wins when present; a blank id in either is treated as unset so the picker
|
|
134
|
+
* shows its placeholder rather than selecting nothing.
|
|
135
|
+
*/
|
|
136
|
+
function readInvoicingQboMappedAccountId(mappedAccount, legacyAccountId) {
|
|
137
|
+
// `qbo_id` first: the pickers key their options on the QuickBooks id, so an
|
|
138
|
+
// internal `account_id` would not select anything even when it is the same
|
|
139
|
+
// account. Both are read because the mapping arrives either way depending on
|
|
140
|
+
// how it was saved.
|
|
141
|
+
const candidates = [
|
|
142
|
+
mappedAccount?.qbo_id,
|
|
143
|
+
mappedAccount?.account_id,
|
|
144
|
+
legacyAccountId,
|
|
145
|
+
];
|
|
146
|
+
return candidates.find((candidate) => candidate != null && candidate !== '');
|
|
147
|
+
}
|
|
131
148
|
/**
|
|
132
149
|
* Read one account-mapping dropdown value by its config `code` (the codes in
|
|
133
150
|
* `qbo_account_mapping_kind_options` match the `account_mappings` field names).
|
|
@@ -135,15 +152,15 @@ export function toInvoicingQboCustomerMatchingMode(value) {
|
|
|
135
152
|
export function getInvoicingQboAccountMappingId(accountMappings, code) {
|
|
136
153
|
switch (code) {
|
|
137
154
|
case 'deposit_account_id':
|
|
138
|
-
return accountMappings?.deposit_account_id
|
|
155
|
+
return readInvoicingQboMappedAccountId(accountMappings?.deposit_account, accountMappings?.deposit_account_id);
|
|
139
156
|
case 'default_income_account_id':
|
|
140
|
-
return accountMappings?.default_income_account_id
|
|
157
|
+
return readInvoicingQboMappedAccountId(accountMappings?.default_income_account, accountMappings?.default_income_account_id);
|
|
141
158
|
case 'discounts_account_id':
|
|
142
|
-
return accountMappings?.discounts_account_id
|
|
159
|
+
return readInvoicingQboMappedAccountId(accountMappings?.discounts_account, accountMappings?.discounts_account_id);
|
|
143
160
|
case 'rounding_account_id':
|
|
144
|
-
return accountMappings?.rounding_account_id
|
|
161
|
+
return readInvoicingQboMappedAccountId(accountMappings?.rounding_account, accountMappings?.rounding_account_id);
|
|
145
162
|
case 'write_off_account_id':
|
|
146
|
-
return accountMappings?.write_off_account_id
|
|
163
|
+
return readInvoicingQboMappedAccountId(accountMappings?.write_off_account, accountMappings?.write_off_account_id);
|
|
147
164
|
default:
|
|
148
165
|
return undefined;
|
|
149
166
|
}
|
|
@@ -153,18 +170,42 @@ export function getInvoicingQboAccountMappingId(accountMappings, code) {
|
|
|
153
170
|
* `code` set to `accountId`. Unknown codes leave the mappings unchanged.
|
|
154
171
|
*/
|
|
155
172
|
export function withInvoicingQboAccountMappingId(accountMappings, code, accountId) {
|
|
173
|
+
// Both slots are written together. Setting only the bare id would leave the
|
|
174
|
+
// object shape behind, and the reader prefers it — so the selection just made
|
|
175
|
+
// would read back as whatever was mapped before. The object is dropped rather
|
|
176
|
+
// than rebuilt: only the id is known here, not the name that came with it.
|
|
156
177
|
const base = accountMappings ?? {};
|
|
157
178
|
switch (code) {
|
|
158
179
|
case 'deposit_account_id':
|
|
159
|
-
return {
|
|
180
|
+
return {
|
|
181
|
+
...base,
|
|
182
|
+
deposit_account: undefined,
|
|
183
|
+
deposit_account_id: accountId,
|
|
184
|
+
};
|
|
160
185
|
case 'default_income_account_id':
|
|
161
|
-
return {
|
|
186
|
+
return {
|
|
187
|
+
...base,
|
|
188
|
+
default_income_account: undefined,
|
|
189
|
+
default_income_account_id: accountId,
|
|
190
|
+
};
|
|
162
191
|
case 'discounts_account_id':
|
|
163
|
-
return {
|
|
192
|
+
return {
|
|
193
|
+
...base,
|
|
194
|
+
discounts_account: undefined,
|
|
195
|
+
discounts_account_id: accountId,
|
|
196
|
+
};
|
|
164
197
|
case 'rounding_account_id':
|
|
165
|
-
return {
|
|
198
|
+
return {
|
|
199
|
+
...base,
|
|
200
|
+
rounding_account: undefined,
|
|
201
|
+
rounding_account_id: accountId,
|
|
202
|
+
};
|
|
166
203
|
case 'write_off_account_id':
|
|
167
|
-
return {
|
|
204
|
+
return {
|
|
205
|
+
...base,
|
|
206
|
+
write_off_account: undefined,
|
|
207
|
+
write_off_account_id: accountId,
|
|
208
|
+
};
|
|
168
209
|
default:
|
|
169
210
|
return base;
|
|
170
211
|
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
export function generateJEScheduleKey(jeScheduleId, jeScheduleType) {
|
|
2
2
|
return `${jeScheduleId}_${jeScheduleType}`;
|
|
3
3
|
}
|
|
4
|
-
// Suffixed rather than using the bare Mongo _id so the key is a distinct type from
|
|
5
|
-
// JEScheduleKey / JEScheduleTransactionKey and the three cannot be passed interchangeably.
|
|
6
|
-
// The unsuffixed id stays on the entity as `accrualId` for callers that need it.
|
|
7
|
-
export function generateJEOneTimeAccrualKey(accrualId) {
|
|
8
|
-
return `${accrualId}_one_time_accrual`;
|
|
9
|
-
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { toAmount } from '../../commonStateTypes/amount';
|
|
2
2
|
import { LAST_SCHEDULE_DAY_OF_MONTH, MAX_SCHEDULE_DAY_OF_MONTH, MIN_SCHEDULE_DAY_OF_MONTH, toScheduleDaysOfMonth, } from '../../commonStateTypes/timePeriod';
|
|
3
3
|
import { date } from '../../zeniDayJS';
|
|
4
|
-
import { toZeniUrl } from '../../zeniUrl';
|
|
5
4
|
import { toTransactionID, } from '../transaction/payloadTypes/transactionIDPayload';
|
|
6
5
|
import { generateJEScheduleKey } from './jeScheduleHelper';
|
|
7
|
-
import { getJEScheduleTransactionKey, toJournalEntryErrorCodeType,
|
|
8
|
-
const USD_CURRENCY_CODE = 'USD';
|
|
6
|
+
import { getJEScheduleTransactionKey, toJournalEntryErrorCodeType, toScheduleJournalEntryStatusCodeType, toScheduleStatusCodeType, toScheduleTypesTypeStrict, } from './jeSchedulesTypes';
|
|
9
7
|
export function toScheduledJournalEntryState(payload, currency_code, currency_symbol) {
|
|
10
8
|
return {
|
|
11
9
|
status: {
|
|
@@ -250,18 +248,9 @@ export function toJEScheduledTransaction(payload) {
|
|
|
250
248
|
startDate: payload.start_date != null ? date(payload.start_date) : undefined,
|
|
251
249
|
endDate: payload.end_date != null ? date(payload.end_date) : undefined,
|
|
252
250
|
period: payload.period != null ? Number(payload.period) : undefined,
|
|
253
|
-
recurringAmount: payload.recurring_amount != null
|
|
254
|
-
? {
|
|
255
|
-
amount: payload.recurring_amount,
|
|
256
|
-
currencyCode: payload.currency_code,
|
|
257
|
-
currencySymbol: payload.currency_symbol,
|
|
258
|
-
}
|
|
259
|
-
: undefined,
|
|
260
|
-
postedCount: payload.posted_count ?? undefined,
|
|
261
251
|
updatedByUserID: payload.updated_by.user_id,
|
|
262
252
|
balanceAsOfToday: payload.balance ?? undefined,
|
|
263
253
|
updatedAt: payload.updated_at != null ? date(payload.updated_at) : undefined,
|
|
264
|
-
createTime: payload.create_time != null ? date(payload.create_time) : undefined,
|
|
265
254
|
jeCredit: {
|
|
266
255
|
accountId: payload.je_credit_account_id ?? undefined,
|
|
267
256
|
accountingClassId: payload.je_credit_accounting_class_id ?? undefined,
|
|
@@ -286,7 +275,6 @@ export function toJEScheduledTransaction(payload) {
|
|
|
286
275
|
: {},
|
|
287
276
|
scheduledJournalEntry: [],
|
|
288
277
|
aiSummaries: toJEScheduleAISummaries(payload.ai_summaries),
|
|
289
|
-
confidenceScore: payload.confidence_score ?? undefined,
|
|
290
278
|
createdByUserID: payload.created_by?.user_id ?? undefined,
|
|
291
279
|
recommendations: toJEScheduleRecommendations(payload.recommendations),
|
|
292
280
|
};
|
|
@@ -344,125 +332,3 @@ export function toJEAccruedScheduledTransaction(payload) {
|
|
|
344
332
|
jeScheduleType: toScheduleTypesTypeStrict(payload.je_schedule_type),
|
|
345
333
|
};
|
|
346
334
|
}
|
|
347
|
-
/**
|
|
348
|
-
* Reads the months in the order the snapshot gives them rather than deriving a range: a vendor that
|
|
349
|
-
* skipped a month has no entry for it, so filling gaps would invent history that was never billed.
|
|
350
|
-
*/
|
|
351
|
-
function toJEOneTimeAccrualMonthlyTotals(snapshot, currencyCode) {
|
|
352
|
-
const monthlyTotals = snapshot.monthly_totals;
|
|
353
|
-
if (monthlyTotals == null) {
|
|
354
|
-
return [];
|
|
355
|
-
}
|
|
356
|
-
const months = snapshot.sorted_months ?? Object.keys(monthlyTotals).sort();
|
|
357
|
-
return months
|
|
358
|
-
.filter((month) => monthlyTotals[month] != null)
|
|
359
|
-
.map((month) => ({
|
|
360
|
-
month,
|
|
361
|
-
amount: toOneTimeAccrualAmount(monthlyTotals[month], currencyCode),
|
|
362
|
-
}));
|
|
363
|
-
}
|
|
364
|
-
function toJEOneTimeAccrualProfileSnapshot(payload, currencyCode) {
|
|
365
|
-
if (payload == null) {
|
|
366
|
-
return undefined;
|
|
367
|
-
}
|
|
368
|
-
const billingPattern = payload.billing_pattern;
|
|
369
|
-
return {
|
|
370
|
-
monthlyTotals: toJEOneTimeAccrualMonthlyTotals(payload, currencyCode),
|
|
371
|
-
billingPattern: billingPattern != null
|
|
372
|
-
? {
|
|
373
|
-
frequency: billingPattern.frequency ?? undefined,
|
|
374
|
-
monthsOfHistory: billingPattern.months_of_history ?? undefined,
|
|
375
|
-
consistencyScore: billingPattern.consistency_score ?? undefined,
|
|
376
|
-
billingLagDays: billingPattern.billing_lag_days ?? undefined,
|
|
377
|
-
typicalBillDay: billingPattern.typical_bill_day ?? undefined,
|
|
378
|
-
avgAmount: billingPattern.avg_amount != null
|
|
379
|
-
? toOneTimeAccrualAmount(billingPattern.avg_amount, currencyCode)
|
|
380
|
-
: undefined,
|
|
381
|
-
lastBillAmount: billingPattern.last_bill_amount != null
|
|
382
|
-
? toOneTimeAccrualAmount(billingPattern.last_bill_amount, currencyCode)
|
|
383
|
-
: undefined,
|
|
384
|
-
lastBillDate: billingPattern.last_bill_date != null
|
|
385
|
-
? date(billingPattern.last_bill_date)
|
|
386
|
-
: undefined,
|
|
387
|
-
}
|
|
388
|
-
: undefined,
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
function toJEOneTimeAccrualAiSuggestion(payload, currencyCode) {
|
|
392
|
-
if (payload == null) {
|
|
393
|
-
return undefined;
|
|
394
|
-
}
|
|
395
|
-
return {
|
|
396
|
-
memo: payload.memo ?? undefined,
|
|
397
|
-
jeDebitAccountName: payload.je_debit_account_name ?? undefined,
|
|
398
|
-
jeCreditAccountName: payload.je_credit_account_name ?? undefined,
|
|
399
|
-
estimatedAmount: payload.estimated_amount != null
|
|
400
|
-
? toOneTimeAccrualAmount(payload.estimated_amount, currencyCode)
|
|
401
|
-
: undefined,
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
export function toJEOneTimeAccrual(payload) {
|
|
405
|
-
return {
|
|
406
|
-
accrualId: payload._id,
|
|
407
|
-
vendorId: payload.vendor_id,
|
|
408
|
-
vendorName: payload.vendor_name,
|
|
409
|
-
serviceMonth: payload.service_month,
|
|
410
|
-
accrualStatus: toOneTimeAccrualStatusCodeType(payload.status),
|
|
411
|
-
origin: toOneTimeAccrualOriginType(payload.origin),
|
|
412
|
-
automationTier: payload.automation_tier != null
|
|
413
|
-
? toOneTimeAccrualAutomationTierType(payload.automation_tier)
|
|
414
|
-
: undefined,
|
|
415
|
-
estimatedAmount: toOneTimeAccrualAmount(payload.estimated_amount, payload.currency),
|
|
416
|
-
memo: payload.memo ?? '',
|
|
417
|
-
profileSnapshot: toJEOneTimeAccrualProfileSnapshot(payload.profile_snapshot, payload.currency),
|
|
418
|
-
aiSuggestion: toJEOneTimeAccrualAiSuggestion(payload.ai_suggestion, payload.currency),
|
|
419
|
-
// Exclusive by contract: a scheduled row reverses on expectedReversalDate and bills never
|
|
420
|
-
// drive it, so the two never need reconciling. Defaulting to on_bill_match matches the
|
|
421
|
-
// create path's default when the field is absent on an older document.
|
|
422
|
-
reversalPolicy: toOneTimeAccrualReversalPolicyType(payload.reversal_policy ?? 'on_bill_match'),
|
|
423
|
-
reversalTrigger: toOneTimeAccrualReversalTriggerType(payload.reversal_trigger ?? undefined),
|
|
424
|
-
expectedReversalDate: payload.expected_reversal_date != null
|
|
425
|
-
? date(payload.expected_reversal_date)
|
|
426
|
-
: undefined,
|
|
427
|
-
postingDate: payload.posting_date != null ? date(payload.posting_date) : undefined,
|
|
428
|
-
actualPostDate: payload.actual_post_date != null
|
|
429
|
-
? date(payload.actual_post_date)
|
|
430
|
-
: undefined,
|
|
431
|
-
actualReversalPostDate: payload.actual_reversal_post_date != null
|
|
432
|
-
? date(payload.actual_reversal_post_date)
|
|
433
|
-
: undefined,
|
|
434
|
-
jeDebitAccountId: payload.je_debit_account_id ?? undefined,
|
|
435
|
-
jeDebitAccountName: payload.je_debit_account_name ?? undefined,
|
|
436
|
-
jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
|
|
437
|
-
jeDebitAccountingClassName: payload.je_debit_accounting_class_name ?? undefined,
|
|
438
|
-
jeCreditAccountId: payload.je_credit_account_id ?? undefined,
|
|
439
|
-
jeCreditAccountName: payload.je_credit_account_name ?? undefined,
|
|
440
|
-
jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
|
|
441
|
-
jeCreditAccountingClassName: payload.je_credit_accounting_class_name ?? undefined,
|
|
442
|
-
transactionId: payload.transaction_id ?? undefined,
|
|
443
|
-
transactionIntegrationId: payload.transaction_integration_id ?? undefined,
|
|
444
|
-
reversalTransactionId: payload.reversal_transaction_id ?? undefined,
|
|
445
|
-
createdBy: toJEOneTimeAccrualCreator(payload.created_by_user),
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
// The accrual wire format carries a currency CODE but no symbol, so the symbol has to be derived.
|
|
449
|
-
// Only USD has a known glyph today (the create path is USD-only); anything else falls back to the
|
|
450
|
-
// code, which reads correctly as "EUR 1,200" rather than silently rendering a wrong "$".
|
|
451
|
-
function toOneTimeAccrualAmount(amount, currencyCode) {
|
|
452
|
-
const code = currencyCode ?? USD_CURRENCY_CODE;
|
|
453
|
-
return toAmount(amount, code, code === USD_CURRENCY_CODE ? '$' : code);
|
|
454
|
-
}
|
|
455
|
-
function toJEOneTimeAccrualCreator(payload) {
|
|
456
|
-
if (payload == null) {
|
|
457
|
-
return undefined;
|
|
458
|
-
}
|
|
459
|
-
return {
|
|
460
|
-
userId: payload.user_id,
|
|
461
|
-
email: payload.email ?? undefined,
|
|
462
|
-
firstName: payload.first_name ?? undefined,
|
|
463
|
-
lastName: payload.last_name ?? undefined,
|
|
464
|
-
photo: payload.photo?.original != null
|
|
465
|
-
? toZeniUrl(payload.photo.original)
|
|
466
|
-
: undefined,
|
|
467
|
-
};
|
|
468
|
-
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import assignWith from 'lodash/assignWith';
|
|
3
3
|
import { clearAll } from '../../rootActions';
|
|
4
|
-
import {
|
|
5
|
-
import { getJEScheduleKey, getJEScheduleTransactionDetailKeyPayload, toJEAccruedScheduledTransaction, toJEOneTimeAccrual, toJEScheduledTransaction, toScheduledJournalEntryState, } from './jeSchedulesPayload';
|
|
4
|
+
import { getJEScheduleKey, getJEScheduleTransactionDetailKeyPayload, toJEAccruedScheduledTransaction, toJEScheduledTransaction, toScheduledJournalEntryState, } from './jeSchedulesPayload';
|
|
6
5
|
export const initialState = {
|
|
7
6
|
schedulesByTransactionKey: {},
|
|
8
7
|
schedulesByAccruedJEScheduleKey: {},
|
|
9
|
-
oneTimeAccrualsByKey: {},
|
|
10
8
|
};
|
|
11
9
|
const jeSchedules = createSlice({
|
|
12
10
|
name: 'jeSchedules',
|
|
@@ -111,41 +109,15 @@ const jeSchedules = createSlice({
|
|
|
111
109
|
delete draft.schedulesByAccruedJEScheduleKey[JEScheduleKey];
|
|
112
110
|
},
|
|
113
111
|
},
|
|
114
|
-
// Writes directly, unlike updateAccruedJESchedules / updateJESchedules, which are no-op
|
|
115
|
-
// actions whose only job is to trigger the entity fan-out epic that fetches vendors,
|
|
116
|
-
// accounts, classes and users. An accrual denormalizes all of those as names on the document,
|
|
117
|
-
// so there is nothing to fan out to.
|
|
118
|
-
updateJEOneTimeAccruals: {
|
|
119
|
-
prepare(jeOneTimeAccrualsPayload) {
|
|
120
|
-
return {
|
|
121
|
-
payload: {
|
|
122
|
-
jeOneTimeAccrualsPayload,
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
},
|
|
126
|
-
reducer(draft, action) {
|
|
127
|
-
action.payload.jeOneTimeAccrualsPayload.forEach((accrualPayload) => {
|
|
128
|
-
const accrual = toJEOneTimeAccrual(accrualPayload);
|
|
129
|
-
draft.oneTimeAccrualsByKey[generateJEOneTimeAccrualKey(accrual.accrualId)] = accrual;
|
|
130
|
-
});
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
clearAllJEScheduleTransactions(draft) {
|
|
134
|
-
draft.schedulesByTransactionKey = {};
|
|
135
|
-
},
|
|
136
|
-
clearAllAccruedJESchedules(draft) {
|
|
137
|
-
draft.schedulesByAccruedJEScheduleKey = {};
|
|
138
|
-
},
|
|
139
112
|
},
|
|
140
113
|
extraReducers: (builder) => {
|
|
141
114
|
builder.addCase(clearAll, (draft) => {
|
|
142
115
|
draft.schedulesByAccruedJEScheduleKey = {};
|
|
143
116
|
draft.schedulesByTransactionKey = {};
|
|
144
|
-
draft.oneTimeAccrualsByKey = {};
|
|
145
117
|
});
|
|
146
118
|
},
|
|
147
119
|
});
|
|
148
|
-
export const { updateJESchedules, updateAccruedJESchedules, updateJEScheduledTransaction, updateAccruedJEScheduledTransaction, updateJESchedulesDetails, updateAccruedJESchedulesDetails, deleteJESchedulesDetails, deleteAccruedJESchedulesDetails,
|
|
120
|
+
export const { updateJESchedules, updateAccruedJESchedules, updateJEScheduledTransaction, updateAccruedJEScheduledTransaction, updateJESchedulesDetails, updateAccruedJESchedulesDetails, deleteJESchedulesDetails, deleteAccruedJESchedulesDetails, } = jeSchedules.actions;
|
|
149
121
|
export default jeSchedules.reducer;
|
|
150
122
|
/**
|
|
151
123
|
* Helper functions
|
|
@@ -5,34 +5,18 @@ import { getClassById } from '../class/classSelector';
|
|
|
5
5
|
import { getScheduleTransactionById } from '../transaction/transactionSelector';
|
|
6
6
|
import { getUserByUserId } from '../user/userSelector';
|
|
7
7
|
import { getVendorByVendorId } from '../vendor/vendorSelector';
|
|
8
|
-
// Takes the slice, not RootState: an accrual denormalizes its vendor, account and class names, so
|
|
9
|
-
// unlike getJEAccruedScheduleByJEScheduleKey this joins nothing.
|
|
10
|
-
//
|
|
11
|
-
// Spreads the stored entity rather than rebuilding it field by field. That is deliberate — the
|
|
12
|
-
// accrued joiner listed every field explicitly and silently dropped jeScheduleType, which made a
|
|
13
|
-
// whole tab render empty while its reducer test still passed. A spread cannot lose a field.
|
|
14
|
-
export const getJEOneTimeAccrualByKey = (jeOneTimeAccrualKey, jeSchedulesState) => {
|
|
15
|
-
const accrual = recordGet(jeSchedulesState.oneTimeAccrualsByKey, jeOneTimeAccrualKey);
|
|
16
|
-
if (accrual == null) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
return { ...accrual, jeOneTimeAccrualKey };
|
|
20
|
-
};
|
|
21
8
|
export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
|
|
22
9
|
const { jeSchedulesState, vendorState, accountState, userState, classState } = state;
|
|
23
10
|
const JEAccruedScheduleState = recordGet(jeSchedulesState.schedulesByAccruedJEScheduleKey, JEScheduleKey);
|
|
24
11
|
if (JEAccruedScheduleState == null) {
|
|
25
12
|
return undefined;
|
|
26
13
|
}
|
|
27
|
-
const { period, updatedByUserID: updatedBy,
|
|
14
|
+
const { period, updatedByUserID: updatedBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, memo, recurringAmount, createTime, otherAttributes, } = JEAccruedScheduleState;
|
|
28
15
|
const vendorDetails = getVendorByVendorId(vendorState, vendorId);
|
|
29
16
|
if (vendorDetails == null) {
|
|
30
17
|
throw new Error(`Vendor with ${vendorId} doesn't exist`);
|
|
31
18
|
}
|
|
32
19
|
const userDetails = updatedBy != null ? getUserByUserId(userState, updatedBy) : undefined;
|
|
33
|
-
// Resolved the same way the prepaid / fixed joiner does. Without it every accrued row rendered a
|
|
34
|
-
// hyphen under "Created by", even though the payload carries created_by.
|
|
35
|
-
const createdByUserDetails = createdBy != null ? getUserByUserId(userState, createdBy) : undefined;
|
|
36
20
|
const accountCredit = jeCredit.accountId != null
|
|
37
21
|
? getAccountBase(accountState, jeCredit.accountId, 'account_list')
|
|
38
22
|
: undefined;
|
|
@@ -51,19 +35,14 @@ export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
|
|
|
51
35
|
reportId: 'class_list',
|
|
52
36
|
})
|
|
53
37
|
: undefined;
|
|
54
|
-
const postedCount = scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
|
|
55
|
-
const lifecycleTotal = period ?? scheduledJournalEntry.length;
|
|
56
38
|
return {
|
|
57
39
|
jeScheduleId,
|
|
58
40
|
otherAttributes,
|
|
59
41
|
vendor: vendorDetails,
|
|
60
42
|
updatedByUser: userDetails,
|
|
61
|
-
createdByUser: createdByUserDetails,
|
|
62
43
|
updatedAt,
|
|
63
44
|
currencyCode,
|
|
64
45
|
currencySymbol,
|
|
65
|
-
lifecycleTotal,
|
|
66
|
-
postedCount,
|
|
67
46
|
jeCredit: {
|
|
68
47
|
accountingClass: classCredit,
|
|
69
48
|
account: accountCredit,
|
|
@@ -81,7 +60,6 @@ export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
|
|
|
81
60
|
memo,
|
|
82
61
|
createTime,
|
|
83
62
|
recurringAmount,
|
|
84
|
-
jeScheduleType,
|
|
85
63
|
jeAccruedScheduleKey: JEScheduleKey,
|
|
86
64
|
balanceAsOfToday: balanceAsOfToday != null
|
|
87
65
|
? toAmount(balanceAsOfToday, currencyCode, currencySymbol)
|
|
@@ -92,7 +70,7 @@ export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
|
|
|
92
70
|
export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
|
|
93
71
|
const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
|
|
94
72
|
const jeScheduleTransactionState = recordGet(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
|
|
95
|
-
const { period, updatedByUserID: updatedBy, createdByUserID: createdBy,
|
|
73
|
+
const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, recommendations, } = jeScheduleTransactionState;
|
|
96
74
|
const vendorDetails = getVendorByVendorId(vendorState, vendorId);
|
|
97
75
|
if (vendorDetails == null) {
|
|
98
76
|
throw new Error(`Vendor with ${vendorId} doesn't exist`);
|
|
@@ -121,24 +99,14 @@ export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTr
|
|
|
121
99
|
reportId: 'class_list',
|
|
122
100
|
})
|
|
123
101
|
: undefined;
|
|
124
|
-
// The expense-automation response carries no scheduled journal entries for these rows, so the
|
|
125
|
-
// filter below counts an empty array and every schedule reported 0 posted. Prefer the count the
|
|
126
|
-
// server derives, and keep the filter for callers that do have entries (the detail page, and
|
|
127
|
-
// failed postings, which come with theirs).
|
|
128
|
-
const postedCount = postedCountFromServer ??
|
|
129
|
-
scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
|
|
130
|
-
const lifecycleTotal = period ?? scheduledJournalEntry.length;
|
|
131
102
|
return {
|
|
132
103
|
jeScheduleId,
|
|
133
104
|
jeScheduleType,
|
|
134
|
-
recurringAmount,
|
|
135
105
|
jeScheduleTransactionKey: jeScheduleTransactionKey,
|
|
136
106
|
vendor: vendorDetails,
|
|
137
107
|
updatedByUser: userDetails,
|
|
138
108
|
updatedAt: updatedAt,
|
|
139
109
|
period,
|
|
140
|
-
lifecycleTotal,
|
|
141
|
-
postedCount,
|
|
142
110
|
balanceAsOfToday: balanceAsOfToday != null
|
|
143
111
|
? toAmount(balanceAsOfToday, currencyCode, currencySymbol)
|
|
144
112
|
: undefined,
|
|
@@ -161,9 +129,7 @@ export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTr
|
|
|
161
129
|
},
|
|
162
130
|
scheduledJournalEntry,
|
|
163
131
|
aiSummaries,
|
|
164
|
-
confidenceScore,
|
|
165
132
|
createdByUser: createdByUserDetails,
|
|
166
|
-
createTime,
|
|
167
133
|
recommendations,
|
|
168
134
|
};
|
|
169
135
|
};
|
|
@@ -24,84 +24,6 @@ const SCHEDULE_STATUS_CODE = [
|
|
|
24
24
|
'draft',
|
|
25
25
|
];
|
|
26
26
|
export const toScheduleStatusCodeType = (v) => stringToUnion(v, SCHEDULE_STATUS_CODE);
|
|
27
|
-
// One-time accruals come from agent-je's Mongo `accruals` collection, not the JE schedule
|
|
28
|
-
// datastore, so they carry their own status vocabulary rather than SCHEDULE_STATUS_CODE.
|
|
29
|
-
// `posting` and `reversing` are transient claims held while a JE posts.
|
|
30
|
-
const ONE_TIME_ACCRUAL_STATUS_CODE = [
|
|
31
|
-
'draft',
|
|
32
|
-
'posting',
|
|
33
|
-
'posted',
|
|
34
|
-
'posting_blocked',
|
|
35
|
-
'reversing',
|
|
36
|
-
'reversed',
|
|
37
|
-
];
|
|
38
|
-
export const toOneTimeAccrualStatusCodeType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_STATUS_CODE);
|
|
39
|
-
// Who created the accrual. This — not the creator's email — is the authoritative
|
|
40
|
-
// AI-vs-manual signal for the Method column.
|
|
41
|
-
const ONE_TIME_ACCRUAL_ORIGIN = ['agent', 'human'];
|
|
42
|
-
export const toOneTimeAccrualOriginType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_ORIGIN);
|
|
43
|
-
const ONE_TIME_ACCRUAL_AUTOMATION_TIER = ['manual', 'draft', 'auto'];
|
|
44
|
-
export const toOneTimeAccrualAutomationTierType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_AUTOMATION_TIER);
|
|
45
|
-
// How the accrual is allowed to reverse. The two are exclusive: a scheduled row reverses on
|
|
46
|
-
// expectedReversalDate and bills never drive it; an on_bill_match row reverses only when a bill
|
|
47
|
-
// is matched, which is why its lifecycle reads "Reverses on match" rather than showing a date.
|
|
48
|
-
const ONE_TIME_ACCRUAL_REVERSAL_POLICY = [
|
|
49
|
-
'on_bill_match',
|
|
50
|
-
'scheduled_date',
|
|
51
|
-
];
|
|
52
|
-
export const toOneTimeAccrualReversalPolicyType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_REVERSAL_POLICY);
|
|
53
|
-
// What actually caused a reverse. Distinct from a *revert*, which soft-deletes the row and
|
|
54
|
-
// never sets this.
|
|
55
|
-
const ONE_TIME_ACCRUAL_REVERSAL_TRIGGER = [
|
|
56
|
-
'bill_match',
|
|
57
|
-
'scheduled_date',
|
|
58
|
-
'manual_reverse',
|
|
59
|
-
];
|
|
60
|
-
export const toOneTimeAccrualReversalTriggerType = (v) => stringToUnionStrict(v ?? '', ONE_TIME_ACCRUAL_REVERSAL_TRIGGER);
|
|
61
|
-
// Why a human told the AI Accountant not to accrue this month. The gateway validates against
|
|
62
|
-
// exactly this set, so it is a union rather than a free-text string.
|
|
63
|
-
const ONE_TIME_ACCRUAL_IGNORE_REASON = [
|
|
64
|
-
'no_activity',
|
|
65
|
-
'paused',
|
|
66
|
-
'too_small',
|
|
67
|
-
'need_invoice',
|
|
68
|
-
'other_ignore',
|
|
69
|
-
];
|
|
70
|
-
export const toOneTimeAccrualIgnoreReasonType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_IGNORE_REASON);
|
|
71
|
-
export const ALL_ONE_TIME_ACCRUAL_IGNORE_REASONS = ONE_TIME_ACCRUAL_IGNORE_REASON;
|
|
72
|
-
// Why a recommended prepaid / fixed-asset schedule is being dismissed. A different set from the
|
|
73
|
-
// accrual ignore reasons: the gateway validates each against its own list.
|
|
74
|
-
const JE_SCHEDULE_IGNORE_REASON = [
|
|
75
|
-
'not_needed',
|
|
76
|
-
'wrong_account',
|
|
77
|
-
'duplicate',
|
|
78
|
-
'already_handled',
|
|
79
|
-
'other_ignore',
|
|
80
|
-
];
|
|
81
|
-
export const toJEScheduleIgnoreReasonType = (v) => stringToUnion(v, JE_SCHEDULE_IGNORE_REASON);
|
|
82
|
-
export const ALL_JE_SCHEDULE_IGNORE_REASONS = JE_SCHEDULE_IGNORE_REASON;
|
|
83
|
-
// Why a posted prepaid / fixed-asset schedule is being undone. Note `not_accrual` is accrual-only
|
|
84
|
-
// and rejected here, and `created_by_mistake` is schedule-only.
|
|
85
|
-
const JE_SCHEDULE_REVERT_REASON = [
|
|
86
|
-
'amount_off',
|
|
87
|
-
'wrong_period',
|
|
88
|
-
'duplicate',
|
|
89
|
-
'created_by_mistake',
|
|
90
|
-
'other_revert',
|
|
91
|
-
];
|
|
92
|
-
export const toJEScheduleRevertReasonType = (v) => stringToUnion(v, JE_SCHEDULE_REVERT_REASON);
|
|
93
|
-
export const ALL_JE_SCHEDULE_REVERT_REASONS = JE_SCHEDULE_REVERT_REASON;
|
|
94
|
-
// Why a posted accrual is being undone. A disjoint set from the ignore reasons — the gateway
|
|
95
|
-
// validates each action against its own list and rejects the other's values.
|
|
96
|
-
const ONE_TIME_ACCRUAL_REVERT_REASON = [
|
|
97
|
-
'amount_off',
|
|
98
|
-
'wrong_period',
|
|
99
|
-
'not_accrual',
|
|
100
|
-
'duplicate',
|
|
101
|
-
'other_revert',
|
|
102
|
-
];
|
|
103
|
-
export const toOneTimeAccrualRevertReasonType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_REVERT_REASON);
|
|
104
|
-
export const ALL_ONE_TIME_ACCRUAL_REVERT_REASONS = ONE_TIME_ACCRUAL_REVERT_REASON;
|
|
105
27
|
const JOURNAL_ENTRY_ERROR_CODE = [
|
|
106
28
|
'vendor_deleted',
|
|
107
29
|
'debit_category_deleted',
|
|
@@ -30,7 +30,5 @@ export const toScheduleTransaction = (payload, currency_code, currency_symbol) =
|
|
|
30
30
|
currencySymbol: currency_symbol,
|
|
31
31
|
},
|
|
32
32
|
description: payload.transaction_description ?? undefined,
|
|
33
|
-
vendorId: payload.vendor_id ?? undefined,
|
|
34
|
-
vendorName: payload.vendor_name ?? undefined,
|
|
35
33
|
};
|
|
36
34
|
};
|
package/lib/esm/epic.js
CHANGED
|
@@ -195,17 +195,9 @@ import { initializeAccountSettingsViewEpic, } from './view/expenseAutomationView
|
|
|
195
195
|
import { saveAccountSettingsViewEpic, } from './view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic';
|
|
196
196
|
import { fetchJeSchedulesPageEpic as fetchExpenseAutomationJESchedulesPageEpic, } from './view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic';
|
|
197
197
|
import { fetchJeSchedulesEpic as fetchExpenseAutomationJeSchedulesEpic, } from './view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic';
|
|
198
|
-
import { fetchOneTimeAccrualEpic, } from './view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic';
|
|
199
198
|
import { ignoreRecommendedJeScheduleEpic as ignoreExpenseAutomationJEScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic';
|
|
200
199
|
import { initializeJeScheduleLocalDataEpic as initializeExpenseAutomationJeScheduleLocalDataEpic, } from './view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic';
|
|
201
|
-
import { createOneTimeAccrualEpic, } from './view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic';
|
|
202
|
-
import { initializeNewScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic';
|
|
203
|
-
import { saveNewScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic';
|
|
204
|
-
import { searchTransactionsForNewScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic';
|
|
205
|
-
import { oneTimeAccrualActionsEpic, } from './view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic';
|
|
206
200
|
import { retryJeScheduleEpic as retryExpenseAutomationJEScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic';
|
|
207
|
-
import { revertJeScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic';
|
|
208
|
-
import { switchJESchedulesTabEpic as switchExpenseAutomationJESchedulesTabEpic, } from './view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic';
|
|
209
201
|
import { bulkUploadMatchResultToastEpic, } from './view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic';
|
|
210
202
|
import { bulkUploadReceiptsEpic, } from './view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic';
|
|
211
203
|
import { confirmBulkUploadMatchEpic, } from './view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic';
|
|
@@ -787,7 +779,6 @@ const ALL_EPICS = [
|
|
|
787
779
|
createNewSchedulesAccruedEpic,
|
|
788
780
|
createNewSchedulesEpic,
|
|
789
781
|
createNewTaskGroupEpic,
|
|
790
|
-
createOneTimeAccrualEpic,
|
|
791
782
|
createPaymentInstrumentEpic,
|
|
792
783
|
createSessionAndSubmitEpic,
|
|
793
784
|
createSessionEpic,
|
|
@@ -1067,7 +1058,6 @@ const ALL_EPICS = [
|
|
|
1067
1058
|
fetchOnboardingCustomerSetupViewEpic,
|
|
1068
1059
|
fetchOnboardingCustomerViewEpic,
|
|
1069
1060
|
fetchOnboardingViewEpic,
|
|
1070
|
-
fetchOneTimeAccrualEpic,
|
|
1071
1061
|
fetchOpExByVendorEpic,
|
|
1072
1062
|
fetchOpExByVendorReportForTimeframeEpic,
|
|
1073
1063
|
fetchOpExByVendorReportSummaryEpic,
|
|
@@ -1222,7 +1212,6 @@ const ALL_EPICS = [
|
|
|
1222
1212
|
initializeInvoicingCustomerAddressEpic,
|
|
1223
1213
|
initializeInvoicingSubscriptionAddressEpic,
|
|
1224
1214
|
initializeMyProfileLocalDataEpic,
|
|
1225
|
-
initializeNewScheduleEpic,
|
|
1226
1215
|
initializeOnboardingCustomerViewUpdateDataEpic,
|
|
1227
1216
|
initializeRemiSetupApproverViewUpdateDataEpic,
|
|
1228
1217
|
initializeRemiToLocalStoreEpic,
|
|
@@ -1245,7 +1234,6 @@ const ALL_EPICS = [
|
|
|
1245
1234
|
markAsCompleteScheduleDetailEpic,
|
|
1246
1235
|
markTransactionAsNotMiscategorizedEpic,
|
|
1247
1236
|
notifyMeForFeatureEpic,
|
|
1248
|
-
oneTimeAccrualActionsEpic,
|
|
1249
1237
|
parallelFetchAccountTransactionListEpic,
|
|
1250
1238
|
parallelFetchClassTransactionListEpic,
|
|
1251
1239
|
parallelFetchEntityTransactionListEpic,
|
|
@@ -1289,7 +1277,6 @@ const ALL_EPICS = [
|
|
|
1289
1277
|
retryExpenseAutomationJEScheduleEpic,
|
|
1290
1278
|
retryInvoicingQboSyncTaskEpic,
|
|
1291
1279
|
retryOrRefundBillEpic,
|
|
1292
|
-
revertJeScheduleEpic,
|
|
1293
1280
|
reviewDraftRemisBulkActionEpic,
|
|
1294
1281
|
reviewExpenseAutomationFluxAnalysisViewEpic,
|
|
1295
1282
|
revokeCardInviteEpic,
|
|
@@ -1325,7 +1312,6 @@ const ALL_EPICS = [
|
|
|
1325
1312
|
saveInvoicingSubscriptionEpic,
|
|
1326
1313
|
saveMagicLinkBankAccountEpic,
|
|
1327
1314
|
saveNewAddressEpic,
|
|
1328
|
-
saveNewScheduleEpic,
|
|
1329
1315
|
saveNotificationPreferencesEpic,
|
|
1330
1316
|
saveNotificationSettingsEpic,
|
|
1331
1317
|
saveOAuthConnectionEpic,
|
|
@@ -1350,7 +1336,6 @@ const ALL_EPICS = [
|
|
|
1350
1336
|
saveVendorsTabVendorEpic,
|
|
1351
1337
|
scheduleTenantCreditScoreCronEpic,
|
|
1352
1338
|
searchTransactionsForManualMatchEpic,
|
|
1353
|
-
searchTransactionsForNewScheduleEpic,
|
|
1354
1339
|
seedAiCardCreationFormDraftEpic,
|
|
1355
1340
|
seedAiCardPolicyFormDraftEpic,
|
|
1356
1341
|
sendCompanyMonthEndReportEpic,
|
|
@@ -1373,7 +1358,6 @@ const ALL_EPICS = [
|
|
|
1373
1358
|
submitIntlVerificationEpic,
|
|
1374
1359
|
submitInvoicingBrandingFormEpic,
|
|
1375
1360
|
submitQuestionEpic,
|
|
1376
|
-
switchExpenseAutomationJESchedulesTabEpic,
|
|
1377
1361
|
syncInvoicingSubscriptionCouponsEpic,
|
|
1378
1362
|
syncTabsAfterAutomatchEpic,
|
|
1379
1363
|
toggleReportUIOptionForecastModeEpic,
|