@zeniai/client-epic-state 5.1.26 → 5.1.27-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/README.md +3 -1
- package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.d.ts +1 -1
- package/lib/entity/invoicing/coupon/couponReducer.d.ts +12 -0
- package/lib/entity/invoicing/coupon/couponReducer.js +33 -0
- package/lib/entity/invoicing/creditNote/creditNoteReducer.d.ts +12 -0
- package/lib/entity/invoicing/creditNote/creditNoteReducer.js +35 -0
- package/lib/entity/invoicing/customer/customerReducer.d.ts +12 -0
- package/lib/entity/invoicing/customer/customerReducer.js +33 -0
- package/lib/entity/invoicing/dunningCase/dunningCaseReducer.d.ts +12 -0
- package/lib/entity/invoicing/dunningCase/dunningCaseReducer.js +35 -0
- package/lib/entity/invoicing/invoice/invoiceReducer.d.ts +10 -0
- package/lib/entity/invoicing/invoice/invoiceReducer.js +36 -0
- package/lib/entity/invoicing/invoice/invoiceSelector.d.ts +5 -0
- package/lib/entity/invoicing/invoice/invoiceSelector.js +9 -0
- package/lib/entity/invoicing/invoice/invoiceState.d.ts +5 -0
- package/lib/entity/invoicing/invoice/invoiceState.js +2 -0
- package/lib/entity/invoicing/invoicingTypes.d.ts +766 -0
- package/lib/entity/invoicing/invoicingTypes.js +15 -0
- package/lib/entity/invoicing/plan/planReducer.d.ts +12 -0
- package/lib/entity/invoicing/plan/planReducer.js +33 -0
- package/lib/entity/invoicing/product/productReducer.d.ts +12 -0
- package/lib/entity/invoicing/product/productReducer.js +33 -0
- package/lib/entity/invoicing/subscription/subscriptionReducer.d.ts +12 -0
- package/lib/entity/invoicing/subscription/subscriptionReducer.js +35 -0
- package/lib/entity/invoicing/transaction/transactionReducer.d.ts +12 -0
- package/lib/entity/invoicing/transaction/transactionReducer.js +35 -0
- package/lib/entity/task/taskState.d.ts +1 -1
- package/lib/entity/tenant/clearAllEpic.d.ts +39 -2
- package/lib/entity/tenant/clearAllEpic.js +82 -8
- package/lib/entity/tenant/tenantReducer.js +3 -3
- package/lib/epic.d.ts +32 -1
- package/lib/epic.js +33 -1
- package/lib/esm/entity/invoicing/coupon/couponReducer.js +29 -0
- package/lib/esm/entity/invoicing/creditNote/creditNoteReducer.js +31 -0
- package/lib/esm/entity/invoicing/customer/customerReducer.js +29 -0
- package/lib/esm/entity/invoicing/dunningCase/dunningCaseReducer.js +31 -0
- package/lib/esm/entity/invoicing/invoice/invoiceReducer.js +32 -0
- package/lib/esm/entity/invoicing/invoice/invoiceSelector.js +4 -0
- package/lib/esm/entity/invoicing/invoice/invoiceState.js +1 -0
- package/lib/esm/entity/invoicing/invoicingTypes.js +14 -0
- package/lib/esm/entity/invoicing/plan/planReducer.js +29 -0
- package/lib/esm/entity/invoicing/product/productReducer.js +29 -0
- package/lib/esm/entity/invoicing/subscription/subscriptionReducer.js +31 -0
- package/lib/esm/entity/invoicing/transaction/transactionReducer.js +31 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +74 -0
- package/lib/esm/entity/tenant/tenantReducer.js +3 -3
- package/lib/esm/epic.js +33 -1
- package/lib/esm/index.js +80 -2
- package/lib/esm/reducer.js +114 -0
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +29 -3
- package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +11 -0
- package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -2
- package/lib/esm/view/aiCfoView/epics/fetchSkillsEpic.js +34 -0
- package/lib/esm/view/aiCfoView/epics/submitQuestionEpic.js +7 -1
- package/lib/esm/view/invoicing/analyticsView/analyticsViewEpics.js +42 -0
- package/lib/esm/view/invoicing/analyticsView/analyticsViewReducer.js +45 -0
- package/lib/esm/view/invoicing/analyticsView/analyticsViewSelector.js +10 -0
- package/lib/esm/view/invoicing/approvalAction/approvalActionEpic.js +28 -0
- package/lib/esm/view/invoicing/approvalAction/approvalActionReducer.js +36 -0
- package/lib/esm/view/invoicing/approvalAction/approvalActionSelector.js +5 -0
- package/lib/esm/view/invoicing/approvalsView/approvalsViewEpics.js +37 -0
- package/lib/esm/view/invoicing/approvalsView/approvalsViewReducer.js +62 -0
- package/lib/esm/view/invoicing/approvalsView/approvalsViewSelector.js +8 -0
- package/lib/esm/view/invoicing/auditView/auditViewEpics.js +46 -0
- package/lib/esm/view/invoicing/auditView/auditViewReducer.js +56 -0
- package/lib/esm/view/invoicing/auditView/auditViewSelector.js +8 -0
- package/lib/esm/view/invoicing/catalogView/catalogViewEpics.js +143 -0
- package/lib/esm/view/invoicing/catalogView/catalogViewReducer.js +162 -0
- package/lib/esm/view/invoicing/catalogView/catalogViewSelector.js +31 -0
- package/lib/esm/view/invoicing/catalogWrite/catalogWriteEpic.js +34 -0
- package/lib/esm/view/invoicing/catalogWrite/catalogWriteReducer.js +39 -0
- package/lib/esm/view/invoicing/catalogWrite/catalogWriteSelector.js +6 -0
- package/lib/esm/view/invoicing/couponView/couponViewEpics.js +83 -0
- package/lib/esm/view/invoicing/couponView/couponViewReducer.js +105 -0
- package/lib/esm/view/invoicing/couponView/couponViewSelector.js +18 -0
- package/lib/esm/view/invoicing/couponWrite/couponWriteEpic.js +29 -0
- package/lib/esm/view/invoicing/couponWrite/couponWriteReducer.js +36 -0
- package/lib/esm/view/invoicing/couponWrite/couponWriteSelector.js +5 -0
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +23 -0
- package/lib/esm/view/invoicing/createInvoice/createInvoiceReducer.js +36 -0
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +5 -0
- package/lib/esm/view/invoicing/creditNoteView/creditNoteViewEpics.js +87 -0
- package/lib/esm/view/invoicing/creditNoteView/creditNoteViewReducer.js +105 -0
- package/lib/esm/view/invoicing/creditNoteView/creditNoteViewSelector.js +20 -0
- package/lib/esm/view/invoicing/customerPaymentMethod/customerPaymentMethodEpic.js +63 -0
- package/lib/esm/view/invoicing/customerPaymentMethod/customerPaymentMethodReducer.js +84 -0
- package/lib/esm/view/invoicing/customerPaymentMethod/customerPaymentMethodSelector.js +7 -0
- package/lib/esm/view/invoicing/customerView/customerViewEpics.js +71 -0
- package/lib/esm/view/invoicing/customerView/customerViewReducer.js +90 -0
- package/lib/esm/view/invoicing/customerView/customerViewSelector.js +17 -0
- package/lib/esm/view/invoicing/customerWrite/customerWriteEpic.js +23 -0
- package/lib/esm/view/invoicing/customerWrite/customerWriteReducer.js +36 -0
- package/lib/esm/view/invoicing/customerWrite/customerWriteSelector.js +5 -0
- package/lib/esm/view/invoicing/dataImportAction/dataImportActionEpic.js +41 -0
- package/lib/esm/view/invoicing/dataImportAction/dataImportActionReducer.js +73 -0
- package/lib/esm/view/invoicing/dataImportAction/dataImportActionSelector.js +5 -0
- package/lib/esm/view/invoicing/dataImportView/dataImportViewEpics.js +41 -0
- package/lib/esm/view/invoicing/dataImportView/dataImportViewReducer.js +66 -0
- package/lib/esm/view/invoicing/dataImportView/dataImportViewSelector.js +6 -0
- package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +28 -0
- package/lib/esm/view/invoicing/dunningAction/dunningActionReducer.js +36 -0
- package/lib/esm/view/invoicing/dunningAction/dunningActionSelector.js +5 -0
- package/lib/esm/view/invoicing/dunningCaseView/dunningCaseViewEpics.js +85 -0
- package/lib/esm/view/invoicing/dunningCaseView/dunningCaseViewReducer.js +105 -0
- package/lib/esm/view/invoicing/dunningCaseView/dunningCaseViewSelector.js +20 -0
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +50 -0
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionReducer.js +42 -0
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionSelector.js +5 -0
- package/lib/esm/view/invoicing/invoiceDetail/fetchInvoiceDetailEpic.js +20 -0
- package/lib/esm/view/invoicing/invoiceDetail/invoiceDetailReducer.js +34 -0
- package/lib/esm/view/invoicing/invoiceDetail/invoiceDetailSelector.js +9 -0
- package/lib/esm/view/invoicing/invoiceDetail/invoiceDetailState.js +1 -0
- package/lib/esm/view/invoicing/invoiceList/fetchInvoiceCountsEpic.js +32 -0
- package/lib/esm/view/invoicing/invoiceList/fetchInvoiceKPIsEpic.js +17 -0
- package/lib/esm/view/invoicing/invoiceList/fetchInvoiceListEpic.js +55 -0
- package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +90 -0
- package/lib/esm/view/invoicing/invoiceList/invoiceListSelector.js +11 -0
- package/lib/esm/view/invoicing/invoiceList/invoiceListState.js +1 -0
- package/lib/esm/view/invoicing/invoicePdf/invoicePdfEpic.js +37 -0
- package/lib/esm/view/invoicing/invoicePdf/invoicePdfReducer.js +33 -0
- package/lib/esm/view/invoicing/invoicePdf/invoicePdfSelector.js +5 -0
- package/lib/esm/view/invoicing/invoicingApiHelper.js +38 -0
- package/lib/esm/view/invoicing/paymentAction/paymentActionEpic.js +28 -0
- package/lib/esm/view/invoicing/paymentAction/paymentActionReducer.js +36 -0
- package/lib/esm/view/invoicing/paymentAction/paymentActionSelector.js +5 -0
- package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +23 -0
- package/lib/esm/view/invoicing/recordPayment/recordPaymentReducer.js +36 -0
- package/lib/esm/view/invoicing/recordPayment/recordPaymentSelector.js +5 -0
- package/lib/esm/view/invoicing/reportsView/reportsViewEpics.js +28 -0
- package/lib/esm/view/invoicing/reportsView/reportsViewReducer.js +54 -0
- package/lib/esm/view/invoicing/reportsView/reportsViewSelector.js +13 -0
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +53 -0
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +69 -0
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +7 -0
- package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +28 -0
- package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionReducer.js +36 -0
- package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionSelector.js +5 -0
- package/lib/esm/view/invoicing/subscriptionView/subscriptionViewEpics.js +85 -0
- package/lib/esm/view/invoicing/subscriptionView/subscriptionViewReducer.js +90 -0
- package/lib/esm/view/invoicing/subscriptionView/subscriptionViewSelector.js +19 -0
- package/lib/esm/view/invoicing/subscriptionWrite/subscriptionWriteEpic.js +25 -0
- package/lib/esm/view/invoicing/subscriptionWrite/subscriptionWriteReducer.js +36 -0
- package/lib/esm/view/invoicing/subscriptionWrite/subscriptionWriteSelector.js +5 -0
- package/lib/esm/view/invoicing/transactionView/transactionViewEpics.js +76 -0
- package/lib/esm/view/invoicing/transactionView/transactionViewReducer.js +90 -0
- package/lib/esm/view/invoicing/transactionView/transactionViewSelector.js +19 -0
- package/lib/index.d.ts +101 -4
- package/lib/index.js +373 -5
- package/lib/reducer.d.ts +114 -0
- package/lib/reducer.js +126 -12
- package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +14 -0
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +8 -4
- package/lib/view/aiCfoView/aiCfoViewReducer.js +30 -4
- package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +2 -1
- package/lib/view/aiCfoView/aiCfoViewSelector.js +12 -0
- package/lib/view/aiCfoView/aiCfoViewState.d.ts +15 -0
- package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -2
- package/lib/view/aiCfoView/epics/fetchSkillsEpic.d.ts +8 -0
- package/lib/view/aiCfoView/epics/fetchSkillsEpic.js +38 -0
- package/lib/view/aiCfoView/epics/submitQuestionEpic.js +7 -1
- package/lib/view/invoicing/analyticsView/analyticsViewEpics.d.ts +7 -0
- package/lib/view/invoicing/analyticsView/analyticsViewEpics.js +46 -0
- package/lib/view/invoicing/analyticsView/analyticsViewReducer.d.ts +22 -0
- package/lib/view/invoicing/analyticsView/analyticsViewReducer.js +49 -0
- package/lib/view/invoicing/analyticsView/analyticsViewSelector.d.ts +10 -0
- package/lib/view/invoicing/analyticsView/analyticsViewSelector.js +20 -0
- package/lib/view/invoicing/approvalAction/approvalActionEpic.d.ts +8 -0
- package/lib/view/invoicing/approvalAction/approvalActionEpic.js +32 -0
- package/lib/view/invoicing/approvalAction/approvalActionReducer.d.ts +20 -0
- package/lib/view/invoicing/approvalAction/approvalActionReducer.js +40 -0
- package/lib/view/invoicing/approvalAction/approvalActionSelector.d.ts +3 -0
- package/lib/view/invoicing/approvalAction/approvalActionSelector.js +9 -0
- package/lib/view/invoicing/approvalsView/approvalsViewEpics.d.ts +7 -0
- package/lib/view/invoicing/approvalsView/approvalsViewEpics.js +41 -0
- package/lib/view/invoicing/approvalsView/approvalsViewReducer.d.ts +33 -0
- package/lib/view/invoicing/approvalsView/approvalsViewReducer.js +66 -0
- package/lib/view/invoicing/approvalsView/approvalsViewSelector.d.ts +9 -0
- package/lib/view/invoicing/approvalsView/approvalsViewSelector.js +16 -0
- package/lib/view/invoicing/auditView/auditViewEpics.d.ts +7 -0
- package/lib/view/invoicing/auditView/auditViewEpics.js +50 -0
- package/lib/view/invoicing/auditView/auditViewReducer.d.ts +36 -0
- package/lib/view/invoicing/auditView/auditViewReducer.js +60 -0
- package/lib/view/invoicing/auditView/auditViewSelector.d.ts +9 -0
- package/lib/view/invoicing/auditView/auditViewSelector.js +16 -0
- package/lib/view/invoicing/catalogView/catalogViewEpics.d.ts +14 -0
- package/lib/view/invoicing/catalogView/catalogViewEpics.js +152 -0
- package/lib/view/invoicing/catalogView/catalogViewReducer.d.ts +76 -0
- package/lib/view/invoicing/catalogView/catalogViewReducer.js +166 -0
- package/lib/view/invoicing/catalogView/catalogViewSelector.d.ts +22 -0
- package/lib/view/invoicing/catalogView/catalogViewSelector.js +52 -0
- package/lib/view/invoicing/catalogWrite/catalogWriteEpic.d.ts +9 -0
- package/lib/view/invoicing/catalogWrite/catalogWriteEpic.js +38 -0
- package/lib/view/invoicing/catalogWrite/catalogWriteReducer.d.ts +21 -0
- package/lib/view/invoicing/catalogWrite/catalogWriteReducer.js +43 -0
- package/lib/view/invoicing/catalogWrite/catalogWriteSelector.d.ts +6 -0
- package/lib/view/invoicing/catalogWrite/catalogWriteSelector.js +12 -0
- package/lib/view/invoicing/couponView/couponViewEpics.d.ts +11 -0
- package/lib/view/invoicing/couponView/couponViewEpics.js +90 -0
- package/lib/view/invoicing/couponView/couponViewReducer.d.ts +42 -0
- package/lib/view/invoicing/couponView/couponViewReducer.js +109 -0
- package/lib/view/invoicing/couponView/couponViewSelector.d.ts +14 -0
- package/lib/view/invoicing/couponView/couponViewSelector.js +31 -0
- package/lib/view/invoicing/couponWrite/couponWriteEpic.d.ts +8 -0
- package/lib/view/invoicing/couponWrite/couponWriteEpic.js +33 -0
- package/lib/view/invoicing/couponWrite/couponWriteReducer.d.ts +17 -0
- package/lib/view/invoicing/couponWrite/couponWriteReducer.js +40 -0
- package/lib/view/invoicing/couponWrite/couponWriteSelector.d.ts +4 -0
- package/lib/view/invoicing/couponWrite/couponWriteSelector.js +10 -0
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +8 -0
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +27 -0
- package/lib/view/invoicing/createInvoice/createInvoiceReducer.d.ts +34 -0
- package/lib/view/invoicing/createInvoice/createInvoiceReducer.js +40 -0
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +4 -0
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +10 -0
- package/lib/view/invoicing/creditNoteView/creditNoteViewEpics.d.ts +11 -0
- package/lib/view/invoicing/creditNoteView/creditNoteViewEpics.js +94 -0
- package/lib/view/invoicing/creditNoteView/creditNoteViewReducer.d.ts +43 -0
- package/lib/view/invoicing/creditNoteView/creditNoteViewReducer.js +109 -0
- package/lib/view/invoicing/creditNoteView/creditNoteViewSelector.d.ts +14 -0
- package/lib/view/invoicing/creditNoteView/creditNoteViewSelector.js +33 -0
- package/lib/view/invoicing/customerPaymentMethod/customerPaymentMethodEpic.d.ts +11 -0
- package/lib/view/invoicing/customerPaymentMethod/customerPaymentMethodEpic.js +70 -0
- package/lib/view/invoicing/customerPaymentMethod/customerPaymentMethodReducer.d.ts +42 -0
- package/lib/view/invoicing/customerPaymentMethod/customerPaymentMethodReducer.js +88 -0
- package/lib/view/invoicing/customerPaymentMethod/customerPaymentMethodSelector.d.ts +10 -0
- package/lib/view/invoicing/customerPaymentMethod/customerPaymentMethodSelector.js +17 -0
- package/lib/view/invoicing/customerView/customerViewEpics.d.ts +10 -0
- package/lib/view/invoicing/customerView/customerViewEpics.js +77 -0
- package/lib/view/invoicing/customerView/customerViewReducer.d.ts +41 -0
- package/lib/view/invoicing/customerView/customerViewReducer.js +94 -0
- package/lib/view/invoicing/customerView/customerViewSelector.d.ts +13 -0
- package/lib/view/invoicing/customerView/customerViewSelector.js +29 -0
- package/lib/view/invoicing/customerWrite/customerWriteEpic.d.ts +8 -0
- package/lib/view/invoicing/customerWrite/customerWriteEpic.js +27 -0
- package/lib/view/invoicing/customerWrite/customerWriteReducer.d.ts +17 -0
- package/lib/view/invoicing/customerWrite/customerWriteReducer.js +40 -0
- package/lib/view/invoicing/customerWrite/customerWriteSelector.d.ts +4 -0
- package/lib/view/invoicing/customerWrite/customerWriteSelector.js +10 -0
- package/lib/view/invoicing/dataImportAction/dataImportActionEpic.d.ts +7 -0
- package/lib/view/invoicing/dataImportAction/dataImportActionEpic.js +45 -0
- package/lib/view/invoicing/dataImportAction/dataImportActionReducer.d.ts +23 -0
- package/lib/view/invoicing/dataImportAction/dataImportActionReducer.js +77 -0
- package/lib/view/invoicing/dataImportAction/dataImportActionSelector.d.ts +4 -0
- package/lib/view/invoicing/dataImportAction/dataImportActionSelector.js +9 -0
- package/lib/view/invoicing/dataImportView/dataImportViewEpics.d.ts +9 -0
- package/lib/view/invoicing/dataImportView/dataImportViewEpics.js +47 -0
- package/lib/view/invoicing/dataImportView/dataImportViewReducer.d.ts +15 -0
- package/lib/view/invoicing/dataImportView/dataImportViewReducer.js +70 -0
- package/lib/view/invoicing/dataImportView/dataImportViewSelector.d.ts +9 -0
- package/lib/view/invoicing/dataImportView/dataImportViewSelector.js +15 -0
- package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +8 -0
- package/lib/view/invoicing/dunningAction/dunningActionEpic.js +32 -0
- package/lib/view/invoicing/dunningAction/dunningActionReducer.d.ts +21 -0
- package/lib/view/invoicing/dunningAction/dunningActionReducer.js +40 -0
- package/lib/view/invoicing/dunningAction/dunningActionSelector.d.ts +3 -0
- package/lib/view/invoicing/dunningAction/dunningActionSelector.js +9 -0
- package/lib/view/invoicing/dunningCaseView/dunningCaseViewEpics.d.ts +11 -0
- package/lib/view/invoicing/dunningCaseView/dunningCaseViewEpics.js +92 -0
- package/lib/view/invoicing/dunningCaseView/dunningCaseViewReducer.d.ts +42 -0
- package/lib/view/invoicing/dunningCaseView/dunningCaseViewReducer.js +109 -0
- package/lib/view/invoicing/dunningCaseView/dunningCaseViewSelector.d.ts +14 -0
- package/lib/view/invoicing/dunningCaseView/dunningCaseViewSelector.js +33 -0
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +9 -0
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +55 -0
- package/lib/view/invoicing/invoiceAction/invoiceActionReducer.d.ts +26 -0
- package/lib/view/invoicing/invoiceAction/invoiceActionReducer.js +46 -0
- package/lib/view/invoicing/invoiceAction/invoiceActionSelector.d.ts +3 -0
- package/lib/view/invoicing/invoiceAction/invoiceActionSelector.js +9 -0
- package/lib/view/invoicing/invoiceDetail/fetchInvoiceDetailEpic.d.ts +8 -0
- package/lib/view/invoicing/invoiceDetail/fetchInvoiceDetailEpic.js +24 -0
- package/lib/view/invoicing/invoiceDetail/invoiceDetailReducer.d.ts +11 -0
- package/lib/view/invoicing/invoiceDetail/invoiceDetailReducer.js +38 -0
- package/lib/view/invoicing/invoiceDetail/invoiceDetailSelector.d.ts +5 -0
- package/lib/view/invoicing/invoiceDetail/invoiceDetailSelector.js +14 -0
- package/lib/view/invoicing/invoiceDetail/invoiceDetailState.d.ts +4 -0
- package/lib/view/invoicing/invoiceDetail/invoiceDetailState.js +2 -0
- package/lib/view/invoicing/invoiceList/fetchInvoiceCountsEpic.d.ts +7 -0
- package/lib/view/invoicing/invoiceList/fetchInvoiceCountsEpic.js +36 -0
- package/lib/view/invoicing/invoiceList/fetchInvoiceKPIsEpic.d.ts +7 -0
- package/lib/view/invoicing/invoiceList/fetchInvoiceKPIsEpic.js +21 -0
- package/lib/view/invoicing/invoiceList/fetchInvoiceListEpic.d.ts +8 -0
- package/lib/view/invoicing/invoiceList/fetchInvoiceListEpic.js +59 -0
- package/lib/view/invoicing/invoiceList/invoiceListReducer.d.ts +22 -0
- package/lib/view/invoicing/invoiceList/invoiceListReducer.js +94 -0
- package/lib/view/invoicing/invoiceList/invoiceListSelector.d.ts +11 -0
- package/lib/view/invoicing/invoiceList/invoiceListSelector.js +21 -0
- package/lib/view/invoicing/invoiceList/invoiceListState.d.ts +25 -0
- package/lib/view/invoicing/invoiceList/invoiceListState.js +2 -0
- package/lib/view/invoicing/invoicePdf/invoicePdfEpic.d.ts +7 -0
- package/lib/view/invoicing/invoicePdf/invoicePdfEpic.js +41 -0
- package/lib/view/invoicing/invoicePdf/invoicePdfReducer.d.ts +20 -0
- package/lib/view/invoicing/invoicePdf/invoicePdfReducer.js +37 -0
- package/lib/view/invoicing/invoicePdf/invoicePdfSelector.d.ts +3 -0
- package/lib/view/invoicing/invoicePdf/invoicePdfSelector.js +9 -0
- package/lib/view/invoicing/invoicingApiHelper.d.ts +22 -0
- package/lib/view/invoicing/invoicingApiHelper.js +44 -0
- package/lib/view/invoicing/paymentAction/paymentActionEpic.d.ts +8 -0
- package/lib/view/invoicing/paymentAction/paymentActionEpic.js +32 -0
- package/lib/view/invoicing/paymentAction/paymentActionReducer.d.ts +21 -0
- package/lib/view/invoicing/paymentAction/paymentActionReducer.js +40 -0
- package/lib/view/invoicing/paymentAction/paymentActionSelector.d.ts +3 -0
- package/lib/view/invoicing/paymentAction/paymentActionSelector.js +9 -0
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +8 -0
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +27 -0
- package/lib/view/invoicing/recordPayment/recordPaymentReducer.d.ts +32 -0
- package/lib/view/invoicing/recordPayment/recordPaymentReducer.js +40 -0
- package/lib/view/invoicing/recordPayment/recordPaymentSelector.d.ts +4 -0
- package/lib/view/invoicing/recordPayment/recordPaymentSelector.js +10 -0
- package/lib/view/invoicing/reportsView/reportsViewEpics.d.ts +7 -0
- package/lib/view/invoicing/reportsView/reportsViewEpics.js +32 -0
- package/lib/view/invoicing/reportsView/reportsViewReducer.d.ts +20 -0
- package/lib/view/invoicing/reportsView/reportsViewReducer.js +58 -0
- package/lib/view/invoicing/reportsView/reportsViewSelector.d.ts +12 -0
- package/lib/view/invoicing/reportsView/reportsViewSelector.js +24 -0
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +10 -0
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +60 -0
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +12 -0
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +73 -0
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +7 -0
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +14 -0
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +8 -0
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +32 -0
- package/lib/view/invoicing/subscriptionAction/subscriptionActionReducer.d.ts +21 -0
- package/lib/view/invoicing/subscriptionAction/subscriptionActionReducer.js +40 -0
- package/lib/view/invoicing/subscriptionAction/subscriptionActionSelector.d.ts +3 -0
- package/lib/view/invoicing/subscriptionAction/subscriptionActionSelector.js +9 -0
- package/lib/view/invoicing/subscriptionView/subscriptionViewEpics.d.ts +10 -0
- package/lib/view/invoicing/subscriptionView/subscriptionViewEpics.js +91 -0
- package/lib/view/invoicing/subscriptionView/subscriptionViewReducer.d.ts +44 -0
- package/lib/view/invoicing/subscriptionView/subscriptionViewReducer.js +94 -0
- package/lib/view/invoicing/subscriptionView/subscriptionViewSelector.d.ts +13 -0
- package/lib/view/invoicing/subscriptionView/subscriptionViewSelector.js +31 -0
- package/lib/view/invoicing/subscriptionWrite/subscriptionWriteEpic.d.ts +8 -0
- package/lib/view/invoicing/subscriptionWrite/subscriptionWriteEpic.js +29 -0
- package/lib/view/invoicing/subscriptionWrite/subscriptionWriteReducer.d.ts +17 -0
- package/lib/view/invoicing/subscriptionWrite/subscriptionWriteReducer.js +40 -0
- package/lib/view/invoicing/subscriptionWrite/subscriptionWriteSelector.d.ts +4 -0
- package/lib/view/invoicing/subscriptionWrite/subscriptionWriteSelector.js +10 -0
- package/lib/view/invoicing/transactionView/transactionViewEpics.d.ts +10 -0
- package/lib/view/invoicing/transactionView/transactionViewEpics.js +82 -0
- package/lib/view/invoicing/transactionView/transactionViewReducer.d.ts +43 -0
- package/lib/view/invoicing/transactionView/transactionViewReducer.js +94 -0
- package/lib/view/invoicing/transactionView/transactionViewSelector.d.ts +13 -0
- package/lib/view/invoicing/transactionView/transactionViewSelector.js +31 -0
- package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +3 -3
- package/lib/zeniAPI.d.ts +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { updateInvoicingCustomers } from '../../../entity/invoicing/customer/customerReducer';
|
|
4
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
5
|
+
import { INVOICING_LIST_PAGE_SIZE, applyListSortParams, invoicingBaseUrl, withQuery, } from '../invoicingApiHelper';
|
|
6
|
+
import { fetchInvoicingCustomerCounts, fetchInvoicingCustomerDetail, fetchInvoicingCustomerList, updateInvoicingCustomerCounts, updateInvoicingCustomerCountsFailure, updateInvoicingCustomerDetail, updateInvoicingCustomerDetailFailure, updateInvoicingCustomerList, updateInvoicingCustomerListFailure, } from './customerViewReducer';
|
|
7
|
+
const buildQuery = (filters, cursor, sort) => {
|
|
8
|
+
const params = new URLSearchParams();
|
|
9
|
+
if (filters.search != null && filters.search.length > 0) {
|
|
10
|
+
params.set('search', filters.search);
|
|
11
|
+
}
|
|
12
|
+
if (filters.status != null && filters.status.length > 0) {
|
|
13
|
+
params.set('status', filters.status);
|
|
14
|
+
}
|
|
15
|
+
params.set('limit', String(INVOICING_LIST_PAGE_SIZE));
|
|
16
|
+
if (cursor != null) {
|
|
17
|
+
params.set('cursor', cursor);
|
|
18
|
+
}
|
|
19
|
+
applyListSortParams(params, sort);
|
|
20
|
+
return params;
|
|
21
|
+
};
|
|
22
|
+
export const fetchInvoicingCustomerListEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingCustomerList.match), switchMap((action) => {
|
|
23
|
+
const { filters, cursor, keepExistingListItems, sort } = action.payload;
|
|
24
|
+
const apiUrl = withQuery(`${invoicingBaseUrl(zeniAPI)}/customers`, buildQuery(filters, cursor, sort));
|
|
25
|
+
return zeniAPI
|
|
26
|
+
.getJSON(apiUrl)
|
|
27
|
+
.pipe(switchMap((response) => {
|
|
28
|
+
if (isSuccessResponse(response)) {
|
|
29
|
+
const items = response.data?.items ?? [];
|
|
30
|
+
return [
|
|
31
|
+
updateInvoicingCustomers(items, 'merge'),
|
|
32
|
+
updateInvoicingCustomerList({
|
|
33
|
+
ids: items.map((item) => item.id),
|
|
34
|
+
nextCursor: response.data?.next_cursor ?? null,
|
|
35
|
+
keepExistingListItems,
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
return of(updateInvoicingCustomerListFailure(response.status));
|
|
40
|
+
}), catchError((error) => of(updateInvoicingCustomerListFailure(createZeniAPIStatus('Unexpected Error', 'Fetch customer list REST API call errored out ' +
|
|
41
|
+
JSON.stringify(error))))));
|
|
42
|
+
}));
|
|
43
|
+
export const fetchInvoicingCustomerCountsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingCustomerCounts.match), switchMap(() => {
|
|
44
|
+
const { filters } = state$.value.invoicingCustomerViewState;
|
|
45
|
+
const params = new URLSearchParams();
|
|
46
|
+
if (filters.search != null && filters.search.length > 0) {
|
|
47
|
+
params.set('search', filters.search);
|
|
48
|
+
}
|
|
49
|
+
const apiUrl = withQuery(`${invoicingBaseUrl(zeniAPI)}/customers/counts`, params);
|
|
50
|
+
return zeniAPI.getJSON(apiUrl).pipe(switchMap((response) => {
|
|
51
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
52
|
+
return of(updateInvoicingCustomerCounts(response.data));
|
|
53
|
+
}
|
|
54
|
+
return of(updateInvoicingCustomerCountsFailure(response.status));
|
|
55
|
+
}), catchError((error) => of(updateInvoicingCustomerCountsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch customer counts REST API call errored out ' +
|
|
56
|
+
JSON.stringify(error))))));
|
|
57
|
+
}));
|
|
58
|
+
export const fetchInvoicingCustomerDetailEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingCustomerDetail.match), switchMap((action) => {
|
|
59
|
+
const { id } = action.payload;
|
|
60
|
+
const apiUrl = `${invoicingBaseUrl(zeniAPI)}/customers/${id}`;
|
|
61
|
+
return zeniAPI.getJSON(apiUrl).pipe(switchMap((response) => {
|
|
62
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
63
|
+
return [
|
|
64
|
+
updateInvoicingCustomers([response.data], 'merge'),
|
|
65
|
+
updateInvoicingCustomerDetail({ id: response.data.id }),
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
return of(updateInvoicingCustomerDetailFailure(response.status));
|
|
69
|
+
}), catchError((error) => of(updateInvoicingCustomerDetailFailure(createZeniAPIStatus('Unexpected Error', 'Fetch customer detail REST API call errored out ' +
|
|
70
|
+
JSON.stringify(error))))));
|
|
71
|
+
}));
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
export const initialState = {
|
|
3
|
+
fetchState: 'Not-Started',
|
|
4
|
+
error: undefined,
|
|
5
|
+
ids: [],
|
|
6
|
+
nextCursor: null,
|
|
7
|
+
filters: {},
|
|
8
|
+
counts: { all: 0 },
|
|
9
|
+
countsFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
10
|
+
detailId: undefined,
|
|
11
|
+
detailFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
12
|
+
hasValidState() {
|
|
13
|
+
return this.fetchState === 'Completed';
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const customerView = createSlice({
|
|
17
|
+
name: 'invoicingCustomerView',
|
|
18
|
+
initialState,
|
|
19
|
+
reducers: {
|
|
20
|
+
fetchInvoicingCustomerList: {
|
|
21
|
+
reducer(draft, action) {
|
|
22
|
+
if (!action.payload.keepExistingListItems) {
|
|
23
|
+
draft.ids = [];
|
|
24
|
+
draft.nextCursor = null;
|
|
25
|
+
}
|
|
26
|
+
draft.filters = action.payload.filters;
|
|
27
|
+
draft.sort = action.payload.sort;
|
|
28
|
+
draft.fetchState = 'In-Progress';
|
|
29
|
+
draft.error = undefined;
|
|
30
|
+
},
|
|
31
|
+
prepare(payload) {
|
|
32
|
+
return {
|
|
33
|
+
payload: {
|
|
34
|
+
filters: payload.filters ?? {},
|
|
35
|
+
cursor: payload.cursor,
|
|
36
|
+
keepExistingListItems: payload.keepExistingListItems ?? false,
|
|
37
|
+
sort: payload.sort,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
updateInvoicingCustomerList(draft, action) {
|
|
43
|
+
draft.ids = action.payload.keepExistingListItems
|
|
44
|
+
? [...new Set([...draft.ids, ...action.payload.ids])]
|
|
45
|
+
: action.payload.ids;
|
|
46
|
+
draft.nextCursor = action.payload.nextCursor;
|
|
47
|
+
draft.fetchState = 'Completed';
|
|
48
|
+
draft.error = undefined;
|
|
49
|
+
},
|
|
50
|
+
updateInvoicingCustomerListFailure(draft, action) {
|
|
51
|
+
draft.fetchState = 'Error';
|
|
52
|
+
draft.error = action.payload;
|
|
53
|
+
},
|
|
54
|
+
fetchInvoicingCustomerCounts(draft) {
|
|
55
|
+
draft.countsFetchState.fetchState = 'In-Progress';
|
|
56
|
+
draft.countsFetchState.error = undefined;
|
|
57
|
+
},
|
|
58
|
+
updateInvoicingCustomerCounts(draft, action) {
|
|
59
|
+
draft.counts = action.payload;
|
|
60
|
+
draft.countsFetchState.fetchState = 'Completed';
|
|
61
|
+
draft.countsFetchState.error = undefined;
|
|
62
|
+
},
|
|
63
|
+
updateInvoicingCustomerCountsFailure(draft, action) {
|
|
64
|
+
draft.countsFetchState.fetchState = 'Error';
|
|
65
|
+
draft.countsFetchState.error = action.payload;
|
|
66
|
+
},
|
|
67
|
+
updateInvoicingCustomerFilters(draft, action) {
|
|
68
|
+
draft.filters = action.payload;
|
|
69
|
+
},
|
|
70
|
+
fetchInvoicingCustomerDetail(draft, action) {
|
|
71
|
+
draft.detailId = action.payload.id;
|
|
72
|
+
draft.detailFetchState.fetchState = 'In-Progress';
|
|
73
|
+
draft.detailFetchState.error = undefined;
|
|
74
|
+
},
|
|
75
|
+
updateInvoicingCustomerDetail(draft, action) {
|
|
76
|
+
draft.detailId = action.payload.id;
|
|
77
|
+
draft.detailFetchState.fetchState = 'Completed';
|
|
78
|
+
draft.detailFetchState.error = undefined;
|
|
79
|
+
},
|
|
80
|
+
updateInvoicingCustomerDetailFailure(draft, action) {
|
|
81
|
+
draft.detailFetchState.fetchState = 'Error';
|
|
82
|
+
draft.detailFetchState.error = action.payload;
|
|
83
|
+
},
|
|
84
|
+
clearInvoicingCustomerView(draft) {
|
|
85
|
+
Object.assign(draft, initialState);
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
export const { fetchInvoicingCustomerList, updateInvoicingCustomerList, updateInvoicingCustomerListFailure, fetchInvoicingCustomerCounts, updateInvoicingCustomerCounts, updateInvoicingCustomerCountsFailure, updateInvoicingCustomerFilters, fetchInvoicingCustomerDetail, updateInvoicingCustomerDetail, updateInvoicingCustomerDetailFailure, clearInvoicingCustomerView, } = customerView.actions;
|
|
90
|
+
export default customerView.reducer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const getInvoicingCustomerListItems = (state) => state.invoicingCustomerViewState.ids
|
|
2
|
+
.map((id) => state.invoicingCustomerState.customerByID[id])
|
|
3
|
+
.filter((item) => item != null);
|
|
4
|
+
export const getInvoicingCustomerListFetchState = (state) => ({
|
|
5
|
+
fetchState: state.invoicingCustomerViewState.fetchState,
|
|
6
|
+
error: state.invoicingCustomerViewState.error,
|
|
7
|
+
});
|
|
8
|
+
export const getInvoicingCustomerListNextCursor = (state) => state.invoicingCustomerViewState.nextCursor;
|
|
9
|
+
export const getInvoicingCustomerListHasMore = (state) => state.invoicingCustomerViewState.nextCursor != null;
|
|
10
|
+
export const getInvoicingCustomerListFilters = (state) => state.invoicingCustomerViewState.filters;
|
|
11
|
+
export const getInvoicingCustomerCounts = (state) => state.invoicingCustomerViewState.counts;
|
|
12
|
+
export const getInvoicingCustomerById = (state, id) => state.invoicingCustomerState.customerByID[id];
|
|
13
|
+
export const getInvoicingCustomerDetail = (state) => {
|
|
14
|
+
const id = state.invoicingCustomerViewState.detailId;
|
|
15
|
+
return id != null ? state.invoicingCustomerState.customerByID[id] : undefined;
|
|
16
|
+
};
|
|
17
|
+
export const getInvoicingCustomerDetailFetchState = (state) => state.invoicingCustomerViewState.detailFetchState;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { updateInvoicingCustomers } from '../../../entity/invoicing/customer/customerReducer';
|
|
4
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
5
|
+
import { invoicingBaseUrl } from '../invoicingApiHelper';
|
|
6
|
+
import { saveInvoicingCustomer, saveInvoicingCustomerFailure, saveInvoicingCustomerSuccess, } from './customerWriteReducer';
|
|
7
|
+
export const saveInvoicingCustomerEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(saveInvoicingCustomer.match), mergeMap((action) => {
|
|
8
|
+
const { data, id } = action.payload;
|
|
9
|
+
const baseUrl = invoicingBaseUrl(zeniAPI);
|
|
10
|
+
const request$ = id != null
|
|
11
|
+
? zeniAPI.putAndGetJSON(`${baseUrl}/customers/${encodeURIComponent(id)}`, { ...data })
|
|
12
|
+
: zeniAPI.postAndGetJSON(`${baseUrl}/customers`, { ...data });
|
|
13
|
+
return request$.pipe(mergeMap((response) => {
|
|
14
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
15
|
+
return [
|
|
16
|
+
updateInvoicingCustomers([response.data], 'merge'),
|
|
17
|
+
saveInvoicingCustomerSuccess({ customerId: response.data.id }),
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
return of(saveInvoicingCustomerFailure(response.status));
|
|
21
|
+
}), catchError((error) => of(saveInvoicingCustomerFailure(createZeniAPIStatus('Unexpected Error', 'Save customer REST API call errored out ' +
|
|
22
|
+
JSON.stringify(error))))));
|
|
23
|
+
}));
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
export const initialState = {
|
|
3
|
+
fetchState: 'Not-Started',
|
|
4
|
+
error: undefined,
|
|
5
|
+
data: undefined,
|
|
6
|
+
savedCustomerId: undefined,
|
|
7
|
+
hasValidState() {
|
|
8
|
+
return this.fetchState === 'Completed';
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
const customerWrite = createSlice({
|
|
12
|
+
name: 'invoicingCustomerWrite',
|
|
13
|
+
initialState,
|
|
14
|
+
reducers: {
|
|
15
|
+
saveInvoicingCustomer(draft, action) {
|
|
16
|
+
draft.fetchState = 'In-Progress';
|
|
17
|
+
draft.error = undefined;
|
|
18
|
+
draft.savedCustomerId = undefined;
|
|
19
|
+
draft.data = action.payload.data;
|
|
20
|
+
},
|
|
21
|
+
saveInvoicingCustomerSuccess(draft, action) {
|
|
22
|
+
draft.fetchState = 'Completed';
|
|
23
|
+
draft.error = undefined;
|
|
24
|
+
draft.savedCustomerId = action.payload.customerId;
|
|
25
|
+
},
|
|
26
|
+
saveInvoicingCustomerFailure(draft, action) {
|
|
27
|
+
draft.fetchState = 'Error';
|
|
28
|
+
draft.error = action.payload;
|
|
29
|
+
},
|
|
30
|
+
resetInvoicingCustomerWrite(draft) {
|
|
31
|
+
Object.assign(draft, initialState);
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
export const { saveInvoicingCustomer, saveInvoicingCustomerSuccess, saveInvoicingCustomerFailure, resetInvoicingCustomerWrite, } = customerWrite.actions;
|
|
36
|
+
export default customerWrite.reducer;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const getInvoicingCustomerWriteState = (state) => ({
|
|
2
|
+
fetchState: state.invoicingCustomerWriteState.fetchState,
|
|
3
|
+
error: state.invoicingCustomerWriteState.error,
|
|
4
|
+
});
|
|
5
|
+
export const getSavedInvoicingCustomerId = (state) => state.invoicingCustomerWriteState.savedCustomerId;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { merge, of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
4
|
+
import { invoicingBaseUrl } from '../invoicingApiHelper';
|
|
5
|
+
import { fetchInvoicingDataImportStatus, fetchInvoicingMigrationSessions, setInvoicingActiveMigrationSessionId, upsertInvoicingMigrationSession, } from '../dataImportView/dataImportViewReducer';
|
|
6
|
+
import { connectInvoicingChargebee, invoicingDataImportActionFailure, invoicingDataImportActionSuccess, retryInvoicingMigration, rollbackInvoicingMigration, startInvoicingMigration, uploadInvoicingMigrationFiles, } from './dataImportActionReducer';
|
|
7
|
+
const onSuccess = (kind, session) => [
|
|
8
|
+
upsertInvoicingMigrationSession(session),
|
|
9
|
+
setInvoicingActiveMigrationSessionId(session.id),
|
|
10
|
+
invoicingDataImportActionSuccess(kind),
|
|
11
|
+
fetchInvoicingMigrationSessions(),
|
|
12
|
+
fetchInvoicingDataImportStatus(),
|
|
13
|
+
];
|
|
14
|
+
const handleResponse = (kind, response$) => response$.pipe(mergeMap((response) => {
|
|
15
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
16
|
+
return onSuccess(kind, response.data);
|
|
17
|
+
}
|
|
18
|
+
return of(invoicingDataImportActionFailure({ kind, error: response.status }));
|
|
19
|
+
}), catchError((error) => of(invoicingDataImportActionFailure({
|
|
20
|
+
kind,
|
|
21
|
+
error: createZeniAPIStatus('Unexpected Error', `Data import ${kind} REST API call errored out ` +
|
|
22
|
+
JSON.stringify(error)),
|
|
23
|
+
}))));
|
|
24
|
+
export const invoicingDataImportActionEpic = (actions$, _state$, zeniAPI) => {
|
|
25
|
+
const base = () => `${invoicingBaseUrl(zeniAPI)}/data-import`;
|
|
26
|
+
const connect$ = actions$.pipe(filter(connectInvoicingChargebee.match), mergeMap((action) => handleResponse('connect', zeniAPI.postAndGetJSON(`${base()}/chargebee/connect`, {
|
|
27
|
+
site: action.payload.site,
|
|
28
|
+
...(action.payload.apiKey != null && action.payload.apiKey.length > 0
|
|
29
|
+
? { api_key: action.payload.apiKey }
|
|
30
|
+
: {}),
|
|
31
|
+
}))));
|
|
32
|
+
const upload$ = actions$.pipe(filter(uploadInvoicingMigrationFiles.match), mergeMap((action) => {
|
|
33
|
+
const form = new FormData();
|
|
34
|
+
action.payload.files.forEach((file) => form.append('files', file, file.name));
|
|
35
|
+
return handleResponse('upload', zeniAPI.postFormData(`${base()}/uploads`, form));
|
|
36
|
+
}));
|
|
37
|
+
const start$ = actions$.pipe(filter(startInvoicingMigration.match), mergeMap((action) => handleResponse('start', zeniAPI.postAndGetJSON(`${base()}/${encodeURIComponent(action.payload)}/import`, {}))));
|
|
38
|
+
const retry$ = actions$.pipe(filter(retryInvoicingMigration.match), mergeMap((action) => handleResponse('retry', zeniAPI.postAndGetJSON(`${base()}/${encodeURIComponent(action.payload)}/retry`, {}))));
|
|
39
|
+
const rollback$ = actions$.pipe(filter(rollbackInvoicingMigration.match), mergeMap((action) => handleResponse('rollback', zeniAPI.postAndGetJSON(`${base()}/${encodeURIComponent(action.payload)}/rollback`, {}))));
|
|
40
|
+
return merge(connect$, upload$, start$, retry$, rollback$);
|
|
41
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
export const initialState = {
|
|
3
|
+
byKind: {},
|
|
4
|
+
};
|
|
5
|
+
const inProgress = (draft, kind) => {
|
|
6
|
+
draft.byKind[kind] = { fetchState: 'In-Progress', error: undefined };
|
|
7
|
+
};
|
|
8
|
+
const dataImportAction = createSlice({
|
|
9
|
+
name: 'invoicingDataImportAction',
|
|
10
|
+
initialState,
|
|
11
|
+
reducers: {
|
|
12
|
+
connectInvoicingChargebee: {
|
|
13
|
+
reducer(draft) {
|
|
14
|
+
inProgress(draft, 'connect');
|
|
15
|
+
},
|
|
16
|
+
prepare(payload) {
|
|
17
|
+
return { payload };
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
uploadInvoicingMigrationFiles: {
|
|
21
|
+
reducer(draft) {
|
|
22
|
+
inProgress(draft, 'upload');
|
|
23
|
+
},
|
|
24
|
+
prepare(payload) {
|
|
25
|
+
return { payload };
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
startInvoicingMigration: {
|
|
29
|
+
reducer(draft) {
|
|
30
|
+
inProgress(draft, 'start');
|
|
31
|
+
},
|
|
32
|
+
prepare(payload) {
|
|
33
|
+
return { payload };
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
retryInvoicingMigration: {
|
|
37
|
+
reducer(draft) {
|
|
38
|
+
inProgress(draft, 'retry');
|
|
39
|
+
},
|
|
40
|
+
prepare(payload) {
|
|
41
|
+
return { payload };
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
rollbackInvoicingMigration: {
|
|
45
|
+
reducer(draft) {
|
|
46
|
+
inProgress(draft, 'rollback');
|
|
47
|
+
},
|
|
48
|
+
prepare(payload) {
|
|
49
|
+
return { payload };
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
invoicingDataImportActionSuccess(draft, action) {
|
|
53
|
+
draft.byKind[action.payload] = {
|
|
54
|
+
fetchState: 'Completed',
|
|
55
|
+
error: undefined,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
invoicingDataImportActionFailure(draft, action) {
|
|
59
|
+
draft.byKind[action.payload.kind] = {
|
|
60
|
+
fetchState: 'Error',
|
|
61
|
+
error: action.payload.error,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
clearInvoicingDataImportAction(draft, action) {
|
|
65
|
+
delete draft.byKind[action.payload];
|
|
66
|
+
},
|
|
67
|
+
clearAllInvoicingDataImportActions(draft) {
|
|
68
|
+
draft.byKind = {};
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
export const { connectInvoicingChargebee, uploadInvoicingMigrationFiles, startInvoicingMigration, retryInvoicingMigration, rollbackInvoicingMigration, invoicingDataImportActionSuccess, invoicingDataImportActionFailure, clearInvoicingDataImportAction, clearAllInvoicingDataImportActions, } = dataImportAction.actions;
|
|
73
|
+
export default dataImportAction.reducer;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
4
|
+
import { invoicingBaseUrl } from '../invoicingApiHelper';
|
|
5
|
+
import { fetchInvoicingDataImportStatus, fetchInvoicingMigrationSession, fetchInvoicingMigrationSessions, updateInvoicingDataImportStatus, updateInvoicingDataImportStatusFailure, updateInvoicingMigrationSessions, updateInvoicingMigrationSessionsFailure, upsertInvoicingMigrationSession, } from './dataImportViewReducer';
|
|
6
|
+
export const fetchInvoicingMigrationSessionsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingMigrationSessions.match), switchMap(() => {
|
|
7
|
+
const apiUrl = `${invoicingBaseUrl(zeniAPI)}/data-import/sessions`;
|
|
8
|
+
return zeniAPI
|
|
9
|
+
.getJSON(apiUrl)
|
|
10
|
+
.pipe(switchMap((response) => {
|
|
11
|
+
if (isSuccessResponse(response)) {
|
|
12
|
+
return of(updateInvoicingMigrationSessions(response.data ?? []));
|
|
13
|
+
}
|
|
14
|
+
return of(updateInvoicingMigrationSessionsFailure(response.status));
|
|
15
|
+
}), catchError((error) => of(updateInvoicingMigrationSessionsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch migration sessions REST API call errored out ' +
|
|
16
|
+
JSON.stringify(error))))));
|
|
17
|
+
}));
|
|
18
|
+
export const fetchInvoicingDataImportStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingDataImportStatus.match), switchMap(() => {
|
|
19
|
+
const apiUrl = `${invoicingBaseUrl(zeniAPI)}/data-import/status`;
|
|
20
|
+
return zeniAPI
|
|
21
|
+
.getJSON(apiUrl)
|
|
22
|
+
.pipe(switchMap((response) => {
|
|
23
|
+
if (isSuccessResponse(response)) {
|
|
24
|
+
return of(updateInvoicingDataImportStatus(response.data ?? []));
|
|
25
|
+
}
|
|
26
|
+
return of(updateInvoicingDataImportStatusFailure(response.status));
|
|
27
|
+
}), catchError((error) => of(updateInvoicingDataImportStatusFailure(createZeniAPIStatus('Unexpected Error', 'Fetch data import status REST API call errored out ' +
|
|
28
|
+
JSON.stringify(error))))));
|
|
29
|
+
}));
|
|
30
|
+
export const fetchInvoicingMigrationSessionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingMigrationSession.match), mergeMap((action) => {
|
|
31
|
+
const apiUrl = `${invoicingBaseUrl(zeniAPI)}/data-import/${encodeURIComponent(action.payload)}`;
|
|
32
|
+
return zeniAPI
|
|
33
|
+
.getJSON(apiUrl)
|
|
34
|
+
.pipe(switchMap((response) => {
|
|
35
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
36
|
+
return of(upsertInvoicingMigrationSession(response.data));
|
|
37
|
+
}
|
|
38
|
+
return of(updateInvoicingMigrationSessionsFailure(response.status));
|
|
39
|
+
}), catchError((error) => of(updateInvoicingMigrationSessionsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch migration session REST API call errored out ' +
|
|
40
|
+
JSON.stringify(error))))));
|
|
41
|
+
}));
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
export const initialState = {
|
|
3
|
+
activeDetailId: null,
|
|
4
|
+
sessions: [],
|
|
5
|
+
sessionsFetch: { fetchState: 'Not-Started', error: undefined },
|
|
6
|
+
statusRows: [],
|
|
7
|
+
statusFetch: { fetchState: 'Not-Started', error: undefined },
|
|
8
|
+
sessionDetail: {},
|
|
9
|
+
};
|
|
10
|
+
const upsertSessionInList = (list, session) => {
|
|
11
|
+
const index = list.findIndex((item) => item.id === session.id);
|
|
12
|
+
if (index >= 0) {
|
|
13
|
+
const next = [...list];
|
|
14
|
+
next[index] = session;
|
|
15
|
+
return next;
|
|
16
|
+
}
|
|
17
|
+
return [session, ...list];
|
|
18
|
+
};
|
|
19
|
+
const dataImportView = createSlice({
|
|
20
|
+
name: 'invoicingDataImportView',
|
|
21
|
+
initialState,
|
|
22
|
+
reducers: {
|
|
23
|
+
fetchInvoicingMigrationSessions(draft) {
|
|
24
|
+
draft.sessionsFetch = { fetchState: 'In-Progress', error: undefined };
|
|
25
|
+
},
|
|
26
|
+
updateInvoicingMigrationSessions(draft, action) {
|
|
27
|
+
draft.sessions = action.payload;
|
|
28
|
+
draft.sessionsFetch = { fetchState: 'Completed', error: undefined };
|
|
29
|
+
},
|
|
30
|
+
updateInvoicingMigrationSessionsFailure(draft, action) {
|
|
31
|
+
draft.sessionsFetch = { fetchState: 'Error', error: action.payload };
|
|
32
|
+
},
|
|
33
|
+
fetchInvoicingDataImportStatus(draft) {
|
|
34
|
+
draft.statusFetch = { fetchState: 'In-Progress', error: undefined };
|
|
35
|
+
},
|
|
36
|
+
updateInvoicingDataImportStatus(draft, action) {
|
|
37
|
+
draft.statusRows = action.payload;
|
|
38
|
+
draft.statusFetch = { fetchState: 'Completed', error: undefined };
|
|
39
|
+
},
|
|
40
|
+
updateInvoicingDataImportStatusFailure(draft, action) {
|
|
41
|
+
draft.statusFetch = { fetchState: 'Error', error: action.payload };
|
|
42
|
+
},
|
|
43
|
+
setInvoicingActiveMigrationSessionId(draft, action) {
|
|
44
|
+
draft.activeDetailId = action.payload;
|
|
45
|
+
},
|
|
46
|
+
fetchInvoicingMigrationSession(draft, action) {
|
|
47
|
+
// Detail/polling fetch is handled by the epic; the cache is updated via
|
|
48
|
+
// upsert. We track the in-flight id so the UI can scope its polling.
|
|
49
|
+
draft.activeDetailId = action.payload;
|
|
50
|
+
},
|
|
51
|
+
upsertInvoicingMigrationSession(draft, action) {
|
|
52
|
+
draft.sessionDetail[action.payload.id] = action.payload;
|
|
53
|
+
draft.sessions = upsertSessionInList(draft.sessions, action.payload);
|
|
54
|
+
},
|
|
55
|
+
clearInvoicingDataImportView(draft) {
|
|
56
|
+
draft.activeDetailId = null;
|
|
57
|
+
draft.sessions = [];
|
|
58
|
+
draft.sessionsFetch = { fetchState: 'Not-Started', error: undefined };
|
|
59
|
+
draft.statusRows = [];
|
|
60
|
+
draft.statusFetch = { fetchState: 'Not-Started', error: undefined };
|
|
61
|
+
draft.sessionDetail = {};
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
export const { fetchInvoicingMigrationSessions, updateInvoicingMigrationSessions, updateInvoicingMigrationSessionsFailure, fetchInvoicingDataImportStatus, updateInvoicingDataImportStatus, updateInvoicingDataImportStatusFailure, fetchInvoicingMigrationSession, setInvoicingActiveMigrationSessionId, upsertInvoicingMigrationSession, clearInvoicingDataImportView, } = dataImportView.actions;
|
|
66
|
+
export default dataImportView.reducer;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const getInvoicingMigrationSessions = (state) => state.invoicingDataImportViewState.sessions;
|
|
2
|
+
export const getInvoicingMigrationSessionsFetchState = (state) => state.invoicingDataImportViewState.sessionsFetch;
|
|
3
|
+
export const getInvoicingDataImportStatusRows = (state) => state.invoicingDataImportViewState.statusRows;
|
|
4
|
+
export const getInvoicingDataImportStatusFetchState = (state) => state.invoicingDataImportViewState.statusFetch;
|
|
5
|
+
export const getInvoicingMigrationSessionById = (id) => (state) => id != null ? state.invoicingDataImportViewState.sessionDetail[id] : undefined;
|
|
6
|
+
export const getInvoicingActiveMigrationSessionId = (state) => state.invoicingDataImportViewState.activeDetailId;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { updateInvoicingDunningCases } from '../../../entity/invoicing/dunningCase/dunningCaseReducer';
|
|
4
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
5
|
+
import { invoicingBaseUrl } from '../invoicingApiHelper';
|
|
6
|
+
import { runInvoicingDunningAction, runInvoicingDunningActionFailure, runInvoicingDunningActionSuccess, } from './dunningActionReducer';
|
|
7
|
+
export const runInvoicingDunningActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(runInvoicingDunningAction.match), mergeMap((action) => {
|
|
8
|
+
const { action: kind, body, id } = action.payload;
|
|
9
|
+
const apiUrl = `${invoicingBaseUrl(zeniAPI)}/dunning/${encodeURIComponent(id)}/${kind}`;
|
|
10
|
+
return zeniAPI
|
|
11
|
+
.postAndGetJSON(apiUrl, body ?? {})
|
|
12
|
+
.pipe(mergeMap((response) => {
|
|
13
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
14
|
+
return [
|
|
15
|
+
updateInvoicingDunningCases([response.data], 'merge'),
|
|
16
|
+
runInvoicingDunningActionSuccess({ id }),
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
return of(runInvoicingDunningActionFailure({
|
|
20
|
+
error: response.status,
|
|
21
|
+
id,
|
|
22
|
+
}));
|
|
23
|
+
}), catchError((error) => of(runInvoicingDunningActionFailure({
|
|
24
|
+
error: createZeniAPIStatus('Unexpected Error', 'Dunning action REST API call errored out ' +
|
|
25
|
+
JSON.stringify(error)),
|
|
26
|
+
id,
|
|
27
|
+
}))));
|
|
28
|
+
}));
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
export const initialState = {
|
|
3
|
+
byId: {},
|
|
4
|
+
};
|
|
5
|
+
const dunningAction = createSlice({
|
|
6
|
+
name: 'invoicingDunningAction',
|
|
7
|
+
initialState,
|
|
8
|
+
reducers: {
|
|
9
|
+
runInvoicingDunningAction(draft, action) {
|
|
10
|
+
draft.byId[action.payload.id] = {
|
|
11
|
+
fetchState: 'In-Progress',
|
|
12
|
+
error: undefined,
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
runInvoicingDunningActionSuccess(draft, action) {
|
|
16
|
+
draft.byId[action.payload.id] = {
|
|
17
|
+
fetchState: 'Completed',
|
|
18
|
+
error: undefined,
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
runInvoicingDunningActionFailure(draft, action) {
|
|
22
|
+
draft.byId[action.payload.id] = {
|
|
23
|
+
fetchState: 'Error',
|
|
24
|
+
error: action.payload.error,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
clearInvoicingDunningAction(draft, action) {
|
|
28
|
+
delete draft.byId[action.payload];
|
|
29
|
+
},
|
|
30
|
+
clearAllInvoicingDunningActions(draft) {
|
|
31
|
+
draft.byId = {};
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
export const { runInvoicingDunningAction, runInvoicingDunningActionSuccess, runInvoicingDunningActionFailure, clearInvoicingDunningAction, clearAllInvoicingDunningActions, } = dunningAction.actions;
|
|
36
|
+
export default dunningAction.reducer;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { updateInvoicingDunningCases } from '../../../entity/invoicing/dunningCase/dunningCaseReducer';
|
|
4
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
5
|
+
import { INVOICING_LIST_PAGE_SIZE, applyListSortParams, invoicingBaseUrl, withQuery, } from '../invoicingApiHelper';
|
|
6
|
+
import { fetchInvoicingDunningCaseCounts, fetchInvoicingDunningCaseDetail, fetchInvoicingDunningCaseKPIs, fetchInvoicingDunningCaseList, updateInvoicingDunningCaseCounts, updateInvoicingDunningCaseCountsFailure, updateInvoicingDunningCaseDetail, updateInvoicingDunningCaseDetailFailure, updateInvoicingDunningCaseKPIs, updateInvoicingDunningCaseKPIsFailure, updateInvoicingDunningCaseList, updateInvoicingDunningCaseListFailure, } from './dunningCaseViewReducer';
|
|
7
|
+
const buildQuery = (filters, cursor, sort) => {
|
|
8
|
+
const params = new URLSearchParams();
|
|
9
|
+
if (filters.status != null && filters.status.length > 0) {
|
|
10
|
+
params.set('status', filters.status);
|
|
11
|
+
}
|
|
12
|
+
if (filters.search != null && filters.search.length > 0) {
|
|
13
|
+
params.set('search', filters.search);
|
|
14
|
+
}
|
|
15
|
+
params.set('limit', String(INVOICING_LIST_PAGE_SIZE));
|
|
16
|
+
if (cursor != null) {
|
|
17
|
+
params.set('cursor', cursor);
|
|
18
|
+
}
|
|
19
|
+
applyListSortParams(params, sort);
|
|
20
|
+
return params;
|
|
21
|
+
};
|
|
22
|
+
export const fetchInvoicingDunningCaseListEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingDunningCaseList.match), switchMap((action) => {
|
|
23
|
+
const { filters, cursor, keepExistingListItems, sort } = action.payload;
|
|
24
|
+
const apiUrl = withQuery(`${invoicingBaseUrl(zeniAPI)}/dunning`, buildQuery(filters, cursor, sort));
|
|
25
|
+
return zeniAPI
|
|
26
|
+
.getJSON(apiUrl)
|
|
27
|
+
.pipe(switchMap((response) => {
|
|
28
|
+
if (isSuccessResponse(response)) {
|
|
29
|
+
const items = response.data?.items ?? [];
|
|
30
|
+
return [
|
|
31
|
+
updateInvoicingDunningCases(items, 'merge'),
|
|
32
|
+
updateInvoicingDunningCaseList({
|
|
33
|
+
ids: items.map((item) => item.id),
|
|
34
|
+
nextCursor: response.data?.next_cursor ?? null,
|
|
35
|
+
keepExistingListItems,
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
return of(updateInvoicingDunningCaseListFailure(response.status));
|
|
40
|
+
}), catchError((error) => of(updateInvoicingDunningCaseListFailure(createZeniAPIStatus('Unexpected Error', 'Fetch dunning list REST API call errored out ' +
|
|
41
|
+
JSON.stringify(error))))));
|
|
42
|
+
}));
|
|
43
|
+
export const fetchInvoicingDunningCaseCountsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingDunningCaseCounts.match), switchMap(() => {
|
|
44
|
+
const { filters } = state$.value.invoicingDunningCaseViewState;
|
|
45
|
+
const params = new URLSearchParams();
|
|
46
|
+
if (filters.search != null && filters.search.length > 0) {
|
|
47
|
+
params.set('search', filters.search);
|
|
48
|
+
}
|
|
49
|
+
const apiUrl = withQuery(`${invoicingBaseUrl(zeniAPI)}/dunning/counts`, params);
|
|
50
|
+
return zeniAPI.getJSON(apiUrl).pipe(switchMap((response) => {
|
|
51
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
52
|
+
return of(updateInvoicingDunningCaseCounts(response.data));
|
|
53
|
+
}
|
|
54
|
+
return of(updateInvoicingDunningCaseCountsFailure(response.status));
|
|
55
|
+
}), catchError((error) => of(updateInvoicingDunningCaseCountsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch dunning counts REST API call errored out ' +
|
|
56
|
+
JSON.stringify(error))))));
|
|
57
|
+
}));
|
|
58
|
+
export const fetchInvoicingDunningCaseKPIsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingDunningCaseKPIs.match), switchMap(() => {
|
|
59
|
+
const apiUrl = `${invoicingBaseUrl(zeniAPI)}/dunning/kpis`;
|
|
60
|
+
return zeniAPI
|
|
61
|
+
.getJSON(apiUrl)
|
|
62
|
+
.pipe(switchMap((response) => {
|
|
63
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
64
|
+
return of(updateInvoicingDunningCaseKPIs(response.data));
|
|
65
|
+
}
|
|
66
|
+
return of(updateInvoicingDunningCaseKPIsFailure(response.status));
|
|
67
|
+
}), catchError((error) => of(updateInvoicingDunningCaseKPIsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch dunning KPIs REST API call errored out ' +
|
|
68
|
+
JSON.stringify(error))))));
|
|
69
|
+
}));
|
|
70
|
+
export const fetchInvoicingDunningCaseDetailEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingDunningCaseDetail.match), switchMap((action) => {
|
|
71
|
+
const { id } = action.payload;
|
|
72
|
+
const apiUrl = `${invoicingBaseUrl(zeniAPI)}/dunning/${id}`;
|
|
73
|
+
return zeniAPI
|
|
74
|
+
.getJSON(apiUrl)
|
|
75
|
+
.pipe(switchMap((response) => {
|
|
76
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
77
|
+
return [
|
|
78
|
+
updateInvoicingDunningCases([response.data], 'merge'),
|
|
79
|
+
updateInvoicingDunningCaseDetail({ id: response.data.id }),
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
return of(updateInvoicingDunningCaseDetailFailure(response.status));
|
|
83
|
+
}), catchError((error) => of(updateInvoicingDunningCaseDetailFailure(createZeniAPIStatus('Unexpected Error', 'Fetch dunning detail REST API call errored out ' +
|
|
84
|
+
JSON.stringify(error))))));
|
|
85
|
+
}));
|