@voyant-travel/finance-react 0.119.5
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/LICENSE +201 -0
- package/README.md +75 -0
- package/dist/admin/booking-invoices-widget.d.ts +19 -0
- package/dist/admin/booking-invoices-widget.d.ts.map +1 -0
- package/dist/admin/booking-invoices-widget.js +204 -0
- package/dist/admin/booking-payment-policy-widget.d.ts +21 -0
- package/dist/admin/booking-payment-policy-widget.d.ts.map +1 -0
- package/dist/admin/booking-payment-policy-widget.js +128 -0
- package/dist/admin/booking-pending-payment-sessions-widget.d.ts +24 -0
- package/dist/admin/booking-pending-payment-sessions-widget.d.ts.map +1 -0
- package/dist/admin/booking-pending-payment-sessions-widget.js +139 -0
- package/dist/admin/credit-note-dialog.d.ts +9 -0
- package/dist/admin/credit-note-dialog.d.ts.map +1 -0
- package/dist/admin/credit-note-dialog.js +70 -0
- package/dist/admin/finance-shared.d.ts +7 -0
- package/dist/admin/finance-shared.d.ts.map +1 -0
- package/dist/admin/finance-shared.js +30 -0
- package/dist/admin/index.d.ts +99 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +286 -0
- package/dist/admin/invoice-detail-host.d.ts +19 -0
- package/dist/admin/invoice-detail-host.d.ts.map +1 -0
- package/dist/admin/invoice-detail-host.js +147 -0
- package/dist/admin/invoice-detail-sections.d.ts +31 -0
- package/dist/admin/invoice-detail-sections.d.ts.map +1 -0
- package/dist/admin/invoice-detail-sections.js +109 -0
- package/dist/admin/invoice-detail-skeleton.d.ts +11 -0
- package/dist/admin/invoice-detail-skeleton.d.ts.map +1 -0
- package/dist/admin/invoice-detail-skeleton.js +33 -0
- package/dist/admin/line-item-dialog.d.ts +10 -0
- package/dist/admin/line-item-dialog.d.ts.map +1 -0
- package/dist/admin/line-item-dialog.js +91 -0
- package/dist/admin/pages/invoice-detail.d.ts +8 -0
- package/dist/admin/pages/invoice-detail.d.ts.map +1 -0
- package/dist/admin/pages/invoice-detail.js +11 -0
- package/dist/admin/pages/invoices-index.d.ts +8 -0
- package/dist/admin/pages/invoices-index.d.ts.map +1 -0
- package/dist/admin/pages/invoices-index.js +14 -0
- package/dist/admin/pages/payment-detail.d.ts +8 -0
- package/dist/admin/pages/payment-detail.d.ts.map +1 -0
- package/dist/admin/pages/payment-detail.js +11 -0
- package/dist/admin/pages/payments-index.d.ts +9 -0
- package/dist/admin/pages/payments-index.d.ts.map +1 -0
- package/dist/admin/pages/payments-index.js +21 -0
- package/dist/admin/pages/profitability.d.ts +10 -0
- package/dist/admin/pages/profitability.d.ts.map +1 -0
- package/dist/admin/pages/profitability.js +32 -0
- package/dist/admin/pages/supplier-invoice-detail.d.ts +20 -0
- package/dist/admin/pages/supplier-invoice-detail.d.ts.map +1 -0
- package/dist/admin/pages/supplier-invoice-detail.js +102 -0
- package/dist/admin/pages/supplier-invoices-index.d.ts +9 -0
- package/dist/admin/pages/supplier-invoices-index.d.ts.map +1 -0
- package/dist/admin/pages/supplier-invoices-index.js +16 -0
- package/dist/admin/payment-detail-host.d.ts +12 -0
- package/dist/admin/payment-detail-host.d.ts.map +1 -0
- package/dist/admin/payment-detail-host.js +108 -0
- package/dist/admin/payment-detail-skeleton.d.ts +8 -0
- package/dist/admin/payment-detail-skeleton.d.ts.map +1 -0
- package/dist/admin/payment-detail-skeleton.js +15 -0
- package/dist/admin/payment-dialog.d.ts +9 -0
- package/dist/admin/payment-dialog.d.ts.map +1 -0
- package/dist/admin/payment-dialog.js +99 -0
- package/dist/admin/record-payment-dialog.d.ts +16 -0
- package/dist/admin/record-payment-dialog.d.ts.map +1 -0
- package/dist/admin/record-payment-dialog.js +219 -0
- package/dist/admin/supplier-payment-policy-widget.d.ts +18 -0
- package/dist/admin/supplier-payment-policy-widget.d.ts.map +1 -0
- package/dist/admin/supplier-payment-policy-widget.js +31 -0
- package/dist/admin/use-supplier-picker.d.ts +19 -0
- package/dist/admin/use-supplier-picker.d.ts.map +1 -0
- package/dist/admin/use-supplier-picker.js +30 -0
- package/dist/checkout-components/collect-payment-dialog.d.ts +45 -0
- package/dist/checkout-components/collect-payment-dialog.d.ts.map +1 -0
- package/dist/checkout-components/collect-payment-dialog.js +121 -0
- package/dist/checkout-components/payment-link-landing-page.d.ts +76 -0
- package/dist/checkout-components/payment-link-landing-page.d.ts.map +1 -0
- package/dist/checkout-components/payment-link-landing-page.js +173 -0
- package/dist/checkout-components/payment-step.d.ts +42 -0
- package/dist/checkout-components/payment-step.d.ts.map +1 -0
- package/dist/checkout-components/payment-step.js +113 -0
- package/dist/checkout-hooks/index.d.ts +5 -0
- package/dist/checkout-hooks/index.d.ts.map +1 -0
- package/dist/checkout-hooks/index.js +4 -0
- package/dist/checkout-hooks/use-checkout-payment-link-config.d.ts +20 -0
- package/dist/checkout-hooks/use-checkout-payment-link-config.d.ts.map +1 -0
- package/dist/checkout-hooks/use-checkout-payment-link-config.js +26 -0
- package/dist/checkout-hooks/use-collect-payment.d.ts +227 -0
- package/dist/checkout-hooks/use-collect-payment.d.ts.map +1 -0
- package/dist/checkout-hooks/use-collect-payment.js +80 -0
- package/dist/checkout-hooks/use-initiate-checkout-collection.d.ts +308 -0
- package/dist/checkout-hooks/use-initiate-checkout-collection.d.ts.map +1 -0
- package/dist/checkout-hooks/use-initiate-checkout-collection.js +35 -0
- package/dist/checkout-hooks/use-preview-checkout-collection.d.ts +65 -0
- package/dist/checkout-hooks/use-preview-checkout-collection.d.ts.map +1 -0
- package/dist/checkout-hooks/use-preview-checkout-collection.js +27 -0
- package/dist/checkout-i18n/en.d.ts +3 -0
- package/dist/checkout-i18n/en.d.ts.map +1 -0
- package/dist/checkout-i18n/en.js +127 -0
- package/dist/checkout-i18n/index.d.ts +5 -0
- package/dist/checkout-i18n/index.d.ts.map +1 -0
- package/dist/checkout-i18n/index.js +3 -0
- package/dist/checkout-i18n/messages.d.ts +121 -0
- package/dist/checkout-i18n/messages.d.ts.map +1 -0
- package/dist/checkout-i18n/messages.js +1 -0
- package/dist/checkout-i18n/provider.d.ts +26 -0
- package/dist/checkout-i18n/provider.d.ts.map +1 -0
- package/dist/checkout-i18n/provider.js +41 -0
- package/dist/checkout-i18n/ro.d.ts +3 -0
- package/dist/checkout-i18n/ro.d.ts.map +1 -0
- package/dist/checkout-i18n/ro.js +127 -0
- package/dist/checkout-types.d.ts +53 -0
- package/dist/checkout-types.d.ts.map +1 -0
- package/dist/checkout-types.js +1 -0
- package/dist/checkout-ui.d.ts +7 -0
- package/dist/checkout-ui.d.ts.map +1 -0
- package/dist/checkout-ui.js +4 -0
- package/dist/checkout.d.ts +5 -0
- package/dist/checkout.d.ts.map +1 -0
- package/dist/checkout.js +3 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +79 -0
- package/dist/components/accountant-portal/body.d.ts +8 -0
- package/dist/components/accountant-portal/body.d.ts.map +1 -0
- package/dist/components/accountant-portal/body.js +114 -0
- package/dist/components/accountant-portal/widgets.d.ts +13 -0
- package/dist/components/accountant-portal/widgets.d.ts.map +1 -0
- package/dist/components/accountant-portal/widgets.js +27 -0
- package/dist/components/accountant-portal.d.ts +10 -0
- package/dist/components/accountant-portal.d.ts.map +1 -0
- package/dist/components/accountant-portal.js +22 -0
- package/dist/components/accountant-share-dialog.d.ts +6 -0
- package/dist/components/accountant-share-dialog.d.ts.map +1 -0
- package/dist/components/accountant-share-dialog.js +53 -0
- package/dist/components/async-combobox.d.ts +33 -0
- package/dist/components/async-combobox.d.ts.map +1 -0
- package/dist/components/async-combobox.js +100 -0
- package/dist/components/booking-invoice-dialog.d.ts +63 -0
- package/dist/components/booking-invoice-dialog.d.ts.map +1 -0
- package/dist/components/booking-invoice-dialog.js +383 -0
- package/dist/components/cost-categories-page.d.ts +5 -0
- package/dist/components/cost-categories-page.d.ts.map +1 -0
- package/dist/components/cost-categories-page.js +30 -0
- package/dist/components/invoice-action-ledger-card.d.ts +15 -0
- package/dist/components/invoice-action-ledger-card.d.ts.map +1 -0
- package/dist/components/invoice-action-ledger-card.js +76 -0
- package/dist/components/invoice-bulk-actions.d.ts +10 -0
- package/dist/components/invoice-bulk-actions.d.ts.map +1 -0
- package/dist/components/invoice-bulk-actions.js +19 -0
- package/dist/components/invoice-detail-page/cards.d.ts +44 -0
- package/dist/components/invoice-detail-page/cards.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/cards.js +43 -0
- package/dist/components/invoice-detail-page/header.d.ts +15 -0
- package/dist/components/invoice-detail-page/header.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/header.js +30 -0
- package/dist/components/invoice-detail-page/notes-dialogs.d.ts +28 -0
- package/dist/components/invoice-detail-page/notes-dialogs.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/notes-dialogs.js +104 -0
- package/dist/components/invoice-detail-page/primitives.d.ts +47 -0
- package/dist/components/invoice-detail-page/primitives.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/primitives.js +76 -0
- package/dist/components/invoice-detail-page-with-action-ledger.d.ts +7 -0
- package/dist/components/invoice-detail-page-with-action-ledger.d.ts.map +1 -0
- package/dist/components/invoice-detail-page-with-action-ledger.js +11 -0
- package/dist/components/invoice-detail-page.d.ts +46 -0
- package/dist/components/invoice-detail-page.d.ts.map +1 -0
- package/dist/components/invoice-detail-page.js +134 -0
- package/dist/components/invoice-dialog.d.ts +9 -0
- package/dist/components/invoice-dialog.d.ts.map +1 -0
- package/dist/components/invoice-dialog.js +145 -0
- package/dist/components/invoice-number-series-dialog.d.ts +9 -0
- package/dist/components/invoice-number-series-dialog.d.ts.map +1 -0
- package/dist/components/invoice-number-series-dialog.js +134 -0
- package/dist/components/invoice-number-series-format.d.ts +3 -0
- package/dist/components/invoice-number-series-format.d.ts.map +1 -0
- package/dist/components/invoice-number-series-format.js +4 -0
- package/dist/components/invoice-number-series-page.d.ts +5 -0
- package/dist/components/invoice-number-series-page.d.ts.map +1 -0
- package/dist/components/invoice-number-series-page.js +55 -0
- package/dist/components/invoice-table-parts.d.ts +25 -0
- package/dist/components/invoice-table-parts.d.ts.map +1 -0
- package/dist/components/invoice-table-parts.js +32 -0
- package/dist/components/invoices-page-skeleton.d.ts +5 -0
- package/dist/components/invoices-page-skeleton.d.ts.map +1 -0
- package/dist/components/invoices-page-skeleton.js +13 -0
- package/dist/components/invoices-page.d.ts +6 -0
- package/dist/components/invoices-page.d.ts.map +1 -0
- package/dist/components/invoices-page.js +145 -0
- package/dist/components/payment-detail-page.d.ts +47 -0
- package/dist/components/payment-detail-page.d.ts.map +1 -0
- package/dist/components/payment-detail-page.js +90 -0
- package/dist/components/payment-policy-form.d.ts +49 -0
- package/dist/components/payment-policy-form.d.ts.map +1 -0
- package/dist/components/payment-policy-form.js +82 -0
- package/dist/components/payments-page/controls.d.ts +23 -0
- package/dist/components/payments-page/controls.d.ts.map +1 -0
- package/dist/components/payments-page/controls.js +20 -0
- package/dist/components/payments-page-skeleton.d.ts +5 -0
- package/dist/components/payments-page-skeleton.d.ts.map +1 -0
- package/dist/components/payments-page-skeleton.js +13 -0
- package/dist/components/payments-page.d.ts +20 -0
- package/dist/components/payments-page.d.ts.map +1 -0
- package/dist/components/payments-page.js +143 -0
- package/dist/components/profitability-page/sections.d.ts +24 -0
- package/dist/components/profitability-page/sections.d.ts.map +1 -0
- package/dist/components/profitability-page/sections.js +43 -0
- package/dist/components/profitability-page.d.ts +13 -0
- package/dist/components/profitability-page.d.ts.map +1 -0
- package/dist/components/profitability-page.js +175 -0
- package/dist/components/record-booking-payment-dialog/shared.d.ts +54 -0
- package/dist/components/record-booking-payment-dialog/shared.d.ts.map +1 -0
- package/dist/components/record-booking-payment-dialog/shared.js +47 -0
- package/dist/components/record-booking-payment-dialog.d.ts +4 -0
- package/dist/components/record-booking-payment-dialog.d.ts.map +1 -0
- package/dist/components/record-booking-payment-dialog.js +256 -0
- package/dist/components/supplier-invoice-detail-page/dialogs.d.ts +34 -0
- package/dist/components/supplier-invoice-detail-page/dialogs.d.ts.map +1 -0
- package/dist/components/supplier-invoice-detail-page/dialogs.js +119 -0
- package/dist/components/supplier-invoice-detail-page/shared.d.ts +64 -0
- package/dist/components/supplier-invoice-detail-page/shared.d.ts.map +1 -0
- package/dist/components/supplier-invoice-detail-page/shared.js +70 -0
- package/dist/components/supplier-invoice-detail-page.d.ts +4 -0
- package/dist/components/supplier-invoice-detail-page.d.ts.map +1 -0
- package/dist/components/supplier-invoice-detail-page.js +101 -0
- package/dist/components/supplier-invoice-form-dialog.d.ts +45 -0
- package/dist/components/supplier-invoice-form-dialog.d.ts.map +1 -0
- package/dist/components/supplier-invoice-form-dialog.js +102 -0
- package/dist/components/supplier-invoices-page.d.ts +14 -0
- package/dist/components/supplier-invoices-page.d.ts.map +1 -0
- package/dist/components/supplier-invoices-page.js +69 -0
- package/dist/components/supplier-payment-dialog.d.ts +7 -0
- package/dist/components/supplier-payment-dialog.d.ts.map +1 -0
- package/dist/components/supplier-payment-dialog.js +103 -0
- package/dist/components/taxes-page/policy-profile-sheet.d.ts +8 -0
- package/dist/components/taxes-page/policy-profile-sheet.d.ts.map +1 -0
- package/dist/components/taxes-page/policy-profile-sheet.js +52 -0
- package/dist/components/taxes-page/policy-rule-sheet.d.ts +10 -0
- package/dist/components/taxes-page/policy-rule-sheet.d.ts.map +1 -0
- package/dist/components/taxes-page/policy-rule-sheet.js +137 -0
- package/dist/components/taxes-page/shared.d.ts +128 -0
- package/dist/components/taxes-page/shared.d.ts.map +1 -0
- package/dist/components/taxes-page/shared.js +288 -0
- package/dist/components/taxes-page/sheets.d.ts +4 -0
- package/dist/components/taxes-page/sheets.d.ts.map +1 -0
- package/dist/components/taxes-page/sheets.js +3 -0
- package/dist/components/taxes-page/tax-sheet.d.ts +9 -0
- package/dist/components/taxes-page/tax-sheet.d.ts.map +1 -0
- package/dist/components/taxes-page/tax-sheet.js +108 -0
- package/dist/components/taxes-page.d.ts +4 -0
- package/dist/components/taxes-page.d.ts.map +1 -0
- package/dist/components/taxes-page.js +165 -0
- package/dist/hooks/index.d.ts +53 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +52 -0
- package/dist/hooks/use-accountant-share-mutation.d.ts +20 -0
- package/dist/hooks/use-accountant-share-mutation.d.ts.map +1 -0
- package/dist/hooks/use-accountant-share-mutation.js +27 -0
- package/dist/hooks/use-accountant-shares.d.ts +13 -0
- package/dist/hooks/use-accountant-shares.d.ts.map +1 -0
- package/dist/hooks/use-accountant-shares.js +8 -0
- package/dist/hooks/use-admin-booking-payments.d.ts +30 -0
- package/dist/hooks/use-admin-booking-payments.d.ts.map +1 -0
- package/dist/hooks/use-admin-booking-payments.js +18 -0
- package/dist/hooks/use-all-payments.d.ts +35 -0
- package/dist/hooks/use-all-payments.d.ts.map +1 -0
- package/dist/hooks/use-all-payments.js +12 -0
- package/dist/hooks/use-booking-guarantees.d.ts +82 -0
- package/dist/hooks/use-booking-guarantees.d.ts.map +1 -0
- package/dist/hooks/use-booking-guarantees.js +46 -0
- package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.d.ts +44 -0
- package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.js +27 -0
- package/dist/hooks/use-booking-payment-schedules.d.ts +63 -0
- package/dist/hooks/use-booking-payment-schedules.d.ts.map +1 -0
- package/dist/hooks/use-booking-payment-schedules.js +47 -0
- package/dist/hooks/use-cost-categories.d.ts +14 -0
- package/dist/hooks/use-cost-categories.d.ts.map +1 -0
- package/dist/hooks/use-cost-categories.js +9 -0
- package/dist/hooks/use-cost-category-mutation.d.ts +31 -0
- package/dist/hooks/use-cost-category-mutation.d.ts.map +1 -0
- package/dist/hooks/use-cost-category-mutation.js +27 -0
- package/dist/hooks/use-departure-profitability.d.ts +56 -0
- package/dist/hooks/use-departure-profitability.d.ts.map +1 -0
- package/dist/hooks/use-departure-profitability.js +12 -0
- package/dist/hooks/use-finance-action-ledger.d.ts +94 -0
- package/dist/hooks/use-finance-action-ledger.d.ts.map +1 -0
- package/dist/hooks/use-finance-action-ledger.js +20 -0
- package/dist/hooks/use-invoice-attachment-mutation.d.ts +43 -0
- package/dist/hooks/use-invoice-attachment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-attachment-mutation.js +39 -0
- package/dist/hooks/use-invoice-attachments.d.ts +18 -0
- package/dist/hooks/use-invoice-attachments.d.ts.map +1 -0
- package/dist/hooks/use-invoice-attachments.js +12 -0
- package/dist/hooks/use-invoice-bulk-status-mutation.d.ts +51 -0
- package/dist/hooks/use-invoice-bulk-status-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-bulk-status-mutation.js +66 -0
- package/dist/hooks/use-invoice-credit-note-mutation.d.ts +38 -0
- package/dist/hooks/use-invoice-credit-note-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-credit-note-mutation.js +35 -0
- package/dist/hooks/use-invoice-credit-notes.d.ts +17 -0
- package/dist/hooks/use-invoice-credit-notes.d.ts.map +1 -0
- package/dist/hooks/use-invoice-credit-notes.js +12 -0
- package/dist/hooks/use-invoice-fx-rate.d.ts +19 -0
- package/dist/hooks/use-invoice-fx-rate.d.ts.map +1 -0
- package/dist/hooks/use-invoice-fx-rate.js +13 -0
- package/dist/hooks/use-invoice-line-item-mutation.d.ts +40 -0
- package/dist/hooks/use-invoice-line-item-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-line-item-mutation.js +42 -0
- package/dist/hooks/use-invoice-line-items.d.ts +17 -0
- package/dist/hooks/use-invoice-line-items.d.ts.map +1 -0
- package/dist/hooks/use-invoice-line-items.js +12 -0
- package/dist/hooks/use-invoice-mutation.d.ts +225 -0
- package/dist/hooks/use-invoice-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-mutation.js +121 -0
- package/dist/hooks/use-invoice-note-mutation.d.ts +11 -0
- package/dist/hooks/use-invoice-note-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-note-mutation.js +23 -0
- package/dist/hooks/use-invoice-notes.d.ts +13 -0
- package/dist/hooks/use-invoice-notes.d.ts.map +1 -0
- package/dist/hooks/use-invoice-notes.js +12 -0
- package/dist/hooks/use-invoice-number-series-mutation.d.ts +62 -0
- package/dist/hooks/use-invoice-number-series-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-number-series-mutation.js +39 -0
- package/dist/hooks/use-invoice-number-series.d.ts +28 -0
- package/dist/hooks/use-invoice-number-series.d.ts.map +1 -0
- package/dist/hooks/use-invoice-number-series.js +12 -0
- package/dist/hooks/use-invoice-payment-mutation.d.ts +29 -0
- package/dist/hooks/use-invoice-payment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-payment-mutation.js +35 -0
- package/dist/hooks/use-invoice-payments.d.ts +21 -0
- package/dist/hooks/use-invoice-payments.d.ts.map +1 -0
- package/dist/hooks/use-invoice-payments.js +12 -0
- package/dist/hooks/use-invoice.d.ts +32 -0
- package/dist/hooks/use-invoice.d.ts.map +1 -0
- package/dist/hooks/use-invoice.js +12 -0
- package/dist/hooks/use-invoices.d.ts +36 -0
- package/dist/hooks/use-invoices.d.ts.map +1 -0
- package/dist/hooks/use-invoices.js +12 -0
- package/dist/hooks/use-payment-mutation.d.ts +57 -0
- package/dist/hooks/use-payment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-payment-mutation.js +59 -0
- package/dist/hooks/use-payment-session-mutation.d.ts +205 -0
- package/dist/hooks/use-payment-session-mutation.d.ts.map +1 -0
- package/dist/hooks/use-payment-session-mutation.js +38 -0
- package/dist/hooks/use-payment-sessions.d.ts +97 -0
- package/dist/hooks/use-payment-sessions.d.ts.map +1 -0
- package/dist/hooks/use-payment-sessions.js +17 -0
- package/dist/hooks/use-payment.d.ts +31 -0
- package/dist/hooks/use-payment.d.ts.map +1 -0
- package/dist/hooks/use-payment.js +12 -0
- package/dist/hooks/use-product-profitability.d.ts +52 -0
- package/dist/hooks/use-product-profitability.d.ts.map +1 -0
- package/dist/hooks/use-product-profitability.js +12 -0
- package/dist/hooks/use-public-booking-documents.d.ts +29 -0
- package/dist/hooks/use-public-booking-documents.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-documents.js +12 -0
- package/dist/hooks/use-public-booking-payment-options.d.ts +47 -0
- package/dist/hooks/use-public-booking-payment-options.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-payment-options.js +12 -0
- package/dist/hooks/use-public-booking-payments.d.ts +24 -0
- package/dist/hooks/use-public-booking-payments.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-payments.js +12 -0
- package/dist/hooks/use-public-finance-document-by-reference.d.ts +27 -0
- package/dist/hooks/use-public-finance-document-by-reference.d.ts.map +1 -0
- package/dist/hooks/use-public-finance-document-by-reference.js +12 -0
- package/dist/hooks/use-public-payment-session-mutation.d.ts +82 -0
- package/dist/hooks/use-public-payment-session-mutation.d.ts.map +1 -0
- package/dist/hooks/use-public-payment-session-mutation.js +33 -0
- package/dist/hooks/use-public-payment-session.d.ts +73 -0
- package/dist/hooks/use-public-payment-session.d.ts.map +1 -0
- package/dist/hooks/use-public-payment-session.js +12 -0
- package/dist/hooks/use-public-voucher-validation-mutation.d.ts +23 -0
- package/dist/hooks/use-public-voucher-validation-mutation.d.ts.map +1 -0
- package/dist/hooks/use-public-voucher-validation-mutation.js +17 -0
- package/dist/hooks/use-supplier-invoice-attachments.d.ts +17 -0
- package/dist/hooks/use-supplier-invoice-attachments.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice-attachments.js +12 -0
- package/dist/hooks/use-supplier-invoice-mutation.d.ts +353 -0
- package/dist/hooks/use-supplier-invoice-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice-mutation.js +81 -0
- package/dist/hooks/use-supplier-invoice-payments.d.ts +26 -0
- package/dist/hooks/use-supplier-invoice-payments.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice-payments.js +12 -0
- package/dist/hooks/use-supplier-invoice.d.ts +65 -0
- package/dist/hooks/use-supplier-invoice.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice.js +12 -0
- package/dist/hooks/use-supplier-invoices.d.ts +36 -0
- package/dist/hooks/use-supplier-invoices.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoices.js +12 -0
- package/dist/hooks/use-supplier-payment-mutation.d.ts +55 -0
- package/dist/hooks/use-supplier-payment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-payment-mutation.js +35 -0
- package/dist/hooks/use-supplier-payments.d.ts +27 -0
- package/dist/hooks/use-supplier-payments.d.ts.map +1 -0
- package/dist/hooks/use-supplier-payments.js +12 -0
- package/dist/hooks/use-traveler-profitability.d.ts +24 -0
- package/dist/hooks/use-traveler-profitability.d.ts.map +1 -0
- package/dist/hooks/use-traveler-profitability.js +11 -0
- package/dist/hooks/use-voucher-mutation.d.ts +105 -0
- package/dist/hooks/use-voucher-mutation.d.ts.map +1 -0
- package/dist/hooks/use-voucher-mutation.js +50 -0
- package/dist/hooks/use-voucher.d.ts +38 -0
- package/dist/hooks/use-voucher.d.ts.map +1 -0
- package/dist/hooks/use-voucher.js +17 -0
- package/dist/hooks/use-vouchers.d.ts +34 -0
- package/dist/hooks/use-vouchers.d.ts.map +1 -0
- package/dist/hooks/use-vouchers.js +18 -0
- package/dist/i18n/en/invoices.d.ts +278 -0
- package/dist/i18n/en/invoices.d.ts.map +1 -0
- package/dist/i18n/en/invoices.js +277 -0
- package/dist/i18n/en/numberingAndPayments.d.ts +387 -0
- package/dist/i18n/en/numberingAndPayments.d.ts.map +1 -0
- package/dist/i18n/en/numberingAndPayments.js +386 -0
- package/dist/i18n/en/profitability.d.ts +147 -0
- package/dist/i18n/en/profitability.d.ts.map +1 -0
- package/dist/i18n/en/profitability.js +146 -0
- package/dist/i18n/en/suppliers.d.ts +187 -0
- package/dist/i18n/en/suppliers.d.ts.map +1 -0
- package/dist/i18n/en/suppliers.js +186 -0
- package/dist/i18n/en.d.ts +998 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +22 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/messages/core.d.ts +18 -0
- package/dist/i18n/messages/core.d.ts.map +1 -0
- package/dist/i18n/messages/core.js +30 -0
- package/dist/i18n/messages/invoices.d.ts +252 -0
- package/dist/i18n/messages/invoices.d.ts.map +1 -0
- package/dist/i18n/messages/invoices.js +1 -0
- package/dist/i18n/messages/numberingAndPayments.d.ts +277 -0
- package/dist/i18n/messages/numberingAndPayments.d.ts.map +1 -0
- package/dist/i18n/messages/numberingAndPayments.js +1 -0
- package/dist/i18n/messages/profitability.d.ts +151 -0
- package/dist/i18n/messages/profitability.d.ts.map +1 -0
- package/dist/i18n/messages/profitability.js +1 -0
- package/dist/i18n/messages/suppliers.d.ts +167 -0
- package/dist/i18n/messages/suppliers.d.ts.map +1 -0
- package/dist/i18n/messages/suppliers.js +1 -0
- package/dist/i18n/messages.d.ts +29 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +1 -0
- package/dist/i18n/provider.d.ts +2018 -0
- package/dist/i18n/provider.d.ts.map +1 -0
- package/dist/i18n/provider.js +44 -0
- package/dist/i18n/ro/invoices.d.ts +278 -0
- package/dist/i18n/ro/invoices.d.ts.map +1 -0
- package/dist/i18n/ro/invoices.js +277 -0
- package/dist/i18n/ro/numberingAndPayments.d.ts +387 -0
- package/dist/i18n/ro/numberingAndPayments.d.ts.map +1 -0
- package/dist/i18n/ro/numberingAndPayments.js +386 -0
- package/dist/i18n/ro/profitability.d.ts +147 -0
- package/dist/i18n/ro/profitability.d.ts.map +1 -0
- package/dist/i18n/ro/profitability.js +146 -0
- package/dist/i18n/ro/suppliers.d.ts +187 -0
- package/dist/i18n/ro/suppliers.d.ts.map +1 -0
- package/dist/i18n/ro/suppliers.js +186 -0
- package/dist/i18n/ro.d.ts +998 -0
- package/dist/i18n/ro.d.ts.map +1 -0
- package/dist/i18n/ro.js +22 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/operations.d.ts +484 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +52 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +1 -0
- package/dist/query-keys.d.ts +195 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +49 -0
- package/dist/query-options/public-reporting.d.ts +2129 -0
- package/dist/query-options/public-reporting.d.ts.map +1 -0
- package/dist/query-options/public-reporting.js +193 -0
- package/dist/query-options-action-ledger.d.ts +382 -0
- package/dist/query-options-action-ledger.d.ts.map +1 -0
- package/dist/query-options-action-ledger.js +36 -0
- package/dist/query-options.d.ts +2057 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +328 -0
- package/dist/schemas/accountant.d.ts +168 -0
- package/dist/schemas/accountant.d.ts.map +1 -0
- package/dist/schemas/accountant.js +53 -0
- package/dist/schemas/action-ledger.d.ts +206 -0
- package/dist/schemas/action-ledger.d.ts.map +1 -0
- package/dist/schemas/action-ledger.js +83 -0
- package/dist/schemas/common.d.ts +17 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +10 -0
- package/dist/schemas/invoice.d.ts +1451 -0
- package/dist/schemas/invoice.d.ts.map +1 -0
- package/dist/schemas/invoice.js +438 -0
- package/dist/schemas/profitability.d.ts +333 -0
- package/dist/schemas/profitability.d.ts.map +1 -0
- package/dist/schemas/profitability.js +84 -0
- package/dist/schemas/public.d.ts +481 -0
- package/dist/schemas/public.d.ts.map +1 -0
- package/dist/schemas/public.js +9 -0
- package/dist/schemas/responses.d.ts +632 -0
- package/dist/schemas/responses.d.ts.map +1 -0
- package/dist/schemas/responses.js +27 -0
- package/dist/schemas/supplier.d.ts +226 -0
- package/dist/schemas/supplier.d.ts.map +1 -0
- package/dist/schemas/supplier.js +103 -0
- package/dist/schemas/vouchers.d.ts +283 -0
- package/dist/schemas/vouchers.d.ts.map +1 -0
- package/dist/schemas/vouchers.js +49 -0
- package/dist/schemas.d.ts +10 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +9 -0
- package/dist/ui.d.ts +27 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +26 -0
- package/package.json +181 -0
- package/src/styles.css +12 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { adminRoutePageModule, defineAdminExtension, } from "@voyant-travel/admin";
|
|
3
|
+
// Importing the slot id also binds the bookings-ui `AdminDestinations`
|
|
4
|
+
// augmentation (`booking.detail`, `person.detail`, `organization.detail`,
|
|
5
|
+
// `invoice.detail`, `payment.detail`, ...) into this program — the finance
|
|
6
|
+
// pages navigate through those shared keys, and this package already
|
|
7
|
+
// peer-depends on `@voyant-travel/bookings-react/ui`, so re-declaring them here would
|
|
8
|
+
// just duplicate the contract.
|
|
9
|
+
import { bookingDetailFinanceEndSlot, bookingDetailFinanceStartSlot, bookingDetailInvoicesTabSlot, } from "@voyant-travel/bookings-react/admin";
|
|
10
|
+
// Importing the slot id also binds the suppliers-ui `AdminDestinations`
|
|
11
|
+
// augmentation (`supplier.list`, `supplier.detail`) — this package already
|
|
12
|
+
// peer-depends on `@voyant-travel/distribution-react/suppliers/ui`.
|
|
13
|
+
import { supplierDetailPaymentPolicySlot } from "@voyant-travel/distribution-react/suppliers/admin";
|
|
14
|
+
import { defaultFetcher } from "@voyant-travel/react";
|
|
15
|
+
import * as React from "react";
|
|
16
|
+
// Skeletons are deliberately the ONLY page-adjacent statics this factory
|
|
17
|
+
// touches: they ship from their own light modules, so attaching them as
|
|
18
|
+
// `pendingComponent` doesn't pull the heavy page chunks into the factory.
|
|
19
|
+
// Query options resolve via dynamic import inside the loaders, and the
|
|
20
|
+
// widgets mount through Suspense-wrapped `React.lazy` loaders — both keep
|
|
21
|
+
// the finance data layer (client + response schemas + the payment-policy
|
|
22
|
+
// engine) out of the workspace-chrome chunk that evaluates this factory.
|
|
23
|
+
import { InvoicesPageSkeleton } from "../components/invoices-page-skeleton.js";
|
|
24
|
+
import { PaymentsPageSkeleton } from "../components/payments-page-skeleton.js";
|
|
25
|
+
import { InvoiceDetailSkeleton } from "./invoice-detail-skeleton.js";
|
|
26
|
+
import { PaymentDetailSkeleton } from "./payment-detail-skeleton.js";
|
|
27
|
+
/** The host runtime as the package's query-option client (`fetchWithValidation`). */
|
|
28
|
+
function runtimeClient(runtime) {
|
|
29
|
+
return { baseUrl: runtime.baseUrl, fetcher: runtime.fetcher ?? defaultFetcher };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Suspense-wrapped lazy widget mount: the widget registry takes a sync
|
|
33
|
+
* component, but the finance cards (and the payment-policy/schedule stack
|
|
34
|
+
* behind them) must not load with workspace chrome — each widget chunk
|
|
35
|
+
* fetches when its slot actually renders on a detail page.
|
|
36
|
+
*/
|
|
37
|
+
function lazyWidget(load) {
|
|
38
|
+
const Lazy = React.lazy(load);
|
|
39
|
+
return function LazyFinanceAdminWidget(props) {
|
|
40
|
+
return (_jsx(React.Suspense, { fallback: null, children: _jsx(Lazy, { ...props }) }));
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const LazyBookingInvoicesWidget = lazyWidget(() => import("./booking-invoices-widget.js").then((module) => ({
|
|
44
|
+
default: module.BookingInvoicesWidget,
|
|
45
|
+
})));
|
|
46
|
+
const LazyBookingPendingPaymentSessionsWidget = lazyWidget(() => import("./booking-pending-payment-sessions-widget.js").then((module) => ({
|
|
47
|
+
default: module.BookingPendingPaymentSessionsWidget,
|
|
48
|
+
})));
|
|
49
|
+
const LazyBookingPaymentPolicyWidget = lazyWidget(() => import("./booking-payment-policy-widget.js").then((module) => ({
|
|
50
|
+
default: module.BookingPaymentPolicyWidget,
|
|
51
|
+
})));
|
|
52
|
+
const LazySupplierPaymentPolicyWidget = lazyWidget(() => import("./supplier-payment-policy-widget.js").then((module) => ({
|
|
53
|
+
default: module.SupplierPaymentPolicyWidget,
|
|
54
|
+
})));
|
|
55
|
+
export { InvoiceDetailSkeleton } from "./invoice-detail-skeleton.js";
|
|
56
|
+
export { PaymentDetailSkeleton } from "./payment-detail-skeleton.js";
|
|
57
|
+
/**
|
|
58
|
+
* The finance admin contribution (packaged-admin RFC Phase 3,
|
|
59
|
+
* `@voyant-travel/<domain>-ui/admin` convention).
|
|
60
|
+
*
|
|
61
|
+
* NAVIGATION: deliberately none. The Finance nav group (invoices, number
|
|
62
|
+
* series, payments, supplier invoices, profitability) is part of the BASE
|
|
63
|
+
* operator navigation — see `createOperatorAdminNavigation` in
|
|
64
|
+
* `@voyant-travel/admin` — so contributing nav entries here would duplicate them.
|
|
65
|
+
* If the base nav ever drops the finance group, this extension is where the
|
|
66
|
+
* entries move.
|
|
67
|
+
*
|
|
68
|
+
* ROUTES: all eight contributions carry the FULL route implementation
|
|
69
|
+
* (packaged-admin RFC §4.8 endgame) — a lazy `page` module loader, a data
|
|
70
|
+
* loader fed by the host runtime (`baseUrl` + cookie-forwarding fetcher),
|
|
71
|
+
* `ssr: "data-only"`, and the pending skeleton where the operator route had
|
|
72
|
+
* one — so the host needs no per-route files for them. Pages stay
|
|
73
|
+
* code-split: this factory never references a page component statically;
|
|
74
|
+
* each `page:` dynamically imports its specific module (never a barrel), and
|
|
75
|
+
* param-taking pages read the matched `$id` off `AdminRoutePageProps` and
|
|
76
|
+
* bind it onto {@link InvoiceDetailHost} / {@link PaymentDetailHost}.
|
|
77
|
+
* Cross-route links resolve through the semantic destinations declared
|
|
78
|
+
* above. The supplier-invoices pages carry their previously app-owned wiring
|
|
79
|
+
* package-side now: attachment uploads post to the starter-level
|
|
80
|
+
* `/v1/uploads` route through the shared finance provider context (the
|
|
81
|
+
* `BookingInvoicesWidget` precedent), inline supplier creation rides the
|
|
82
|
+
* suppliers package's `useSupplierMutation`, and the allocation dialog's
|
|
83
|
+
* cross-domain target search composes the bookings / products /
|
|
84
|
+
* availability packages' query options through the same context client.
|
|
85
|
+
*
|
|
86
|
+
* WIDGETS: the cycle-resolution piece (RFC §4.7). The booking detail page
|
|
87
|
+
* needs the finance-owned invoices card, but this package peer-depends on
|
|
88
|
+
* `@voyant-travel/bookings-react/ui`, so the bookings host cannot import it. Instead
|
|
89
|
+
* this extension contributes {@link BookingInvoicesWidget} on the
|
|
90
|
+
* `booking.details.invoices-tab` slot the bookings host exposes; the host
|
|
91
|
+
* mounts its Invoices tab whenever a contribution targets that slot and
|
|
92
|
+
* hands the widget its typed slot context as props. The Finance tab's
|
|
93
|
+
* payment-links card ({@link BookingPendingPaymentSessionsWidget}) and
|
|
94
|
+
* payment-policy override card ({@link BookingPaymentPolicyWidget}) travel
|
|
95
|
+
* the same way on `booking.details.finance-start` / `…finance-end`. The
|
|
96
|
+
* same pattern resolves the finance-ui ↔ suppliers-ui cycle: the supplier detail page's
|
|
97
|
+
* customer-payment-policy card ships as {@link SupplierPaymentPolicyWidget}
|
|
98
|
+
* on the `supplier.details.payment-policy` slot the supplier host exposes.
|
|
99
|
+
*/
|
|
100
|
+
export function createFinanceAdminExtension(options = {}) {
|
|
101
|
+
const { basePath = "/finance", labels = {} } = options;
|
|
102
|
+
const { invoices = "Invoices", invoiceNumberSeries = "Number Series", payments = "Payments", supplierInvoices = "Supplier invoices", profitability = "Profitability", } = labels;
|
|
103
|
+
return defineAdminExtension({
|
|
104
|
+
id: "finance",
|
|
105
|
+
routes: [
|
|
106
|
+
{
|
|
107
|
+
// Index redirect (formerly the host's `finance/index.tsx` file
|
|
108
|
+
// route): `/finance` lands on the invoices page.
|
|
109
|
+
id: "finance-index",
|
|
110
|
+
path: basePath,
|
|
111
|
+
title: invoices,
|
|
112
|
+
redirectTo: `${basePath}/invoices`,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: "finance-invoices-index",
|
|
116
|
+
path: `${basePath}/invoices`,
|
|
117
|
+
title: invoices,
|
|
118
|
+
// Route-backed destination (RFC §4.7 endgame): the key resolves by
|
|
119
|
+
// pure path interpolation of this route, so the host's resolver is
|
|
120
|
+
// generated (`voyant admin generate --destinations`).
|
|
121
|
+
destination: "invoice.list",
|
|
122
|
+
ssr: "data-only",
|
|
123
|
+
page: () => import("./pages/invoices-index.js"),
|
|
124
|
+
// Dynamic import on purpose: the query options pull the finance
|
|
125
|
+
// data layer (client + response schemas), and a static import here
|
|
126
|
+
// would pin it into the workspace-chrome chunk that evaluates this
|
|
127
|
+
// factory.
|
|
128
|
+
loader: async ({ queryClient, runtime }) => {
|
|
129
|
+
const { getInvoicesQueryOptions } = await import("../query-options.js");
|
|
130
|
+
return queryClient.ensureQueryData(getInvoicesQueryOptions(runtimeClient(runtime)));
|
|
131
|
+
},
|
|
132
|
+
pendingComponent: InvoicesPageSkeleton,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "finance-invoices-detail",
|
|
136
|
+
path: `${basePath}/invoices/$id`,
|
|
137
|
+
title: invoices,
|
|
138
|
+
// Key declared by @voyant-travel/bookings-react/admin (bound above).
|
|
139
|
+
destination: "invoice.detail",
|
|
140
|
+
destinationParams: { id: "invoiceId" },
|
|
141
|
+
ssr: "data-only",
|
|
142
|
+
page: () => import("./pages/invoice-detail.js"),
|
|
143
|
+
loader: async ({ queryClient, runtime, params }) => {
|
|
144
|
+
const id = params.id;
|
|
145
|
+
if (!id)
|
|
146
|
+
return;
|
|
147
|
+
// Dynamic import on purpose — see the invoices index loader above.
|
|
148
|
+
const { getInvoiceCreditNotesQueryOptions, getInvoiceLineItemsQueryOptions, getInvoiceNotesQueryOptions, getInvoicePaymentsQueryOptions, getInvoiceQueryOptions, } = await import("../query-options.js");
|
|
149
|
+
const client = runtimeClient(runtime);
|
|
150
|
+
await queryClient.ensureQueryData(getInvoiceQueryOptions(client, id));
|
|
151
|
+
void queryClient.prefetchQuery(getInvoiceLineItemsQueryOptions(client, id));
|
|
152
|
+
void queryClient.prefetchQuery(getInvoicePaymentsQueryOptions(client, id));
|
|
153
|
+
void queryClient.prefetchQuery(getInvoiceCreditNotesQueryOptions(client, id));
|
|
154
|
+
void queryClient.prefetchQuery(getInvoiceNotesQueryOptions(client, id));
|
|
155
|
+
},
|
|
156
|
+
pendingComponent: InvoiceDetailSkeleton,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: "finance-invoice-number-series",
|
|
160
|
+
path: `${basePath}/invoice-number-series`,
|
|
161
|
+
title: invoiceNumberSeries,
|
|
162
|
+
ssr: "data-only",
|
|
163
|
+
// `InvoiceNumberSeriesPage` takes an all-optional props bag, which
|
|
164
|
+
// TypeScript's weak-type rule rejects as a route page component
|
|
165
|
+
// despite being safe to mount — hence `adminRoutePageModule`.
|
|
166
|
+
page: () => import("../components/invoice-number-series-page.js").then((module) => adminRoutePageModule(module.InvoiceNumberSeriesPage)),
|
|
167
|
+
// Dynamic import on purpose — see the invoices index loader above.
|
|
168
|
+
loader: async ({ queryClient, runtime }) => {
|
|
169
|
+
const { getInvoiceNumberSeriesQueryOptions } = await import("../query-options.js");
|
|
170
|
+
return queryClient.ensureQueryData(getInvoiceNumberSeriesQueryOptions(runtimeClient(runtime), {
|
|
171
|
+
limit: 100,
|
|
172
|
+
offset: 0,
|
|
173
|
+
}));
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: "finance-payments-index",
|
|
178
|
+
path: `${basePath}/payments`,
|
|
179
|
+
title: payments,
|
|
180
|
+
destination: "payment.list",
|
|
181
|
+
ssr: "data-only",
|
|
182
|
+
page: () => import("./pages/payments-index.js"),
|
|
183
|
+
// Dynamic import on purpose — see the invoices index loader above.
|
|
184
|
+
loader: async ({ queryClient, runtime }) => {
|
|
185
|
+
const { getAllPaymentsQueryOptions } = await import("../query-options.js");
|
|
186
|
+
return queryClient.ensureQueryData(getAllPaymentsQueryOptions(runtimeClient(runtime)));
|
|
187
|
+
},
|
|
188
|
+
pendingComponent: PaymentsPageSkeleton,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: "finance-payments-detail",
|
|
192
|
+
path: `${basePath}/payments/$id`,
|
|
193
|
+
title: payments,
|
|
194
|
+
// Key declared by @voyant-travel/bookings-react/admin (bound above).
|
|
195
|
+
destination: "payment.detail",
|
|
196
|
+
destinationParams: { id: "paymentId" },
|
|
197
|
+
ssr: "data-only",
|
|
198
|
+
page: () => import("./pages/payment-detail.js"),
|
|
199
|
+
loader: async ({ queryClient, runtime, params }) => {
|
|
200
|
+
const id = params.id;
|
|
201
|
+
if (!id)
|
|
202
|
+
return;
|
|
203
|
+
// Dynamic import on purpose — see the invoices index loader above.
|
|
204
|
+
const { getPaymentQueryOptions } = await import("../query-options.js");
|
|
205
|
+
return queryClient.ensureQueryData(getPaymentQueryOptions(runtimeClient(runtime), id));
|
|
206
|
+
},
|
|
207
|
+
pendingComponent: PaymentDetailSkeleton,
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
id: "finance-supplier-invoices-index",
|
|
211
|
+
path: `${basePath}/supplier-invoices`,
|
|
212
|
+
title: supplierInvoices,
|
|
213
|
+
destination: "supplierInvoice.list",
|
|
214
|
+
ssr: "data-only",
|
|
215
|
+
page: () => import("./pages/supplier-invoices-index.js"),
|
|
216
|
+
// Dynamic import on purpose — see the invoices index loader above.
|
|
217
|
+
loader: async ({ queryClient, runtime }) => {
|
|
218
|
+
const { getSupplierInvoicesQueryOptions } = await import("../query-options.js");
|
|
219
|
+
return queryClient.ensureQueryData(getSupplierInvoicesQueryOptions(runtimeClient(runtime)));
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
id: "finance-supplier-invoices-detail",
|
|
224
|
+
path: `${basePath}/supplier-invoices/$id`,
|
|
225
|
+
title: supplierInvoices,
|
|
226
|
+
destination: "supplierInvoice.detail",
|
|
227
|
+
destinationParams: { id: "supplierInvoiceId" },
|
|
228
|
+
ssr: "data-only",
|
|
229
|
+
page: () => import("./pages/supplier-invoice-detail.js"),
|
|
230
|
+
loader: async ({ queryClient, runtime, params }) => {
|
|
231
|
+
const id = params.id;
|
|
232
|
+
if (!id)
|
|
233
|
+
return;
|
|
234
|
+
// Dynamic import on purpose — see the invoices index loader above.
|
|
235
|
+
const { getSupplierInvoiceQueryOptions } = await import("../query-options.js");
|
|
236
|
+
return queryClient.ensureQueryData(getSupplierInvoiceQueryOptions(runtimeClient(runtime), id));
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: "finance-profitability",
|
|
241
|
+
path: `${basePath}/profitability`,
|
|
242
|
+
title: profitability,
|
|
243
|
+
ssr: "data-only",
|
|
244
|
+
page: () => import("./pages/profitability.js"),
|
|
245
|
+
// Dynamic import on purpose — see the invoices index loader above.
|
|
246
|
+
loader: async ({ queryClient, runtime }) => {
|
|
247
|
+
const { getDepartureProfitabilityQueryOptions } = await import("../query-options.js");
|
|
248
|
+
return queryClient.ensureQueryData(getDepartureProfitabilityQueryOptions(runtimeClient(runtime)));
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
widgets: [
|
|
253
|
+
{
|
|
254
|
+
id: "finance-booking-invoices",
|
|
255
|
+
slot: bookingDetailInvoicesTabSlot,
|
|
256
|
+
// The widget registry is untyped (`Record<string, unknown>` props);
|
|
257
|
+
// the typed contract is `BookingDetailHostSlotContext`, which the
|
|
258
|
+
// bookings host passes verbatim to this slot's widgets.
|
|
259
|
+
component: LazyBookingInvoicesWidget,
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
id: "finance-booking-pending-payment-sessions",
|
|
263
|
+
slot: bookingDetailFinanceStartSlot,
|
|
264
|
+
// Same untyped-registry cast; the typed contract is
|
|
265
|
+
// `BookingDetailHostSlotContext`, which the bookings host passes
|
|
266
|
+
// verbatim to this slot's widgets.
|
|
267
|
+
component: LazyBookingPendingPaymentSessionsWidget,
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
id: "finance-booking-payment-policy",
|
|
271
|
+
slot: bookingDetailFinanceEndSlot,
|
|
272
|
+
// Same untyped-registry cast; the typed contract is
|
|
273
|
+
// `BookingDetailHostSlotContext`.
|
|
274
|
+
component: LazyBookingPaymentPolicyWidget,
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
id: "finance-supplier-payment-policy",
|
|
278
|
+
slot: supplierDetailPaymentPolicySlot,
|
|
279
|
+
// Same untyped-registry cast; the typed contract is
|
|
280
|
+
// `SupplierDetailHostSlotContext`, which the supplier detail host
|
|
281
|
+
// passes verbatim to this slot's widgets.
|
|
282
|
+
component: LazySupplierPaymentPolicyWidget,
|
|
283
|
+
},
|
|
284
|
+
],
|
|
285
|
+
});
|
|
286
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface InvoiceDetailHostProps {
|
|
2
|
+
id: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Packaged admin host for the operator-grade invoice detail page
|
|
6
|
+
* (packaged-admin RFC Phase 3). Owns everything package-clean:
|
|
7
|
+
*
|
|
8
|
+
* - Data access through `@voyant-travel/finance-react` hooks (shared finance
|
|
9
|
+
* provider context — no app RPC client).
|
|
10
|
+
* - Cross-route links resolve through semantic destinations (RFC §4.7):
|
|
11
|
+
* `invoice.list` (back/after delete), `invoice.detail` (after a proforma
|
|
12
|
+
* converts), `booking.detail` — no host route tree import.
|
|
13
|
+
* - Admin widget extension points: the `invoice.details.header` and
|
|
14
|
+
* `invoice.details.after-summary` slots render through the shared
|
|
15
|
+
* `AdminWidgetSlotRenderer`, which reads the workspace shell's
|
|
16
|
+
* `AdminExtensionsProvider` context.
|
|
17
|
+
*/
|
|
18
|
+
export declare function InvoiceDetailHost({ id }: InvoiceDetailHostProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=invoice-detail-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoice-detail-host.d.ts","sourceRoot":"","sources":["../../src/admin/invoice-detail-host.tsx"],"names":[],"mappings":"AAqEA,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;CACX;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,sBAAsB,2CAmS/D"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AdminWidgetSlotRenderer, useAdminNavigate, useOperatorAdminMessages, } from "@voyant-travel/admin";
|
|
4
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Badge, Button, Textarea, } from "@voyant-travel/ui/components";
|
|
5
|
+
import { ArrowLeft, ArrowRightLeft, Ban, Loader2, Pencil, Trash2 } from "lucide-react";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { InvoiceActionLedgerCard } from "../components/invoice-action-ledger-card.js";
|
|
8
|
+
import { InvoiceDialog } from "../components/invoice-dialog.js";
|
|
9
|
+
import { useInvoice, useInvoiceCreditNotes, useInvoiceLineItemMutation, useInvoiceLineItems, useInvoiceMutation, useInvoiceNoteMutation, useInvoiceNotes, useInvoicePayments, } from "../index.js";
|
|
10
|
+
import { CreditNoteDialog } from "./credit-note-dialog.js";
|
|
11
|
+
import { invoiceStatusVariant } from "./finance-shared.js";
|
|
12
|
+
import { InvoiceAttachmentsCard, InvoiceCreditNotesCard, InvoiceInfoCards, InvoiceLineItemsCard, InvoiceNotesCard, InvoicePaymentsCard, } from "./invoice-detail-sections.js";
|
|
13
|
+
import { InvoiceDetailSkeleton } from "./invoice-detail-skeleton.js";
|
|
14
|
+
import { LineItemDialog } from "./line-item-dialog.js";
|
|
15
|
+
import { PaymentDialog } from "./payment-dialog.js";
|
|
16
|
+
function getInvoiceStatusLabel(messages, status) {
|
|
17
|
+
switch (status) {
|
|
18
|
+
case "draft":
|
|
19
|
+
return messages.finance.invoiceStatusDraft;
|
|
20
|
+
case "issued":
|
|
21
|
+
return messages.finance.invoiceStatusIssued;
|
|
22
|
+
case "partially_paid":
|
|
23
|
+
return messages.finance.invoiceStatusPartiallyPaid;
|
|
24
|
+
case "paid":
|
|
25
|
+
return messages.finance.invoiceStatusPaid;
|
|
26
|
+
case "overdue":
|
|
27
|
+
return messages.finance.invoiceStatusOverdue;
|
|
28
|
+
case "void":
|
|
29
|
+
return messages.finance.invoiceStatusVoid;
|
|
30
|
+
default:
|
|
31
|
+
return status.replace(/_/g, " ");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Packaged admin host for the operator-grade invoice detail page
|
|
36
|
+
* (packaged-admin RFC Phase 3). Owns everything package-clean:
|
|
37
|
+
*
|
|
38
|
+
* - Data access through `@voyant-travel/finance-react` hooks (shared finance
|
|
39
|
+
* provider context — no app RPC client).
|
|
40
|
+
* - Cross-route links resolve through semantic destinations (RFC §4.7):
|
|
41
|
+
* `invoice.list` (back/after delete), `invoice.detail` (after a proforma
|
|
42
|
+
* converts), `booking.detail` — no host route tree import.
|
|
43
|
+
* - Admin widget extension points: the `invoice.details.header` and
|
|
44
|
+
* `invoice.details.after-summary` slots render through the shared
|
|
45
|
+
* `AdminWidgetSlotRenderer`, which reads the workspace shell's
|
|
46
|
+
* `AdminExtensionsProvider` context.
|
|
47
|
+
*/
|
|
48
|
+
export function InvoiceDetailHost({ id }) {
|
|
49
|
+
const messages = useOperatorAdminMessages();
|
|
50
|
+
const navigateTo = useAdminNavigate();
|
|
51
|
+
const [editOpen, setEditOpen] = useState(false);
|
|
52
|
+
const [lineItemDialogOpen, setLineItemDialogOpen] = useState(false);
|
|
53
|
+
const [editingLineItem, setEditingLineItem] = useState();
|
|
54
|
+
const [paymentDialogOpen, setPaymentDialogOpen] = useState(false);
|
|
55
|
+
const [creditNoteDialogOpen, setCreditNoteDialogOpen] = useState(false);
|
|
56
|
+
const [noteContent, setNoteContent] = useState("");
|
|
57
|
+
const [actionError, setActionError] = useState(null);
|
|
58
|
+
const [voidDialogOpen, setVoidDialogOpen] = useState(false);
|
|
59
|
+
const [voidReason, setVoidReason] = useState("");
|
|
60
|
+
const { data: invoiceData, isPending } = useInvoice(id);
|
|
61
|
+
const { data: lineItemsData } = useInvoiceLineItems(id);
|
|
62
|
+
const { data: paymentsData } = useInvoicePayments(id);
|
|
63
|
+
const { data: creditNotesData } = useInvoiceCreditNotes(id);
|
|
64
|
+
const { data: notesData } = useInvoiceNotes(id);
|
|
65
|
+
const { convertToInvoice, remove: deleteInvoice, voidInvoice } = useInvoiceMutation();
|
|
66
|
+
const { remove: deleteLineItem } = useInvoiceLineItemMutation(id);
|
|
67
|
+
const addNoteMutation = useInvoiceNoteMutation(id);
|
|
68
|
+
if (isPending) {
|
|
69
|
+
return _jsx(InvoiceDetailSkeleton, {});
|
|
70
|
+
}
|
|
71
|
+
const invoice = invoiceData?.data;
|
|
72
|
+
if (!invoice) {
|
|
73
|
+
return (_jsxs("div", { className: "flex flex-col items-center justify-center gap-4 py-12", children: [_jsx("p", { className: "text-muted-foreground", children: messages.finance.detailPage.notFound }), _jsx(Button, { variant: "outline", onClick: () => navigateTo("invoice.list", {}), children: messages.finance.detailPage.backToFinance })] }));
|
|
74
|
+
}
|
|
75
|
+
const lineItems = lineItemsData?.data ?? [];
|
|
76
|
+
const payments = paymentsData?.data ?? [];
|
|
77
|
+
const creditNotes = creditNotesData?.data ?? [];
|
|
78
|
+
const notes = notesData?.data ?? [];
|
|
79
|
+
const canVoidInvoice = ["pending_external_allocation", "issued", "overdue"].includes(invoice.status);
|
|
80
|
+
const canConvertProforma = invoice.invoiceType === "proforma" && invoice.status !== "void";
|
|
81
|
+
const getMutationErrorMessage = (fallback) => (error) => error instanceof Error ? error.message : fallback;
|
|
82
|
+
return (_jsxs("div", { className: "flex flex-col gap-6 p-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx(Button, { variant: "ghost", size: "icon", onClick: () => navigateTo("invoice.list", {}), children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsxs("div", { className: "flex-1", children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight", children: invoice.invoiceNumber }), _jsx("div", { className: "mt-1 flex items-center gap-2", children: _jsx(Badge, { variant: invoiceStatusVariant[invoice.status] ?? "secondary", className: "capitalize", children: getInvoiceStatusLabel(messages, invoice.status) }) })] }), _jsxs("div", { className: "flex items-center gap-2", children: [canConvertProforma ? (_jsxs(Button, { variant: "outline", disabled: convertToInvoice.isPending, onClick: () => {
|
|
83
|
+
if (!confirm(messages.finance.convertConfirm))
|
|
84
|
+
return;
|
|
85
|
+
setActionError(null);
|
|
86
|
+
convertToInvoice.mutate({ id }, {
|
|
87
|
+
onSuccess: (converted) => {
|
|
88
|
+
navigateTo("invoice.detail", { invoiceId: converted.id });
|
|
89
|
+
},
|
|
90
|
+
onError: (error) => {
|
|
91
|
+
setActionError(getMutationErrorMessage(messages.finance.detailPage.convertFailed)(error));
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
}, children: [convertToInvoice.isPending ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": "true" })) : (_jsx(ArrowRightLeft, { className: "mr-2 h-4 w-4" })), messages.finance.convertToInvoice] })) : null, _jsxs(Button, { variant: "outline", onClick: () => setEditOpen(true), children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), messages.finance.detailPage.edit] }), _jsxs(AlertDialog, { open: voidDialogOpen, onOpenChange: (open) => {
|
|
95
|
+
setVoidDialogOpen(open);
|
|
96
|
+
if (!open)
|
|
97
|
+
setVoidReason("");
|
|
98
|
+
}, children: [_jsxs(AlertDialogTrigger, { disabled: !canVoidInvoice || voidInvoice.isPending, render: _jsx(Button, { type: "button", variant: "outline" }), children: [_jsx(Ban, { className: "mr-2 h-4 w-4" }), messages.finance.detailPage.void] }), _jsxs(AlertDialogContent, { size: "sm", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: messages.finance.detailPage.voidConfirm }), _jsx(AlertDialogDescription, { children: messages.finance.detailPage.voidDescription })] }), _jsx(Textarea, { value: voidReason, onChange: (event) => setVoidReason(event.target.value), placeholder: messages.finance.detailPage.voidReasonPlaceholder, className: "min-h-24" }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: voidInvoice.isPending, children: messages.finance.detailPage.cancel }), _jsxs(AlertDialogAction, { variant: "destructive", disabled: voidInvoice.isPending, onClick: () => {
|
|
99
|
+
setActionError(null);
|
|
100
|
+
voidInvoice.mutate({ id, input: { reason: voidReason.trim() || null } }, {
|
|
101
|
+
onSuccess: () => {
|
|
102
|
+
setVoidDialogOpen(false);
|
|
103
|
+
setVoidReason("");
|
|
104
|
+
},
|
|
105
|
+
onError: (error) => {
|
|
106
|
+
setActionError(getMutationErrorMessage(messages.finance.detailPage.voidFailed)(error));
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
}, children: [voidInvoice.isPending ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": "true" })) : null, messages.finance.detailPage.void] })] })] })] }), _jsxs(Button, { variant: "destructive", onClick: () => {
|
|
110
|
+
if (invoice.status !== "draft") {
|
|
111
|
+
alert(messages.finance.detailPage.deleteOnlyDraftAlert);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (confirm(messages.finance.detailPage.deleteConfirm)) {
|
|
115
|
+
setActionError(null);
|
|
116
|
+
deleteInvoice.mutate(id, {
|
|
117
|
+
onSuccess: () => {
|
|
118
|
+
navigateTo("invoice.list", {});
|
|
119
|
+
},
|
|
120
|
+
onError: (error) => {
|
|
121
|
+
setActionError(getMutationErrorMessage(messages.finance.detailPage.deleteOnlyDraftAlert)(error));
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}, disabled: deleteInvoice.isPending, children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), messages.finance.detailPage.delete] })] })] }), actionError ? (_jsx("div", { className: "rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-destructive text-sm", children: actionError })) : null, _jsx(AdminWidgetSlotRenderer, { slot: "invoice.details.header", props: { invoice } }), _jsx(InvoiceInfoCards, { invoice: invoice, onOpenBooking: () => navigateTo("booking.detail", { bookingId: invoice.bookingId }) }), _jsx(AdminWidgetSlotRenderer, { slot: "invoice.details.after-summary", props: { invoice, lineItems, payments, creditNotes, notes } }), _jsx(InvoiceLineItemsCard, { lineItems: lineItems, onCreate: () => {
|
|
126
|
+
setEditingLineItem(undefined);
|
|
127
|
+
setLineItemDialogOpen(true);
|
|
128
|
+
}, onEdit: (lineItem) => {
|
|
129
|
+
setEditingLineItem(lineItem);
|
|
130
|
+
setLineItemDialogOpen(true);
|
|
131
|
+
}, onDelete: (lineId) => {
|
|
132
|
+
if (confirm(messages.finance.detailPage.deleteLineItemConfirm)) {
|
|
133
|
+
setActionError(null);
|
|
134
|
+
deleteLineItem.mutate(lineId, {
|
|
135
|
+
onError: (error) => {
|
|
136
|
+
setActionError(getMutationErrorMessage(messages.finance.detailPage.deleteLineItemFailed)(error));
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
} }), _jsx(InvoiceAttachmentsCard, { invoiceId: id }), _jsx(InvoicePaymentsCard, { payments: payments, onCreate: () => setPaymentDialogOpen(true), canCreate: invoice.status !== "void" }), _jsx(InvoiceCreditNotesCard, { creditNotes: creditNotes, onCreate: () => setCreditNoteDialogOpen(true) }), _jsx(InvoiceNotesCard, { noteContent: noteContent, isAdding: addNoteMutation.isPending, notes: notes, onNoteChange: setNoteContent, onAddNote: () => addNoteMutation.mutate({ content: noteContent.trim() }, {
|
|
141
|
+
onSuccess: () => {
|
|
142
|
+
setNoteContent("");
|
|
143
|
+
},
|
|
144
|
+
}) }), _jsx(InvoiceActionLedgerCard, { invoiceId: invoice.id }), _jsx(InvoiceDialog, { open: editOpen, onOpenChange: setEditOpen, invoice: invoice }), _jsx(LineItemDialog, { open: lineItemDialogOpen, onOpenChange: setLineItemDialogOpen, invoiceId: id, lineItem: editingLineItem, onSuccess: () => {
|
|
145
|
+
setEditingLineItem(undefined);
|
|
146
|
+
} }), _jsx(PaymentDialog, { open: paymentDialogOpen, onOpenChange: setPaymentDialogOpen, invoiceId: id, invoiceCurrency: invoice.currency }), _jsx(CreditNoteDialog, { open: creditNoteDialogOpen, onOpenChange: setCreditNoteDialogOpen, invoiceId: id, invoiceCurrency: invoice.currency })] }));
|
|
147
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type CreditNoteRow, type FinanceNote, type InvoiceDetail, type LineItem, type PaymentRow } from "./finance-shared.js";
|
|
2
|
+
export declare function InvoiceInfoCards({ invoice, onOpenBooking, }: {
|
|
3
|
+
invoice: InvoiceDetail;
|
|
4
|
+
onOpenBooking: () => void;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function InvoiceLineItemsCard({ lineItems, onCreate, onEdit, onDelete, }: {
|
|
7
|
+
lineItems: LineItem[];
|
|
8
|
+
onCreate: () => void;
|
|
9
|
+
onEdit: (lineItem: LineItem) => void;
|
|
10
|
+
onDelete: (lineId: string) => void;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function InvoicePaymentsCard({ payments, onCreate, canCreate, }: {
|
|
13
|
+
payments: PaymentRow[];
|
|
14
|
+
onCreate: () => void;
|
|
15
|
+
canCreate?: boolean;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function InvoiceCreditNotesCard({ creditNotes, onCreate, }: {
|
|
18
|
+
creditNotes: CreditNoteRow[];
|
|
19
|
+
onCreate: () => void;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function InvoiceAttachmentsCard({ invoiceId }: {
|
|
22
|
+
invoiceId: string;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function InvoiceNotesCard({ notes, noteContent, isAdding, onNoteChange, onAddNote, }: {
|
|
25
|
+
notes: FinanceNote[];
|
|
26
|
+
noteContent: string;
|
|
27
|
+
isAdding: boolean;
|
|
28
|
+
onNoteChange: (value: string) => void;
|
|
29
|
+
onAddNote: () => void;
|
|
30
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
//# sourceMappingURL=invoice-detail-sections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoice-detail-sections.d.ts","sourceRoot":"","sources":["../../src/admin/invoice-detail-sections.tsx"],"names":[],"mappings":"AAoBA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,WAAW,EAGhB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,UAAU,EAEhB,MAAM,qBAAqB,CAAA;AA+C5B,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,aAAa,GACd,EAAE;IACD,OAAO,EAAE,aAAa,CAAA;IACtB,aAAa,EAAE,MAAM,IAAI,CAAA;CAC1B,2CA2HA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,QAAQ,EACR,MAAM,EACN,QAAQ,GACT,EAAE;IACD,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;IACpC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,2CAkFA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,QAAQ,EACR,SAAgB,GACjB,EAAE;IACD,QAAQ,EAAE,UAAU,EAAE,CAAA;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,2CAmEA;AAED,wBAAgB,sBAAsB,CAAC,EACrC,WAAW,EACX,QAAQ,GACT,EAAE;IACD,WAAW,EAAE,aAAa,EAAE,CAAA;IAC5B,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB,2CAyDA;AAED,wBAAgB,sBAAsB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,2CAsD1E;AAyBD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAS,GACV,EAAE;IACD,KAAK,EAAE,WAAW,EAAE,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,2CAyCA"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// agent-quality: file-size exception -- owner: finance-react; existing UI surface stays co-located until a dedicated split preserves behavior and tests.
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useLocale, useOperatorAdminMessages, } from "@voyant-travel/admin";
|
|
5
|
+
import { Badge, Button, Card, CardContent, CardHeader, CardTitle, Textarea, } from "@voyant-travel/ui/components";
|
|
6
|
+
import { Download, FileText, Pencil, Plus, Trash2 } from "lucide-react";
|
|
7
|
+
import { useInvoiceAttachments, useVoyantFinanceContext } from "../index.js";
|
|
8
|
+
import { creditNoteStatusVariant, formatAmount, formatMethod, paymentStatusVariant, } from "./finance-shared.js";
|
|
9
|
+
function getPaymentStatusLabel(messages, status) {
|
|
10
|
+
switch (status) {
|
|
11
|
+
case "pending":
|
|
12
|
+
return messages.finance.paymentStatusPending;
|
|
13
|
+
case "completed":
|
|
14
|
+
return messages.finance.paymentStatusCompleted;
|
|
15
|
+
case "failed":
|
|
16
|
+
return messages.finance.paymentStatusFailed;
|
|
17
|
+
case "refunded":
|
|
18
|
+
return messages.finance.paymentStatusRefunded;
|
|
19
|
+
default:
|
|
20
|
+
return status.replace(/_/g, " ");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function getPaymentMethodLabel(messages, method) {
|
|
24
|
+
switch (method) {
|
|
25
|
+
case "bank_transfer":
|
|
26
|
+
return messages.finance.paymentMethodBankTransfer;
|
|
27
|
+
case "credit_card":
|
|
28
|
+
return messages.finance.paymentMethodCreditCard;
|
|
29
|
+
case "cash":
|
|
30
|
+
return messages.finance.paymentMethodCash;
|
|
31
|
+
case "cheque":
|
|
32
|
+
return messages.finance.paymentMethodCheque;
|
|
33
|
+
case "other":
|
|
34
|
+
return messages.finance.paymentMethodOther;
|
|
35
|
+
default:
|
|
36
|
+
return formatMethod(method);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function getCreditNoteStatusLabel(messages, status) {
|
|
40
|
+
switch (status) {
|
|
41
|
+
case "draft":
|
|
42
|
+
return messages.finance.creditNoteStatusDraft;
|
|
43
|
+
case "issued":
|
|
44
|
+
return messages.finance.creditNoteStatusIssued;
|
|
45
|
+
case "applied":
|
|
46
|
+
return messages.finance.creditNoteStatusApplied;
|
|
47
|
+
default:
|
|
48
|
+
return status.replace(/_/g, " ");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export function InvoiceInfoCards({ invoice, onOpenBooking, }) {
|
|
52
|
+
const messages = useOperatorAdminMessages();
|
|
53
|
+
const { resolvedLocale } = useLocale();
|
|
54
|
+
return (_jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.finance.detailSections.invoiceDetailsTitle }) }), _jsxs(CardContent, { className: "grid gap-3 text-sm", children: [_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.currencyLabel, ":"] }), " ", _jsx("span", { children: invoice.currency })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.subtotalLabel, ":"] }), " ", _jsx("span", { className: "font-mono", children: formatAmount(invoice.subtotalCents, invoice.currency) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.taxLabel, ":"] }), " ", _jsx("span", { className: "font-mono", children: formatAmount(invoice.taxCents, invoice.currency) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.totalLabel, ":"] }), " ", _jsx("span", { className: "font-mono font-semibold", children: formatAmount(invoice.totalCents, invoice.currency) })] }), _jsxs("div", { className: "mt-2 border-t pt-3", children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.paidLabel, ":"] }), " ", _jsx("span", { className: "font-mono", children: formatAmount(invoice.paidCents, invoice.currency) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.balanceDueLabel, ":"] }), " ", _jsx("span", { className: "font-mono font-semibold", children: formatAmount(invoice.balanceDueCents, invoice.currency) })] })] })] }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.finance.detailSections.datesLinksTitle }) }), _jsxs(CardContent, { className: "grid gap-3 text-sm", children: [_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.issueDateLabel, ":"] }), " ", _jsx("span", { children: invoice.issueDate })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.dueDateLabel, ":"] }), " ", _jsx("span", { children: invoice.dueDate })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.bookingLabel, ":"] }), " ", _jsx("button", { type: "button", className: "text-primary underline", onClick: onOpenBooking, children: messages.finance.detailSections.viewBooking })] }), invoice.personId ? (_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.personLabel, ":"] }), " ", _jsx("span", { className: "font-mono text-xs", children: invoice.personId })] })) : null, invoice.organizationId ? (_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.organizationLabel, ":"] }), " ", _jsx("span", { className: "font-mono text-xs", children: invoice.organizationId })] })) : null, invoice.notes ? (_jsxs("div", { className: "mt-2 border-t pt-3", children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.notesLabel, ":"] }), _jsx("p", { className: "mt-1 whitespace-pre-wrap", children: invoice.notes })] })) : null, _jsxs("div", { className: "mt-2 border-t pt-3", children: [_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.createdLabel, ":"] }), " ", _jsx("span", { children: new Date(invoice.createdAt).toLocaleDateString(resolvedLocale) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.updatedLabel, ":"] }), " ", _jsx("span", { children: new Date(invoice.updatedAt).toLocaleDateString(resolvedLocale) })] })] })] })] })] }));
|
|
55
|
+
}
|
|
56
|
+
export function InvoiceLineItemsCard({ lineItems, onCreate, onEdit, onDelete, }) {
|
|
57
|
+
const messages = useOperatorAdminMessages();
|
|
58
|
+
const noValue = messages.finance.detailSections.noValue;
|
|
59
|
+
return (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { children: messages.finance.detailSections.lineItemsTitle }), _jsxs(Button, { size: "sm", onClick: onCreate, children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), messages.finance.detailSections.addLineItem] })] }), _jsx(CardContent, { children: lineItems.length === 0 ? (_jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: messages.finance.detailSections.noLineItems })) : (_jsx("div", { className: "rounded border bg-background", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b text-muted-foreground", children: [_jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.detailSections.descriptionColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.detailSections.quantityColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.detailSections.unitPriceColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.totalColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.detailSections.taxRateColumn }), _jsx("th", { className: "w-20 p-2" })] }) }), _jsx("tbody", { children: lineItems.map((lineItem) => (_jsxs("tr", { className: "border-b last:border-b-0", children: [_jsx("td", { className: "p-2", children: lineItem.description }), _jsx("td", { className: "p-2 text-right", children: lineItem.quantity }), _jsx("td", { className: "p-2 text-right font-mono", children: (lineItem.unitPriceCents / 100).toFixed(2) }), _jsx("td", { className: "p-2 text-right font-mono", children: (lineItem.totalCents / 100).toFixed(2) }), _jsx("td", { className: "p-2 text-right", children: lineItem.taxRate != null
|
|
60
|
+
? `${(lineItem.taxRate / 100).toFixed(2)}%`
|
|
61
|
+
: noValue }), _jsx("td", { className: "p-2", children: _jsxs("div", { className: "flex items-center justify-end gap-1", children: [_jsx("button", { type: "button", onClick: () => onEdit(lineItem), className: "text-muted-foreground hover:text-foreground", children: _jsx(Pencil, { className: "h-3.5 w-3.5" }) }), _jsx("button", { type: "button", onClick: () => onDelete(lineItem.id), className: "text-muted-foreground hover:text-destructive", children: _jsx(Trash2, { className: "h-3.5 w-3.5" }) })] }) })] }, lineItem.id))) })] }) })) })] }));
|
|
62
|
+
}
|
|
63
|
+
export function InvoicePaymentsCard({ payments, onCreate, canCreate = true, }) {
|
|
64
|
+
const messages = useOperatorAdminMessages();
|
|
65
|
+
const noValue = messages.finance.detailSections.noValue;
|
|
66
|
+
return (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { children: messages.finance.detailSections.paymentsTitle }), canCreate ? (_jsxs(Button, { size: "sm", onClick: onCreate, children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), messages.finance.detailSections.recordPayment] })) : null] }), _jsx(CardContent, { children: payments.length === 0 ? (_jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: messages.finance.detailSections.noPayments })) : (_jsx("div", { className: "rounded border bg-background", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b text-muted-foreground", children: [_jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.dateColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.detailSections.methodColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.amountColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.statusColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.referenceColumn })] }) }), _jsx("tbody", { children: payments.map((payment) => (_jsxs("tr", { className: "border-b last:border-b-0", children: [_jsx("td", { className: "p-2", children: payment.paymentDate }), _jsx("td", { className: "p-2 capitalize", children: getPaymentMethodLabel(messages, payment.paymentMethod) }), _jsxs("td", { className: "p-2 text-right font-mono", children: [_jsx("div", { children: formatAmount(payment.amountCents, payment.currency) }), payment.baseAmountCents !== null && payment.baseCurrency ? (_jsx("div", { className: "text-muted-foreground text-xs", children: formatAmount(payment.baseAmountCents, payment.baseCurrency) })) : null] }), _jsx("td", { className: "p-2", children: _jsx(Badge, { variant: paymentStatusVariant[payment.status] ?? "secondary", className: "text-xs capitalize", children: getPaymentStatusLabel(messages, payment.status) }) }), _jsx("td", { className: "p-2", children: payment.referenceNumber ?? noValue })] }, payment.id))) })] }) })) })] }));
|
|
67
|
+
}
|
|
68
|
+
export function InvoiceCreditNotesCard({ creditNotes, onCreate, }) {
|
|
69
|
+
const messages = useOperatorAdminMessages();
|
|
70
|
+
return (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { children: messages.finance.detailSections.creditNotesTitle }), _jsxs(Button, { size: "sm", onClick: onCreate, children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), messages.finance.detailSections.addCreditNote] })] }), _jsx(CardContent, { children: creditNotes.length === 0 ? (_jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: messages.finance.detailSections.noCreditNotes })) : (_jsx("div", { className: "rounded border bg-background", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b text-muted-foreground", children: [_jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.detailSections.creditNoteNumberColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.amountColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.detailSections.reasonColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.statusColumn })] }) }), _jsx("tbody", { children: creditNotes.map((creditNote) => (_jsxs("tr", { className: "border-b last:border-b-0", children: [_jsx("td", { className: "p-2", children: creditNote.creditNoteNumber }), _jsx("td", { className: "p-2 text-right font-mono", children: formatAmount(creditNote.amountCents, creditNote.currency) }), _jsx("td", { className: "p-2", children: creditNote.reason }), _jsx("td", { className: "p-2", children: _jsx(Badge, { variant: creditNoteStatusVariant[creditNote.status] ?? "secondary", className: "text-xs capitalize", children: getCreditNoteStatusLabel(messages, creditNote.status) }) })] }, creditNote.id))) })] }) })) })] }));
|
|
71
|
+
}
|
|
72
|
+
export function InvoiceAttachmentsCard({ invoiceId }) {
|
|
73
|
+
const messages = useOperatorAdminMessages().finance.detailSections;
|
|
74
|
+
const { resolvedLocale } = useLocale();
|
|
75
|
+
const { data } = useInvoiceAttachments(invoiceId);
|
|
76
|
+
const attachments = data?.data ?? [];
|
|
77
|
+
// Download links hit the admin API directly — base URL from the shared
|
|
78
|
+
// finance provider context, not a host-app env helper.
|
|
79
|
+
const { baseUrl } = useVoyantFinanceContext();
|
|
80
|
+
return (_jsxs(Card, { children: [_jsx(CardHeader, { className: "pb-3", children: _jsxs(CardTitle, { className: "flex items-center gap-2 text-base", children: [_jsx(FileText, { className: "h-4 w-4 text-muted-foreground" }), messages.attachmentsTitle, attachments.length > 0 ? (_jsx(Badge, { variant: "outline", className: "text-[10px]", children: attachments.length })) : null] }) }), _jsx(CardContent, { className: "p-0", children: attachments.length === 0 ? (_jsx("p", { className: "px-6 py-6 text-center text-muted-foreground text-sm", children: messages.noAttachments })) : (_jsx("ul", { className: "divide-y", children: attachments.map((attachment) => (_jsxs("li", { className: "flex items-center justify-between gap-3 px-6 py-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "truncate text-sm font-medium", children: attachment.name }), _jsx("p", { className: "text-muted-foreground text-xs", children: formatAttachmentMeta(attachment, resolvedLocale) })] }), _jsxs("a", { href: `${baseUrl}/v1/admin/finance/invoice-attachments/${attachment.id}/download`, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-1.5 rounded px-2 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": messages.downloadAttachment, children: [_jsx(Download, { className: "h-3.5 w-3.5" }), messages.downloadAttachment] })] }, attachment.id))) })) })] }));
|
|
81
|
+
}
|
|
82
|
+
function formatAttachmentMeta(attachment, locale) {
|
|
83
|
+
const parts = [];
|
|
84
|
+
if (attachment.mimeType)
|
|
85
|
+
parts.push(attachment.mimeType);
|
|
86
|
+
if (typeof attachment.fileSize === "number")
|
|
87
|
+
parts.push(formatBytes(attachment.fileSize));
|
|
88
|
+
if (attachment.createdAt) {
|
|
89
|
+
try {
|
|
90
|
+
parts.push(new Date(attachment.createdAt).toLocaleDateString(locale));
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// ignore — locale parse failures fall through silently
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return parts.join(" · ");
|
|
97
|
+
}
|
|
98
|
+
function formatBytes(bytes) {
|
|
99
|
+
if (bytes < 1024)
|
|
100
|
+
return `${bytes} B`;
|
|
101
|
+
if (bytes < 1024 * 1024)
|
|
102
|
+
return `${Math.round(bytes / 1024)} KB`;
|
|
103
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
104
|
+
}
|
|
105
|
+
export function InvoiceNotesCard({ notes, noteContent, isAdding, onNoteChange, onAddNote, }) {
|
|
106
|
+
const messages = useOperatorAdminMessages();
|
|
107
|
+
const { resolvedLocale } = useLocale();
|
|
108
|
+
return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.finance.detailSections.notesTitle }) }), _jsxs(CardContent, { className: "space-y-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Textarea, { value: noteContent, onChange: (event) => onNoteChange(event.target.value), placeholder: messages.finance.detailSections.addInternalNotePlaceholder }), _jsx("div", { className: "flex justify-end", children: _jsx(Button, { disabled: isAdding || !noteContent.trim(), onClick: onAddNote, children: messages.finance.detailSections.addNote }) })] }), notes.length === 0 ? (_jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: messages.finance.detailSections.noNotes })) : (_jsx("div", { className: "space-y-3", children: notes.map((note) => (_jsxs("div", { className: "rounded border p-3", children: [_jsx("p", { className: "whitespace-pre-wrap text-sm", children: note.content }), _jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: new Date(note.createdAt).toLocaleString(resolvedLocale) })] }, note.id))) }))] })] }));
|
|
109
|
+
}
|