@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,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.resetInvoicingCustomerPaymentMethod = exports.sendInvoicingPaymentLinkFailure = exports.sendInvoicingPaymentLinkSuccess = exports.sendInvoicingPaymentLink = exports.saveInvoicingPaymentMethodFailure = exports.saveInvoicingPaymentMethodSuccess = exports.saveInvoicingPaymentMethod = exports.fetchInvoicingPlaidLinkTokenFailure = exports.fetchInvoicingPlaidLinkTokenSuccess = exports.fetchInvoicingPlaidLinkToken = exports.createInvoicingSetupIntentFailure = exports.createInvoicingSetupIntentSuccess = exports.createInvoicingSetupIntent = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
exports.initialState = {
|
|
7
|
+
fetchState: 'Not-Started',
|
|
8
|
+
error: undefined,
|
|
9
|
+
customerId: undefined,
|
|
10
|
+
plaidLinkToken: undefined,
|
|
11
|
+
plaidTokenFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
12
|
+
saveFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
13
|
+
sendLinkFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
14
|
+
sentLinkEmail: undefined,
|
|
15
|
+
setupIntent: undefined,
|
|
16
|
+
setupIntentFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
17
|
+
hasValidState() {
|
|
18
|
+
return true;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const customerPaymentMethod = (0, toolkit_1.createSlice)({
|
|
22
|
+
name: 'invoicingCustomerPaymentMethod',
|
|
23
|
+
initialState: exports.initialState,
|
|
24
|
+
reducers: {
|
|
25
|
+
createInvoicingSetupIntent(draft, action) {
|
|
26
|
+
draft.customerId = action.payload.customerId;
|
|
27
|
+
draft.setupIntent = undefined;
|
|
28
|
+
draft.setupIntentFetchState = {
|
|
29
|
+
fetchState: 'In-Progress',
|
|
30
|
+
error: undefined,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
createInvoicingSetupIntentSuccess(draft, action) {
|
|
34
|
+
draft.setupIntent = action.payload;
|
|
35
|
+
draft.setupIntentFetchState = {
|
|
36
|
+
fetchState: 'Completed',
|
|
37
|
+
error: undefined,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
createInvoicingSetupIntentFailure(draft, action) {
|
|
41
|
+
draft.setupIntentFetchState = {
|
|
42
|
+
fetchState: 'Error',
|
|
43
|
+
error: action.payload,
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
fetchInvoicingPlaidLinkToken(draft, action) {
|
|
47
|
+
draft.customerId = action.payload.customerId;
|
|
48
|
+
draft.plaidLinkToken = undefined;
|
|
49
|
+
draft.plaidTokenFetchState = {
|
|
50
|
+
fetchState: 'In-Progress',
|
|
51
|
+
error: undefined,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
fetchInvoicingPlaidLinkTokenSuccess(draft, action) {
|
|
55
|
+
draft.plaidLinkToken = action.payload;
|
|
56
|
+
draft.plaidTokenFetchState = { fetchState: 'Completed', error: undefined };
|
|
57
|
+
},
|
|
58
|
+
fetchInvoicingPlaidLinkTokenFailure(draft, action) {
|
|
59
|
+
draft.plaidTokenFetchState = { fetchState: 'Error', error: action.payload };
|
|
60
|
+
},
|
|
61
|
+
saveInvoicingPaymentMethod(draft, action) {
|
|
62
|
+
draft.customerId = action.payload.customerId;
|
|
63
|
+
draft.saveFetchState = { fetchState: 'In-Progress', error: undefined };
|
|
64
|
+
},
|
|
65
|
+
saveInvoicingPaymentMethodSuccess(draft) {
|
|
66
|
+
draft.saveFetchState = { fetchState: 'Completed', error: undefined };
|
|
67
|
+
},
|
|
68
|
+
saveInvoicingPaymentMethodFailure(draft, action) {
|
|
69
|
+
draft.saveFetchState = { fetchState: 'Error', error: action.payload };
|
|
70
|
+
},
|
|
71
|
+
sendInvoicingPaymentLink(draft, action) {
|
|
72
|
+
draft.customerId = action.payload.customerId;
|
|
73
|
+
draft.sendLinkFetchState = { fetchState: 'In-Progress', error: undefined };
|
|
74
|
+
},
|
|
75
|
+
sendInvoicingPaymentLinkSuccess(draft, action) {
|
|
76
|
+
draft.sentLinkEmail = action.payload;
|
|
77
|
+
draft.sendLinkFetchState = { fetchState: 'Completed', error: undefined };
|
|
78
|
+
},
|
|
79
|
+
sendInvoicingPaymentLinkFailure(draft, action) {
|
|
80
|
+
draft.sendLinkFetchState = { fetchState: 'Error', error: action.payload };
|
|
81
|
+
},
|
|
82
|
+
resetInvoicingCustomerPaymentMethod(draft) {
|
|
83
|
+
Object.assign(draft, exports.initialState);
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
_a = customerPaymentMethod.actions, exports.createInvoicingSetupIntent = _a.createInvoicingSetupIntent, exports.createInvoicingSetupIntentSuccess = _a.createInvoicingSetupIntentSuccess, exports.createInvoicingSetupIntentFailure = _a.createInvoicingSetupIntentFailure, exports.fetchInvoicingPlaidLinkToken = _a.fetchInvoicingPlaidLinkToken, exports.fetchInvoicingPlaidLinkTokenSuccess = _a.fetchInvoicingPlaidLinkTokenSuccess, exports.fetchInvoicingPlaidLinkTokenFailure = _a.fetchInvoicingPlaidLinkTokenFailure, exports.saveInvoicingPaymentMethod = _a.saveInvoicingPaymentMethod, exports.saveInvoicingPaymentMethodSuccess = _a.saveInvoicingPaymentMethodSuccess, exports.saveInvoicingPaymentMethodFailure = _a.saveInvoicingPaymentMethodFailure, exports.sendInvoicingPaymentLink = _a.sendInvoicingPaymentLink, exports.sendInvoicingPaymentLinkSuccess = _a.sendInvoicingPaymentLinkSuccess, exports.sendInvoicingPaymentLinkFailure = _a.sendInvoicingPaymentLinkFailure, exports.resetInvoicingCustomerPaymentMethod = _a.resetInvoicingCustomerPaymentMethod;
|
|
88
|
+
exports.default = customerPaymentMethod.reducer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
|
+
import { RootState } from '../../../reducer';
|
|
3
|
+
import { InvoicingSetupIntent } from './customerPaymentMethodReducer';
|
|
4
|
+
export declare const getInvoicingSetupIntent: (state: RootState) => InvoicingSetupIntent | undefined;
|
|
5
|
+
export declare const getInvoicingSetupIntentFetchState: (state: RootState) => FetchStateAndError;
|
|
6
|
+
export declare const getInvoicingPlaidLinkToken: (state: RootState) => string | undefined;
|
|
7
|
+
export declare const getInvoicingPlaidLinkTokenFetchState: (state: RootState) => FetchStateAndError;
|
|
8
|
+
export declare const getInvoicingPaymentMethodSaveState: (state: RootState) => FetchStateAndError;
|
|
9
|
+
export declare const getInvoicingPaymentLinkSendState: (state: RootState) => FetchStateAndError;
|
|
10
|
+
export declare const getInvoicingSentPaymentLinkEmail: (state: RootState) => string | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInvoicingSentPaymentLinkEmail = exports.getInvoicingPaymentLinkSendState = exports.getInvoicingPaymentMethodSaveState = exports.getInvoicingPlaidLinkTokenFetchState = exports.getInvoicingPlaidLinkToken = exports.getInvoicingSetupIntentFetchState = exports.getInvoicingSetupIntent = void 0;
|
|
4
|
+
const getInvoicingSetupIntent = (state) => state.invoicingCustomerPaymentMethodState.setupIntent;
|
|
5
|
+
exports.getInvoicingSetupIntent = getInvoicingSetupIntent;
|
|
6
|
+
const getInvoicingSetupIntentFetchState = (state) => state.invoicingCustomerPaymentMethodState.setupIntentFetchState;
|
|
7
|
+
exports.getInvoicingSetupIntentFetchState = getInvoicingSetupIntentFetchState;
|
|
8
|
+
const getInvoicingPlaidLinkToken = (state) => state.invoicingCustomerPaymentMethodState.plaidLinkToken;
|
|
9
|
+
exports.getInvoicingPlaidLinkToken = getInvoicingPlaidLinkToken;
|
|
10
|
+
const getInvoicingPlaidLinkTokenFetchState = (state) => state.invoicingCustomerPaymentMethodState.plaidTokenFetchState;
|
|
11
|
+
exports.getInvoicingPlaidLinkTokenFetchState = getInvoicingPlaidLinkTokenFetchState;
|
|
12
|
+
const getInvoicingPaymentMethodSaveState = (state) => state.invoicingCustomerPaymentMethodState.saveFetchState;
|
|
13
|
+
exports.getInvoicingPaymentMethodSaveState = getInvoicingPaymentMethodSaveState;
|
|
14
|
+
const getInvoicingPaymentLinkSendState = (state) => state.invoicingCustomerPaymentMethodState.sendLinkFetchState;
|
|
15
|
+
exports.getInvoicingPaymentLinkSendState = getInvoicingPaymentLinkSendState;
|
|
16
|
+
const getInvoicingSentPaymentLinkEmail = (state) => state.invoicingCustomerPaymentMethodState.sentLinkEmail;
|
|
17
|
+
exports.getInvoicingSentPaymentLinkEmail = getInvoicingSentPaymentLinkEmail;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateInvoicingCustomers } from '../../../entity/invoicing/customer/customerReducer';
|
|
4
|
+
import { RootState } from '../../../reducer';
|
|
5
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
+
import { fetchInvoicingCustomerCounts, fetchInvoicingCustomerDetail, fetchInvoicingCustomerList, updateInvoicingCustomerCounts, updateInvoicingCustomerCountsFailure, updateInvoicingCustomerDetail, updateInvoicingCustomerDetailFailure, updateInvoicingCustomerList, updateInvoicingCustomerListFailure } from './customerViewReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchInvoicingCustomerList> | ReturnType<typeof fetchInvoicingCustomerCounts> | ReturnType<typeof fetchInvoicingCustomerDetail> | ReturnType<typeof updateInvoicingCustomerList> | ReturnType<typeof updateInvoicingCustomerListFailure> | ReturnType<typeof updateInvoicingCustomerCounts> | ReturnType<typeof updateInvoicingCustomerCountsFailure> | ReturnType<typeof updateInvoicingCustomerDetail> | ReturnType<typeof updateInvoicingCustomerDetailFailure> | ReturnType<typeof updateInvoicingCustomers>;
|
|
8
|
+
export declare const fetchInvoicingCustomerListEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
9
|
+
export declare const fetchInvoicingCustomerCountsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
10
|
+
export declare const fetchInvoicingCustomerDetailEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchInvoicingCustomerDetailEpic = exports.fetchInvoicingCustomerCountsEpic = exports.fetchInvoicingCustomerListEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const customerReducer_1 = require("../../../entity/invoicing/customer/customerReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
+
const invoicingApiHelper_1 = require("../invoicingApiHelper");
|
|
9
|
+
const customerViewReducer_1 = require("./customerViewReducer");
|
|
10
|
+
const buildQuery = (filters, cursor, sort) => {
|
|
11
|
+
const params = new URLSearchParams();
|
|
12
|
+
if (filters.search != null && filters.search.length > 0) {
|
|
13
|
+
params.set('search', filters.search);
|
|
14
|
+
}
|
|
15
|
+
if (filters.status != null && filters.status.length > 0) {
|
|
16
|
+
params.set('status', filters.status);
|
|
17
|
+
}
|
|
18
|
+
params.set('limit', String(invoicingApiHelper_1.INVOICING_LIST_PAGE_SIZE));
|
|
19
|
+
if (cursor != null) {
|
|
20
|
+
params.set('cursor', cursor);
|
|
21
|
+
}
|
|
22
|
+
(0, invoicingApiHelper_1.applyListSortParams)(params, sort);
|
|
23
|
+
return params;
|
|
24
|
+
};
|
|
25
|
+
const fetchInvoicingCustomerListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(customerViewReducer_1.fetchInvoicingCustomerList.match), (0, operators_1.switchMap)((action) => {
|
|
26
|
+
const { filters, cursor, keepExistingListItems, sort } = action.payload;
|
|
27
|
+
const apiUrl = (0, invoicingApiHelper_1.withQuery)(`${(0, invoicingApiHelper_1.invoicingBaseUrl)(zeniAPI)}/customers`, buildQuery(filters, cursor, sort));
|
|
28
|
+
return zeniAPI
|
|
29
|
+
.getJSON(apiUrl)
|
|
30
|
+
.pipe((0, operators_1.switchMap)((response) => {
|
|
31
|
+
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
32
|
+
const items = response.data?.items ?? [];
|
|
33
|
+
return [
|
|
34
|
+
(0, customerReducer_1.updateInvoicingCustomers)(items, 'merge'),
|
|
35
|
+
(0, customerViewReducer_1.updateInvoicingCustomerList)({
|
|
36
|
+
ids: items.map((item) => item.id),
|
|
37
|
+
nextCursor: response.data?.next_cursor ?? null,
|
|
38
|
+
keepExistingListItems,
|
|
39
|
+
}),
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
return (0, rxjs_1.of)((0, customerViewReducer_1.updateInvoicingCustomerListFailure)(response.status));
|
|
43
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, customerViewReducer_1.updateInvoicingCustomerListFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch customer list REST API call errored out ' +
|
|
44
|
+
JSON.stringify(error))))));
|
|
45
|
+
}));
|
|
46
|
+
exports.fetchInvoicingCustomerListEpic = fetchInvoicingCustomerListEpic;
|
|
47
|
+
const fetchInvoicingCustomerCountsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(customerViewReducer_1.fetchInvoicingCustomerCounts.match), (0, operators_1.switchMap)(() => {
|
|
48
|
+
const { filters } = state$.value.invoicingCustomerViewState;
|
|
49
|
+
const params = new URLSearchParams();
|
|
50
|
+
if (filters.search != null && filters.search.length > 0) {
|
|
51
|
+
params.set('search', filters.search);
|
|
52
|
+
}
|
|
53
|
+
const apiUrl = (0, invoicingApiHelper_1.withQuery)(`${(0, invoicingApiHelper_1.invoicingBaseUrl)(zeniAPI)}/customers/counts`, params);
|
|
54
|
+
return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
|
|
55
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
56
|
+
return (0, rxjs_1.of)((0, customerViewReducer_1.updateInvoicingCustomerCounts)(response.data));
|
|
57
|
+
}
|
|
58
|
+
return (0, rxjs_1.of)((0, customerViewReducer_1.updateInvoicingCustomerCountsFailure)(response.status));
|
|
59
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, customerViewReducer_1.updateInvoicingCustomerCountsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch customer counts REST API call errored out ' +
|
|
60
|
+
JSON.stringify(error))))));
|
|
61
|
+
}));
|
|
62
|
+
exports.fetchInvoicingCustomerCountsEpic = fetchInvoicingCustomerCountsEpic;
|
|
63
|
+
const fetchInvoicingCustomerDetailEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(customerViewReducer_1.fetchInvoicingCustomerDetail.match), (0, operators_1.switchMap)((action) => {
|
|
64
|
+
const { id } = action.payload;
|
|
65
|
+
const apiUrl = `${(0, invoicingApiHelper_1.invoicingBaseUrl)(zeniAPI)}/customers/${id}`;
|
|
66
|
+
return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
|
|
67
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
68
|
+
return [
|
|
69
|
+
(0, customerReducer_1.updateInvoicingCustomers)([response.data], 'merge'),
|
|
70
|
+
(0, customerViewReducer_1.updateInvoicingCustomerDetail)({ id: response.data.id }),
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
return (0, rxjs_1.of)((0, customerViewReducer_1.updateInvoicingCustomerDetailFailure)(response.status));
|
|
74
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, customerViewReducer_1.updateInvoicingCustomerDetailFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch customer detail REST API call errored out ' +
|
|
75
|
+
JSON.stringify(error))))));
|
|
76
|
+
}));
|
|
77
|
+
exports.fetchInvoicingCustomerDetailEpic = fetchInvoicingCustomerDetailEpic;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
|
+
import { InvoicingListCounts } from '../../../entity/invoicing/invoicingTypes';
|
|
3
|
+
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
4
|
+
import { InvoicingListSort } from '../invoicingApiHelper';
|
|
5
|
+
export interface InvoicingCustomerFilters {
|
|
6
|
+
search?: string;
|
|
7
|
+
status?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface InvoicingCustomerViewState extends FetchedState {
|
|
10
|
+
counts: InvoicingListCounts;
|
|
11
|
+
countsFetchState: FetchStateAndError;
|
|
12
|
+
detailFetchState: FetchStateAndError;
|
|
13
|
+
filters: InvoicingCustomerFilters;
|
|
14
|
+
ids: ID[];
|
|
15
|
+
nextCursor: string | null;
|
|
16
|
+
detailId?: ID;
|
|
17
|
+
/** Active server-side sort (undefined = backend default order). */
|
|
18
|
+
sort?: InvoicingListSort;
|
|
19
|
+
}
|
|
20
|
+
export declare const initialState: InvoicingCustomerViewState;
|
|
21
|
+
export declare const fetchInvoicingCustomerList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
|
|
22
|
+
cursor?: string;
|
|
23
|
+
filters?: InvoicingCustomerFilters;
|
|
24
|
+
keepExistingListItems?: boolean;
|
|
25
|
+
sort?: InvoicingListSort;
|
|
26
|
+
}], {
|
|
27
|
+
filters: InvoicingCustomerFilters;
|
|
28
|
+
cursor: string | undefined;
|
|
29
|
+
keepExistingListItems: boolean;
|
|
30
|
+
sort: InvoicingListSort | undefined;
|
|
31
|
+
}, "invoicingCustomerView/fetchInvoicingCustomerList", never, never>, updateInvoicingCustomerList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
32
|
+
ids: ID[];
|
|
33
|
+
keepExistingListItems: boolean;
|
|
34
|
+
nextCursor: string | null;
|
|
35
|
+
}, "invoicingCustomerView/updateInvoicingCustomerList">, updateInvoicingCustomerListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerView/updateInvoicingCustomerListFailure">, fetchInvoicingCustomerCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCustomerView/fetchInvoicingCustomerCounts">, updateInvoicingCustomerCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingCustomerView/updateInvoicingCustomerCounts">, updateInvoicingCustomerCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerView/updateInvoicingCustomerCountsFailure">, updateInvoicingCustomerFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingCustomerFilters, "invoicingCustomerView/updateInvoicingCustomerFilters">, fetchInvoicingCustomerDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
36
|
+
id: ID;
|
|
37
|
+
}, "invoicingCustomerView/fetchInvoicingCustomerDetail">, updateInvoicingCustomerDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
38
|
+
id: ID;
|
|
39
|
+
}, "invoicingCustomerView/updateInvoicingCustomerDetail">, updateInvoicingCustomerDetailFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerView/updateInvoicingCustomerDetailFailure">, clearInvoicingCustomerView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCustomerView/clearInvoicingCustomerView">;
|
|
40
|
+
declare const _default: import("redux").Reducer<InvoicingCustomerViewState>;
|
|
41
|
+
export default _default;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearInvoicingCustomerView = exports.updateInvoicingCustomerDetailFailure = exports.updateInvoicingCustomerDetail = exports.fetchInvoicingCustomerDetail = exports.updateInvoicingCustomerFilters = exports.updateInvoicingCustomerCountsFailure = exports.updateInvoicingCustomerCounts = exports.fetchInvoicingCustomerCounts = exports.updateInvoicingCustomerListFailure = exports.updateInvoicingCustomerList = exports.fetchInvoicingCustomerList = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
exports.initialState = {
|
|
7
|
+
fetchState: 'Not-Started',
|
|
8
|
+
error: undefined,
|
|
9
|
+
ids: [],
|
|
10
|
+
nextCursor: null,
|
|
11
|
+
filters: {},
|
|
12
|
+
counts: { all: 0 },
|
|
13
|
+
countsFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
14
|
+
detailId: undefined,
|
|
15
|
+
detailFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
16
|
+
hasValidState() {
|
|
17
|
+
return this.fetchState === 'Completed';
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const customerView = (0, toolkit_1.createSlice)({
|
|
21
|
+
name: 'invoicingCustomerView',
|
|
22
|
+
initialState: exports.initialState,
|
|
23
|
+
reducers: {
|
|
24
|
+
fetchInvoicingCustomerList: {
|
|
25
|
+
reducer(draft, action) {
|
|
26
|
+
if (!action.payload.keepExistingListItems) {
|
|
27
|
+
draft.ids = [];
|
|
28
|
+
draft.nextCursor = null;
|
|
29
|
+
}
|
|
30
|
+
draft.filters = action.payload.filters;
|
|
31
|
+
draft.sort = action.payload.sort;
|
|
32
|
+
draft.fetchState = 'In-Progress';
|
|
33
|
+
draft.error = undefined;
|
|
34
|
+
},
|
|
35
|
+
prepare(payload) {
|
|
36
|
+
return {
|
|
37
|
+
payload: {
|
|
38
|
+
filters: payload.filters ?? {},
|
|
39
|
+
cursor: payload.cursor,
|
|
40
|
+
keepExistingListItems: payload.keepExistingListItems ?? false,
|
|
41
|
+
sort: payload.sort,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
updateInvoicingCustomerList(draft, action) {
|
|
47
|
+
draft.ids = action.payload.keepExistingListItems
|
|
48
|
+
? [...new Set([...draft.ids, ...action.payload.ids])]
|
|
49
|
+
: action.payload.ids;
|
|
50
|
+
draft.nextCursor = action.payload.nextCursor;
|
|
51
|
+
draft.fetchState = 'Completed';
|
|
52
|
+
draft.error = undefined;
|
|
53
|
+
},
|
|
54
|
+
updateInvoicingCustomerListFailure(draft, action) {
|
|
55
|
+
draft.fetchState = 'Error';
|
|
56
|
+
draft.error = action.payload;
|
|
57
|
+
},
|
|
58
|
+
fetchInvoicingCustomerCounts(draft) {
|
|
59
|
+
draft.countsFetchState.fetchState = 'In-Progress';
|
|
60
|
+
draft.countsFetchState.error = undefined;
|
|
61
|
+
},
|
|
62
|
+
updateInvoicingCustomerCounts(draft, action) {
|
|
63
|
+
draft.counts = action.payload;
|
|
64
|
+
draft.countsFetchState.fetchState = 'Completed';
|
|
65
|
+
draft.countsFetchState.error = undefined;
|
|
66
|
+
},
|
|
67
|
+
updateInvoicingCustomerCountsFailure(draft, action) {
|
|
68
|
+
draft.countsFetchState.fetchState = 'Error';
|
|
69
|
+
draft.countsFetchState.error = action.payload;
|
|
70
|
+
},
|
|
71
|
+
updateInvoicingCustomerFilters(draft, action) {
|
|
72
|
+
draft.filters = action.payload;
|
|
73
|
+
},
|
|
74
|
+
fetchInvoicingCustomerDetail(draft, action) {
|
|
75
|
+
draft.detailId = action.payload.id;
|
|
76
|
+
draft.detailFetchState.fetchState = 'In-Progress';
|
|
77
|
+
draft.detailFetchState.error = undefined;
|
|
78
|
+
},
|
|
79
|
+
updateInvoicingCustomerDetail(draft, action) {
|
|
80
|
+
draft.detailId = action.payload.id;
|
|
81
|
+
draft.detailFetchState.fetchState = 'Completed';
|
|
82
|
+
draft.detailFetchState.error = undefined;
|
|
83
|
+
},
|
|
84
|
+
updateInvoicingCustomerDetailFailure(draft, action) {
|
|
85
|
+
draft.detailFetchState.fetchState = 'Error';
|
|
86
|
+
draft.detailFetchState.error = action.payload;
|
|
87
|
+
},
|
|
88
|
+
clearInvoicingCustomerView(draft) {
|
|
89
|
+
Object.assign(draft, exports.initialState);
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
_a = customerView.actions, exports.fetchInvoicingCustomerList = _a.fetchInvoicingCustomerList, exports.updateInvoicingCustomerList = _a.updateInvoicingCustomerList, exports.updateInvoicingCustomerListFailure = _a.updateInvoicingCustomerListFailure, exports.fetchInvoicingCustomerCounts = _a.fetchInvoicingCustomerCounts, exports.updateInvoicingCustomerCounts = _a.updateInvoicingCustomerCounts, exports.updateInvoicingCustomerCountsFailure = _a.updateInvoicingCustomerCountsFailure, exports.updateInvoicingCustomerFilters = _a.updateInvoicingCustomerFilters, exports.fetchInvoicingCustomerDetail = _a.fetchInvoicingCustomerDetail, exports.updateInvoicingCustomerDetail = _a.updateInvoicingCustomerDetail, exports.updateInvoicingCustomerDetailFailure = _a.updateInvoicingCustomerDetailFailure, exports.clearInvoicingCustomerView = _a.clearInvoicingCustomerView;
|
|
94
|
+
exports.default = customerView.reducer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
|
+
import { InvoicingCustomer, InvoicingListCounts } from '../../../entity/invoicing/invoicingTypes';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
4
|
+
import { InvoicingCustomerFilters } from './customerViewReducer';
|
|
5
|
+
export declare const getInvoicingCustomerListItems: (state: RootState) => InvoicingCustomer[];
|
|
6
|
+
export declare const getInvoicingCustomerListFetchState: (state: RootState) => FetchStateAndError;
|
|
7
|
+
export declare const getInvoicingCustomerListNextCursor: (state: RootState) => string | null;
|
|
8
|
+
export declare const getInvoicingCustomerListHasMore: (state: RootState) => boolean;
|
|
9
|
+
export declare const getInvoicingCustomerListFilters: (state: RootState) => InvoicingCustomerFilters;
|
|
10
|
+
export declare const getInvoicingCustomerCounts: (state: RootState) => InvoicingListCounts;
|
|
11
|
+
export declare const getInvoicingCustomerById: (state: RootState, id: string) => InvoicingCustomer | undefined;
|
|
12
|
+
export declare const getInvoicingCustomerDetail: (state: RootState) => InvoicingCustomer | undefined;
|
|
13
|
+
export declare const getInvoicingCustomerDetailFetchState: (state: RootState) => FetchStateAndError;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInvoicingCustomerDetailFetchState = exports.getInvoicingCustomerDetail = exports.getInvoicingCustomerById = exports.getInvoicingCustomerCounts = exports.getInvoicingCustomerListFilters = exports.getInvoicingCustomerListHasMore = exports.getInvoicingCustomerListNextCursor = exports.getInvoicingCustomerListFetchState = exports.getInvoicingCustomerListItems = void 0;
|
|
4
|
+
const getInvoicingCustomerListItems = (state) => state.invoicingCustomerViewState.ids
|
|
5
|
+
.map((id) => state.invoicingCustomerState.customerByID[id])
|
|
6
|
+
.filter((item) => item != null);
|
|
7
|
+
exports.getInvoicingCustomerListItems = getInvoicingCustomerListItems;
|
|
8
|
+
const getInvoicingCustomerListFetchState = (state) => ({
|
|
9
|
+
fetchState: state.invoicingCustomerViewState.fetchState,
|
|
10
|
+
error: state.invoicingCustomerViewState.error,
|
|
11
|
+
});
|
|
12
|
+
exports.getInvoicingCustomerListFetchState = getInvoicingCustomerListFetchState;
|
|
13
|
+
const getInvoicingCustomerListNextCursor = (state) => state.invoicingCustomerViewState.nextCursor;
|
|
14
|
+
exports.getInvoicingCustomerListNextCursor = getInvoicingCustomerListNextCursor;
|
|
15
|
+
const getInvoicingCustomerListHasMore = (state) => state.invoicingCustomerViewState.nextCursor != null;
|
|
16
|
+
exports.getInvoicingCustomerListHasMore = getInvoicingCustomerListHasMore;
|
|
17
|
+
const getInvoicingCustomerListFilters = (state) => state.invoicingCustomerViewState.filters;
|
|
18
|
+
exports.getInvoicingCustomerListFilters = getInvoicingCustomerListFilters;
|
|
19
|
+
const getInvoicingCustomerCounts = (state) => state.invoicingCustomerViewState.counts;
|
|
20
|
+
exports.getInvoicingCustomerCounts = getInvoicingCustomerCounts;
|
|
21
|
+
const getInvoicingCustomerById = (state, id) => state.invoicingCustomerState.customerByID[id];
|
|
22
|
+
exports.getInvoicingCustomerById = getInvoicingCustomerById;
|
|
23
|
+
const getInvoicingCustomerDetail = (state) => {
|
|
24
|
+
const id = state.invoicingCustomerViewState.detailId;
|
|
25
|
+
return id != null ? state.invoicingCustomerState.customerByID[id] : undefined;
|
|
26
|
+
};
|
|
27
|
+
exports.getInvoicingCustomerDetail = getInvoicingCustomerDetail;
|
|
28
|
+
const getInvoicingCustomerDetailFetchState = (state) => state.invoicingCustomerViewState.detailFetchState;
|
|
29
|
+
exports.getInvoicingCustomerDetailFetchState = getInvoicingCustomerDetailFetchState;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateInvoicingCustomers } from '../../../entity/invoicing/customer/customerReducer';
|
|
4
|
+
import { RootState } from '../../../reducer';
|
|
5
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
+
import { saveInvoicingCustomer, saveInvoicingCustomerFailure, saveInvoicingCustomerSuccess } from './customerWriteReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof saveInvoicingCustomer> | ReturnType<typeof saveInvoicingCustomerSuccess> | ReturnType<typeof saveInvoicingCustomerFailure> | ReturnType<typeof updateInvoicingCustomers>;
|
|
8
|
+
export declare const saveInvoicingCustomerEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveInvoicingCustomerEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const customerReducer_1 = require("../../../entity/invoicing/customer/customerReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
+
const invoicingApiHelper_1 = require("../invoicingApiHelper");
|
|
9
|
+
const customerWriteReducer_1 = require("./customerWriteReducer");
|
|
10
|
+
const saveInvoicingCustomerEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(customerWriteReducer_1.saveInvoicingCustomer.match), (0, operators_1.mergeMap)((action) => {
|
|
11
|
+
const { data, id } = action.payload;
|
|
12
|
+
const baseUrl = (0, invoicingApiHelper_1.invoicingBaseUrl)(zeniAPI);
|
|
13
|
+
const request$ = id != null
|
|
14
|
+
? zeniAPI.putAndGetJSON(`${baseUrl}/customers/${encodeURIComponent(id)}`, { ...data })
|
|
15
|
+
: zeniAPI.postAndGetJSON(`${baseUrl}/customers`, { ...data });
|
|
16
|
+
return request$.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
+
return [
|
|
19
|
+
(0, customerReducer_1.updateInvoicingCustomers)([response.data], 'merge'),
|
|
20
|
+
(0, customerWriteReducer_1.saveInvoicingCustomerSuccess)({ customerId: response.data.id }),
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
return (0, rxjs_1.of)((0, customerWriteReducer_1.saveInvoicingCustomerFailure)(response.status));
|
|
24
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, customerWriteReducer_1.saveInvoicingCustomerFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save customer REST API call errored out ' +
|
|
25
|
+
JSON.stringify(error))))));
|
|
26
|
+
}));
|
|
27
|
+
exports.saveInvoicingCustomerEpic = saveInvoicingCustomerEpic;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
|
+
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
3
|
+
/** Payload for creating (no id) or updating (with id) a customer. */
|
|
4
|
+
export interface SaveInvoicingCustomerPayload {
|
|
5
|
+
data: Record<string, unknown>;
|
|
6
|
+
id?: ID;
|
|
7
|
+
}
|
|
8
|
+
export interface InvoicingCustomerWriteState extends FetchedState {
|
|
9
|
+
data?: Record<string, unknown>;
|
|
10
|
+
savedCustomerId?: ID;
|
|
11
|
+
}
|
|
12
|
+
export declare const initialState: InvoicingCustomerWriteState;
|
|
13
|
+
export declare const saveInvoicingCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveInvoicingCustomerPayload, "invoicingCustomerWrite/saveInvoicingCustomer">, saveInvoicingCustomerSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
14
|
+
customerId: ID;
|
|
15
|
+
}, "invoicingCustomerWrite/saveInvoicingCustomerSuccess">, saveInvoicingCustomerFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerWrite/saveInvoicingCustomerFailure">, resetInvoicingCustomerWrite: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCustomerWrite/resetInvoicingCustomerWrite">;
|
|
16
|
+
declare const _default: import("redux").Reducer<InvoicingCustomerWriteState>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.resetInvoicingCustomerWrite = exports.saveInvoicingCustomerFailure = exports.saveInvoicingCustomerSuccess = exports.saveInvoicingCustomer = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
exports.initialState = {
|
|
7
|
+
fetchState: 'Not-Started',
|
|
8
|
+
error: undefined,
|
|
9
|
+
data: undefined,
|
|
10
|
+
savedCustomerId: undefined,
|
|
11
|
+
hasValidState() {
|
|
12
|
+
return this.fetchState === 'Completed';
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
const customerWrite = (0, toolkit_1.createSlice)({
|
|
16
|
+
name: 'invoicingCustomerWrite',
|
|
17
|
+
initialState: exports.initialState,
|
|
18
|
+
reducers: {
|
|
19
|
+
saveInvoicingCustomer(draft, action) {
|
|
20
|
+
draft.fetchState = 'In-Progress';
|
|
21
|
+
draft.error = undefined;
|
|
22
|
+
draft.savedCustomerId = undefined;
|
|
23
|
+
draft.data = action.payload.data;
|
|
24
|
+
},
|
|
25
|
+
saveInvoicingCustomerSuccess(draft, action) {
|
|
26
|
+
draft.fetchState = 'Completed';
|
|
27
|
+
draft.error = undefined;
|
|
28
|
+
draft.savedCustomerId = action.payload.customerId;
|
|
29
|
+
},
|
|
30
|
+
saveInvoicingCustomerFailure(draft, action) {
|
|
31
|
+
draft.fetchState = 'Error';
|
|
32
|
+
draft.error = action.payload;
|
|
33
|
+
},
|
|
34
|
+
resetInvoicingCustomerWrite(draft) {
|
|
35
|
+
Object.assign(draft, exports.initialState);
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
_a = customerWrite.actions, exports.saveInvoicingCustomer = _a.saveInvoicingCustomer, exports.saveInvoicingCustomerSuccess = _a.saveInvoicingCustomerSuccess, exports.saveInvoicingCustomerFailure = _a.saveInvoicingCustomerFailure, exports.resetInvoicingCustomerWrite = _a.resetInvoicingCustomerWrite;
|
|
40
|
+
exports.default = customerWrite.reducer;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
|
+
import { RootState } from '../../../reducer';
|
|
3
|
+
export declare const getInvoicingCustomerWriteState: (state: RootState) => FetchStateAndError;
|
|
4
|
+
export declare const getSavedInvoicingCustomerId: (state: RootState) => ID | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSavedInvoicingCustomerId = exports.getInvoicingCustomerWriteState = void 0;
|
|
4
|
+
const getInvoicingCustomerWriteState = (state) => ({
|
|
5
|
+
fetchState: state.invoicingCustomerWriteState.fetchState,
|
|
6
|
+
error: state.invoicingCustomerWriteState.error,
|
|
7
|
+
});
|
|
8
|
+
exports.getInvoicingCustomerWriteState = getInvoicingCustomerWriteState;
|
|
9
|
+
const getSavedInvoicingCustomerId = (state) => state.invoicingCustomerWriteState.savedCustomerId;
|
|
10
|
+
exports.getSavedInvoicingCustomerId = getSavedInvoicingCustomerId;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
+
export declare const invoicingDataImportActionEpic: (actions$: ActionsObservable<{
|
|
6
|
+
type: string;
|
|
7
|
+
}>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<unknown>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.invoicingDataImportActionEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const invoicingApiHelper_1 = require("../invoicingApiHelper");
|
|
8
|
+
const dataImportViewReducer_1 = require("../dataImportView/dataImportViewReducer");
|
|
9
|
+
const dataImportActionReducer_1 = require("./dataImportActionReducer");
|
|
10
|
+
const onSuccess = (kind, session) => [
|
|
11
|
+
(0, dataImportViewReducer_1.upsertInvoicingMigrationSession)(session),
|
|
12
|
+
(0, dataImportViewReducer_1.setInvoicingActiveMigrationSessionId)(session.id),
|
|
13
|
+
(0, dataImportActionReducer_1.invoicingDataImportActionSuccess)(kind),
|
|
14
|
+
(0, dataImportViewReducer_1.fetchInvoicingMigrationSessions)(),
|
|
15
|
+
(0, dataImportViewReducer_1.fetchInvoicingDataImportStatus)(),
|
|
16
|
+
];
|
|
17
|
+
const handleResponse = (kind, response$) => response$.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
19
|
+
return onSuccess(kind, response.data);
|
|
20
|
+
}
|
|
21
|
+
return (0, rxjs_1.of)((0, dataImportActionReducer_1.invoicingDataImportActionFailure)({ kind, error: response.status }));
|
|
22
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, dataImportActionReducer_1.invoicingDataImportActionFailure)({
|
|
23
|
+
kind,
|
|
24
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Data import ${kind} REST API call errored out ` +
|
|
25
|
+
JSON.stringify(error)),
|
|
26
|
+
}))));
|
|
27
|
+
const invoicingDataImportActionEpic = (actions$, _state$, zeniAPI) => {
|
|
28
|
+
const base = () => `${(0, invoicingApiHelper_1.invoicingBaseUrl)(zeniAPI)}/data-import`;
|
|
29
|
+
const connect$ = actions$.pipe((0, operators_1.filter)(dataImportActionReducer_1.connectInvoicingChargebee.match), (0, operators_1.mergeMap)((action) => handleResponse('connect', zeniAPI.postAndGetJSON(`${base()}/chargebee/connect`, {
|
|
30
|
+
site: action.payload.site,
|
|
31
|
+
...(action.payload.apiKey != null && action.payload.apiKey.length > 0
|
|
32
|
+
? { api_key: action.payload.apiKey }
|
|
33
|
+
: {}),
|
|
34
|
+
}))));
|
|
35
|
+
const upload$ = actions$.pipe((0, operators_1.filter)(dataImportActionReducer_1.uploadInvoicingMigrationFiles.match), (0, operators_1.mergeMap)((action) => {
|
|
36
|
+
const form = new FormData();
|
|
37
|
+
action.payload.files.forEach((file) => form.append('files', file, file.name));
|
|
38
|
+
return handleResponse('upload', zeniAPI.postFormData(`${base()}/uploads`, form));
|
|
39
|
+
}));
|
|
40
|
+
const start$ = actions$.pipe((0, operators_1.filter)(dataImportActionReducer_1.startInvoicingMigration.match), (0, operators_1.mergeMap)((action) => handleResponse('start', zeniAPI.postAndGetJSON(`${base()}/${encodeURIComponent(action.payload)}/import`, {}))));
|
|
41
|
+
const retry$ = actions$.pipe((0, operators_1.filter)(dataImportActionReducer_1.retryInvoicingMigration.match), (0, operators_1.mergeMap)((action) => handleResponse('retry', zeniAPI.postAndGetJSON(`${base()}/${encodeURIComponent(action.payload)}/retry`, {}))));
|
|
42
|
+
const rollback$ = actions$.pipe((0, operators_1.filter)(dataImportActionReducer_1.rollbackInvoicingMigration.match), (0, operators_1.mergeMap)((action) => handleResponse('rollback', zeniAPI.postAndGetJSON(`${base()}/${encodeURIComponent(action.payload)}/rollback`, {}))));
|
|
43
|
+
return (0, rxjs_1.merge)(connect$, upload$, start$, retry$, rollback$);
|
|
44
|
+
};
|
|
45
|
+
exports.invoicingDataImportActionEpic = invoicingDataImportActionEpic;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
|
+
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
3
|
+
export type InvoicingDataImportActionKind = 'connect' | 'retry' | 'rollback' | 'start' | 'upload';
|
|
4
|
+
export interface InvoicingDataImportActionState {
|
|
5
|
+
byKind: Partial<Record<InvoicingDataImportActionKind, FetchStateAndError>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const initialState: InvoicingDataImportActionState;
|
|
8
|
+
export declare const connectInvoicingChargebee: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
|
|
9
|
+
site: string;
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
}], {
|
|
12
|
+
site: string;
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
}, "invoicingDataImportAction/connectInvoicingChargebee", never, never>, uploadInvoicingMigrationFiles: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
|
|
15
|
+
files: File[];
|
|
16
|
+
}], {
|
|
17
|
+
files: File[];
|
|
18
|
+
}, "invoicingDataImportAction/uploadInvoicingMigrationFiles", never, never>, startInvoicingMigration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: string], string, "invoicingDataImportAction/startInvoicingMigration", never, never>, retryInvoicingMigration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: string], string, "invoicingDataImportAction/retryInvoicingMigration", never, never>, rollbackInvoicingMigration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: string], string, "invoicingDataImportAction/rollbackInvoicingMigration", never, never>, invoicingDataImportActionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingDataImportActionKind, "invoicingDataImportAction/invoicingDataImportActionSuccess">, invoicingDataImportActionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
19
|
+
error: ZeniAPIStatus;
|
|
20
|
+
kind: InvoicingDataImportActionKind;
|
|
21
|
+
}, "invoicingDataImportAction/invoicingDataImportActionFailure">, clearInvoicingDataImportAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingDataImportActionKind, "invoicingDataImportAction/clearInvoicingDataImportAction">, clearAllInvoicingDataImportActions: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingDataImportAction/clearAllInvoicingDataImportActions">;
|
|
22
|
+
declare const _default: import("redux").Reducer<InvoicingDataImportActionState>;
|
|
23
|
+
export default _default;
|