@zeniai/client-epic-state 5.2.41-beta6MM → 5.2.41-beta8MM
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 +6 -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/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 +7 -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
|
@@ -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.
|
|
@@ -5,6 +5,7 @@ const toolkit_1 = require("@reduxjs/toolkit");
|
|
|
5
5
|
const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
|
|
6
6
|
const planSelector_1 = require("../../../entity/invoicing/plan/planSelector");
|
|
7
7
|
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
8
|
+
const invoicingFormDraft_1 = require("../invoicingFormDraft");
|
|
8
9
|
const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
|
|
9
10
|
const invoicingCatalogItemFormHelper_1 = require("./invoicingCatalogItemFormHelper");
|
|
10
11
|
const getEditInvoicingCatalogItemDetailViewState = (state) => ({
|
|
@@ -49,6 +50,21 @@ const NOT_STARTED = {
|
|
|
49
50
|
error: undefined,
|
|
50
51
|
fetchState: 'Not-Started',
|
|
51
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* The QuickBooks ids a price point's income account may be picked from.
|
|
55
|
+
*
|
|
56
|
+
* Memoized, and collapsing to one shared empty array while QBO is disconnected:
|
|
57
|
+
* the pages turn this into their picker options and re-seed their form defaults
|
|
58
|
+
* when those change, so a fresh array on every store change would reset the form
|
|
59
|
+
* under the user — including mid-save.
|
|
60
|
+
*/
|
|
61
|
+
const getInvoicingCatalogIncomeAccountIds = (0, toolkit_1.createSelector)([
|
|
62
|
+
invoicingQboViewSelector_1.getInvoicingQboAccountOptions,
|
|
63
|
+
(state) => (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state).qboAccountMappingKindOptions,
|
|
64
|
+
invoicingQboViewSelector_1.isInvoicingQboConnected,
|
|
65
|
+
], (accounts, qboAccountMappingKindOptions, isQboConnected) => isQboConnected
|
|
66
|
+
? (0, invoicingQboViewSelector_1.invoicingQboAccountIdsForMappingSlot)(accounts, qboAccountMappingKindOptions, invoicingQboViewSelector_1.INVOICING_INCOME_ACCOUNT_MAPPING_SLOT, invoicingQboViewSelector_1.INVOICING_DEFAULT_INCOME_ACCOUNT_TYPES)
|
|
67
|
+
: invoicingQboViewSelector_1.NO_INVOICING_ACCOUNT_IDS);
|
|
52
68
|
const getInvoicingCatalogItemFormView = (state, id) => {
|
|
53
69
|
const { editDraftById, error, fetchState, newItemDraft, savedItemId, savedKind, } = state.editInvoicingCatalogItemDetailViewState;
|
|
54
70
|
const plan = id != null ? (0, planSelector_1.getInvoicingPlanById)(state.invoicingPlanState, id) : undefined;
|
|
@@ -58,7 +74,7 @@ const getInvoicingCatalogItemFormView = (state, id) => {
|
|
|
58
74
|
// lands. Until then the page is showing its skeleton, so the blank shape here
|
|
59
75
|
// is never rendered.
|
|
60
76
|
const localData = id != null
|
|
61
|
-
? (editDraftById
|
|
77
|
+
? (0, invoicingFormDraft_1.getInvoicingFormDraftLocalData)(editDraftById, id, invoicingCatalogItemFormHelper_1.initialInvoicingCatalogItemFormLocalData)
|
|
62
78
|
: newItemDraft;
|
|
63
79
|
const allApplicableItemOptions = (0, exports.getInvoicingApplicableCatalogItemOptions)(state);
|
|
64
80
|
const applicableItemOptions = id != null
|
|
@@ -96,9 +112,12 @@ const getInvoicingCatalogItemFormView = (state, id) => {
|
|
|
96
112
|
catalogProductLifecycleActionOptions,
|
|
97
113
|
recordState,
|
|
98
114
|
fieldHelp: (0, invoicingConfigViewSelector_1.invoicingFieldHelpForGroup)(state, 'catalog'),
|
|
115
|
+
isFormLoading: (0, invoicingQboViewSelector_1.isInvoicingAccountingPickerDataLoading)(state) ||
|
|
116
|
+
(0, invoicingFormDraft_1.isInvoicingFormDraftPending)(editDraftById, id),
|
|
99
117
|
isQboPickerDataLoading: (0, invoicingQboViewSelector_1.isInvoicingAccountingPickerDataLoading)(state),
|
|
100
|
-
qboAccountHierarchy: qboView?.nestedAccountHierarchy ??
|
|
101
|
-
qboClassHierarchy: qboView?.nestedClassHierarchy ??
|
|
118
|
+
qboAccountHierarchy: qboView?.nestedAccountHierarchy ?? invoicingQboViewSelector_1.NO_INVOICING_ACCOUNT_HIERARCHY,
|
|
119
|
+
qboClassHierarchy: qboView?.nestedClassHierarchy ?? invoicingQboViewSelector_1.NO_INVOICING_CLASS_HIERARCHY,
|
|
120
|
+
qboIncomeAccountIds: getInvoicingCatalogIncomeAccountIds(state),
|
|
102
121
|
applicabilityValues: invoicingCatalogItemFormHelper_1.INVOICING_CATALOG_APPLICABILITY_VALUES,
|
|
103
122
|
applicableItemOptions,
|
|
104
123
|
localData,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
2
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
3
|
+
import { InvoicingFormDraftById } from '../invoicingFormDraft';
|
|
3
4
|
/** A single pricing tier within a price point (values kept as raw strings). */
|
|
4
5
|
export interface InvoicingCatalogItemFormTier {
|
|
5
6
|
endingUnit: string;
|
|
@@ -63,7 +64,7 @@ export interface EditInvoicingCatalogItemDetailViewState extends FetchedState {
|
|
|
63
64
|
*/
|
|
64
65
|
actionStateById: Record<ID, FetchStateAndError>;
|
|
65
66
|
/** Inline-edit drafts, keyed by catalog item id. */
|
|
66
|
-
editDraftById:
|
|
67
|
+
editDraftById: InvoicingFormDraftById<InvoicingCatalogItemFormLocalData>;
|
|
67
68
|
newItemDraft: InvoicingCatalogItemFormLocalData;
|
|
68
69
|
/**
|
|
69
70
|
* Detail-load state per catalog item id. Keyed rather than a single slot, so
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { InvoicingPlan } from '../../../entity/invoicing/plan/planState';
|
|
2
|
-
import { InvoicingProduct } from '../../../entity/invoicing/product/productState';
|
|
2
|
+
import { InvoicingCatalogPricingModel, InvoicingProduct } from '../../../entity/invoicing/product/productState';
|
|
3
3
|
import { InvoicingCatalogItemFormLocalData, InvoicingCatalogItemFormSubFamily, InvoicingCatalogItemFormTier } from './editInvoicingCatalogItemDetailViewState';
|
|
4
4
|
/**
|
|
5
5
|
* Value sets the catalog item form still owns locally: the backend has no enum
|
|
6
6
|
* for pricing model, tier type, proration or applicability yet, so these stay
|
|
7
7
|
* here until it does. Everything else on this form comes from `/1.0/config`.
|
|
8
8
|
*/
|
|
9
|
-
export declare const INVOICING_CATALOG_PRICING_MODEL_VALUES: readonly [
|
|
9
|
+
export declare const INVOICING_CATALOG_PRICING_MODEL_VALUES: readonly InvoicingCatalogPricingModel[];
|
|
10
10
|
export declare const INVOICING_CATALOG_TIER_TYPE_VALUES: readonly ["per_unit", "flat_fee", "package"];
|
|
11
11
|
export declare const INVOICING_CATALOG_PRORATION_VALUES: readonly ["site_default", "partial_term", "full_term"];
|
|
12
12
|
export declare const INVOICING_CATALOG_APPLICABILITY_VALUES: readonly ["all", "restricted"];
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.js
CHANGED
|
@@ -6,13 +6,7 @@ exports.entityToInvoicingCatalogItemFormLocalData = exports.initialInvoicingCata
|
|
|
6
6
|
* for pricing model, tier type, proration or applicability yet, so these stay
|
|
7
7
|
* here until it does. Everything else on this form comes from `/1.0/config`.
|
|
8
8
|
*/
|
|
9
|
-
exports.INVOICING_CATALOG_PRICING_MODEL_VALUES = [
|
|
10
|
-
'flat_fee',
|
|
11
|
-
'per_unit',
|
|
12
|
-
'tiered',
|
|
13
|
-
'volume',
|
|
14
|
-
'stairstep',
|
|
15
|
-
];
|
|
9
|
+
exports.INVOICING_CATALOG_PRICING_MODEL_VALUES = ['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'];
|
|
16
10
|
exports.INVOICING_CATALOG_TIER_TYPE_VALUES = [
|
|
17
11
|
'per_unit',
|
|
18
12
|
'flat_fee',
|