@zeniai/client-epic-state 5.2.41-beta5MM → 5.2.41-beta7MM
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/billPay/billTransaction/billTransactionReducer.d.ts +5 -1
- package/lib/entity/billPay/billTransaction/billTransactionReducer.js +17 -2
- package/lib/entity/invoicing/coupon/couponPayload.d.ts +8 -0
- package/lib/entity/invoicing/coupon/couponPayload.js +8 -0
- package/lib/entity/invoicing/coupon/couponState.d.ts +6 -0
- package/lib/entity/invoicing/dunningCase/dunningCaseTypes.d.ts +1 -1
- package/lib/entity/invoicing/plan/planSelector.d.ts +20 -0
- package/lib/entity/invoicing/plan/planSelector.js +42 -0
- package/lib/entity/invoicing/product/productPayload.d.ts +8 -1
- package/lib/entity/invoicing/product/productPayload.js +4 -1
- package/lib/entity/invoicing/product/productState.d.ts +16 -0
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -1
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +79 -5
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/task/taskState.d.ts +1 -1
- package/lib/epic.d.ts +4 -1
- package/lib/epic.js +10 -4
- package/lib/esm/entity/billPay/billTransaction/billTransactionReducer.js +16 -1
- package/lib/esm/entity/invoicing/coupon/couponPayload.js +8 -0
- package/lib/esm/entity/invoicing/plan/planSelector.js +39 -0
- package/lib/esm/entity/invoicing/product/productPayload.js +4 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +78 -4
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/epic.js +10 -4
- package/lib/esm/index.js +8 -7
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +3 -2
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchFailedJePostingsEpic.js +39 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +14 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +10 -13
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic.js +38 -17
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.js +17 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +15 -4
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +6 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +74 -1
- package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +80 -53
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +10 -0
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +11 -2
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +49 -14
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +28 -11
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +28 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +67 -35
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +22 -11
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +23 -4
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.js +1 -7
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +19 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +30 -7
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +16 -1
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +22 -11
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +69 -6
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +22 -0
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/fetchInvoicingCouponDetailPageEpic.js +22 -4
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +18 -4
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/seedInvoicingCouponFormDraftEpic.js +29 -6
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +28 -12
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +37 -2
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.js +43 -17
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/seedInvoicingCustomerFormDraftEpic.js +29 -6
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer.js +30 -14
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +143 -8
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/fetchInvoicingSubscriptionFormPageEpic.js +4 -1
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.js +44 -18
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/seedInvoicingSubscriptionFormDraftEpic.js +29 -8
- package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +12 -0
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +6 -6
- package/lib/esm/view/invoicing/invoicingFormDraft.js +78 -0
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +57 -9
- package/lib/esm/view/recommendation/recommendationPayload.js +3 -1
- package/lib/esm/view/recommendation/recommendationReducer.js +27 -7
- package/lib/esm/view/recommendation/recommendationSelector.js +1 -0
- package/lib/esm/view/recommendation/submitRecommendationFeedbackEpic.js +20 -8
- package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewReducer.js +87 -1
- package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +1 -0
- package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewState.js +4 -0
- package/lib/esm/view/spendManagement/billPay/billDetailView/epics/fetchBillRecommendationsEpic.js +97 -0
- package/lib/esm/view/spendManagement/billPay/billDetailView/epics/fetchRecommendationsForBill.js +85 -0
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewReducer.js +18 -1
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +3 -0
- package/lib/esm/view/spendManagement/billPay/editBillView/epics/applyBillRecommendationsToLocalStoreEpic.js +95 -0
- package/lib/index.d.ts +9 -8
- package/lib/index.js +54 -48
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +3 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchFailedJePostingsEpic.d.ts +20 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchFailedJePostingsEpic.js +43 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +13 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +8 -11
- package/lib/view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic.js +38 -17
- package/lib/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.js +17 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +15 -4
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +18 -0
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +18 -7
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +6 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +10 -3
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +76 -3
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +80 -53
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +10 -0
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +3 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +3 -0
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +8 -4
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +12 -2
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +49 -14
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +27 -10
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +16 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +8 -5
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +7 -2
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +28 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +46 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +69 -36
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +22 -11
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +17 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +22 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewState.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.js +1 -7
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +17 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.d.ts +10 -6
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +29 -6
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.d.ts +5 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +16 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +22 -11
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.d.ts +46 -0
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +68 -5
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.d.ts +21 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +24 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/fetchInvoicingCouponDetailPageEpic.d.ts +9 -5
- package/lib/view/invoicing/editInvoicingCouponDetailView/fetchInvoicingCouponDetailPageEpic.js +22 -4
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +18 -4
- package/lib/view/invoicing/editInvoicingCouponDetailView/seedInvoicingCouponFormDraftEpic.d.ts +10 -6
- package/lib/view/invoicing/editInvoicingCouponDetailView/seedInvoicingCouponFormDraftEpic.js +28 -5
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.d.ts +5 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +29 -13
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +16 -7
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +37 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewState.d.ts +8 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.d.ts +15 -10
- package/lib/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.js +42 -16
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +1 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/seedInvoicingCustomerFormDraftEpic.d.ts +10 -6
- package/lib/view/invoicing/editInvoicingCustomerDetailView/seedInvoicingCustomerFormDraftEpic.js +28 -5
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer.d.ts +5 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer.js +31 -15
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +79 -12
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +145 -9
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +8 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/fetchInvoicingSubscriptionFormPageEpic.js +4 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.d.ts +15 -11
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.js +42 -16
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +1 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/seedInvoicingSubscriptionFormDraftEpic.d.ts +10 -6
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/seedInvoicingSubscriptionFormDraftEpic.js +28 -7
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.d.ts +10 -0
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +12 -0
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +2 -2
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +6 -6
- package/lib/view/invoicing/invoicingFormDraft.d.ts +63 -0
- package/lib/view/invoicing/invoicingFormDraft.js +86 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +49 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +59 -10
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +1 -1
- package/lib/view/recommendation/recommendationPayload.d.ts +1 -0
- package/lib/view/recommendation/recommendationPayload.js +5 -0
- package/lib/view/recommendation/recommendationReducer.d.ts +7 -1
- package/lib/view/recommendation/recommendationReducer.js +28 -8
- package/lib/view/recommendation/recommendationSelector.d.ts +2 -0
- package/lib/view/recommendation/recommendationSelector.js +3 -1
- package/lib/view/recommendation/recommendationState.d.ts +2 -1
- package/lib/view/recommendation/submitRecommendationFeedbackEpic.d.ts +2 -2
- package/lib/view/recommendation/submitRecommendationFeedbackEpic.js +18 -6
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewPayload.d.ts +19 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewReducer.d.ts +10 -1
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewReducer.js +88 -2
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +1 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewState.d.ts +7 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewState.js +4 -0
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillRecommendationsEpic.d.ts +37 -0
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillRecommendationsEpic.js +104 -0
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchRecommendationsForBill.d.ts +24 -0
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchRecommendationsForBill.js +92 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +4 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +19 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +3 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/applyBillRecommendationsToLocalStoreEpic.d.ts +18 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/applyBillRecommendationsToLocalStoreEpic.js +102 -0
- package/package.json +2 -2
|
@@ -225,7 +225,7 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
225
225
|
const accruedSchedules = [];
|
|
226
226
|
const oneTimeAccruals = [];
|
|
227
227
|
const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, } = state;
|
|
228
|
-
const { jeScheduleTransactionKeysByPeriodAndTab, jeScheduleAccruedKeysByPeriodAndTab, jeScheduleOneTimeAccrualKeysByPeriodAndTab,
|
|
228
|
+
const { jeScheduleTransactionKeysByPeriodAndTab, jeScheduleAccruedKeysByPeriodAndTab, jeScheduleOneTimeAccrualKeysByPeriodAndTab, failedJePostings, jeScheduleLocalDataById, postStatusById, ignoreStatusById, revertStatusById, oneTimeAccrualActionStatusById, uiState, error, fetchState, refreshStatus, newSchedule, } = expenseAutomationJESchedulesViewState;
|
|
229
229
|
const accountSettingsView = (0, jeAccountSettingsViewSelector_1.getJEAccountSettingsView)(state);
|
|
230
230
|
const newScheduleView = newSchedule.selectedDetailScheduleType === 'fixed_assets' ||
|
|
231
231
|
newSchedule.selectedDetailScheduleType === 'prepaid_expenses'
|
|
@@ -264,15 +264,11 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
264
264
|
const jeScheduleTransactionKeysForSelectedTab = selectedPeriodTabKey != null
|
|
265
265
|
? jeScheduleTransactionKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
266
266
|
: undefined;
|
|
267
|
-
const failedJeScheduleTransactionKeysForSelectedTab = selectedPeriodTabKey != null
|
|
268
|
-
? failedJeScheduleTransactionKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
269
|
-
: undefined;
|
|
270
267
|
// Distinguishes "this tab has never been fetched for this period" from "fetched and genuinely
|
|
271
268
|
// empty". Without it the page cannot tell a first visit from a real empty state, and renders an
|
|
272
269
|
// empty table where it should render a skeleton.
|
|
273
270
|
const hasLoadedForSelectedTab = jeScheduleTransactionKeysForSelectedTab != null;
|
|
274
271
|
const jeScheduleTransactionKeys = jeScheduleTransactionKeysForSelectedTab ?? [];
|
|
275
|
-
const failedJeScheduleTransactionKeys = failedJeScheduleTransactionKeysForSelectedTab ?? [];
|
|
276
272
|
const jeScheduleAccruedKeys = (selectedPeriodTabKey != null
|
|
277
273
|
? jeScheduleAccruedKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
278
274
|
: undefined) ?? [];
|
|
@@ -295,24 +291,57 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
295
291
|
accruedSchedules.push(accruedScheduleDetails);
|
|
296
292
|
}
|
|
297
293
|
});
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
294
|
+
// Sourced from the tenant-wide bucket, not the per-period one: a failed posting belongs to no
|
|
295
|
+
// close month, and windowing it is what kept older failures off the only tab that can resolve
|
|
296
|
+
// them.
|
|
297
|
+
failedJePostings.jeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
298
|
+
// getJEScheduledTransactionByJEScheduleTransactionKey throws three different ways: it
|
|
299
|
+
// destructures the result of recordGet without a null check, and it raises explicitly for a
|
|
300
|
+
// missing vendor and for a missing base transaction. Catching rather than pre-checking each
|
|
301
|
+
// one keeps this correct if a fourth is added, and none of the three is recoverable here --
|
|
302
|
+
// the row cannot be drawn either way.
|
|
303
|
+
//
|
|
304
|
+
// This matters more for this bucket than anywhere else on the page. It is tenant-wide, so it
|
|
305
|
+
// names schedules the close-month list never loaded, and the group is defined by deleted
|
|
306
|
+
// vendors and deleted categories -- precisely the rows whose entities are most likely to be
|
|
307
|
+
// missing. Unguarded, one such key takes down the whole JE tab instead of dropping one row.
|
|
308
|
+
try {
|
|
309
|
+
failedJeScheduledTransaction.push((0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state));
|
|
310
|
+
}
|
|
311
|
+
catch {
|
|
312
|
+
// Intentionally swallowed: a failed posting we cannot resolve is one missing row, and the
|
|
313
|
+
// alternative is a blank page for every other row too.
|
|
314
|
+
}
|
|
301
315
|
});
|
|
316
|
+
// What the endpoint last reported as failing. The entity store keeps every month a schedule
|
|
317
|
+
// has and an entry resolved by someone else keeps its old `error` array, so `error` alone would
|
|
318
|
+
// leave a Retry button on a posting that is no longer failing.
|
|
319
|
+
const failedScheduledJournalEntryIDs = new Set(failedJePostings.scheduledJournalEntryIDs);
|
|
302
320
|
const { sortKey, sortOrder, selectedJETypeFilter } = uiState;
|
|
321
|
+
const matchesTypeFilter = (schedule) => selectedJETypeFilter == null ||
|
|
322
|
+
getJEScheduleRowType(schedule) === selectedJETypeFilter;
|
|
303
323
|
const unsortedResolveSchedules = [];
|
|
304
324
|
failedJeScheduledTransaction.forEach((schedule) => {
|
|
305
|
-
|
|
325
|
+
// Only the entries that actually carry an error. The schedule's entry array is shared state:
|
|
326
|
+
// opening a schedule's detail page or Quick View replaces it with every month the schedule
|
|
327
|
+
// has, posted ones included, so fanning out over all of them turned one failed posting into a
|
|
328
|
+
// row per month -- and a month that never failed has nothing to resolve, so it rendered with
|
|
329
|
+
// an empty action column.
|
|
330
|
+
//
|
|
331
|
+
// Intersected with the ids the endpoint actually returned, not just `error`: the entry array
|
|
332
|
+
// is a cache of every month, and an entry whose failure someone else resolved keeps its stale
|
|
333
|
+
// error array until something overwrites it. Only what the last fetch named is still failing.
|
|
334
|
+
schedule.scheduledJournalEntry
|
|
335
|
+
.filter((journalEntry) => journalEntry.error.length > 0 &&
|
|
336
|
+
failedScheduledJournalEntryIDs.has(journalEntry.scheduledJournalEntryID))
|
|
337
|
+
.forEach((journalEntry) => {
|
|
306
338
|
unsortedResolveSchedules.push({
|
|
307
339
|
...schedule,
|
|
308
340
|
scheduledJournalEntry: journalEntry,
|
|
309
341
|
});
|
|
310
342
|
});
|
|
311
343
|
});
|
|
312
|
-
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
|
|
313
|
-
const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
|
|
314
|
-
const matchesTypeFilter = (schedule) => selectedJETypeFilter == null ||
|
|
315
|
-
getJEScheduleRowType(schedule) === selectedJETypeFilter;
|
|
344
|
+
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules.filter(matchesTypeFilter), sortKey, sortOrder);
|
|
316
345
|
const isCreatedStatus = (schedule) => {
|
|
317
346
|
// An accrual is "created" once it is not review work: posted, reversing, reversed, or in a
|
|
318
347
|
// transient posting claim.
|
|
@@ -330,7 +359,6 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
330
359
|
];
|
|
331
360
|
const pendingReviewSchedules = sortJEScheduledTransactions([
|
|
332
361
|
...allScheduleRows.filter((schedule) => isPendingReviewRow(schedule) && matchesTypeFilter(schedule)),
|
|
333
|
-
...validResolveForPending,
|
|
334
362
|
], sortKey, sortOrder);
|
|
335
363
|
const createdSchedules = sortJEScheduledTransactions(allScheduleRows.filter((schedule) => isCreatedStatus(schedule) && matchesTypeFilter(schedule)), sortKey, sortOrder);
|
|
336
364
|
// KPI summary — derived from unfiltered schedules so counts are always accurate
|
|
@@ -449,6 +477,13 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
449
477
|
kpiSummary,
|
|
450
478
|
pendingReviewSchedules,
|
|
451
479
|
pendingReviewTotal,
|
|
480
|
+
failedPostings: resolveSchedules,
|
|
481
|
+
// Exposed so a consumer can tell "still loading" and "the lookup failed" from "nothing has
|
|
482
|
+
// failed". The bucket keeps its rows on failure precisely so an error can be shown beside
|
|
483
|
+
// them, which is only possible if the state travels with them.
|
|
484
|
+
failedPostingsFetchState: failedJePostings.fetchState,
|
|
485
|
+
// Deprecated alias of failedPostings. Still read by the section's footer-form effect and by
|
|
486
|
+
// app-ui analytics; remove once both are repointed.
|
|
452
487
|
resolveSchedules: resolveSchedules,
|
|
453
488
|
accountSettingsView,
|
|
454
489
|
newScheduleView,
|
|
@@ -182,18 +182,35 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
182
182
|
review: monthYearPeriodId != null ? totalCountByReview[monthYearPeriodId] : 0,
|
|
183
183
|
autoCategorized: monthYearPeriodId != null ? totalCountByAutoCat[monthYearPeriodId] : 0,
|
|
184
184
|
};
|
|
185
|
-
//
|
|
186
|
-
//
|
|
187
|
-
//
|
|
188
|
-
//
|
|
185
|
+
// Tab badge counts, used exclusively by the navbar / tab strip badges. Both
|
|
186
|
+
// tabs are counted under the filters applied to the list, so a badge always
|
|
187
|
+
// equals the number of rows that tab shows.
|
|
188
|
+
//
|
|
189
|
+
// The ACTIVE tab prefers its own list count: the two are the same number (the
|
|
190
|
+
// backend's parent_tab_total_count mirrors total_count), but `uiState.totalCount`
|
|
191
|
+
// is restored by every cache path that skips a fetch -- switching back to an
|
|
192
|
+
// already-loaded period, or to a cached Completed sub-tab -- whereas the stored
|
|
193
|
+
// badge is only written when a response lands, so on those paths it would keep
|
|
194
|
+
// showing whatever was fetched last.
|
|
195
|
+
//
|
|
196
|
+
// The `in` check is load-bearing, not defensive: `totalCount` is a per-period
|
|
197
|
+
// map typed as `Record<MonthYearPeriodId, number>`, so indexing it is typed
|
|
198
|
+
// `number` but is `undefined` for any period the active (sub-)tab has not
|
|
199
|
+
// loaded -- the window between switching to a fresh sub-tab and its response
|
|
200
|
+
// landing. Falling back to the stored badge there keeps a real number in the
|
|
201
|
+
// label instead of blanking it.
|
|
189
202
|
const parentTotalCountByTab = expenseAutomationTransactionsViewState.parentTotalCountByTab;
|
|
203
|
+
const storedBadgeByTab = (tab) => monthYearPeriodId != null
|
|
204
|
+
? (parentTotalCountByTab[tab][monthYearPeriodId] ?? 0)
|
|
205
|
+
: 0;
|
|
206
|
+
const badgeForTab = (tab, listCountByPeriod) => selectedTransactionCategorizationTab === tab &&
|
|
207
|
+
monthYearPeriodId != null &&
|
|
208
|
+
monthYearPeriodId in listCountByPeriod
|
|
209
|
+
? listCountByPeriod[monthYearPeriodId]
|
|
210
|
+
: storedBadgeByTab(tab);
|
|
190
211
|
const parentTabTotalCountByTab = {
|
|
191
|
-
review:
|
|
192
|
-
|
|
193
|
-
: 0,
|
|
194
|
-
autoCategorized: monthYearPeriodId != null
|
|
195
|
-
? (parentTotalCountByTab.autoCategorized[monthYearPeriodId] ?? 0)
|
|
196
|
-
: 0,
|
|
212
|
+
review: badgeForTab('review', totalCountByReview),
|
|
213
|
+
autoCategorized: badgeForTab('autoCategorized', totalCountByAutoCat),
|
|
197
214
|
};
|
|
198
215
|
const fetchStateByTab = {
|
|
199
216
|
review: {
|
|
@@ -19,6 +19,7 @@ export type JESchedulePeriodTabKey = `${JEPageTab}_${MonthYearPeriodId}`;
|
|
|
19
19
|
export declare const getJESchedulePeriodTabKey: (selectedPageTab: JEPageTab, monthYearPeriodId: MonthYearPeriodId) => JESchedulePeriodTabKey;
|
|
20
20
|
export interface JESchedulesViewUIState {
|
|
21
21
|
createdGroupCollapsed: boolean;
|
|
22
|
+
failedGroupCollapsed: boolean;
|
|
22
23
|
pendingGroupCollapsed: boolean;
|
|
23
24
|
scrollPosition: {
|
|
24
25
|
scrollTop: number;
|
|
@@ -41,8 +42,23 @@ export interface JEScheduleLocalData {
|
|
|
41
42
|
updatedClassId?: ID;
|
|
42
43
|
updatedVendor?: VendorBase;
|
|
43
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* The Failed Postings bucket, and the only list on this page that is not scoped to a period.
|
|
47
|
+
*
|
|
48
|
+
* A failed posting is broken until someone resolves it, whatever month it belongs to, so windowing
|
|
49
|
+
* it the way the schedule lists are windowed is what hid a March failure from the September close.
|
|
50
|
+
* It therefore has no period-tab key, and its own fetch state rather than the slice's: the list is
|
|
51
|
+
* fetched separately from `/1.0/expenses_automation/failed_je_postings`, so a slow or failing
|
|
52
|
+
* lookup here must not blank the schedules table, or vice versa.
|
|
53
|
+
*/
|
|
54
|
+
export interface FailedJePostingsState {
|
|
55
|
+
fetchState: FetchStateAndError;
|
|
56
|
+
jeScheduleTransactionKeys: JEScheduleTransactionKey[];
|
|
57
|
+
scheduledJournalEntryIDs: ID[];
|
|
58
|
+
}
|
|
44
59
|
export interface JESchedulesViewState extends FetchedState {
|
|
45
60
|
accountSettings: AccountSettingsState;
|
|
61
|
+
failedJePostings: FailedJePostingsState;
|
|
46
62
|
failedJeScheduleTransactionKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleTransactionKey[]>;
|
|
47
63
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
48
64
|
jeScheduleAccruedKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleKey[]>;
|
|
@@ -139,11 +139,14 @@ export type TransactionsViewState = {
|
|
|
139
139
|
*/
|
|
140
140
|
autoCategorizedSubTabCache: Partial<Record<CompletedSubTab, AutoCategorizedSubTabSnapshot>>;
|
|
141
141
|
/**
|
|
142
|
-
* Period-keyed
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
142
|
+
* Period-keyed tab badge counts, scoped per {@link TransactionsTab}. Every
|
|
143
|
+
* count here is taken under the filters currently applied to the list
|
|
144
|
+
* (`transaction_group` + Completed `sub_tab` + search), so a badge always
|
|
145
|
+
* matches the rows that tab renders. The active tab is filled from the
|
|
146
|
+
* listing response's `parent_tab_total_count` and the inactive one from its
|
|
147
|
+
* `other_tab_total_count`. Used exclusively to drive the tab badges — every
|
|
148
|
+
* other count consumer (pagination, in-tab "showing X of Y") keeps reading
|
|
149
|
+
* from {@link TransactionsViewUIState.totalCount}.
|
|
147
150
|
*/
|
|
148
151
|
parentTotalCountByTab: Record<TransactionsTab, Record<MonthYearPeriodId, number>>;
|
|
149
152
|
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
@@ -9,8 +9,13 @@ import { InvoicingCreateInvoiceFormLocalData } from './createInvoiceState';
|
|
|
9
9
|
* One catalog plan price, split into its two naming parts so consumers can
|
|
10
10
|
* compose the label themselves (the plan family name and the price point/price
|
|
11
11
|
* name are separate columns in the catalog). `price` is the price point's
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* per-unit amount in whole USD (never minor units): the service-computed
|
|
13
|
+
* single-unit display price, falling back to the configured price for
|
|
14
|
+
* responses predating it. It is absent when the catalog carries no price for
|
|
15
|
+
* it, and deliberately absent for tiered, volume and stairstep price points —
|
|
16
|
+
* their single-unit figure is a step/band fee, not a rate, so multiplying it
|
|
17
|
+
* by a quantity (which is what the Create Invoice line prefill does) would
|
|
18
|
+
* produce a plausible-looking wrong total. Those lines start unpriced.
|
|
14
19
|
*/
|
|
15
20
|
export interface InvoicingPlanNameOption {
|
|
16
21
|
planName: string;
|
|
@@ -2,10 +2,37 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCreateInvoiceFormView = void 0;
|
|
4
4
|
const addressSelector_1 = require("../../../entity/address/addressSelector");
|
|
5
|
+
const planSelector_1 = require("../../../entity/invoicing/plan/planSelector");
|
|
5
6
|
const invoicingCatalogListViewSelector_1 = require("../invoicingCatalogListView/invoicingCatalogListViewSelector");
|
|
6
7
|
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
7
8
|
const invoicingCustomerListViewSelector_1 = require("../invoicingCustomerListView/invoicingCustomerListViewSelector");
|
|
8
9
|
const settingsViewSelector_1 = require("../settingsView/settingsViewSelector");
|
|
10
|
+
/**
|
|
11
|
+
* Pricing models whose single-unit amount is a true per-unit rate — the only
|
|
12
|
+
* ones a Create Invoice line may be prefilled from. Typed against the entity
|
|
13
|
+
* union so a misspelt member fails to compile; a model added to the union
|
|
14
|
+
* still has to be classified here by hand (it is left out, so it fails closed:
|
|
15
|
+
* no prefill). The complement is `isTieredCatalogPricingModel`.
|
|
16
|
+
*/
|
|
17
|
+
const PER_UNIT_RATE_PRICING_MODELS = [
|
|
18
|
+
'per_unit',
|
|
19
|
+
'flat_fee',
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Whether a price point's single-unit amount is a per-unit rate. A missing
|
|
23
|
+
* model means per-unit: the service defaults `pricing_model` to `per_unit`
|
|
24
|
+
* and older records may omit it.
|
|
25
|
+
*/
|
|
26
|
+
const hasPerUnitRate = (pricingModel) => pricingModel == null ||
|
|
27
|
+
pricingModel === '' ||
|
|
28
|
+
PER_UNIT_RATE_PRICING_MODELS.some((model) => model === pricingModel);
|
|
29
|
+
/**
|
|
30
|
+
* The amount to prefill on a Create Invoice line for a price point, or
|
|
31
|
+
* `undefined` when there is no safe per-unit rate to prefill.
|
|
32
|
+
*/
|
|
33
|
+
const planNamePrefillPrice = (pricePoint) => hasPerUnitRate(pricePoint.pricingModel)
|
|
34
|
+
? (0, planSelector_1.invoicingPricePointDisplayAmount)(pricePoint)?.amount
|
|
35
|
+
: undefined;
|
|
9
36
|
/**
|
|
10
37
|
* Display name for a customer option: company, else the full name, else the
|
|
11
38
|
* email, else the raw id.
|
|
@@ -50,7 +77,7 @@ const getCreateInvoiceFormView = (state) => {
|
|
|
50
77
|
.filter((subFamily) => (subFamily.name ?? '') !== '')
|
|
51
78
|
.map((subFamily) => ({
|
|
52
79
|
planName: plan.name ?? '',
|
|
53
|
-
price: subFamily
|
|
80
|
+
price: planNamePrefillPrice(subFamily),
|
|
54
81
|
subFamilyName: subFamily.name ?? '',
|
|
55
82
|
}))),
|
|
56
83
|
products: (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogPrices)(catalogListView.products),
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
2
2
|
import { ClassBase } from '../../../entity/class/classState';
|
|
3
3
|
import { InvoicingPlanPayload } from '../../../entity/invoicing/plan/planPayload';
|
|
4
|
-
import { InvoicingProductPayload } from '../../../entity/invoicing/product/productPayload';
|
|
4
|
+
import { InvoicingAccountingDetailPayload, InvoicingProductPayload } from '../../../entity/invoicing/product/productPayload';
|
|
5
5
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
6
6
|
import { InvoicingCatalogItemFormLocalData } from './editInvoicingCatalogItemDetailViewState';
|
|
7
7
|
export type SaveInvoicingCatalogItemResponse = ZeniAPIResponse<InvoicingPlanPayload>;
|
|
8
|
+
/**
|
|
9
|
+
* The price-point half of a save body. `InvoicingProductPayload` is the shape
|
|
10
|
+
* the service returns; a save differs in that a field is cleared by sending an
|
|
11
|
+
* explicit `null`, since an absent key reads as "leave it alone".
|
|
12
|
+
*/
|
|
13
|
+
export type InvoicingCatalogSubFamilySavePayload = Omit<Partial<InvoicingProductPayload>, 'accounting_detail' | 'description' | 'invoice_notes'> & {
|
|
14
|
+
accounting_detail?: InvoicingAccountingDetailPayload | null;
|
|
15
|
+
description?: string | null;
|
|
16
|
+
invoice_notes?: string | null;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The catalog-item save body: the item the service returns, minus the fields it
|
|
20
|
+
* assigns itself.
|
|
21
|
+
*
|
|
22
|
+
* Price points travel under `sub_families`, the name they are read back under,
|
|
23
|
+
* and differ only in allowing the cleared forms above. An update addresses them
|
|
24
|
+
* by id, so a price point added on the form — which has none yet — is created
|
|
25
|
+
* by its own request instead; see
|
|
26
|
+
* `localDataToCreateInvoicingCatalogProductPayloads`.
|
|
27
|
+
*/
|
|
28
|
+
export type InvoicingCatalogItemSavePayload = Omit<Partial<InvoicingPlanPayload>, 'sub_families'> & {
|
|
29
|
+
sub_families?: InvoicingCatalogSubFamilySavePayload[];
|
|
30
|
+
};
|
|
8
31
|
/**
|
|
9
32
|
* Resolves the QuickBooks ids the pickers submit back to the entities they name.
|
|
10
33
|
* The payload carries the whole account and class, so the ids alone are not
|
|
@@ -20,12 +43,30 @@ export interface InvoicingCatalogAccountingFields {
|
|
|
20
43
|
accountingCode: string;
|
|
21
44
|
sku: string;
|
|
22
45
|
}
|
|
23
|
-
export declare const buildAccountingDetail: (subFamily: InvoicingCatalogAccountingFields, lookup: InvoicingCatalogAccountingLookup) =>
|
|
46
|
+
export declare const buildAccountingDetail: (subFamily: InvoicingCatalogAccountingFields, lookup: InvoicingCatalogAccountingLookup) => InvoicingAccountingDetailPayload | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Build the parent catalog-item request body from the form draft. Every field
|
|
49
|
+
* the form holds is sent, so a value cleared on the form is cleared on the
|
|
50
|
+
* item: the service reads an absent key as "leave it alone", which is why
|
|
51
|
+
* `description` travels as an empty string and `applicable_items` as an empty
|
|
52
|
+
* list rather than being dropped. Fields the form does not collect
|
|
53
|
+
* (`external_name`, `item_family_id`, `metadata`, …) stay off the body so an
|
|
54
|
+
* edit cannot overwrite them with a value nobody chose.
|
|
55
|
+
*/
|
|
56
|
+
export declare const localDataToSaveInvoicingCatalogItemPayload: (localData: InvoicingCatalogItemFormLocalData, isCreate: boolean, lookup: InvoicingCatalogAccountingLookup) => InvoicingCatalogItemSavePayload;
|
|
24
57
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
58
|
+
* The bodies that create the price points added on an edit form, one per
|
|
59
|
+
* request to `/catalog/products`.
|
|
60
|
+
*
|
|
61
|
+
* An update cannot carry them: it addresses price points by id, and these have
|
|
62
|
+
* none until the service assigns one. They are bound to their item by
|
|
63
|
+
* `item_id`, so this needs the saved item's id and runs after the item itself
|
|
64
|
+
* is saved.
|
|
65
|
+
*
|
|
66
|
+
* Empty values are left off rather than sent as `null`: there is nothing on a
|
|
67
|
+
* price point that does not exist yet to clear.
|
|
27
68
|
*/
|
|
28
|
-
export declare const
|
|
69
|
+
export declare const localDataToCreateInvoicingCatalogProductPayloads: (localData: InvoicingCatalogItemFormLocalData, itemId: string, lookup: InvoicingCatalogAccountingLookup) => InvoicingCatalogSubFamilySavePayload[];
|
|
29
70
|
export type RunInvoicingCatalogPlanActionResponse = ZeniAPIResponse<InvoicingPlanPayload>;
|
|
30
71
|
export type RunInvoicingCatalogProductActionResponse = ZeniAPIResponse<InvoicingProductPayload>;
|
|
31
72
|
export type InvoicingCatalogItemDetailResponse = ZeniAPIResponse<InvoicingPlanPayload>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.localDataToSaveInvoicingCatalogItemPayload = exports.buildAccountingDetail = void 0;
|
|
3
|
+
exports.localDataToCreateInvoicingCatalogProductPayloads = exports.localDataToSaveInvoicingCatalogItemPayload = exports.buildAccountingDetail = void 0;
|
|
4
4
|
const accountPayload_1 = require("../../../entity/account/accountPayload");
|
|
5
5
|
const classPayload_1 = require("../../../entity/class/classPayload");
|
|
6
6
|
const invoicingCatalogItemFormHelper_1 = require("./invoicingCatalogItemFormHelper");
|
|
7
7
|
const CURRENCY_CODE = 'USD';
|
|
8
8
|
const trimOrUndefined = (value) => value.trim() !== '' ? value.trim() : undefined;
|
|
9
|
-
const trimOrNull = (value) => value.trim() !== '' ? value.trim() : null;
|
|
10
9
|
const toProductCode = (value) => value
|
|
11
10
|
.trim()
|
|
12
11
|
.toLowerCase()
|
|
@@ -95,13 +94,24 @@ const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues, lookup) =
|
|
|
95
94
|
/** `unit` is the item's unit of measure, not a currency; `CURRENCY_CODE` above prices Price points. */
|
|
96
95
|
const DEFAULT_CATALOG_ITEM_UNIT = 'USD';
|
|
97
96
|
/**
|
|
98
|
-
* Build the parent catalog-item request body from the form draft.
|
|
99
|
-
*
|
|
97
|
+
* Build the parent catalog-item request body from the form draft. Every field
|
|
98
|
+
* the form holds is sent, so a value cleared on the form is cleared on the
|
|
99
|
+
* item: the service reads an absent key as "leave it alone", which is why
|
|
100
|
+
* `description` travels as an empty string and `applicable_items` as an empty
|
|
101
|
+
* list rather than being dropped. Fields the form does not collect
|
|
102
|
+
* (`external_name`, `item_family_id`, `metadata`, …) stay off the body so an
|
|
103
|
+
* edit cannot overwrite them with a value nobody chose.
|
|
100
104
|
*/
|
|
101
105
|
const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate, lookup) => {
|
|
102
|
-
const description = trimOrUndefined(localData.description);
|
|
103
106
|
const productCode = trimOrUndefined(localData.productCode) ?? toProductCode(localData.name);
|
|
104
107
|
const itemPayload = {
|
|
108
|
+
// `applicable_items` only means anything while the item is restricted;
|
|
109
|
+
// sending the empty list otherwise is what clears a restriction that was
|
|
110
|
+
// just lifted.
|
|
111
|
+
applicable_items: localData.itemApplicability === 'restricted'
|
|
112
|
+
? localData.applicableItems
|
|
113
|
+
: [],
|
|
114
|
+
description: trimOrUndefined(localData.description) ?? '',
|
|
105
115
|
enabled_for_checkout: true,
|
|
106
116
|
enabled_in_portal: true,
|
|
107
117
|
is_giftable: false,
|
|
@@ -111,42 +121,65 @@ const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate, lookup)
|
|
|
111
121
|
name: localData.name.trim(),
|
|
112
122
|
product_code: productCode,
|
|
113
123
|
type: localData.catalogType,
|
|
124
|
+
// The form no longer collects a unit; an item that already has one keeps it.
|
|
125
|
+
unit: trimOrUndefined(localData.unit) ?? DEFAULT_CATALOG_ITEM_UNIT,
|
|
114
126
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (localData.itemApplicability === 'restricted' &&
|
|
122
|
-
localData.applicableItems.length > 0) {
|
|
123
|
-
itemPayload.applicable_items = localData.applicableItems;
|
|
127
|
+
// The external id is assigned by the billing service and shown read-only, so
|
|
128
|
+
// it is echoed back only when the item already has one: sending the blank a
|
|
129
|
+
// create starts with would clear an id assigned in the meantime.
|
|
130
|
+
const externalId = trimOrUndefined(localData.externalId);
|
|
131
|
+
if (externalId != null) {
|
|
132
|
+
itemPayload.external_id = externalId;
|
|
124
133
|
}
|
|
125
134
|
const subFamilies = localData.subFamilies.length > 0
|
|
126
135
|
? localData.subFamilies
|
|
127
136
|
: [(0, invoicingCatalogItemFormHelper_1.blankInvoicingCatalogSubFamily)()];
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
137
|
+
if (isCreate) {
|
|
138
|
+
itemPayload.sub_families = subFamilies.map((subFamily) => buildSubFamilyPayload(localData, subFamily, false, lookup));
|
|
139
|
+
return itemPayload;
|
|
140
|
+
}
|
|
141
|
+
// Only price points the service has already stored travel in an update: it
|
|
142
|
+
// addresses them by id, and a blank one has nothing to address. A price point
|
|
143
|
+
// added on the form is created by its own request once the item is saved,
|
|
144
|
+
// rather than riding along as a row the update cannot place.
|
|
145
|
+
itemPayload.sub_families = subFamilies
|
|
146
|
+
.filter((subFamily) => subFamily.id !== '')
|
|
147
|
+
.map((subFamily) => {
|
|
148
|
+
// Edits send the same body a create does. The narrower hand-built one
|
|
149
|
+
// this replaces had to be kept in step by hand and was not: it dropped
|
|
150
|
+
// `accounting_detail` once, and `billing_cycles`, `price`,
|
|
151
|
+
// `pricing_model`, `period`, the trial fields, `proration_type`,
|
|
152
|
+
// `free_quantity`, `is_taxable` and `tiers` were never added at all, so
|
|
153
|
+
// editing any of them looked saved and changed nothing.
|
|
154
|
+
const detail = buildSubFamilyPayload(localData, subFamily, true, lookup);
|
|
155
|
+
// `null` rather than omitted when empty: an absent key on an update
|
|
156
|
+
// reads as "leave it alone", which would make a cleared mapping
|
|
157
|
+
// impossible to save — the same reason `description` and
|
|
158
|
+
// `invoice_notes` are cleared rather than dropped above.
|
|
159
|
+
detail.accounting_detail = detail.accounting_detail ?? null;
|
|
160
|
+
// Never blank: the filter above leaves only price points the service has
|
|
161
|
+
// already stored, which is the only kind an update can address.
|
|
162
|
+
return { ...detail, id: subFamily.id };
|
|
163
|
+
});
|
|
150
164
|
return itemPayload;
|
|
151
165
|
};
|
|
152
166
|
exports.localDataToSaveInvoicingCatalogItemPayload = localDataToSaveInvoicingCatalogItemPayload;
|
|
167
|
+
/**
|
|
168
|
+
* The bodies that create the price points added on an edit form, one per
|
|
169
|
+
* request to `/catalog/products`.
|
|
170
|
+
*
|
|
171
|
+
* An update cannot carry them: it addresses price points by id, and these have
|
|
172
|
+
* none until the service assigns one. They are bound to their item by
|
|
173
|
+
* `item_id`, so this needs the saved item's id and runs after the item itself
|
|
174
|
+
* is saved.
|
|
175
|
+
*
|
|
176
|
+
* Empty values are left off rather than sent as `null`: there is nothing on a
|
|
177
|
+
* price point that does not exist yet to clear.
|
|
178
|
+
*/
|
|
179
|
+
const localDataToCreateInvoicingCatalogProductPayloads = (localData, itemId, lookup) => localData.subFamilies
|
|
180
|
+
.filter((subFamily) => subFamily.id === '')
|
|
181
|
+
.map((subFamily) => ({
|
|
182
|
+
...buildSubFamilyPayload(localData, subFamily, false, lookup),
|
|
183
|
+
item_id: itemId,
|
|
184
|
+
}));
|
|
185
|
+
exports.localDataToCreateInvoicingCatalogProductPayloads = localDataToCreateInvoicingCatalogProductPayloads;
|
|
@@ -74,6 +74,8 @@ export declare const updateInvoicingCatalogItemFormDraft: import("@reduxjs/toolk
|
|
|
74
74
|
}, "editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionFailure">, submitInvoicingCatalogItemForm: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: SubmitInvoicingCatalogItemFormPayload], SubmitInvoicingCatalogItemFormPayload, "editInvoicingCatalogItemDetailView/submitInvoicingCatalogItemForm", never, never>, submitInvoicingCatalogItemFormSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
75
75
|
itemId: ID;
|
|
76
76
|
kind: InvoicingCatalogItemKind;
|
|
77
|
-
}, "editInvoicingCatalogItemDetailView/submitInvoicingCatalogItemFormSuccess">, submitInvoicingCatalogItemFormFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "editInvoicingCatalogItemDetailView/submitInvoicingCatalogItemFormFailure">, resetEditInvoicingCatalogItemDetailView: import("@reduxjs/toolkit").
|
|
77
|
+
}, "editInvoicingCatalogItemDetailView/submitInvoicingCatalogItemFormSuccess">, submitInvoicingCatalogItemFormFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "editInvoicingCatalogItemDetailView/submitInvoicingCatalogItemFormFailure">, resetEditInvoicingCatalogItemDetailView: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<{
|
|
78
|
+
id?: ID;
|
|
79
|
+
} | undefined, "editInvoicingCatalogItemDetailView/resetEditInvoicingCatalogItemDetailView">;
|
|
78
80
|
declare const _default: import("redux").Reducer<EditInvoicingCatalogItemDetailViewState>;
|
|
79
81
|
export default _default;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.resetEditInvoicingCatalogItemDetailView = exports.submitInvoicingCatalogItemFormFailure = exports.submitInvoicingCatalogItemFormSuccess = exports.submitInvoicingCatalogItemForm = exports.runInvoicingCatalogProductActionFailure = exports.runInvoicingCatalogProductActionSuccess = exports.runInvoicingCatalogProductAction = exports.runInvoicingCatalogPlanActionFailure = exports.runInvoicingCatalogPlanActionSuccess = exports.runInvoicingCatalogPlanAction = exports.seedInvoicingCatalogItemFormDraft = exports.updateInvoicingCatalogItemDetailFailure = exports.updateInvoicingCatalogItemDetail = exports.fetchInvoicingCatalogItemDetailPage = exports.fetchInvoicingCatalogItemDetail = exports.updateInvoicingCatalogItemFormDraft = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const rootActions_1 = require("../../../rootActions");
|
|
7
|
+
const invoicingFormDraft_1 = require("../invoicingFormDraft");
|
|
7
8
|
const invoicingCatalogItemFormHelper_1 = require("./invoicingCatalogItemFormHelper");
|
|
8
9
|
exports.initialState = {
|
|
9
10
|
fetchState: 'Not-Started',
|
|
@@ -25,7 +26,7 @@ const editInvoicingCatalogItemDetailView = (0, toolkit_1.createSlice)({
|
|
|
25
26
|
updateInvoicingCatalogItemFormDraft(draft, action) {
|
|
26
27
|
const { id, localData } = action.payload;
|
|
27
28
|
if (id != null) {
|
|
28
|
-
draft.editDraftById
|
|
29
|
+
(0, invoicingFormDraft_1.applyInvoicingFormDraftEdit)(draft.editDraftById, id, localData);
|
|
29
30
|
}
|
|
30
31
|
else {
|
|
31
32
|
draft.newItemDraft = localData;
|
|
@@ -46,6 +47,9 @@ const editInvoicingCatalogItemDetailView = (0, toolkit_1.createSlice)({
|
|
|
46
47
|
draft.error = undefined;
|
|
47
48
|
draft.savedItemId = action.payload.itemId;
|
|
48
49
|
draft.savedKind = action.payload.kind;
|
|
50
|
+
// An edit is refetched on success; keep the saved values on screen until
|
|
51
|
+
// that lands, and let it replace them.
|
|
52
|
+
(0, invoicingFormDraft_1.applyInvoicingFormDraftSaved)(draft.editDraftById, action.payload.itemId);
|
|
49
53
|
},
|
|
50
54
|
submitInvoicingCatalogItemFormFailure(draft, action) {
|
|
51
55
|
draft.fetchState = 'Error';
|
|
@@ -68,6 +72,7 @@ const editInvoicingCatalogItemDetailView = (0, toolkit_1.createSlice)({
|
|
|
68
72
|
fetchState: 'Error',
|
|
69
73
|
error: action.payload.error,
|
|
70
74
|
};
|
|
75
|
+
(0, invoicingFormDraft_1.applyInvoicingFormDraftFailure)(draft.editDraftById, action.payload.id, invoicingCatalogItemFormHelper_1.initialInvoicingCatalogItemFormLocalData);
|
|
71
76
|
},
|
|
72
77
|
fetchInvoicingCatalogItemDetailPage: {
|
|
73
78
|
reducer() {
|
|
@@ -83,14 +88,10 @@ const editInvoicingCatalogItemDetailView = (0, toolkit_1.createSlice)({
|
|
|
83
88
|
};
|
|
84
89
|
},
|
|
85
90
|
},
|
|
86
|
-
/**
|
|
87
|
-
* Seed the draft from the loaded record, once. Skipped when a draft already
|
|
88
|
-
* exists so a late-arriving refetch cannot overwrite in-progress edits.
|
|
89
|
-
*/
|
|
91
|
+
/** Fill the draft from the loaded record — see `applyInvoicingFormDraftSeed`. */
|
|
90
92
|
seedInvoicingCatalogItemFormDraft(draft, action) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
93
|
+
const { id, localData } = action.payload;
|
|
94
|
+
(0, invoicingFormDraft_1.applyInvoicingFormDraftSeed)(draft.editDraftById, id, localData);
|
|
94
95
|
},
|
|
95
96
|
runInvoicingCatalogPlanAction(draft, action) {
|
|
96
97
|
draft.actionStateById[action.payload.id] = {
|
|
@@ -129,13 +130,23 @@ const editInvoicingCatalogItemDetailView = (0, toolkit_1.createSlice)({
|
|
|
129
130
|
error: action.payload.error,
|
|
130
131
|
};
|
|
131
132
|
},
|
|
132
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Discard a form's draft — the catalog item's own when `id` is given,
|
|
135
|
+
* the create draft otherwise. Scoped to the one form on purpose: another
|
|
136
|
+
* catalog item's half-finished edit is not this form's to throw away.
|
|
137
|
+
* Clearing every draft at once is what `clearAll` is for.
|
|
138
|
+
*/
|
|
139
|
+
resetEditInvoicingCatalogItemDetailView(draft, action) {
|
|
133
140
|
draft.fetchState = 'Not-Started';
|
|
134
141
|
draft.error = undefined;
|
|
135
142
|
draft.savedItemId = undefined;
|
|
136
143
|
draft.savedKind = undefined;
|
|
137
|
-
|
|
138
|
-
|
|
144
|
+
const id = action.payload?.id;
|
|
145
|
+
if (id == null) {
|
|
146
|
+
draft.newItemDraft = { ...invoicingCatalogItemFormHelper_1.initialInvoicingCatalogItemFormLocalData };
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
delete draft.editDraftById[id];
|
|
139
150
|
},
|
|
140
151
|
},
|
|
141
152
|
extraReducers: (builder) => {
|
|
@@ -44,6 +44,16 @@ export interface InvoicingCatalogItemFormView extends SelectorView {
|
|
|
44
44
|
* Folded in here so the screen never reaches for the config view itself.
|
|
45
45
|
*/
|
|
46
46
|
fieldHelp: InvoicingFieldHelpByCode;
|
|
47
|
+
/**
|
|
48
|
+
* True while anything the form's fields mount against is still loading: the
|
|
49
|
+
* accounting lists, and — until it has reached the draft — the item being
|
|
50
|
+
* edited. The form holds a skeleton on this rather than mount, because both
|
|
51
|
+
* arrive too late to be picked up: it seeds react-hook-form once, at first
|
|
52
|
+
* render, and the accounting fields choose between a picker and a text input
|
|
53
|
+
* from the lists. A later refetch does not raise this again, so a refresh
|
|
54
|
+
* leaves the form on screen instead of blanking it mid-edit.
|
|
55
|
+
*/
|
|
56
|
+
isFormLoading: boolean;
|
|
47
57
|
/**
|
|
48
58
|
* True while the accounting lists are still loading, so the form can wait
|
|
49
59
|
* instead of mounting pickers whose options are not there yet.
|
|
@@ -69,6 +79,13 @@ export interface InvoicingCatalogItemFormView extends SelectorView {
|
|
|
69
79
|
*/
|
|
70
80
|
qboAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
71
81
|
qboClassHierarchy: NestedClassHierarchyForReport[];
|
|
82
|
+
/**
|
|
83
|
+
* The ids within the account tree an income account may be picked from.
|
|
84
|
+
* QuickBooks only accepts an income account on a product, so a price point
|
|
85
|
+
* mapped to anything else — A/R, deferred revenue, a bank account — fails to
|
|
86
|
+
* sync once an invoice carrying it is pushed.
|
|
87
|
+
*/
|
|
88
|
+
qboIncomeAccountIds: string[];
|
|
72
89
|
/**
|
|
73
90
|
* Loading the item, as distinct from this view's own `fetchState`, which
|
|
74
91
|
* tracks the save.
|