@zeniai/client-epic-state 5.1.93 → 5.1.95-betaAK0
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/commonStateTypes/viewAndReport/reportIDHelper.d.ts +16 -0
- package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +22 -1
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/aiCfo/aiCfoPayload.d.ts +7 -0
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +3 -2
- package/lib/entity/aiCfo/aiCfoReducer.js +25 -2
- package/lib/entity/aiCfo/aiCfoState.d.ts +7 -0
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classSelectorV2.d.ts +2 -1
- package/lib/entity/class/classSelectorV2.js +7 -7
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/company/companyPayload.d.ts +4 -0
- package/lib/entity/company/companyPayload.js +18 -8
- package/lib/entity/company/companyStateTypes.d.ts +4 -0
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.d.ts +1 -1
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.js +6 -2
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/invoicing/invoicingCommonPayload.d.ts +9 -0
- package/lib/entity/invoicing/invoicingCommonPayload.js +7 -0
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/sectionClassesViewV2/sectionClassesViewSelector.d.ts +2 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewSelector.js +3 -3
- package/lib/entity/sectionProjectView/sectionProjectView.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +2 -2
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.d.ts +2 -1
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +4 -4
- package/lib/entity/snackbar/snackbarApiError.d.ts +8 -0
- package/lib/entity/snackbar/snackbarApiError.js +15 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +31 -0
- package/lib/entity/tenant/tenantReducer.d.ts +5 -1
- package/lib/entity/tenant/tenantReducer.js +21 -2
- package/lib/epic.d.ts +7 -1
- package/lib/epic.js +9 -1
- package/lib/esm/commonStateTypes/viewAndReport/reportIDHelper.js +17 -0
- package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +23 -1
- package/lib/esm/entity/class/classSelectorV2.js +7 -7
- package/lib/esm/entity/company/companyPayload.js +18 -8
- package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +4 -1
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +6 -0
- package/lib/esm/entity/sectionClassesViewV2/sectionClassesViewSelector.js +3 -3
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +4 -4
- package/lib/esm/entity/snackbar/snackbarApiError.js +11 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +31 -0
- package/lib/esm/entity/tenant/tenantReducer.js +20 -1
- package/lib/esm/epic.js +9 -1
- package/lib/esm/index.js +19 -12
- package/lib/esm/reducer.js +6 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewEpic.js +30 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewPayload.js +1 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewReducer.js +132 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewSelector.js +90 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewSelectorTypes.js +1 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewState.js +1 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetForTimeframeClassesViewEpic.js +61 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetForTimeframeProjectViewEpic.js +63 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewEpic.js +30 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewPayload.js +1 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewReducer.js +128 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewSelector.js +90 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewSelectorTypes.js +1 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewState.js +1 -0
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +4 -1
- package/lib/esm/view/companyView/companyViewReducer.js +58 -1
- package/lib/esm/view/companyView/epic/updateCompanyProductServicesEpic.js +91 -0
- package/lib/esm/view/companyView/epic/updateCompanyQboRealmIdEpic.js +58 -0
- package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +52 -0
- package/lib/esm/view/companyView/types/cockpitTypes.js +13 -1
- package/lib/esm/view/companyView/types/companyManagementViewState.js +2 -0
- package/lib/esm/view/financeStatement/financeStatementSelector.js +21 -1
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +26 -4
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +26 -4
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
- package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +37 -10
- package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +39 -10
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +5 -4
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +35 -5
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +25 -3
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +26 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +16 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +34 -1
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +26 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +20 -3
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +65 -18
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +35 -1
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +26 -0
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +16 -0
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +9 -1
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +50 -1
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +14 -1
- package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +31 -10
- package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +30 -5
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +26 -4
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +22 -14
- package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +49 -7
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +30 -9
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +56 -1
- package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +45 -10
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +7 -2
- package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +1 -1
- package/lib/esm/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +4 -1
- package/lib/esm/view/vendorTabView/vendorTabViewReducer.js +4 -1
- package/lib/index.d.ts +32 -18
- package/lib/index.js +90 -50
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewEpic.d.ts +6 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewEpic.js +34 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewPayload.d.ts +20 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewPayload.js +2 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewReducer.d.ts +34 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewReducer.js +136 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelector.d.ts +7 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelector.js +94 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelectorTypes.d.ts +7 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelectorTypes.js +2 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewState.d.ts +23 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewState.js +2 -0
- package/lib/view/balanceSheetClassesView/balanceSheetForTimeframeClassesViewEpic.d.ts +9 -0
- package/lib/view/balanceSheetClassesView/balanceSheetForTimeframeClassesViewEpic.js +66 -0
- package/lib/view/balanceSheetProjectView/balanceSheetForTimeframeProjectViewEpic.d.ts +10 -0
- package/lib/view/balanceSheetProjectView/balanceSheetForTimeframeProjectViewEpic.js +68 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewEpic.d.ts +6 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewEpic.js +34 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewPayload.d.ts +20 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewPayload.js +2 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewReducer.d.ts +33 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewReducer.js +132 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelector.d.ts +7 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelector.js +94 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelectorTypes.d.ts +18 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelectorTypes.js +2 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewState.d.ts +22 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewState.js +2 -0
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +5 -2
- package/lib/view/companyView/companyViewReducer.d.ts +22 -1
- package/lib/view/companyView/companyViewReducer.js +60 -3
- package/lib/view/companyView/epic/updateCompanyProductServicesEpic.d.ts +10 -0
- package/lib/view/companyView/epic/updateCompanyProductServicesEpic.js +95 -0
- package/lib/view/companyView/epic/updateCompanyQboRealmIdEpic.d.ts +8 -0
- package/lib/view/companyView/epic/updateCompanyQboRealmIdEpic.js +62 -0
- package/lib/view/companyView/selector/companyManagementViewSelector.d.ts +3 -0
- package/lib/view/companyView/selector/companyManagementViewSelector.js +55 -0
- package/lib/view/companyView/types/cockpitTypes.d.ts +7 -3
- package/lib/view/companyView/types/cockpitTypes.js +15 -1
- package/lib/view/companyView/types/companyManagementViewState.d.ts +2 -0
- package/lib/view/companyView/types/companyManagementViewState.js +2 -0
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/financeStatement/financeStatementSelector.d.ts +4 -0
- package/lib/view/financeStatement/financeStatementSelector.js +21 -1
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +25 -3
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +2 -1
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +25 -3
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +22 -8
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
- package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +2 -1
- package/lib/view/invoicing/discountAction/discountActionEpic.js +35 -8
- package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +2 -1
- package/lib/view/invoicing/dunningAction/dunningActionEpic.js +37 -8
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +5 -4
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +34 -4
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +24 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +25 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.d.ts +4 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +15 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +17 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.d.ts +7 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +37 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +25 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +19 -2
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +2 -1
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +63 -16
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +15 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +34 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +11 -31
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +22 -1
- package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.d.ts +7 -0
- package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +30 -0
- package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +20 -0
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewEpics.d.ts +2 -2
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.d.ts +12 -0
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +11 -0
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.d.ts +21 -4
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +51 -2
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.d.ts +3 -0
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +16 -2
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewState.d.ts +13 -0
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +2 -1
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +30 -9
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +29 -4
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +25 -3
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +24 -7
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +23 -16
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +2 -1
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +48 -6
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +2 -1
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +28 -7
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +10 -1
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +44 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +59 -2
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +2 -1
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +43 -8
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.d.ts +1 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +7 -2
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +1 -1
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +1 -1
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +5 -2
- package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +1 -1
- package/lib/view/vendorTabView/vendorTabViewReducer.js +5 -2
- package/package.json +2 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingCustomerAddresses } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerPayload';
|
|
5
5
|
import { updateInvoicingCustomers } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerReducer';
|
|
6
|
+
import { apiErrorSnackbarVariables } from '../../../entity/snackbar/snackbarApiError';
|
|
7
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
8
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
9
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
8
10
|
import { addInvoicingCustomerToList } from '../invoicingCustomerListView/invoicingCustomerListViewReducer';
|
|
@@ -45,9 +47,29 @@ export const saveInvoicingCustomerEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
45
47
|
status: response.data.status,
|
|
46
48
|
}));
|
|
47
49
|
}
|
|
50
|
+
resultActions.push(openSnackbar({
|
|
51
|
+
messageSection: 'invoicing_customer_saved',
|
|
52
|
+
messageText: 'success',
|
|
53
|
+
type: 'success',
|
|
54
|
+
}));
|
|
48
55
|
return resultActions;
|
|
49
56
|
}
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
return from([
|
|
58
|
+
submitInvoicingCustomerFormFailure(response.status),
|
|
59
|
+
openSnackbar({
|
|
60
|
+
messageSection: 'invoicing_customer_saved',
|
|
61
|
+
messageText: 'failed',
|
|
62
|
+
type: 'error',
|
|
63
|
+
variables: apiErrorSnackbarVariables(response.status),
|
|
64
|
+
}),
|
|
65
|
+
]);
|
|
66
|
+
}), catchError((error) => from([
|
|
67
|
+
submitInvoicingCustomerFormFailure(createZeniAPIStatus('Unexpected Error', 'Save customer REST API call errored out ' +
|
|
68
|
+
JSON.stringify(error))),
|
|
69
|
+
openSnackbar({
|
|
70
|
+
messageSection: 'invoicing_customer_saved',
|
|
71
|
+
messageText: 'failed',
|
|
72
|
+
type: 'error',
|
|
73
|
+
}),
|
|
74
|
+
])));
|
|
53
75
|
}));
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { toAddressUpdatableInfoPayload } from '../../addressView/addressViewPayload';
|
|
2
|
-
import { billingFrequencyToPeriod } from './invoicingSubscriptionFormConfig';
|
|
2
|
+
import { billingFrequencyToPeriod, invoicingSubscriptionTodayIso, toInvoicingSubscriptionQuantity, } from './invoicingSubscriptionFormConfig';
|
|
3
3
|
/**
|
|
4
4
|
* Build the create/update subscription request body from the form draft. The
|
|
5
5
|
* shipping address is sent as an object (captured via the shared Address
|
|
6
6
|
* screen); the backend persists it — same pattern as the customer save flow.
|
|
7
|
+
*
|
|
8
|
+
* `remaining_billing_cycles` is omitted when the user left the field empty, so
|
|
9
|
+
* the backend applies the plan's own `billing_cycles` (or renews forever when
|
|
10
|
+
* the plan sets no limit) rather than being pinned to a value the form invented.
|
|
7
11
|
*/
|
|
8
12
|
export const localDataToSaveInvoicingSubscriptionPayload = (localData, shippingAddress) => {
|
|
9
13
|
const frequency = billingFrequencyToPeriod(localData.billingFrequency);
|
|
@@ -11,32 +15,40 @@ export const localDataToSaveInvoicingSubscriptionPayload = (localData, shippingA
|
|
|
11
15
|
{
|
|
12
16
|
item_price_code: localData.planPriceCode,
|
|
13
17
|
item_type: 'plan',
|
|
14
|
-
quantity:
|
|
18
|
+
quantity: toInvoicingSubscriptionQuantity(localData.planQuantity),
|
|
15
19
|
},
|
|
16
20
|
...localData.addonPriceCodes.map((priceCode) => ({
|
|
17
21
|
item_price_code: priceCode,
|
|
18
22
|
item_type: 'addon',
|
|
19
|
-
quantity:
|
|
23
|
+
quantity: toInvoicingSubscriptionQuantity(localData.addonQuantities[priceCode]),
|
|
20
24
|
})),
|
|
21
25
|
...localData.chargePriceCodes.map((priceCode) => ({
|
|
22
26
|
item_price_code: priceCode,
|
|
23
27
|
item_type: 'charge',
|
|
24
|
-
quantity:
|
|
28
|
+
quantity: toInvoicingSubscriptionQuantity(localData.chargeQuantities[priceCode]),
|
|
25
29
|
})),
|
|
26
30
|
];
|
|
27
31
|
const setupFee = localData.setupFee?.amount;
|
|
28
32
|
const poNumber = localData.poNumber.trim();
|
|
29
33
|
const trialEnd = localData.trialEnd.trim();
|
|
34
|
+
const startedAt = localData.startedAt.trim();
|
|
35
|
+
const remainingBillingCycles = localData.remainingBillingCycles.trim();
|
|
30
36
|
return {
|
|
31
37
|
auto_collection: localData.autoCollection ? 'on' : 'off',
|
|
32
38
|
billing_period: frequency.period,
|
|
33
39
|
billing_period_unit: frequency.unit,
|
|
34
40
|
currency_code: localData.preferredCurrencyCode,
|
|
35
41
|
customer_id: localData.customerId,
|
|
42
|
+
started_at: startedAt !== '' ? startedAt : invoicingSubscriptionTodayIso(),
|
|
36
43
|
subscription_items: items,
|
|
37
44
|
...(setupFee != null ? { setup_fee: setupFee } : {}),
|
|
38
45
|
...(poNumber !== '' ? { po_number: poNumber } : {}),
|
|
39
46
|
...(trialEnd !== '' ? { trial_end: trialEnd } : {}),
|
|
47
|
+
...(remainingBillingCycles !== ''
|
|
48
|
+
? {
|
|
49
|
+
remaining_billing_cycles: toInvoicingSubscriptionQuantity(Number(remainingBillingCycles)),
|
|
50
|
+
}
|
|
51
|
+
: {}),
|
|
40
52
|
...(localData.couponId !== '' ? { coupon_ids: [localData.couponId] } : {}),
|
|
41
53
|
...(shippingAddress != null
|
|
42
54
|
? { shipping_address: toAddressUpdatableInfoPayload(shippingAddress) }
|
|
@@ -33,17 +33,42 @@ const subscriptionItemPriceCodes = (subscription, itemType) => subscription?.sub
|
|
|
33
33
|
?.filter((item) => item.itemType === itemType)
|
|
34
34
|
.map((item) => item.itemPriceCode)
|
|
35
35
|
.filter((code) => code != null && code !== '') ?? [];
|
|
36
|
+
const subscriptionItemQuantities = (subscription, itemType) => {
|
|
37
|
+
const quantities = {};
|
|
38
|
+
subscription?.subscriptionItems
|
|
39
|
+
?.filter((item) => item.itemType === itemType)
|
|
40
|
+
.forEach((item) => {
|
|
41
|
+
if (item.itemPriceCode != null && item.itemPriceCode !== '') {
|
|
42
|
+
quantities[item.itemPriceCode] = toInvoicingSubscriptionQuantity(item.quantity);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return quantities;
|
|
46
|
+
};
|
|
47
|
+
/** Today as `YYYY-MM-DD`, the default subscription start date. */
|
|
48
|
+
export const invoicingSubscriptionTodayIso = () => new Date().toISOString().slice(0, 10);
|
|
49
|
+
/**
|
|
50
|
+
* Clamp a subscription-item quantity to the minimum the API accepts. Shared by
|
|
51
|
+
* the plan, add-on and charge items so none of them can bill a 0 or a fraction.
|
|
52
|
+
*/
|
|
53
|
+
export const toInvoicingSubscriptionQuantity = (quantity) => {
|
|
54
|
+
const whole = Math.floor(Number(quantity));
|
|
55
|
+
return Number.isFinite(whole) && whole > 0 ? whole : 1;
|
|
56
|
+
};
|
|
36
57
|
export const initialInvoicingSubscriptionFormLocalData = {
|
|
37
58
|
addonPriceCodes: [],
|
|
59
|
+
addonQuantities: {},
|
|
38
60
|
autoCollection: true,
|
|
39
61
|
billingFrequency: 'monthly',
|
|
40
62
|
chargePriceCodes: [],
|
|
63
|
+
chargeQuantities: {},
|
|
41
64
|
couponId: '',
|
|
42
65
|
customerId: '',
|
|
43
66
|
planPriceCode: '',
|
|
44
67
|
planQuantity: 1,
|
|
45
68
|
poNumber: '',
|
|
46
69
|
preferredCurrencyCode: 'USD',
|
|
70
|
+
remainingBillingCycles: '',
|
|
71
|
+
startedAt: '',
|
|
47
72
|
trialEnd: '',
|
|
48
73
|
};
|
|
49
74
|
/** Seed the form draft from an existing subscription entity (edit mode). */
|
|
@@ -54,18 +79,26 @@ export const entityToInvoicingSubscriptionFormLocalData = (subscription) => {
|
|
|
54
79
|
const planItem = subscription.subscriptionItems?.find((item) => item.itemType === 'plan');
|
|
55
80
|
return {
|
|
56
81
|
addonPriceCodes: subscriptionItemPriceCodes(subscription, 'addon'),
|
|
82
|
+
addonQuantities: subscriptionItemQuantities(subscription, 'addon'),
|
|
57
83
|
autoCollection: (subscription.autoCollection ?? 'on') === 'on',
|
|
58
84
|
billingFrequency: periodToBillingFrequency(subscription.billingPeriod, subscription.billingPeriodUnit),
|
|
59
85
|
chargePriceCodes: subscriptionItemPriceCodes(subscription, 'charge'),
|
|
86
|
+
chargeQuantities: subscriptionItemQuantities(subscription, 'charge'),
|
|
60
87
|
couponId: subscription.coupons?.[0]?.couponCode ??
|
|
61
88
|
subscription.coupons?.[0]?.couponID ??
|
|
62
89
|
'',
|
|
63
90
|
customerId: subscription.customerID ?? '',
|
|
64
91
|
planPriceCode: subscriptionItemPriceCodes(subscription, 'plan')[0] ?? '',
|
|
65
|
-
planQuantity: planItem?.quantity
|
|
92
|
+
planQuantity: toInvoicingSubscriptionQuantity(planItem?.quantity),
|
|
66
93
|
poNumber: subscription.poNumber ?? '',
|
|
67
94
|
preferredCurrencyCode: subscription.currencyCode ?? 'USD',
|
|
95
|
+
remainingBillingCycles: subscription.remainingBillingCycles != null
|
|
96
|
+
? String(subscription.remainingBillingCycles)
|
|
97
|
+
: '',
|
|
68
98
|
setupFee: subscription.setupFee,
|
|
99
|
+
startedAt: subscription.startedAt != null
|
|
100
|
+
? subscription.startedAt.format('YYYY-MM-DD')
|
|
101
|
+
: '',
|
|
69
102
|
trialEnd: subscription.trialEnd != null
|
|
70
103
|
? subscription.trialEnd.format('YYYY-MM-DD')
|
|
71
104
|
: '',
|
package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingSubscriptionAddresses } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload';
|
|
5
5
|
import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
6
|
+
import { apiErrorSnackbarVariables } from '../../../entity/snackbar/snackbarApiError';
|
|
7
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
8
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
9
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
8
10
|
import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
|
|
@@ -38,7 +40,15 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
38
40
|
: zeniAPI.postAndGetJSON(`${baseUrl}/subscriptions`, { ...data });
|
|
39
41
|
return request$.pipe(mergeMap((response) => {
|
|
40
42
|
if (!isSuccessResponse(response) || response.data == null) {
|
|
41
|
-
return [
|
|
43
|
+
return [
|
|
44
|
+
submitInvoicingSubscriptionFormFailure(response.status),
|
|
45
|
+
openSnackbar({
|
|
46
|
+
messageSection: 'invoicing_subscription_saved',
|
|
47
|
+
messageText: 'failed',
|
|
48
|
+
type: 'error',
|
|
49
|
+
variables: apiErrorSnackbarVariables(response.status),
|
|
50
|
+
}),
|
|
51
|
+
];
|
|
42
52
|
}
|
|
43
53
|
const saved = response.data;
|
|
44
54
|
const couponChanged = id != null &&
|
|
@@ -78,7 +88,19 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
78
88
|
status: saved.status,
|
|
79
89
|
}));
|
|
80
90
|
}
|
|
91
|
+
resultActions.push(openSnackbar({
|
|
92
|
+
messageSection: 'invoicing_subscription_saved',
|
|
93
|
+
messageText: 'success',
|
|
94
|
+
type: 'success',
|
|
95
|
+
}));
|
|
81
96
|
return resultActions;
|
|
82
|
-
}), catchError((error) =>
|
|
83
|
-
|
|
97
|
+
}), catchError((error) => from([
|
|
98
|
+
submitInvoicingSubscriptionFormFailure(createZeniAPIStatus('Unexpected Error', 'Save subscription REST API call errored out ' +
|
|
99
|
+
JSON.stringify(error))),
|
|
100
|
+
openSnackbar({
|
|
101
|
+
messageSection: 'invoicing_subscription_saved',
|
|
102
|
+
messageText: 'failed',
|
|
103
|
+
type: 'error',
|
|
104
|
+
}),
|
|
105
|
+
])));
|
|
84
106
|
}));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { EMPTY, of } from 'rxjs';
|
|
1
|
+
import { EMPTY, from, of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, map, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingSubscriptionAddresses, } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload';
|
|
5
5
|
import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
6
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
7
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
7
8
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
8
9
|
import { submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons, } from './editInvoicingSubscriptionDetailViewReducer';
|
|
@@ -39,7 +40,14 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
39
40
|
: couponMutation$(zeniAPI, baseUrl, subscriptionId, 'remove-coupon', prev);
|
|
40
41
|
return removeStep$.pipe(mergeMap((removeResult) => {
|
|
41
42
|
if (!removeResult.success) {
|
|
42
|
-
return
|
|
43
|
+
return from([
|
|
44
|
+
submitInvoicingSubscriptionFormFailure(failureStatus(removeResult)),
|
|
45
|
+
openSnackbar({
|
|
46
|
+
messageSection: 'invoicing_subscription_saved',
|
|
47
|
+
messageText: 'failed',
|
|
48
|
+
type: 'error',
|
|
49
|
+
}),
|
|
50
|
+
]);
|
|
43
51
|
}
|
|
44
52
|
const applyStep$ = next === ''
|
|
45
53
|
? of({
|
|
@@ -51,6 +59,11 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
51
59
|
if (!applyResult.success) {
|
|
52
60
|
return [
|
|
53
61
|
submitInvoicingSubscriptionFormFailure(failureStatus(applyResult)),
|
|
62
|
+
openSnackbar({
|
|
63
|
+
messageSection: 'invoicing_subscription_saved',
|
|
64
|
+
messageText: 'failed',
|
|
65
|
+
type: 'error',
|
|
66
|
+
}),
|
|
54
67
|
];
|
|
55
68
|
}
|
|
56
69
|
const couponUpdated = applyResult.payload ?? removeResult.payload;
|
|
@@ -58,7 +71,11 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
58
71
|
if (couponUpdated != null) {
|
|
59
72
|
resultActions.push(updateInvoicingSubscriptions([couponUpdated], 'merge'), updateAddresses(extractInvoicingSubscriptionAddresses([couponUpdated])));
|
|
60
73
|
}
|
|
61
|
-
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE)
|
|
74
|
+
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE), openSnackbar({
|
|
75
|
+
messageSection: 'invoicing_subscription_saved',
|
|
76
|
+
messageText: 'success',
|
|
77
|
+
type: 'success',
|
|
78
|
+
}));
|
|
62
79
|
return resultActions;
|
|
63
80
|
}));
|
|
64
81
|
}));
|
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingInvoiceAddresses } from '../../../entity/invoicing/invoice/invoicePayload';
|
|
5
5
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
6
|
-
import {
|
|
6
|
+
import { apiErrorSnackbarVariables } from '../../../entity/snackbar/snackbarApiError';
|
|
7
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
8
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
7
9
|
import { runInvoicingInvoiceAction, runInvoicingInvoiceActionFailure, runInvoicingInvoiceActionSuccess, updateInvoicingInvoice, } from './invoiceActionReducer';
|
|
10
|
+
/** Snackbar copy per action kind; unlisted kinds run without one. */
|
|
11
|
+
const SNACKBAR_SECTION_BY_KIND = {
|
|
12
|
+
regenerate: 'invoicing_invoice_regenerated',
|
|
13
|
+
'send-reminder': 'invoicing_invoice_reminder_sent',
|
|
14
|
+
void: 'invoicing_invoice_voided',
|
|
15
|
+
};
|
|
8
16
|
export const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter((action) => runInvoicingInvoiceAction.match(action) &&
|
|
9
17
|
action.payload.action !== 'issue-credit-note'), mergeMap((action) => {
|
|
10
18
|
const { action: kind, body, invoiceId } = action.payload;
|
|
19
|
+
const snackbarSection = SNACKBAR_SECTION_BY_KIND[kind];
|
|
20
|
+
/** `status` surfaces the platform's error text; omit it to keep the generic copy. */
|
|
21
|
+
const snackbar = (messageText, status) => snackbarSection == null
|
|
22
|
+
? []
|
|
23
|
+
: [
|
|
24
|
+
openSnackbar({
|
|
25
|
+
messageSection: snackbarSection,
|
|
26
|
+
messageText,
|
|
27
|
+
type: messageText === 'success' ? 'success' : 'error',
|
|
28
|
+
variables: apiErrorSnackbarVariables(status),
|
|
29
|
+
}),
|
|
30
|
+
];
|
|
11
31
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/invoices/${encodeURIComponent(invoiceId)}/${kind}`;
|
|
12
32
|
return zeniAPI
|
|
13
33
|
.postAndGetJSON(apiUrl, (body ?? {}))
|
|
@@ -17,17 +37,24 @@ export const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => act
|
|
|
17
37
|
updateInvoices([response.data], 'merge'),
|
|
18
38
|
updateAddresses(extractInvoicingInvoiceAddresses([response.data])),
|
|
19
39
|
runInvoicingInvoiceActionSuccess({ invoiceId }),
|
|
40
|
+
...snackbar('success'),
|
|
20
41
|
];
|
|
21
42
|
}
|
|
22
|
-
return
|
|
23
|
-
|
|
43
|
+
return from([
|
|
44
|
+
runInvoicingInvoiceActionFailure({
|
|
45
|
+
error: response.status,
|
|
46
|
+
invoiceId,
|
|
47
|
+
}),
|
|
48
|
+
...snackbar('failed', response.status),
|
|
49
|
+
]);
|
|
50
|
+
}), catchError((error) => from([
|
|
51
|
+
runInvoicingInvoiceActionFailure({
|
|
52
|
+
error: createZeniAPIStatus('Unexpected Error', 'Invoice action REST API call errored out ' +
|
|
53
|
+
JSON.stringify(error)),
|
|
24
54
|
invoiceId,
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
JSON.stringify(error)),
|
|
29
|
-
invoiceId,
|
|
30
|
-
}))));
|
|
55
|
+
}),
|
|
56
|
+
...snackbar('failed'),
|
|
57
|
+
])));
|
|
31
58
|
}));
|
|
32
59
|
export const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateInvoicingInvoice.match), mergeMap((action) => {
|
|
33
60
|
const { data, invoiceId } = action.payload;
|
|
@@ -40,15 +67,35 @@ export const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => action
|
|
|
40
67
|
updateInvoices([response.data], 'merge'),
|
|
41
68
|
updateAddresses(extractInvoicingInvoiceAddresses([response.data])),
|
|
42
69
|
runInvoicingInvoiceActionSuccess({ invoiceId }),
|
|
70
|
+
openSnackbar({
|
|
71
|
+
messageSection: 'invoicing_invoice_saved',
|
|
72
|
+
messageText: 'success',
|
|
73
|
+
type: 'success',
|
|
74
|
+
}),
|
|
43
75
|
];
|
|
44
76
|
}
|
|
45
|
-
return
|
|
46
|
-
|
|
77
|
+
return from([
|
|
78
|
+
runInvoicingInvoiceActionFailure({
|
|
79
|
+
error: response.status,
|
|
80
|
+
invoiceId,
|
|
81
|
+
}),
|
|
82
|
+
openSnackbar({
|
|
83
|
+
messageSection: 'invoicing_invoice_saved',
|
|
84
|
+
messageText: 'failed',
|
|
85
|
+
type: 'error',
|
|
86
|
+
variables: apiErrorSnackbarVariables(response.status),
|
|
87
|
+
}),
|
|
88
|
+
]);
|
|
89
|
+
}), catchError((error) => from([
|
|
90
|
+
runInvoicingInvoiceActionFailure({
|
|
91
|
+
error: createZeniAPIStatus('Unexpected Error', 'Invoice update REST API call errored out ' +
|
|
92
|
+
JSON.stringify(error)),
|
|
47
93
|
invoiceId,
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
94
|
+
}),
|
|
95
|
+
openSnackbar({
|
|
96
|
+
messageSection: 'invoicing_invoice_saved',
|
|
97
|
+
messageText: 'failed',
|
|
98
|
+
type: 'error',
|
|
99
|
+
}),
|
|
100
|
+
])));
|
|
54
101
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { toAuditLogEntityRouteOption, toInvoicingCatalogItemLifecycleActionOption, toInvoicingCatalogProductLifecycleActionOption, toInvoicingDiscountLifecycleActionOption, toInvoicingDunningAction, toInvoicingNamedOption, toInvoicingQboAccountMappingKindOption, toInvoicingSubscriptionEditFieldOption, toInvoicingSubscriptionLifecycleActionOption, } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
|
+
import { toAuditLogEntityRouteOption, toInvoicingCatalogItemLifecycleActionOption, toInvoicingCatalogProductLifecycleActionOption, toInvoicingDiscountLifecycleActionOption, toInvoicingDunningAction, toInvoicingNamedOption, toInvoicingNamedOptionsByKey, toInvoicingQboAccountMappingKindOption, toInvoicingSubscriptionEditFieldOption, toInvoicingSubscriptionLifecycleActionOption, } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
3
|
import { clearAll } from '../../../rootActions';
|
|
4
4
|
export const initialState = {
|
|
5
5
|
fetchState: 'Not-Started',
|
|
@@ -8,7 +8,21 @@ export const initialState = {
|
|
|
8
8
|
auditLogEntityRouteOptions: [],
|
|
9
9
|
auditLogListSortFieldOptions: [],
|
|
10
10
|
auditLogSourceLabels: [],
|
|
11
|
+
autoCollectionOptions: [],
|
|
12
|
+
billingPeriodUnitOptions: [],
|
|
13
|
+
catalogTierTypeOptionsByPricingModel: undefined,
|
|
14
|
+
catalogTrialEndActionOptions: [],
|
|
15
|
+
catalogTrialUnitOptions: [],
|
|
16
|
+
customerTypeOptions: [],
|
|
17
|
+
dateFormatOptions: [],
|
|
18
|
+
discountApplyOnOptions: [],
|
|
19
|
+
discountDurationTypeOptions: [],
|
|
20
|
+
discountTypeOptions: [],
|
|
11
21
|
dunningScheduleActionOptions: [],
|
|
22
|
+
manualPaymentMethodOptions: [],
|
|
23
|
+
netTermDayOptions: [],
|
|
24
|
+
paymentGatewayOptions: [],
|
|
25
|
+
taxabilityOptions: [],
|
|
12
26
|
enableFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
13
27
|
subscriptionLifecycleActionOptions: [],
|
|
14
28
|
subscriptionCommercialEditAllowedFromStatuses: [],
|
|
@@ -29,6 +43,8 @@ export const initialState = {
|
|
|
29
43
|
invoicingTosAcceptanceUserAgent: undefined,
|
|
30
44
|
invoicingTosAcceptanceUserId: undefined,
|
|
31
45
|
isInvoicingSettingsSeeded: undefined,
|
|
46
|
+
createdAt: undefined,
|
|
47
|
+
updatedAt: undefined,
|
|
32
48
|
hasValidState() {
|
|
33
49
|
return (this.fetchState === 'Completed' && this.isInvoicingTosAccepted != null);
|
|
34
50
|
},
|
|
@@ -44,6 +60,24 @@ export function mapInvoicingConfigPayloadToState(payload) {
|
|
|
44
60
|
code: option.code,
|
|
45
61
|
name: option.name,
|
|
46
62
|
})),
|
|
63
|
+
autoCollectionOptions: (payload.auto_collection_options ?? []).map(toInvoicingNamedOption),
|
|
64
|
+
billingPeriodUnitOptions: (payload.billing_period_unit_options ?? []).map(toInvoicingNamedOption),
|
|
65
|
+
catalogTierTypeOptionsByPricingModel: payload.catalog_tier_type_options_by_pricing_model != null
|
|
66
|
+
? toInvoicingNamedOptionsByKey(payload.catalog_tier_type_options_by_pricing_model)
|
|
67
|
+
: undefined,
|
|
68
|
+
catalogTrialEndActionOptions: (payload.catalog_trial_end_action_options ?? []).map(toInvoicingNamedOption),
|
|
69
|
+
catalogTrialUnitOptions: (payload.catalog_trial_unit_options ?? []).map(toInvoicingNamedOption),
|
|
70
|
+
customerTypeOptions: (payload.customer_type_options ?? []).map(toInvoicingNamedOption),
|
|
71
|
+
dateFormatOptions: (payload.date_format_options ?? []).map(toInvoicingNamedOption),
|
|
72
|
+
discountApplyOnOptions: (payload.discount_apply_on_options ?? []).map(toInvoicingNamedOption),
|
|
73
|
+
discountDurationTypeOptions: (payload.discount_duration_type_options ?? []).map(toInvoicingNamedOption),
|
|
74
|
+
discountTypeOptions: (payload.discount_type_options ?? []).map(toInvoicingNamedOption),
|
|
75
|
+
manualPaymentMethodOptions: (payload.manual_payment_method_options ?? []).map(toInvoicingNamedOption),
|
|
76
|
+
netTermDayOptions: (payload.net_term_day_options ?? []).map(toInvoicingNamedOption),
|
|
77
|
+
paymentGatewayOptions: (payload.payment_gateway_options ?? []).map(toInvoicingNamedOption),
|
|
78
|
+
taxabilityOptions: (payload.taxability_options ?? []).map(toInvoicingNamedOption),
|
|
79
|
+
createdAt: payload.created_at ?? undefined,
|
|
80
|
+
updatedAt: payload.updated_at ?? undefined,
|
|
47
81
|
dunningScheduleActionOptions: payload.dunning_schedule_action_options.map((option) => ({
|
|
48
82
|
code: toInvoicingDunningAction(option.code),
|
|
49
83
|
name: option.name,
|
|
@@ -1,35 +1,10 @@
|
|
|
1
1
|
import { deriveInvoicingOnboardingStatus, } from './invoicingConfigViewPayload';
|
|
2
|
-
/**
|
|
3
|
-
* Single bundled view for the invoicing config — consumers read only this.
|
|
4
|
-
* Carries the config flags, the derived onboarding `status` used for route
|
|
5
|
-
* gating, the config fetch (`fetchState`/`error`), and the accept-terms /
|
|
6
|
-
* enable action fetch states.
|
|
7
|
-
*/
|
|
8
2
|
export const getInvoicingConfigView = (state) => {
|
|
9
|
-
const configState = state.invoicingConfigViewState;
|
|
3
|
+
const { acceptTermsFetchState, enableFetchState, ...configState } = state.invoicingConfigViewState;
|
|
10
4
|
return {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
auditLogSourceLabels: configState.auditLogSourceLabels,
|
|
15
|
-
dunningScheduleActionOptions: configState.dunningScheduleActionOptions,
|
|
16
|
-
enableState: configState.enableFetchState,
|
|
17
|
-
subscriptionLifecycleActionOptions: configState.subscriptionLifecycleActionOptions,
|
|
18
|
-
subscriptionCommercialEditAllowedFromStatuses: configState.subscriptionCommercialEditAllowedFromStatuses,
|
|
19
|
-
subscriptionMetadataEditAllowedFromStatuses: configState.subscriptionMetadataEditAllowedFromStatuses,
|
|
20
|
-
subscriptionEditFieldOptions: configState.subscriptionEditFieldOptions,
|
|
21
|
-
subscriptionCancelTimingOptions: configState.subscriptionCancelTimingOptions,
|
|
22
|
-
subscriptionChangeOptionOptions: configState.subscriptionChangeOptionOptions,
|
|
23
|
-
catalogItemLifecycleActionOptions: configState.catalogItemLifecycleActionOptions,
|
|
24
|
-
catalogProductLifecycleActionOptions: configState.catalogProductLifecycleActionOptions,
|
|
25
|
-
discountLifecycleActionOptions: configState.discountLifecycleActionOptions,
|
|
26
|
-
qboAccountMappingKindOptions: configState.qboAccountMappingKindOptions,
|
|
27
|
-
qboCustomerMatchingOptions: configState.qboCustomerMatchingOptions,
|
|
28
|
-
qboSyncStatusOptions: configState.qboSyncStatusOptions,
|
|
29
|
-
error: configState.error,
|
|
30
|
-
fetchState: configState.fetchState,
|
|
31
|
-
isInvoicingEnabled: configState.isInvoicingEnabled,
|
|
32
|
-
isInvoicingTosAccepted: configState.isInvoicingTosAccepted,
|
|
5
|
+
...configState,
|
|
6
|
+
acceptTermsState: acceptTermsFetchState,
|
|
7
|
+
enableState: enableFetchState,
|
|
33
8
|
status: deriveInvoicingOnboardingStatus(configState.isInvoicingTosAccepted, configState.isInvoicingEnabled),
|
|
34
9
|
};
|
|
35
10
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, map, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
4
|
+
import { toInvoicingDunningEmailPreview, } from './invoicingDunningCaseDetailViewPayload';
|
|
5
|
+
import { fetchInvoicingDunningEmailPreview, updateInvoicingDunningEmailPreview, updateInvoicingDunningEmailPreviewFailure, } from './invoicingDunningCaseDetailViewReducer';
|
|
6
|
+
export const fetchInvoicingDunningEmailPreviewEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingDunningEmailPreview.match), switchMap((action) => {
|
|
7
|
+
const { id } = action.payload;
|
|
8
|
+
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/dunning/${encodeURIComponent(id)}/email-preview`;
|
|
9
|
+
return zeniAPI
|
|
10
|
+
.postAndGetJSON(apiUrl, {})
|
|
11
|
+
.pipe(map((response) => {
|
|
12
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
13
|
+
return updateInvoicingDunningEmailPreview({
|
|
14
|
+
id,
|
|
15
|
+
preview: toInvoicingDunningEmailPreview(response.data),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return updateInvoicingDunningEmailPreviewFailure({
|
|
19
|
+
id,
|
|
20
|
+
status: response.status,
|
|
21
|
+
});
|
|
22
|
+
}), catchError((error) => of(updateInvoicingDunningEmailPreviewFailure({
|
|
23
|
+
id,
|
|
24
|
+
status: createZeniAPIStatus('Unexpected Error', `Dunning email preview REST API call errored out: ${error instanceof Error ? error.message : String(error)}`),
|
|
25
|
+
}))));
|
|
26
|
+
}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EMPTY, of } from 'rxjs';
|
|
2
|
+
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { fetchInvoicingDunningEmailPreview, fetchInvoicingDunningEmailPreviewPage, } from './invoicingDunningCaseDetailViewReducer';
|
|
4
|
+
const shouldFetch = (fetchStateAndError, cacheOverride) => cacheOverride ||
|
|
5
|
+
(fetchStateAndError.fetchState !== 'Completed' &&
|
|
6
|
+
fetchStateAndError.fetchState !== 'In-Progress');
|
|
7
|
+
export const fetchInvoicingDunningEmailPreviewPageEpic = (actions$, state$) => actions$.pipe(filter(fetchInvoicingDunningEmailPreviewPage.match), mergeMap((action) => {
|
|
8
|
+
const { cacheOverride, id } = action.payload;
|
|
9
|
+
const detailState = state$.value.invoicingDunningCaseDetailViewState;
|
|
10
|
+
if (detailState.id !== id) {
|
|
11
|
+
return EMPTY;
|
|
12
|
+
}
|
|
13
|
+
return shouldFetch(detailState.emailPreview, cacheOverride)
|
|
14
|
+
? of(fetchInvoicingDunningEmailPreview({ id }))
|
|
15
|
+
: EMPTY;
|
|
16
|
+
}));
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export const toInvoicingDunningEmailPreview = (payload) => ({
|
|
2
|
+
body: payload.body,
|
|
3
|
+
bodyToken: payload.body_token,
|
|
4
|
+
cc: payload.cc,
|
|
5
|
+
renderedHtmlTemplate: payload.rendered_html_template,
|
|
6
|
+
subject: payload.subject,
|
|
7
|
+
subjectToken: payload.subject_token,
|
|
8
|
+
to: payload.to,
|
|
9
|
+
});
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { clearAll } from '../../../rootActions';
|
|
3
|
+
export const initialEmailPreviewState = {
|
|
4
|
+
fetchState: 'Not-Started',
|
|
5
|
+
error: undefined,
|
|
6
|
+
preview: undefined,
|
|
7
|
+
};
|
|
3
8
|
export const initialState = {
|
|
4
9
|
fetchState: 'Not-Started',
|
|
5
10
|
error: undefined,
|
|
11
|
+
emailPreview: initialEmailPreviewState,
|
|
6
12
|
id: undefined,
|
|
7
13
|
};
|
|
8
14
|
const invoicingDunningCaseDetailView = createSlice({
|
|
@@ -10,10 +16,38 @@ const invoicingDunningCaseDetailView = createSlice({
|
|
|
10
16
|
initialState,
|
|
11
17
|
reducers: {
|
|
12
18
|
fetchInvoicingDunningCaseDetail(draft, action) {
|
|
19
|
+
if (draft.id !== action.payload.id) {
|
|
20
|
+
draft.emailPreview = { ...initialEmailPreviewState };
|
|
21
|
+
}
|
|
13
22
|
draft.id = action.payload.id;
|
|
14
23
|
draft.fetchState = 'In-Progress';
|
|
15
24
|
draft.error = undefined;
|
|
16
25
|
},
|
|
26
|
+
fetchInvoicingDunningEmailPreview(draft, action) {
|
|
27
|
+
if (draft.id !== action.payload.id) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
draft.emailPreview.fetchState = 'In-Progress';
|
|
31
|
+
draft.emailPreview.error = undefined;
|
|
32
|
+
},
|
|
33
|
+
fetchInvoicingDunningEmailPreviewPage: {
|
|
34
|
+
reducer() {
|
|
35
|
+
// Cache-aware orchestrator trigger only.
|
|
36
|
+
},
|
|
37
|
+
prepare(payload) {
|
|
38
|
+
return {
|
|
39
|
+
payload: {
|
|
40
|
+
cacheOverride: payload.cacheOverride ?? false,
|
|
41
|
+
id: payload.id,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
invalidateInvoicingDunningEmailPreview(draft, action) {
|
|
47
|
+
if (draft.id === action.payload.id) {
|
|
48
|
+
draft.emailPreview = { ...initialEmailPreviewState };
|
|
49
|
+
}
|
|
50
|
+
},
|
|
17
51
|
updateInvoicingDunningCaseDetail(draft, action) {
|
|
18
52
|
draft.id = action.payload.id;
|
|
19
53
|
draft.fetchState = 'Completed';
|
|
@@ -23,6 +57,21 @@ const invoicingDunningCaseDetailView = createSlice({
|
|
|
23
57
|
draft.fetchState = 'Error';
|
|
24
58
|
draft.error = action.payload;
|
|
25
59
|
},
|
|
60
|
+
updateInvoicingDunningEmailPreview(draft, action) {
|
|
61
|
+
if (draft.id === action.payload.id) {
|
|
62
|
+
draft.emailPreview = {
|
|
63
|
+
error: undefined,
|
|
64
|
+
fetchState: 'Completed',
|
|
65
|
+
preview: action.payload.preview,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
updateInvoicingDunningEmailPreviewFailure(draft, action) {
|
|
70
|
+
if (draft.id === action.payload.id) {
|
|
71
|
+
draft.emailPreview.fetchState = 'Error';
|
|
72
|
+
draft.emailPreview.error = action.payload.status;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
26
75
|
clearInvoicingDunningCaseDetailView(draft) {
|
|
27
76
|
Object.assign(draft, initialState);
|
|
28
77
|
},
|
|
@@ -33,5 +82,5 @@ const invoicingDunningCaseDetailView = createSlice({
|
|
|
33
82
|
});
|
|
34
83
|
},
|
|
35
84
|
});
|
|
36
|
-
export const { fetchInvoicingDunningCaseDetail, updateInvoicingDunningCaseDetail, updateInvoicingDunningCaseDetailFailure,
|
|
85
|
+
export const { clearInvoicingDunningCaseDetailView, fetchInvoicingDunningCaseDetail, fetchInvoicingDunningEmailPreview, fetchInvoicingDunningEmailPreviewPage, invalidateInvoicingDunningEmailPreview, updateInvoicingDunningCaseDetail, updateInvoicingDunningCaseDetailFailure, updateInvoicingDunningEmailPreview, updateInvoicingDunningEmailPreviewFailure, } = invoicingDunningCaseDetailView.actions;
|
|
37
86
|
export default invoicingDunningCaseDetailView.reducer;
|