@zeniai/client-epic-state 5.2.10 → 5.2.11-betaAM1
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 +1 -0
- package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +86 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +172 -0
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +101 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +88 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
- package/lib/epic.d.ts +14 -1
- package/lib/epic.js +26 -0
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +172 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +78 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/esm/epic.js +26 -0
- package/lib/esm/index.js +19 -9
- package/lib/esm/reducer.js +3 -0
- package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
- package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
- package/lib/esm/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
- package/lib/esm/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
- package/lib/esm/view/companyMonthEndReportView/monthEndTemplateData.js +32 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +46 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +7 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +50 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
- package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +104 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +136 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +157 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +111 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +33 -0
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
- package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +35 -0
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +260 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +314 -29
- package/lib/esm/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +162 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +297 -22
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +22 -0
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -5
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
- package/lib/index.d.ts +25 -14
- package/lib/index.js +119 -51
- package/lib/reducer.d.ts +1 -0
- package/lib/reducer.js +3 -0
- package/lib/rootStateTypes.d.ts +2 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +8 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +6 -2
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +2 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
- package/lib/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
- package/lib/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
- package/lib/view/companyMonthEndReportView/monthEndTemplateData.d.ts +16 -0
- package/lib/view/companyMonthEndReportView/monthEndTemplateData.js +36 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +50 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +11 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +54 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +48 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +48 -0
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +21 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +108 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +140 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +13 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +164 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +65 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +115 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +37 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +66 -0
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +40 -0
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +72 -3
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +53 -0
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +264 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +91 -12
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +316 -29
- 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/actualMatchingViewSelectorTypes.d.ts +58 -0
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +36 -7
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +9 -0
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +172 -0
- package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +305 -21
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +76 -0
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +27 -0
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +11 -7
- 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 +7 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
- package/package.json +1 -1
package/lib/epic.js
CHANGED
|
@@ -188,6 +188,11 @@ const updateCombinedStatementInfoEpic_1 = require("./view/expenseAutomationView/
|
|
|
188
188
|
const updateReconcileTabLocalDataEpic_1 = require("./view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic");
|
|
189
189
|
const updateStatementInfoEpic_1 = require("./view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic");
|
|
190
190
|
const uploadAccountStatementEpic_1 = require("./view/expenseAutomationView/epics/accountRecon/uploadAccountStatementEpic");
|
|
191
|
+
const fetchActualMatchingEpic_1 = require("./view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic");
|
|
192
|
+
const fetchActualMatchingPageEpic_1 = require("./view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic");
|
|
193
|
+
const matchAndReverseAccrualsEpic_1 = require("./view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic");
|
|
194
|
+
const searchMatchAccrualsEpic_1 = require("./view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic");
|
|
195
|
+
const searchMatchTransactionsEpic_1 = require("./view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic");
|
|
191
196
|
const fetchAllExpenseAutomationTabsEpic_1 = require("./view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic");
|
|
192
197
|
const refreshExpenseAutomationCurrentTabEpic_1 = require("./view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic");
|
|
193
198
|
const fetchFluxAnalysisViewEpic_1 = require("./view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic");
|
|
@@ -198,9 +203,17 @@ const initializeAccountSettingsViewEpic_1 = require("./view/expenseAutomationVie
|
|
|
198
203
|
const saveAccountSettingsViewEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic");
|
|
199
204
|
const fetchJeSchedulePageEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic");
|
|
200
205
|
const fetchJeSchedulesEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic");
|
|
206
|
+
const fetchOneTimeAccrualEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic");
|
|
201
207
|
const ignoreRecommendedJeScheduleEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic");
|
|
202
208
|
const initializeJeScheduleLocalDataEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic");
|
|
209
|
+
const createOneTimeAccrualEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic");
|
|
210
|
+
const initializeNewScheduleEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic");
|
|
211
|
+
const saveNewScheduleEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic");
|
|
212
|
+
const searchTransactionsForNewScheduleEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic");
|
|
213
|
+
const oneTimeAccrualActionsEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic");
|
|
203
214
|
const retryJeSchedulesEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic");
|
|
215
|
+
const revertJeScheduleEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic");
|
|
216
|
+
const switchJESchedulesTabEpic_1 = require("./view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic");
|
|
204
217
|
const bulkUploadMatchResultToastEpic_1 = require("./view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic");
|
|
205
218
|
const bulkUploadReceiptsEpic_1 = require("./view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic");
|
|
206
219
|
const confirmBulkUploadMatchEpic_1 = require("./view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic");
|
|
@@ -782,6 +795,7 @@ const ALL_EPICS = [
|
|
|
782
795
|
createNewSchedulesAccruedEpic_1.createNewSchedulesAccruedEpic,
|
|
783
796
|
createNewSchedulesEpic_1.createNewSchedulesEpic,
|
|
784
797
|
createNewTaskGroupEpic_1.createNewTaskGroupEpic,
|
|
798
|
+
createOneTimeAccrualEpic_1.createOneTimeAccrualEpic,
|
|
785
799
|
createInternationalPaymentInstrumentEpic_1.createPaymentInstrumentEpic,
|
|
786
800
|
createSessionAndSubmitEpic_1.createSessionAndSubmitEpic,
|
|
787
801
|
createSessionEpic_1.createSessionEpic,
|
|
@@ -953,6 +967,8 @@ const ALL_EPICS = [
|
|
|
953
967
|
fetchEntityRecommendationsByTransactionIdEpic_1.fetchEntityRecommendationsByTransactionIdEpic,
|
|
954
968
|
fetchEntityRecommendationsForLineUpdateEpic_1.fetchEntityRecommendationsForLineUpdateEpic,
|
|
955
969
|
fetchExcludedResourcesEpic_1.fetchExcludedResourcesEpic,
|
|
970
|
+
fetchActualMatchingEpic_1.fetchActualMatchingEpic,
|
|
971
|
+
fetchActualMatchingPageEpic_1.fetchActualMatchingPageEpic,
|
|
956
972
|
fetchFluxAnalysisViewEpic_1.fetchFluxAnalysisViewEpic,
|
|
957
973
|
initializeTransactionCategorizationLocalDataEpic_1.initializeTransactionCategorizationViewLocalDataEpic,
|
|
958
974
|
fetchJeSchedulesEpic_1.fetchJeSchedulesEpic,
|
|
@@ -1061,6 +1077,7 @@ const ALL_EPICS = [
|
|
|
1061
1077
|
fetchOnboardingCustomerSetupViewEpic_1.fetchOnboardingCustomerSetupViewEpic,
|
|
1062
1078
|
fetchOnboardingCustomerViewEpic_1.fetchOnboardingCustomerViewEpic,
|
|
1063
1079
|
fetchOnboardingViewEpic_1.fetchOnboardingViewEpic,
|
|
1080
|
+
fetchOneTimeAccrualEpic_1.fetchOneTimeAccrualEpic,
|
|
1064
1081
|
fetchOpExByVendorReportEpic_1.fetchOpExByVendorEpic,
|
|
1065
1082
|
fetchOpExByVendorReportForTimeframeEpic_1.fetchOpExByVendorReportForTimeframeEpic,
|
|
1066
1083
|
fetchOpExByVendorReportSummaryEpic_1.fetchOpExByVendorReportSummaryEpic,
|
|
@@ -1215,6 +1232,7 @@ const ALL_EPICS = [
|
|
|
1215
1232
|
initializeInvoicingCustomerAddressEpic_1.initializeInvoicingCustomerAddressEpic,
|
|
1216
1233
|
initializeInvoicingSubscriptionAddressEpic_1.initializeInvoicingSubscriptionAddressEpic,
|
|
1217
1234
|
initializeMyProfileLocalDataEpic_1.initializeMyProfileLocalDataEpic,
|
|
1235
|
+
initializeNewScheduleEpic_1.initializeNewScheduleEpic,
|
|
1218
1236
|
initializeOnboardingCustomerViewUpdateDataEpic_1.initializeOnboardingCustomerViewUpdateDataEpic,
|
|
1219
1237
|
initializeRemiSetupApproverViewUpdateDataEpic_1.initializeRemiSetupApproverViewUpdateDataEpic,
|
|
1220
1238
|
initializeRemiToLocalStoreEpic_1.initializeRemiToLocalStoreEpic,
|
|
@@ -1236,7 +1254,9 @@ const ALL_EPICS = [
|
|
|
1236
1254
|
lockChargeCardsEpic_1.lockChargeCardsEpic,
|
|
1237
1255
|
markAsCompleteScheduleDetailEpic_1.markAsCompleteScheduleDetailEpic,
|
|
1238
1256
|
markTransactionAsNotMiscategorizedEpic_2.markTransactionAsNotMiscategorizedEpic,
|
|
1257
|
+
matchAndReverseAccrualsEpic_1.matchAndReverseAccrualsEpic,
|
|
1239
1258
|
notifyMeForFeatureEpic_1.notifyMeForFeatureEpic,
|
|
1259
|
+
oneTimeAccrualActionsEpic_1.oneTimeAccrualActionsEpic,
|
|
1240
1260
|
parallelFetchAccountTransactionListEpic_1.parallelFetchAccountTransactionListEpic,
|
|
1241
1261
|
parallelFetchClassTransactionListEpic_1.parallelFetchClassTransactionListEpic,
|
|
1242
1262
|
parallelFetchEntityTransactionListEpic_1.parallelFetchEntityTransactionListEpic,
|
|
@@ -1280,6 +1300,7 @@ const ALL_EPICS = [
|
|
|
1280
1300
|
retryJeSchedulesEpic_1.retryJeScheduleEpic,
|
|
1281
1301
|
retryInvoicingQboSyncTaskEpic_1.retryInvoicingQboSyncTaskEpic,
|
|
1282
1302
|
retryOrRefundBillEpic_1.retryOrRefundBillEpic,
|
|
1303
|
+
revertJeScheduleEpic_1.revertJeScheduleEpic,
|
|
1283
1304
|
reviewDraftRemisBulkActionEpic_ts_1.reviewDraftRemisBulkActionEpic,
|
|
1284
1305
|
reviewFluxAnalysisEpic_1.reviewFluxAnalysisViewEpic,
|
|
1285
1306
|
revokeCardInviteEpic_1.revokeCardInviteEpic,
|
|
@@ -1315,6 +1336,7 @@ const ALL_EPICS = [
|
|
|
1315
1336
|
saveInvoicingSubscriptionEpic_1.saveInvoicingSubscriptionEpic,
|
|
1316
1337
|
saveMagicLinkBankAccountEpic_1.saveMagicLinkBankAccountEpic,
|
|
1317
1338
|
saveNewAddressEpic_1.saveNewAddressEpic,
|
|
1339
|
+
saveNewScheduleEpic_1.saveNewScheduleEpic,
|
|
1318
1340
|
saveNotificationPreferencesEpic_1.saveNotificationPreferencesEpic,
|
|
1319
1341
|
saveNotificationSettingsEpic_1.saveNotificationSettingsEpic,
|
|
1320
1342
|
saveOAuthConnectionEpic_1.saveOAuthConnectionEpic,
|
|
@@ -1338,7 +1360,10 @@ const ALL_EPICS = [
|
|
|
1338
1360
|
saveVendorFirstReviewViewEpic_1.saveVendorFirstReviewViewEpic,
|
|
1339
1361
|
saveVendorsTabVendorEpic_1.saveVendorsTabVendorEpic,
|
|
1340
1362
|
scheduleTenantCreditScoreCronEpic_1.scheduleTenantCreditScoreCronEpic,
|
|
1363
|
+
searchMatchAccrualsEpic_1.searchMatchAccrualsEpic,
|
|
1364
|
+
searchMatchTransactionsEpic_1.searchMatchTransactionsEpic,
|
|
1341
1365
|
searchTransactionsForManualMatchEpic_1.searchTransactionsForManualMatchEpic,
|
|
1366
|
+
searchTransactionsForNewScheduleEpic_1.searchTransactionsForNewScheduleEpic,
|
|
1342
1367
|
seedAiCardCreationFormDraftEpic_1.seedAiCardCreationFormDraftEpic,
|
|
1343
1368
|
seedAiCardPolicyFormDraftEpic_1.seedAiCardPolicyFormDraftEpic,
|
|
1344
1369
|
sendCompanyMonthEndReportEpic_1.sendCompanyMonthEndReportEpic,
|
|
@@ -1361,6 +1386,7 @@ const ALL_EPICS = [
|
|
|
1361
1386
|
submitIntlVerificationEpic_1.submitIntlVerificationEpic,
|
|
1362
1387
|
invoicingBrandingFormEpics_1.submitInvoicingBrandingFormEpic,
|
|
1363
1388
|
submitQuestionEpic_1.submitQuestionEpic,
|
|
1389
|
+
switchJESchedulesTabEpic_1.switchJESchedulesTabEpic,
|
|
1364
1390
|
syncInvoicingSubscriptionCouponsEpic_1.syncInvoicingSubscriptionCouponsEpic,
|
|
1365
1391
|
syncTabsAfterAutomatchEpic_1.syncTabsAfterAutomatchEpic,
|
|
1366
1392
|
toggleReportUIOptionForecastModeEpic_1.toggleReportUIOptionForecastModeEpic,
|
|
@@ -1,3 +1,9 @@
|
|
|
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,9 +1,11 @@
|
|
|
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';
|
|
4
5
|
import { toTransactionID, } from '../transaction/payloadTypes/transactionIDPayload';
|
|
5
6
|
import { generateJEScheduleKey } from './jeScheduleHelper';
|
|
6
|
-
import { getJEScheduleTransactionKey, toJournalEntryErrorCodeType, toScheduleJournalEntryStatusCodeType, toScheduleStatusCodeType, toScheduleTypesTypeStrict, } from './jeSchedulesTypes';
|
|
7
|
+
import { getJEScheduleTransactionKey, toJournalEntryErrorCodeType, toOneTimeAccrualAutomationTierType, toOneTimeAccrualOriginType, toOneTimeAccrualReversalPolicyType, toOneTimeAccrualReversalTriggerType, toOneTimeAccrualStatusCodeType, toScheduleJournalEntryStatusCodeType, toScheduleStatusCodeType, toScheduleTypesTypeStrict, } from './jeSchedulesTypes';
|
|
8
|
+
const USD_CURRENCY_CODE = 'USD';
|
|
7
9
|
export function toScheduledJournalEntryState(payload, currency_code, currency_symbol) {
|
|
8
10
|
return {
|
|
9
11
|
status: {
|
|
@@ -248,9 +250,18 @@ export function toJEScheduledTransaction(payload) {
|
|
|
248
250
|
startDate: payload.start_date != null ? date(payload.start_date) : undefined,
|
|
249
251
|
endDate: payload.end_date != null ? date(payload.end_date) : undefined,
|
|
250
252
|
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,
|
|
251
261
|
updatedByUserID: payload.updated_by.user_id,
|
|
252
262
|
balanceAsOfToday: payload.balance ?? undefined,
|
|
253
263
|
updatedAt: payload.updated_at != null ? date(payload.updated_at) : undefined,
|
|
264
|
+
createTime: payload.create_time != null ? date(payload.create_time) : undefined,
|
|
254
265
|
jeCredit: {
|
|
255
266
|
accountId: payload.je_credit_account_id ?? undefined,
|
|
256
267
|
accountingClassId: payload.je_credit_accounting_class_id ?? undefined,
|
|
@@ -275,6 +286,7 @@ export function toJEScheduledTransaction(payload) {
|
|
|
275
286
|
: {},
|
|
276
287
|
scheduledJournalEntry: [],
|
|
277
288
|
aiSummaries: toJEScheduleAISummaries(payload.ai_summaries),
|
|
289
|
+
confidenceScore: payload.confidence_score ?? undefined,
|
|
278
290
|
createdByUserID: payload.created_by?.user_id ?? undefined,
|
|
279
291
|
recommendations: toJEScheduleRecommendations(payload.recommendations),
|
|
280
292
|
};
|
|
@@ -306,6 +318,9 @@ export function toJEAccruedScheduledTransaction(payload) {
|
|
|
306
318
|
endDate: payload.end_date != null ? date(payload.end_date) : undefined,
|
|
307
319
|
period: payload.period != null ? Number(payload.period) : undefined,
|
|
308
320
|
updatedByUserID: payload.updated_by.user_id,
|
|
321
|
+
// The accrued joiner resolves createdByUserID into the "Created by" cell. Without this the
|
|
322
|
+
// payload's created_by was dropped here and every accrued row rendered a hyphen.
|
|
323
|
+
createdByUserID: payload.created_by?.user_id ?? undefined,
|
|
309
324
|
balanceAsOfToday: payload.balance ?? undefined,
|
|
310
325
|
updatedAt: payload.updated_at != null ? date(payload.updated_at) : undefined,
|
|
311
326
|
jeCredit: {
|
|
@@ -332,3 +347,159 @@ export function toJEAccruedScheduledTransaction(payload) {
|
|
|
332
347
|
jeScheduleType: toScheduleTypesTypeStrict(payload.je_schedule_type),
|
|
333
348
|
};
|
|
334
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* Reads the months in the order the snapshot gives them rather than deriving a range: a vendor that
|
|
352
|
+
* skipped a month has no entry for it, so filling gaps would invent history that was never billed.
|
|
353
|
+
*/
|
|
354
|
+
function toJEOneTimeAccrualMonthlyTotals(snapshot, currencyCode) {
|
|
355
|
+
const monthlyTotals = snapshot.monthly_totals;
|
|
356
|
+
if (monthlyTotals == null) {
|
|
357
|
+
return [];
|
|
358
|
+
}
|
|
359
|
+
const months = snapshot.sorted_months ?? Object.keys(monthlyTotals).sort();
|
|
360
|
+
return months
|
|
361
|
+
.filter((month) => monthlyTotals[month] != null)
|
|
362
|
+
.map((month) => ({
|
|
363
|
+
month,
|
|
364
|
+
amount: toOneTimeAccrualAmount(monthlyTotals[month], currencyCode),
|
|
365
|
+
}));
|
|
366
|
+
}
|
|
367
|
+
function toJEOneTimeAccrualProfileSnapshot(payload, currencyCode) {
|
|
368
|
+
if (payload == null) {
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
371
|
+
const billingPattern = payload.billing_pattern;
|
|
372
|
+
return {
|
|
373
|
+
monthlyTotals: toJEOneTimeAccrualMonthlyTotals(payload, currencyCode),
|
|
374
|
+
billingPattern: billingPattern != null
|
|
375
|
+
? {
|
|
376
|
+
frequency: billingPattern.frequency ?? undefined,
|
|
377
|
+
monthsOfHistory: billingPattern.months_of_history ?? undefined,
|
|
378
|
+
consistencyScore: billingPattern.consistency_score ?? undefined,
|
|
379
|
+
billingLagDays: billingPattern.billing_lag_days ?? undefined,
|
|
380
|
+
typicalBillDay: billingPattern.typical_bill_day ?? undefined,
|
|
381
|
+
avgAmount: billingPattern.avg_amount != null
|
|
382
|
+
? toOneTimeAccrualAmount(billingPattern.avg_amount, currencyCode)
|
|
383
|
+
: undefined,
|
|
384
|
+
lastBillAmount: billingPattern.last_bill_amount != null
|
|
385
|
+
? toOneTimeAccrualAmount(billingPattern.last_bill_amount, currencyCode)
|
|
386
|
+
: undefined,
|
|
387
|
+
lastBillDate: billingPattern.last_bill_date != null
|
|
388
|
+
? date(billingPattern.last_bill_date)
|
|
389
|
+
: undefined,
|
|
390
|
+
}
|
|
391
|
+
: undefined,
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function toJEOneTimeAccrualAiSuggestion(payload, currencyCode) {
|
|
395
|
+
if (payload == null) {
|
|
396
|
+
return undefined;
|
|
397
|
+
}
|
|
398
|
+
return {
|
|
399
|
+
memo: payload.memo ?? undefined,
|
|
400
|
+
jeDebitAccountName: payload.je_debit_account_name ?? undefined,
|
|
401
|
+
jeCreditAccountName: payload.je_credit_account_name ?? undefined,
|
|
402
|
+
estimatedAmount: payload.estimated_amount != null
|
|
403
|
+
? toOneTimeAccrualAmount(payload.estimated_amount, currencyCode)
|
|
404
|
+
: undefined,
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function toJEOneTimeAccrualCleared(payload, currencyCode) {
|
|
408
|
+
if (payload == null) {
|
|
409
|
+
return undefined;
|
|
410
|
+
}
|
|
411
|
+
return {
|
|
412
|
+
matchedTransactionIntegrationId: payload.matched_transaction_integration_id ?? undefined,
|
|
413
|
+
matchedTransactionId: payload.matched_transaction_id ?? undefined,
|
|
414
|
+
matchedTransactionType: payload.matched_transaction_type ?? undefined,
|
|
415
|
+
matchedLineId: payload.matched_line_id ?? undefined,
|
|
416
|
+
consumedLineIds: payload.consumed_line_ids ?? undefined,
|
|
417
|
+
matchedAmount: payload.matched_amount != null
|
|
418
|
+
? toOneTimeAccrualAmount(payload.matched_amount, currencyCode)
|
|
419
|
+
: undefined,
|
|
420
|
+
reversedAt: payload.reversed_at != null ? date(payload.reversed_at) : undefined,
|
|
421
|
+
matchTier: payload.match_tier ?? undefined,
|
|
422
|
+
matchShape: payload.match_shape ?? undefined,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function toJEOneTimeAccrualMatchSuggestion(payload, currencyCode) {
|
|
426
|
+
if (payload == null) {
|
|
427
|
+
return undefined;
|
|
428
|
+
}
|
|
429
|
+
return {
|
|
430
|
+
resolution: payload.resolution ?? undefined,
|
|
431
|
+
matchedTransactionIntegrationId: payload.matched_transaction_integration_id ?? undefined,
|
|
432
|
+
matchedTransactionId: payload.matched_transaction_id ?? undefined,
|
|
433
|
+
matchedTransactionType: payload.matched_transaction_type ?? undefined,
|
|
434
|
+
matchedAmount: payload.matched_amount != null
|
|
435
|
+
? toOneTimeAccrualAmount(payload.matched_amount, currencyCode)
|
|
436
|
+
: undefined,
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
export function toJEOneTimeAccrual(payload) {
|
|
440
|
+
return {
|
|
441
|
+
accrualId: payload._id,
|
|
442
|
+
vendorId: payload.vendor_id,
|
|
443
|
+
vendorName: payload.vendor_name,
|
|
444
|
+
serviceMonth: payload.service_month,
|
|
445
|
+
accrualStatus: toOneTimeAccrualStatusCodeType(payload.status),
|
|
446
|
+
origin: toOneTimeAccrualOriginType(payload.origin),
|
|
447
|
+
automationTier: payload.automation_tier != null
|
|
448
|
+
? toOneTimeAccrualAutomationTierType(payload.automation_tier)
|
|
449
|
+
: undefined,
|
|
450
|
+
estimatedAmount: toOneTimeAccrualAmount(payload.estimated_amount, payload.currency),
|
|
451
|
+
memo: payload.memo ?? '',
|
|
452
|
+
profileSnapshot: toJEOneTimeAccrualProfileSnapshot(payload.profile_snapshot, payload.currency),
|
|
453
|
+
aiSuggestion: toJEOneTimeAccrualAiSuggestion(payload.ai_suggestion, payload.currency),
|
|
454
|
+
cleared: toJEOneTimeAccrualCleared(payload.cleared, payload.currency),
|
|
455
|
+
matchSuggestion: toJEOneTimeAccrualMatchSuggestion(payload.match_suggestion, payload.currency),
|
|
456
|
+
// Exclusive by contract: a scheduled row reverses on expectedReversalDate and bills never
|
|
457
|
+
// drive it, so the two never need reconciling. Defaulting to on_bill_match matches the
|
|
458
|
+
// create path's default when the field is absent on an older document.
|
|
459
|
+
reversalPolicy: toOneTimeAccrualReversalPolicyType(payload.reversal_policy ?? 'on_bill_match'),
|
|
460
|
+
reversalTrigger: toOneTimeAccrualReversalTriggerType(payload.reversal_trigger ?? undefined),
|
|
461
|
+
expectedReversalDate: payload.expected_reversal_date != null
|
|
462
|
+
? date(payload.expected_reversal_date)
|
|
463
|
+
: undefined,
|
|
464
|
+
postingDate: payload.posting_date != null ? date(payload.posting_date) : undefined,
|
|
465
|
+
actualPostDate: payload.actual_post_date != null
|
|
466
|
+
? date(payload.actual_post_date)
|
|
467
|
+
: undefined,
|
|
468
|
+
actualReversalPostDate: payload.actual_reversal_post_date != null
|
|
469
|
+
? date(payload.actual_reversal_post_date)
|
|
470
|
+
: undefined,
|
|
471
|
+
jeDebitAccountId: payload.je_debit_account_id ?? undefined,
|
|
472
|
+
jeDebitAccountName: payload.je_debit_account_name ?? undefined,
|
|
473
|
+
jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
|
|
474
|
+
jeDebitAccountingClassName: payload.je_debit_accounting_class_name ?? undefined,
|
|
475
|
+
jeCreditAccountId: payload.je_credit_account_id ?? undefined,
|
|
476
|
+
jeCreditAccountName: payload.je_credit_account_name ?? undefined,
|
|
477
|
+
jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
|
|
478
|
+
jeCreditAccountingClassName: payload.je_credit_accounting_class_name ?? undefined,
|
|
479
|
+
transactionId: payload.transaction_id ?? undefined,
|
|
480
|
+
transactionIntegrationId: payload.transaction_integration_id ?? undefined,
|
|
481
|
+
reversalTransactionId: payload.reversal_transaction_id ?? undefined,
|
|
482
|
+
createdBy: toJEOneTimeAccrualCreator(payload.created_by_user),
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
// The accrual wire format carries a currency CODE but no symbol, so the symbol has to be derived.
|
|
486
|
+
// Only USD has a known glyph today (the create path is USD-only); anything else falls back to the
|
|
487
|
+
// code, which reads correctly as "EUR 1,200" rather than silently rendering a wrong "$".
|
|
488
|
+
function toOneTimeAccrualAmount(amount, currencyCode) {
|
|
489
|
+
const code = currencyCode ?? USD_CURRENCY_CODE;
|
|
490
|
+
return toAmount(amount, code, code === USD_CURRENCY_CODE ? '$' : code);
|
|
491
|
+
}
|
|
492
|
+
function toJEOneTimeAccrualCreator(payload) {
|
|
493
|
+
if (payload == null) {
|
|
494
|
+
return undefined;
|
|
495
|
+
}
|
|
496
|
+
return {
|
|
497
|
+
userId: payload.user_id,
|
|
498
|
+
email: payload.email ?? undefined,
|
|
499
|
+
firstName: payload.first_name ?? undefined,
|
|
500
|
+
lastName: payload.last_name ?? undefined,
|
|
501
|
+
photo: payload.photo?.original != null
|
|
502
|
+
? toZeniUrl(payload.photo.original)
|
|
503
|
+
: undefined,
|
|
504
|
+
};
|
|
505
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import assignWith from 'lodash/assignWith';
|
|
3
3
|
import { clearAll } from '../../rootActions';
|
|
4
|
-
import {
|
|
4
|
+
import { generateJEOneTimeAccrualKey } from './jeScheduleHelper';
|
|
5
|
+
import { getJEScheduleKey, getJEScheduleTransactionDetailKeyPayload, toJEAccruedScheduledTransaction, toJEOneTimeAccrual, toJEScheduledTransaction, toScheduledJournalEntryState, } from './jeSchedulesPayload';
|
|
5
6
|
export const initialState = {
|
|
6
7
|
schedulesByTransactionKey: {},
|
|
7
8
|
schedulesByAccruedJEScheduleKey: {},
|
|
9
|
+
oneTimeAccrualsByKey: {},
|
|
8
10
|
};
|
|
9
11
|
const jeSchedules = createSlice({
|
|
10
12
|
name: 'jeSchedules',
|
|
@@ -109,15 +111,41 @@ const jeSchedules = createSlice({
|
|
|
109
111
|
delete draft.schedulesByAccruedJEScheduleKey[JEScheduleKey];
|
|
110
112
|
},
|
|
111
113
|
},
|
|
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
|
+
},
|
|
112
139
|
},
|
|
113
140
|
extraReducers: (builder) => {
|
|
114
141
|
builder.addCase(clearAll, (draft) => {
|
|
115
142
|
draft.schedulesByAccruedJEScheduleKey = {};
|
|
116
143
|
draft.schedulesByTransactionKey = {};
|
|
144
|
+
draft.oneTimeAccrualsByKey = {};
|
|
117
145
|
});
|
|
118
146
|
},
|
|
119
147
|
});
|
|
120
|
-
export const { updateJESchedules, updateAccruedJESchedules, updateJEScheduledTransaction, updateAccruedJEScheduledTransaction, updateJESchedulesDetails, updateAccruedJESchedulesDetails, deleteJESchedulesDetails, deleteAccruedJESchedulesDetails, } = jeSchedules.actions;
|
|
148
|
+
export const { updateJESchedules, updateAccruedJESchedules, updateJEScheduledTransaction, updateAccruedJEScheduledTransaction, updateJESchedulesDetails, updateAccruedJESchedulesDetails, deleteJESchedulesDetails, deleteAccruedJESchedulesDetails, clearAllAccruedJESchedules, clearAllJEScheduleTransactions, updateJEOneTimeAccruals, } = jeSchedules.actions;
|
|
121
149
|
export default jeSchedules.reducer;
|
|
122
150
|
/**
|
|
123
151
|
* Helper functions
|
|
@@ -5,18 +5,34 @@ 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
|
+
};
|
|
8
21
|
export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
|
|
9
22
|
const { jeSchedulesState, vendorState, accountState, userState, classState } = state;
|
|
10
23
|
const JEAccruedScheduleState = recordGet(jeSchedulesState.schedulesByAccruedJEScheduleKey, JEScheduleKey);
|
|
11
24
|
if (JEAccruedScheduleState == null) {
|
|
12
25
|
return undefined;
|
|
13
26
|
}
|
|
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;
|
|
27
|
+
const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, memo, recurringAmount, createTime, otherAttributes, jeScheduleType, } = JEAccruedScheduleState;
|
|
15
28
|
const vendorDetails = getVendorByVendorId(vendorState, vendorId);
|
|
16
29
|
if (vendorDetails == null) {
|
|
17
30
|
throw new Error(`Vendor with ${vendorId} doesn't exist`);
|
|
18
31
|
}
|
|
19
32
|
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;
|
|
20
36
|
const accountCredit = jeCredit.accountId != null
|
|
21
37
|
? getAccountBase(accountState, jeCredit.accountId, 'account_list')
|
|
22
38
|
: undefined;
|
|
@@ -35,14 +51,19 @@ export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
|
|
|
35
51
|
reportId: 'class_list',
|
|
36
52
|
})
|
|
37
53
|
: undefined;
|
|
54
|
+
const postedCount = scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
|
|
55
|
+
const lifecycleTotal = period ?? scheduledJournalEntry.length;
|
|
38
56
|
return {
|
|
39
57
|
jeScheduleId,
|
|
40
58
|
otherAttributes,
|
|
41
59
|
vendor: vendorDetails,
|
|
42
60
|
updatedByUser: userDetails,
|
|
61
|
+
createdByUser: createdByUserDetails,
|
|
43
62
|
updatedAt,
|
|
44
63
|
currencyCode,
|
|
45
64
|
currencySymbol,
|
|
65
|
+
lifecycleTotal,
|
|
66
|
+
postedCount,
|
|
46
67
|
jeCredit: {
|
|
47
68
|
accountingClass: classCredit,
|
|
48
69
|
account: accountCredit,
|
|
@@ -60,6 +81,7 @@ export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
|
|
|
60
81
|
memo,
|
|
61
82
|
createTime,
|
|
62
83
|
recurringAmount,
|
|
84
|
+
jeScheduleType,
|
|
63
85
|
jeAccruedScheduleKey: JEScheduleKey,
|
|
64
86
|
balanceAsOfToday: balanceAsOfToday != null
|
|
65
87
|
? toAmount(balanceAsOfToday, currencyCode, currencySymbol)
|
|
@@ -70,7 +92,7 @@ export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
|
|
|
70
92
|
export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
|
|
71
93
|
const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
|
|
72
94
|
const jeScheduleTransactionState = recordGet(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
|
|
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;
|
|
95
|
+
const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, createTime, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, confidenceScore, recommendations, recurringAmount, postedCount: postedCountFromServer, } = jeScheduleTransactionState;
|
|
74
96
|
const vendorDetails = getVendorByVendorId(vendorState, vendorId);
|
|
75
97
|
if (vendorDetails == null) {
|
|
76
98
|
throw new Error(`Vendor with ${vendorId} doesn't exist`);
|
|
@@ -99,14 +121,24 @@ export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTr
|
|
|
99
121
|
reportId: 'class_list',
|
|
100
122
|
})
|
|
101
123
|
: 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;
|
|
102
131
|
return {
|
|
103
132
|
jeScheduleId,
|
|
104
133
|
jeScheduleType,
|
|
134
|
+
recurringAmount,
|
|
105
135
|
jeScheduleTransactionKey: jeScheduleTransactionKey,
|
|
106
136
|
vendor: vendorDetails,
|
|
107
137
|
updatedByUser: userDetails,
|
|
108
138
|
updatedAt: updatedAt,
|
|
109
139
|
period,
|
|
140
|
+
lifecycleTotal,
|
|
141
|
+
postedCount,
|
|
110
142
|
balanceAsOfToday: balanceAsOfToday != null
|
|
111
143
|
? toAmount(balanceAsOfToday, currencyCode, currencySymbol)
|
|
112
144
|
: undefined,
|
|
@@ -129,7 +161,9 @@ export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTr
|
|
|
129
161
|
},
|
|
130
162
|
scheduledJournalEntry,
|
|
131
163
|
aiSummaries,
|
|
164
|
+
confidenceScore,
|
|
132
165
|
createdByUser: createdByUserDetails,
|
|
166
|
+
createTime,
|
|
133
167
|
recommendations,
|
|
134
168
|
};
|
|
135
169
|
};
|
|
@@ -24,6 +24,84 @@ 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;
|
|
27
105
|
const JOURNAL_ENTRY_ERROR_CODE = [
|
|
28
106
|
'vendor_deleted',
|
|
29
107
|
'debit_category_deleted',
|
|
@@ -30,5 +30,7 @@ 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,
|
|
33
35
|
};
|
|
34
36
|
};
|