@zeniai/client-epic-state 5.2.14-betaRD0 → 5.2.14
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/jeSchedules/jeScheduleHelper.d.ts +0 -1
- package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -78
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +4 -183
- 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 -123
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -96
- 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/jeSchedules/jeScheduleHelper.js +0 -6
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +5 -183
- 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 -86
- 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/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +1 -9
- 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 -319
- package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +0 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -327
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
- 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/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +1 -9
- 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 -86
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -93
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -321
- 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/jeAccountSettingsViewSelectorTypes.d.ts +0 -1
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -41
- package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +0 -1
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -335
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -83
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
- 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/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -104
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -138
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -180
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -111
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -28
- 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/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -21
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -9
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -108
- 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 -9
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -142
- 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 -13
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -187
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -65
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -115
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -32
- 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/epic.js
CHANGED
|
@@ -198,17 +198,9 @@ const initializeAccountSettingsViewEpic_1 = require("./view/expenseAutomationVie
|
|
|
198
198
|
const saveAccountSettingsViewEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic");
|
|
199
199
|
const fetchJeSchedulePageEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic");
|
|
200
200
|
const fetchJeSchedulesEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic");
|
|
201
|
-
const fetchOneTimeAccrualEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic");
|
|
202
201
|
const ignoreRecommendedJeScheduleEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic");
|
|
203
202
|
const initializeJeScheduleLocalDataEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic");
|
|
204
|
-
const createOneTimeAccrualEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic");
|
|
205
|
-
const initializeNewScheduleEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic");
|
|
206
|
-
const saveNewScheduleEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic");
|
|
207
|
-
const searchTransactionsForNewScheduleEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic");
|
|
208
|
-
const oneTimeAccrualActionsEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic");
|
|
209
203
|
const retryJeSchedulesEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic");
|
|
210
|
-
const revertJeScheduleEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic");
|
|
211
|
-
const switchJESchedulesTabEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic");
|
|
212
204
|
const bulkUploadMatchResultToastEpic_1 = require("./view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic");
|
|
213
205
|
const bulkUploadReceiptsEpic_1 = require("./view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic");
|
|
214
206
|
const confirmBulkUploadMatchEpic_1 = require("./view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic");
|
|
@@ -794,7 +786,6 @@ const ALL_EPICS = [
|
|
|
794
786
|
createNewSchedulesAccruedEpic_1.createNewSchedulesAccruedEpic,
|
|
795
787
|
createNewSchedulesEpic_1.createNewSchedulesEpic,
|
|
796
788
|
createNewTaskGroupEpic_1.createNewTaskGroupEpic,
|
|
797
|
-
createOneTimeAccrualEpic_1.createOneTimeAccrualEpic,
|
|
798
789
|
createInternationalPaymentInstrumentEpic_1.createPaymentInstrumentEpic,
|
|
799
790
|
createSessionAndSubmitEpic_1.createSessionAndSubmitEpic,
|
|
800
791
|
createSessionEpic_1.createSessionEpic,
|
|
@@ -1074,7 +1065,6 @@ const ALL_EPICS = [
|
|
|
1074
1065
|
fetchOnboardingCustomerSetupViewEpic_1.fetchOnboardingCustomerSetupViewEpic,
|
|
1075
1066
|
fetchOnboardingCustomerViewEpic_1.fetchOnboardingCustomerViewEpic,
|
|
1076
1067
|
fetchOnboardingViewEpic_1.fetchOnboardingViewEpic,
|
|
1077
|
-
fetchOneTimeAccrualEpic_1.fetchOneTimeAccrualEpic,
|
|
1078
1068
|
fetchOpExByVendorReportEpic_1.fetchOpExByVendorEpic,
|
|
1079
1069
|
fetchOpExByVendorReportForTimeframeEpic_1.fetchOpExByVendorReportForTimeframeEpic,
|
|
1080
1070
|
fetchOpExByVendorReportSummaryEpic_1.fetchOpExByVendorReportSummaryEpic,
|
|
@@ -1229,7 +1219,6 @@ const ALL_EPICS = [
|
|
|
1229
1219
|
initializeInvoicingCustomerAddressEpic_1.initializeInvoicingCustomerAddressEpic,
|
|
1230
1220
|
initializeInvoicingSubscriptionAddressEpic_1.initializeInvoicingSubscriptionAddressEpic,
|
|
1231
1221
|
initializeMyProfileLocalDataEpic_1.initializeMyProfileLocalDataEpic,
|
|
1232
|
-
initializeNewScheduleEpic_1.initializeNewScheduleEpic,
|
|
1233
1222
|
initializeOnboardingCustomerViewUpdateDataEpic_1.initializeOnboardingCustomerViewUpdateDataEpic,
|
|
1234
1223
|
initializeRemiSetupApproverViewUpdateDataEpic_1.initializeRemiSetupApproverViewUpdateDataEpic,
|
|
1235
1224
|
initializeRemiToLocalStoreEpic_1.initializeRemiToLocalStoreEpic,
|
|
@@ -1252,7 +1241,6 @@ const ALL_EPICS = [
|
|
|
1252
1241
|
markAsCompleteScheduleDetailEpic_1.markAsCompleteScheduleDetailEpic,
|
|
1253
1242
|
markTransactionAsNotMiscategorizedEpic_2.markTransactionAsNotMiscategorizedEpic,
|
|
1254
1243
|
notifyMeForFeatureEpic_1.notifyMeForFeatureEpic,
|
|
1255
|
-
oneTimeAccrualActionsEpic_1.oneTimeAccrualActionsEpic,
|
|
1256
1244
|
parallelFetchAccountTransactionListEpic_1.parallelFetchAccountTransactionListEpic,
|
|
1257
1245
|
parallelFetchClassTransactionListEpic_1.parallelFetchClassTransactionListEpic,
|
|
1258
1246
|
parallelFetchEntityTransactionListEpic_1.parallelFetchEntityTransactionListEpic,
|
|
@@ -1296,7 +1284,6 @@ const ALL_EPICS = [
|
|
|
1296
1284
|
retryJeSchedulesEpic_1.retryJeScheduleEpic,
|
|
1297
1285
|
retryInvoicingQboSyncTaskEpic_1.retryInvoicingQboSyncTaskEpic,
|
|
1298
1286
|
retryOrRefundBillEpic_1.retryOrRefundBillEpic,
|
|
1299
|
-
revertJeScheduleEpic_1.revertJeScheduleEpic,
|
|
1300
1287
|
reviewDraftRemisBulkActionEpic_ts_1.reviewDraftRemisBulkActionEpic,
|
|
1301
1288
|
reviewFluxAnalysisEpic_1.reviewFluxAnalysisViewEpic,
|
|
1302
1289
|
revokeCardInviteEpic_1.revokeCardInviteEpic,
|
|
@@ -1332,7 +1319,6 @@ const ALL_EPICS = [
|
|
|
1332
1319
|
saveInvoicingSubscriptionEpic_1.saveInvoicingSubscriptionEpic,
|
|
1333
1320
|
saveMagicLinkBankAccountEpic_1.saveMagicLinkBankAccountEpic,
|
|
1334
1321
|
saveNewAddressEpic_1.saveNewAddressEpic,
|
|
1335
|
-
saveNewScheduleEpic_1.saveNewScheduleEpic,
|
|
1336
1322
|
saveNotificationPreferencesEpic_1.saveNotificationPreferencesEpic,
|
|
1337
1323
|
saveNotificationSettingsEpic_1.saveNotificationSettingsEpic,
|
|
1338
1324
|
saveOAuthConnectionEpic_1.saveOAuthConnectionEpic,
|
|
@@ -1357,7 +1343,6 @@ const ALL_EPICS = [
|
|
|
1357
1343
|
saveVendorsTabVendorEpic_1.saveVendorsTabVendorEpic,
|
|
1358
1344
|
scheduleTenantCreditScoreCronEpic_1.scheduleTenantCreditScoreCronEpic,
|
|
1359
1345
|
searchTransactionsForManualMatchEpic_1.searchTransactionsForManualMatchEpic,
|
|
1360
|
-
searchTransactionsForNewScheduleEpic_1.searchTransactionsForNewScheduleEpic,
|
|
1361
1346
|
seedAiCardCreationFormDraftEpic_1.seedAiCardCreationFormDraftEpic,
|
|
1362
1347
|
seedAiCardPolicyFormDraftEpic_1.seedAiCardPolicyFormDraftEpic,
|
|
1363
1348
|
sendCompanyMonthEndReportEpic_1.sendCompanyMonthEndReportEpic,
|
|
@@ -1381,7 +1366,6 @@ const ALL_EPICS = [
|
|
|
1381
1366
|
invoicingBrandingFormEpics_1.submitInvoicingBrandingFormEpic,
|
|
1382
1367
|
submitInvoicingQboSettingsEpic_1.submitInvoicingQboSettingsEpic,
|
|
1383
1368
|
submitQuestionEpic_1.submitQuestionEpic,
|
|
1384
|
-
switchJESchedulesTabEpic_1.switchJESchedulesTabEpic,
|
|
1385
1369
|
syncInvoicingSubscriptionCouponsEpic_1.syncInvoicingSubscriptionCouponsEpic,
|
|
1386
1370
|
syncTabsAfterAutomatchEpic_1.syncTabsAfterAutomatchEpic,
|
|
1387
1371
|
toggleReportUIOptionForecastModeEpic_1.toggleReportUIOptionForecastModeEpic,
|
|
@@ -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: {
|
|
@@ -204,43 +202,6 @@ function toJEScheduleAISummaries(payload) {
|
|
|
204
202
|
: undefined,
|
|
205
203
|
};
|
|
206
204
|
}
|
|
207
|
-
if (payload.starting_month != null) {
|
|
208
|
-
result.startingMonth = {
|
|
209
|
-
confidence: payload.starting_month.confidence,
|
|
210
|
-
reasoning: payload.starting_month.reasoning,
|
|
211
|
-
cot: Array.isArray(payload.starting_month.cot)
|
|
212
|
-
? payload.starting_month.cot
|
|
213
|
-
: undefined,
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
if (payload.end_date != null) {
|
|
217
|
-
result.endDate = {
|
|
218
|
-
confidence: payload.end_date.confidence,
|
|
219
|
-
reasoning: payload.end_date.reasoning,
|
|
220
|
-
cot: Array.isArray(payload.end_date.cot)
|
|
221
|
-
? payload.end_date.cot
|
|
222
|
-
: undefined,
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
if (payload.posting_start_date != null) {
|
|
226
|
-
result.postingStartDate = {
|
|
227
|
-
confidence: payload.posting_start_date.confidence,
|
|
228
|
-
reasoning: payload.posting_start_date.reasoning,
|
|
229
|
-
cot: Array.isArray(payload.posting_start_date.cot)
|
|
230
|
-
? payload.posting_start_date.cot
|
|
231
|
-
: undefined,
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
if (payload.schedule_summary != null) {
|
|
235
|
-
result.scheduleSummary = {
|
|
236
|
-
confidence: payload.schedule_summary.confidence,
|
|
237
|
-
reasoning: payload.schedule_summary.reasoning,
|
|
238
|
-
reasoningLong: payload.schedule_summary.reasoning_long,
|
|
239
|
-
cot: Array.isArray(payload.schedule_summary.cot)
|
|
240
|
-
? payload.schedule_summary.cot
|
|
241
|
-
: undefined,
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
205
|
return Object.keys(result).length > 0 ? result : undefined;
|
|
245
206
|
}
|
|
246
207
|
function toJEScheduleRecommendations(payload) {
|
|
@@ -287,18 +248,9 @@ export function toJEScheduledTransaction(payload) {
|
|
|
287
248
|
startDate: payload.start_date != null ? date(payload.start_date) : undefined,
|
|
288
249
|
endDate: payload.end_date != null ? date(payload.end_date) : undefined,
|
|
289
250
|
period: payload.period != null ? Number(payload.period) : undefined,
|
|
290
|
-
recurringAmount: payload.recurring_amount != null
|
|
291
|
-
? {
|
|
292
|
-
amount: payload.recurring_amount,
|
|
293
|
-
currencyCode: payload.currency_code,
|
|
294
|
-
currencySymbol: payload.currency_symbol,
|
|
295
|
-
}
|
|
296
|
-
: undefined,
|
|
297
|
-
postedCount: payload.posted_count ?? undefined,
|
|
298
251
|
updatedByUserID: payload.updated_by.user_id,
|
|
299
252
|
balanceAsOfToday: payload.balance ?? undefined,
|
|
300
253
|
updatedAt: payload.updated_at != null ? date(payload.updated_at) : undefined,
|
|
301
|
-
createTime: payload.create_time != null ? date(payload.create_time) : undefined,
|
|
302
254
|
jeCredit: {
|
|
303
255
|
accountId: payload.je_credit_account_id ?? undefined,
|
|
304
256
|
accountingClassId: payload.je_credit_accounting_class_id ?? undefined,
|
|
@@ -323,7 +275,6 @@ export function toJEScheduledTransaction(payload) {
|
|
|
323
275
|
: {},
|
|
324
276
|
scheduledJournalEntry: [],
|
|
325
277
|
aiSummaries: toJEScheduleAISummaries(payload.ai_summaries),
|
|
326
|
-
confidenceScore: payload.confidence_score ?? undefined,
|
|
327
278
|
createdByUserID: payload.created_by?.user_id ?? undefined,
|
|
328
279
|
recommendations: toJEScheduleRecommendations(payload.recommendations),
|
|
329
280
|
};
|
|
@@ -336,20 +287,17 @@ export function toJEAccruedScheduledTransaction(payload) {
|
|
|
336
287
|
label: payload.status.label,
|
|
337
288
|
},
|
|
338
289
|
vendorId: payload.vendor.vendor_id,
|
|
339
|
-
// The accrued payload extends JEScheduledTransactionPayload, so it carries currency_code and
|
|
340
|
-
// currency_symbol like every other schedule -- this mapper was hardcoding USD over fields it
|
|
341
|
-
// already had.
|
|
342
290
|
recurringAmount: {
|
|
343
291
|
amount: payload.recurring_amount,
|
|
344
|
-
currencyCode:
|
|
345
|
-
currencySymbol:
|
|
292
|
+
currencyCode: 'USD',
|
|
293
|
+
currencySymbol: '$',
|
|
346
294
|
},
|
|
347
295
|
otherAttributes: {
|
|
348
296
|
startingBalance: payload.other_attributes?.starting_balance != null
|
|
349
297
|
? {
|
|
350
298
|
amount: payload.other_attributes?.starting_balance ?? 0,
|
|
351
|
-
currencyCode:
|
|
352
|
-
currencySymbol:
|
|
299
|
+
currencyCode: 'USD',
|
|
300
|
+
currencySymbol: '$',
|
|
353
301
|
}
|
|
354
302
|
: undefined,
|
|
355
303
|
},
|
|
@@ -358,9 +306,6 @@ export function toJEAccruedScheduledTransaction(payload) {
|
|
|
358
306
|
endDate: payload.end_date != null ? date(payload.end_date) : undefined,
|
|
359
307
|
period: payload.period != null ? Number(payload.period) : undefined,
|
|
360
308
|
updatedByUserID: payload.updated_by.user_id,
|
|
361
|
-
// The accrued joiner resolves createdByUserID into the "Created by" cell. Without this the
|
|
362
|
-
// payload's created_by was dropped here and every accrued row rendered a hyphen.
|
|
363
|
-
createdByUserID: payload.created_by?.user_id ?? undefined,
|
|
364
309
|
balanceAsOfToday: payload.balance ?? undefined,
|
|
365
310
|
updatedAt: payload.updated_at != null ? date(payload.updated_at) : undefined,
|
|
366
311
|
jeCredit: {
|
|
@@ -387,126 +332,3 @@ export function toJEAccruedScheduledTransaction(payload) {
|
|
|
387
332
|
jeScheduleType: toScheduleTypesTypeStrict(payload.je_schedule_type),
|
|
388
333
|
};
|
|
389
334
|
}
|
|
390
|
-
/**
|
|
391
|
-
* Reads the months in the order the snapshot gives them rather than deriving a range: a vendor that
|
|
392
|
-
* skipped a month has no entry for it, so filling gaps would invent history that was never billed.
|
|
393
|
-
*/
|
|
394
|
-
function toJEOneTimeAccrualMonthlyTotals(snapshot, currencyCode) {
|
|
395
|
-
const monthlyTotals = snapshot.monthly_totals;
|
|
396
|
-
if (monthlyTotals == null) {
|
|
397
|
-
return [];
|
|
398
|
-
}
|
|
399
|
-
const months = snapshot.sorted_months ?? Object.keys(monthlyTotals).sort();
|
|
400
|
-
return months
|
|
401
|
-
.filter((month) => monthlyTotals[month] != null)
|
|
402
|
-
.map((month) => ({
|
|
403
|
-
month,
|
|
404
|
-
amount: toOneTimeAccrualAmount(monthlyTotals[month], currencyCode),
|
|
405
|
-
}));
|
|
406
|
-
}
|
|
407
|
-
function toJEOneTimeAccrualProfileSnapshot(payload, currencyCode) {
|
|
408
|
-
if (payload == null) {
|
|
409
|
-
return undefined;
|
|
410
|
-
}
|
|
411
|
-
const billingPattern = payload.billing_pattern;
|
|
412
|
-
return {
|
|
413
|
-
monthlyTotals: toJEOneTimeAccrualMonthlyTotals(payload, currencyCode),
|
|
414
|
-
billingPattern: billingPattern != null
|
|
415
|
-
? {
|
|
416
|
-
frequency: billingPattern.frequency ?? undefined,
|
|
417
|
-
monthsOfHistory: billingPattern.months_of_history ?? undefined,
|
|
418
|
-
consistencyScore: billingPattern.consistency_score ?? undefined,
|
|
419
|
-
billingLagDays: billingPattern.billing_lag_days ?? undefined,
|
|
420
|
-
typicalBillDay: billingPattern.typical_bill_day ?? undefined,
|
|
421
|
-
avgAmount: billingPattern.avg_amount != null
|
|
422
|
-
? toOneTimeAccrualAmount(billingPattern.avg_amount, currencyCode)
|
|
423
|
-
: undefined,
|
|
424
|
-
lastBillAmount: billingPattern.last_bill_amount != null
|
|
425
|
-
? toOneTimeAccrualAmount(billingPattern.last_bill_amount, currencyCode)
|
|
426
|
-
: undefined,
|
|
427
|
-
lastBillDate: billingPattern.last_bill_date != null
|
|
428
|
-
? date(billingPattern.last_bill_date)
|
|
429
|
-
: undefined,
|
|
430
|
-
}
|
|
431
|
-
: undefined,
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
function toJEOneTimeAccrualAiSuggestion(payload, currencyCode) {
|
|
435
|
-
if (payload == null) {
|
|
436
|
-
return undefined;
|
|
437
|
-
}
|
|
438
|
-
return {
|
|
439
|
-
memo: payload.memo ?? undefined,
|
|
440
|
-
jeDebitAccountName: payload.je_debit_account_name ?? undefined,
|
|
441
|
-
jeCreditAccountName: payload.je_credit_account_name ?? undefined,
|
|
442
|
-
estimatedAmount: payload.estimated_amount != null
|
|
443
|
-
? toOneTimeAccrualAmount(payload.estimated_amount, currencyCode)
|
|
444
|
-
: undefined,
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
export function toJEOneTimeAccrual(payload) {
|
|
448
|
-
return {
|
|
449
|
-
accrualId: payload._id,
|
|
450
|
-
vendorId: payload.vendor_id,
|
|
451
|
-
vendorName: payload.vendor_name,
|
|
452
|
-
serviceMonth: payload.service_month,
|
|
453
|
-
accrualStatus: toOneTimeAccrualStatusCodeType(payload.status),
|
|
454
|
-
origin: toOneTimeAccrualOriginType(payload.origin),
|
|
455
|
-
automationTier: payload.automation_tier != null
|
|
456
|
-
? toOneTimeAccrualAutomationTierType(payload.automation_tier)
|
|
457
|
-
: undefined,
|
|
458
|
-
estimatedAmount: toOneTimeAccrualAmount(payload.estimated_amount, payload.currency),
|
|
459
|
-
memo: payload.memo ?? '',
|
|
460
|
-
profileSnapshot: toJEOneTimeAccrualProfileSnapshot(payload.profile_snapshot, payload.currency),
|
|
461
|
-
isIgnored: payload.is_ignored === true,
|
|
462
|
-
aiSuggestion: toJEOneTimeAccrualAiSuggestion(payload.ai_suggestion, payload.currency),
|
|
463
|
-
// Exclusive by contract: a scheduled row reverses on expectedReversalDate and bills never
|
|
464
|
-
// drive it, so the two never need reconciling. Defaulting to on_bill_match matches the
|
|
465
|
-
// create path's default when the field is absent on an older document.
|
|
466
|
-
reversalPolicy: toOneTimeAccrualReversalPolicyType(payload.reversal_policy ?? 'on_bill_match'),
|
|
467
|
-
reversalTrigger: toOneTimeAccrualReversalTriggerType(payload.reversal_trigger ?? undefined),
|
|
468
|
-
expectedReversalDate: payload.expected_reversal_date != null
|
|
469
|
-
? date(payload.expected_reversal_date)
|
|
470
|
-
: undefined,
|
|
471
|
-
postingDate: payload.posting_date != null ? date(payload.posting_date) : undefined,
|
|
472
|
-
actualPostDate: payload.actual_post_date != null
|
|
473
|
-
? date(payload.actual_post_date)
|
|
474
|
-
: undefined,
|
|
475
|
-
actualReversalPostDate: payload.actual_reversal_post_date != null
|
|
476
|
-
? date(payload.actual_reversal_post_date)
|
|
477
|
-
: undefined,
|
|
478
|
-
jeDebitAccountId: payload.je_debit_account_id ?? undefined,
|
|
479
|
-
jeDebitAccountName: payload.je_debit_account_name ?? undefined,
|
|
480
|
-
jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
|
|
481
|
-
jeDebitAccountingClassName: payload.je_debit_accounting_class_name ?? undefined,
|
|
482
|
-
jeCreditAccountId: payload.je_credit_account_id ?? undefined,
|
|
483
|
-
jeCreditAccountName: payload.je_credit_account_name ?? undefined,
|
|
484
|
-
jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
|
|
485
|
-
jeCreditAccountingClassName: payload.je_credit_accounting_class_name ?? undefined,
|
|
486
|
-
transactionId: payload.transaction_id ?? undefined,
|
|
487
|
-
transactionIntegrationId: payload.transaction_integration_id ?? undefined,
|
|
488
|
-
reversalTransactionId: payload.reversal_transaction_id ?? undefined,
|
|
489
|
-
createdBy: toJEOneTimeAccrualCreator(payload.created_by_user),
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
// The accrual wire format carries a currency CODE but no symbol, so the symbol has to be derived.
|
|
493
|
-
// Only USD has a known glyph today (the create path is USD-only); anything else falls back to the
|
|
494
|
-
// code, which reads correctly as "EUR 1,200" rather than silently rendering a wrong "$".
|
|
495
|
-
function toOneTimeAccrualAmount(amount, currencyCode) {
|
|
496
|
-
const code = currencyCode ?? USD_CURRENCY_CODE;
|
|
497
|
-
return toAmount(amount, code, code === USD_CURRENCY_CODE ? '$' : code);
|
|
498
|
-
}
|
|
499
|
-
function toJEOneTimeAccrualCreator(payload) {
|
|
500
|
-
if (payload == null) {
|
|
501
|
-
return undefined;
|
|
502
|
-
}
|
|
503
|
-
return {
|
|
504
|
-
userId: payload.user_id,
|
|
505
|
-
email: payload.email ?? undefined,
|
|
506
|
-
firstName: payload.first_name ?? undefined,
|
|
507
|
-
lastName: payload.last_name ?? undefined,
|
|
508
|
-
photo: payload.photo?.original != null
|
|
509
|
-
? toZeniUrl(payload.photo.original)
|
|
510
|
-
: undefined,
|
|
511
|
-
};
|
|
512
|
-
}
|
|
@@ -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,92 +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
|
-
/**
|
|
31
|
-
* Mirrors agent-je's own status constants. `reverted` is the terminal state a manual revert writes
|
|
32
|
-
* alongside is_deleted; without it stringToUnion logs an error and passes the raw string through.
|
|
33
|
-
*
|
|
34
|
-
* There is deliberately no `ignored` member -- ignoring an accrual sets the `is_ignored` flag and
|
|
35
|
-
* leaves the status on `draft`.
|
|
36
|
-
*/
|
|
37
|
-
const ONE_TIME_ACCRUAL_STATUS_CODE = [
|
|
38
|
-
'draft',
|
|
39
|
-
'posting',
|
|
40
|
-
'posted',
|
|
41
|
-
'posting_blocked',
|
|
42
|
-
'reversing',
|
|
43
|
-
'reversed',
|
|
44
|
-
'reverted',
|
|
45
|
-
];
|
|
46
|
-
export const toOneTimeAccrualStatusCodeType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_STATUS_CODE);
|
|
47
|
-
// Who created the accrual. This — not the creator's email — is the authoritative
|
|
48
|
-
// AI-vs-manual signal for the Method column.
|
|
49
|
-
const ONE_TIME_ACCRUAL_ORIGIN = ['agent', 'human'];
|
|
50
|
-
export const toOneTimeAccrualOriginType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_ORIGIN);
|
|
51
|
-
const ONE_TIME_ACCRUAL_AUTOMATION_TIER = ['manual', 'draft', 'auto'];
|
|
52
|
-
export const toOneTimeAccrualAutomationTierType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_AUTOMATION_TIER);
|
|
53
|
-
// How the accrual is allowed to reverse. The two are exclusive: a scheduled row reverses on
|
|
54
|
-
// expectedReversalDate and bills never drive it; an on_bill_match row reverses only when a bill
|
|
55
|
-
// is matched, which is why its lifecycle reads "Reverses on match" rather than showing a date.
|
|
56
|
-
const ONE_TIME_ACCRUAL_REVERSAL_POLICY = [
|
|
57
|
-
'on_bill_match',
|
|
58
|
-
'scheduled_date',
|
|
59
|
-
];
|
|
60
|
-
export const toOneTimeAccrualReversalPolicyType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_REVERSAL_POLICY);
|
|
61
|
-
// What actually caused a reverse. Distinct from a *revert*, which soft-deletes the row and
|
|
62
|
-
// never sets this.
|
|
63
|
-
const ONE_TIME_ACCRUAL_REVERSAL_TRIGGER = [
|
|
64
|
-
'bill_match',
|
|
65
|
-
'scheduled_date',
|
|
66
|
-
'manual_reverse',
|
|
67
|
-
];
|
|
68
|
-
export const toOneTimeAccrualReversalTriggerType = (v) => stringToUnionStrict(v ?? '', ONE_TIME_ACCRUAL_REVERSAL_TRIGGER);
|
|
69
|
-
// Why a human told the AI Accountant not to accrue this month. The gateway validates against
|
|
70
|
-
// exactly this set, so it is a union rather than a free-text string.
|
|
71
|
-
const ONE_TIME_ACCRUAL_IGNORE_REASON = [
|
|
72
|
-
'no_activity',
|
|
73
|
-
'paused',
|
|
74
|
-
'too_small',
|
|
75
|
-
'need_invoice',
|
|
76
|
-
'other_ignore',
|
|
77
|
-
];
|
|
78
|
-
export const toOneTimeAccrualIgnoreReasonType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_IGNORE_REASON);
|
|
79
|
-
export const ALL_ONE_TIME_ACCRUAL_IGNORE_REASONS = ONE_TIME_ACCRUAL_IGNORE_REASON;
|
|
80
|
-
// Why a recommended prepaid / fixed-asset schedule is being dismissed. A different set from the
|
|
81
|
-
// accrual ignore reasons: the gateway validates each against its own list.
|
|
82
|
-
const JE_SCHEDULE_IGNORE_REASON = [
|
|
83
|
-
'not_needed',
|
|
84
|
-
'wrong_account',
|
|
85
|
-
'duplicate',
|
|
86
|
-
'already_handled',
|
|
87
|
-
'other_ignore',
|
|
88
|
-
];
|
|
89
|
-
export const toJEScheduleIgnoreReasonType = (v) => stringToUnion(v, JE_SCHEDULE_IGNORE_REASON);
|
|
90
|
-
export const ALL_JE_SCHEDULE_IGNORE_REASONS = JE_SCHEDULE_IGNORE_REASON;
|
|
91
|
-
// Why a posted prepaid / fixed-asset schedule is being undone. Note `not_accrual` is accrual-only
|
|
92
|
-
// and rejected here, and `created_by_mistake` is schedule-only.
|
|
93
|
-
const JE_SCHEDULE_REVERT_REASON = [
|
|
94
|
-
'amount_off',
|
|
95
|
-
'wrong_period',
|
|
96
|
-
'duplicate',
|
|
97
|
-
'created_by_mistake',
|
|
98
|
-
'other_revert',
|
|
99
|
-
];
|
|
100
|
-
export const toJEScheduleRevertReasonType = (v) => stringToUnion(v, JE_SCHEDULE_REVERT_REASON);
|
|
101
|
-
export const ALL_JE_SCHEDULE_REVERT_REASONS = JE_SCHEDULE_REVERT_REASON;
|
|
102
|
-
// Why a posted accrual is being undone. A disjoint set from the ignore reasons — the gateway
|
|
103
|
-
// validates each action against its own list and rejects the other's values.
|
|
104
|
-
const ONE_TIME_ACCRUAL_REVERT_REASON = [
|
|
105
|
-
'amount_off',
|
|
106
|
-
'wrong_period',
|
|
107
|
-
'not_accrual',
|
|
108
|
-
'duplicate',
|
|
109
|
-
'other_revert',
|
|
110
|
-
];
|
|
111
|
-
export const toOneTimeAccrualRevertReasonType = (v) => stringToUnion(v, ONE_TIME_ACCRUAL_REVERT_REASON);
|
|
112
|
-
export const ALL_ONE_TIME_ACCRUAL_REVERT_REASONS = ONE_TIME_ACCRUAL_REVERT_REASON;
|
|
113
27
|
const JOURNAL_ENTRY_ERROR_CODE = [
|
|
114
28
|
'vendor_deleted',
|
|
115
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
|
};
|