@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,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { useOperatorAdminMessages } from "@voyant-travel/admin";
|
|
5
|
+
import { bookingsQueryKeys, useBookingActivity } from "@voyant-travel/bookings-react";
|
|
6
|
+
import { formatMessage } from "@voyant-travel/i18n";
|
|
7
|
+
import { Badge, Button, Collapsible, CollapsibleContent, CollapsibleTrigger, Dialog, DialogBody, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from "@voyant-travel/ui/components";
|
|
8
|
+
import { ChevronDown, History, Loader2 } from "lucide-react";
|
|
9
|
+
import { useEffect, useMemo, useState } from "react";
|
|
10
|
+
import { toast } from "sonner";
|
|
11
|
+
import { PaymentPolicyForm, PaymentPolicyPreview } from "../components/payment-policy-form.js";
|
|
12
|
+
import { useBookingPaymentScheduleRegenerateMutation } from "../index.js";
|
|
13
|
+
/**
|
|
14
|
+
* Booking detail → Finance tab → Payment-policy card, delivered as a
|
|
15
|
+
* widget contribution on `booking.details.finance-end` (packaged-admin RFC
|
|
16
|
+
* §4.7 cycle resolution: this package depends on `@voyant-travel/bookings-react/ui`,
|
|
17
|
+
* so the bookings host cannot import the card — finance contributes it).
|
|
18
|
+
*
|
|
19
|
+
* Surfaces the cascade trace (which layer's policy applied to this
|
|
20
|
+
* booking's schedule) and lets ops override the policy + regenerate the
|
|
21
|
+
* schedule. Mounted below the schedule list, collapsed by default, so the
|
|
22
|
+
* operator sees both the rule and the generated installments together.
|
|
23
|
+
*/
|
|
24
|
+
export function BookingPaymentPolicyWidget({ booking }) {
|
|
25
|
+
const t = useOperatorAdminMessages().bookings.detail.paymentPolicyCard;
|
|
26
|
+
return (_jsxs(Collapsible, { children: [_jsxs(CollapsibleTrigger, { className: "group flex w-full items-center justify-between rounded-md border bg-background px-4 py-3 text-sm font-semibold hover:bg-muted/30", children: [t.title, _jsx(ChevronDown, { className: "h-4 w-4 transition-transform group-data-panel-open:rotate-180" })] }), _jsx(CollapsibleContent, { className: "mt-3", children: _jsx(BookingPaymentPolicyCard, { booking: booking, messages: t }) })] }));
|
|
27
|
+
}
|
|
28
|
+
function BookingPaymentPolicyCard({ booking, messages: t, }) {
|
|
29
|
+
const queryClient = useQueryClient();
|
|
30
|
+
const persisted = booking.customerPaymentPolicy ?? null;
|
|
31
|
+
const [draft, setDraft] = useState(persisted);
|
|
32
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
33
|
+
const [resolvedSource, setResolvedSource] = useState(null);
|
|
34
|
+
// Read the current cascade source from the booking's
|
|
35
|
+
// internalNotes marker (stamped by the schedule subscriber). This
|
|
36
|
+
// is best-effort — if the booking hasn't been confirmed yet, no
|
|
37
|
+
// marker exists and the badge falls back to "(not yet computed)".
|
|
38
|
+
const initialSource = useMemo(() => {
|
|
39
|
+
return readSourceFromNotes(booking.internalNotes ?? "") ?? null;
|
|
40
|
+
}, [booking.internalNotes]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
setResolvedSource(initialSource);
|
|
43
|
+
}, [initialSource]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
setDraft(persisted);
|
|
46
|
+
}, [persisted]);
|
|
47
|
+
const regenerate = useBookingPaymentScheduleRegenerateMutation(booking.id);
|
|
48
|
+
const submitPolicy = (policy) => {
|
|
49
|
+
regenerate.mutate({ customerPaymentPolicy: policy ?? null }, {
|
|
50
|
+
onSuccess: ({ cascadeSource }) => {
|
|
51
|
+
setResolvedSource(cascadeSource);
|
|
52
|
+
toast.success(t.regenerateSucceeded);
|
|
53
|
+
// The hook already refreshes the schedule list; the booking
|
|
54
|
+
// record carries the persisted override, so refresh it too.
|
|
55
|
+
void queryClient.invalidateQueries({
|
|
56
|
+
queryKey: bookingsQueryKeys.booking(booking.id),
|
|
57
|
+
});
|
|
58
|
+
setDialogOpen(false);
|
|
59
|
+
},
|
|
60
|
+
onError: (err) => {
|
|
61
|
+
toast.error(err instanceof Error ? err.message : t.regenerateFailed);
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const policySourceLabel = (source) => {
|
|
66
|
+
if (!source)
|
|
67
|
+
return t.sourceLabels.unknown;
|
|
68
|
+
return t.sourceLabels[source] ?? source;
|
|
69
|
+
};
|
|
70
|
+
const persistedHasOverride = persisted !== null;
|
|
71
|
+
return (_jsxs("div", { "data-slot": "booking-payment-policy", className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: t.description }), _jsx(Badge, { variant: persistedHasOverride ? "default" : "outline", children: persistedHasOverride
|
|
72
|
+
? t.sourceLabels.booking
|
|
73
|
+
: formatMessage(t.cascadePrefix, { source: policySourceLabel(resolvedSource) }) })] }), _jsx("div", { className: "rounded-md border p-4", children: persistedHasOverride ? (_jsx(PaymentPolicyPreview, { policy: persisted, currency: booking.sellCurrency ?? "EUR", sampleTotalCents: booking.sellAmountCents ?? 100_000 })) : (_jsx("p", { className: "text-muted-foreground text-sm", children: formatMessage(t.noOverrideHint, {
|
|
74
|
+
source: policySourceLabel(resolvedSource).toLowerCase(),
|
|
75
|
+
}) })) }), _jsxs("div", { className: "flex justify-end gap-2", children: [persistedHasOverride ? (_jsxs(Button, { variant: "outline", size: "sm", disabled: regenerate.isPending, onClick: () => submitPolicy(null), children: [regenerate.isPending ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, t.clearOverride] })) : null, _jsx(Button, { variant: "outline", size: "sm", onClick: () => setDialogOpen(true), children: persistedHasOverride ? t.editOverride : t.addOverride })] }), _jsx(PaymentPolicyHistory, { bookingId: booking.id, messages: t }), _jsx(Dialog, { open: dialogOpen, onOpenChange: setDialogOpen, children: _jsxs(DialogContent, { size: "lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t.dialogTitle }) }), _jsxs(DialogBody, { className: "grid gap-6 lg:grid-cols-[2fr_1fr]", children: [_jsx(PaymentPolicyForm, { value: draft, onChange: setDraft, inheritable: false, currency: booking.sellCurrency ?? "EUR", disabled: regenerate.isPending }), _jsx(PaymentPolicyPreview, { policy: draft, currency: booking.sellCurrency ?? "EUR", sampleTotalCents: booking.sellAmountCents ?? 100_000 })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => setDialogOpen(false), disabled: regenerate.isPending, children: t.cancel }), _jsxs(Button, { type: "button", size: "sm", disabled: regenerate.isPending || draft === null, onClick: () => submitPolicy(draft), children: [regenerate.isPending ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, t.saveAndRegenerate] })] })] }) })] }));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Inline history of payment-schedule regenerations for this booking.
|
|
79
|
+
*
|
|
80
|
+
* Reads the `booking_activity_log` table (filtered to entries the
|
|
81
|
+
* scheduler tagged with `metadata.kind === "payment_schedule_regenerated"`)
|
|
82
|
+
* and renders the most recent ten entries — operator sees the
|
|
83
|
+
* cascade-source chain over time and can spot when the schedule was
|
|
84
|
+
* last regenerated.
|
|
85
|
+
*
|
|
86
|
+
* The Activity tab on the booking page already shows the full
|
|
87
|
+
* timeline; this card-local view is just the policy slice for
|
|
88
|
+
* convenience.
|
|
89
|
+
*/
|
|
90
|
+
function PaymentPolicyHistory({ bookingId, messages, }) {
|
|
91
|
+
const { data, isLoading } = useBookingActivity(bookingId);
|
|
92
|
+
const rows = Array.isArray(data) ? data : (data?.data ?? []);
|
|
93
|
+
const policyRows = rows
|
|
94
|
+
.filter((row) => row.activityType === "system_action" &&
|
|
95
|
+
row.metadata?.kind === "payment_schedule_regenerated")
|
|
96
|
+
.slice(0, 10);
|
|
97
|
+
if (isLoading) {
|
|
98
|
+
return _jsx("div", { className: "text-muted-foreground text-xs", children: messages.historyLoading });
|
|
99
|
+
}
|
|
100
|
+
if (policyRows.length === 0) {
|
|
101
|
+
return (_jsxs("div", { className: "rounded-md border border-dashed p-3 text-muted-foreground text-xs", children: [_jsx(History, { className: "mr-1 inline-block h-3 w-3" }), messages.historyEmpty] }));
|
|
102
|
+
}
|
|
103
|
+
return (_jsxs("div", { className: "rounded-md border bg-muted/10 p-3", children: [_jsxs("div", { className: "mb-2 flex items-center gap-2 text-xs font-medium", children: [_jsx(History, { className: "h-3 w-3" }), messages.historyTitle] }), _jsx("ul", { className: "space-y-2 text-xs", children: policyRows.map((row) => {
|
|
104
|
+
const meta = row.metadata ?? {};
|
|
105
|
+
const source = String(meta.policySource ?? "operator_default");
|
|
106
|
+
const entries = Array.isArray(meta.entries) ? meta.entries : [];
|
|
107
|
+
const sourceLabel = messages.sourceLabels[source] ?? source;
|
|
108
|
+
const template = entries.length === 1 ? messages.historyRowSingular : messages.historyRowPlural;
|
|
109
|
+
return (_jsxs("li", { className: "flex flex-col gap-0.5", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("span", { className: "font-medium", children: formatMessage(template, { source: sourceLabel, count: entries.length }) }), _jsx("span", { className: "font-mono text-muted-foreground", children: new Date(row.createdAt).toLocaleString() })] }), _jsx("span", { className: "text-muted-foreground", children: row.description })] }, row.id));
|
|
110
|
+
}) })] }));
|
|
111
|
+
}
|
|
112
|
+
const POLICY_SOURCE_MARKER_PREFIX = "__payment_policy_source__:";
|
|
113
|
+
function readSourceFromNotes(notes) {
|
|
114
|
+
for (const line of notes.split(/\r?\n/)) {
|
|
115
|
+
const trimmed = line.trim();
|
|
116
|
+
if (trimmed.startsWith(POLICY_SOURCE_MARKER_PREFIX)) {
|
|
117
|
+
const value = trimmed.slice(POLICY_SOURCE_MARKER_PREFIX.length).trim();
|
|
118
|
+
if (value === "booking" ||
|
|
119
|
+
value === "listing" ||
|
|
120
|
+
value === "category" ||
|
|
121
|
+
value === "supplier" ||
|
|
122
|
+
value === "operator_default") {
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BookingDetailHostSlotContext } from "@voyant-travel/bookings-react/admin";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Props of the pending payment-sessions widget: exactly the slot context
|
|
5
|
+
* the bookings detail host hands to `booking.details.finance-start` widget
|
|
6
|
+
* contributions (see `bookingDetailFinanceStartSlot` in
|
|
7
|
+
* `@voyant-travel/bookings-react/admin`).
|
|
8
|
+
*/
|
|
9
|
+
export type BookingPendingPaymentSessionsWidgetProps = BookingDetailHostSlotContext;
|
|
10
|
+
/**
|
|
11
|
+
* Finance-owned payment-links card for the booking detail page's Finance
|
|
12
|
+
* tab, delivered as a widget contribution on `booking.details.finance-start`
|
|
13
|
+
* (packaged-admin RFC §4.7 cycle resolution: this package depends on
|
|
14
|
+
* `@voyant-travel/bookings-react/ui`, so the bookings host cannot import the card —
|
|
15
|
+
* finance contributes it instead). Lists the booking's pending payment
|
|
16
|
+
* sessions and lets ops copy the public payment link, mark a session paid
|
|
17
|
+
* (manual bank-transfer capture) or cancel it.
|
|
18
|
+
*
|
|
19
|
+
* The copy action resolves the public checkout origin from the
|
|
20
|
+
* starter-level `/v1/public/payment-link-config` route through the shared
|
|
21
|
+
* finance provider context, falling back to the dashboard origin.
|
|
22
|
+
*/
|
|
23
|
+
export declare function BookingPendingPaymentSessionsWidget({ booking, fullyPaidReason, onGenerateLink, }: BookingPendingPaymentSessionsWidgetProps): React.ReactElement;
|
|
24
|
+
//# sourceMappingURL=booking-pending-payment-sessions-widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-pending-payment-sessions-widget.d.ts","sourceRoot":"","sources":["../../src/admin/booking-pending-payment-sessions-widget.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAA;AAqBvF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAc9B;;;;;GAKG;AACH,MAAM,MAAM,wCAAwC,GAAG,4BAA4B,CAAA;AAEnF;;;;;;;;;;;;GAYG;AACH,wBAAgB,mCAAmC,CAAC,EAClD,OAAO,EACP,eAAe,EACf,cAAc,GACf,EAAE,wCAAwC,GAAG,KAAK,CAAC,YAAY,CA0M/D"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { useOperatorAdminMessages } from "@voyant-travel/admin";
|
|
5
|
+
import { bookingsQueryKeys } from "@voyant-travel/bookings-react";
|
|
6
|
+
import { IconActionButton, StatusBadge, useBookingsUiI18nOrDefault, } from "@voyant-travel/bookings-react/ui";
|
|
7
|
+
import { buildPaymentLinkUrl } from "@voyant-travel/finance/payment-link";
|
|
8
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@voyant-travel/ui/components";
|
|
9
|
+
import { Button } from "@voyant-travel/ui/components/button";
|
|
10
|
+
import { DataTable } from "@voyant-travel/ui/components/data-table";
|
|
11
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "@voyant-travel/ui/components/tooltip";
|
|
12
|
+
import { Check, Copy, Loader2, Plus, Trash2, Wallet } from "lucide-react";
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
import { toast } from "sonner";
|
|
15
|
+
import { financeQueryKeys, usePaymentSessionMutation, usePaymentSessions, useVoyantFinanceContext, } from "../index.js";
|
|
16
|
+
/**
|
|
17
|
+
* Finance-owned payment-links card for the booking detail page's Finance
|
|
18
|
+
* tab, delivered as a widget contribution on `booking.details.finance-start`
|
|
19
|
+
* (packaged-admin RFC §4.7 cycle resolution: this package depends on
|
|
20
|
+
* `@voyant-travel/bookings-react/ui`, so the bookings host cannot import the card —
|
|
21
|
+
* finance contributes it instead). Lists the booking's pending payment
|
|
22
|
+
* sessions and lets ops copy the public payment link, mark a session paid
|
|
23
|
+
* (manual bank-transfer capture) or cancel it.
|
|
24
|
+
*
|
|
25
|
+
* The copy action resolves the public checkout origin from the
|
|
26
|
+
* starter-level `/v1/public/payment-link-config` route through the shared
|
|
27
|
+
* finance provider context, falling back to the dashboard origin.
|
|
28
|
+
*/
|
|
29
|
+
export function BookingPendingPaymentSessionsWidget({ booking, fullyPaidReason, onGenerateLink, }) {
|
|
30
|
+
const t = useOperatorAdminMessages().bookings.detail.paymentSessions;
|
|
31
|
+
const { formatDateTime } = useBookingsUiI18nOrDefault();
|
|
32
|
+
const { baseUrl, fetcher } = useVoyantFinanceContext();
|
|
33
|
+
const queryClient = useQueryClient();
|
|
34
|
+
const bookingId = booking.id;
|
|
35
|
+
const [cancelTarget, setCancelTarget] = React.useState(null);
|
|
36
|
+
const { data } = usePaymentSessions({ bookingId, status: "pending", limit: 10 });
|
|
37
|
+
// Shares the cache entry with `useCheckoutPaymentLinkConfig` from
|
|
38
|
+
// Finance checkout collection uses the same endpoint and query key.
|
|
39
|
+
const { data: paymentLinkConfig } = useQuery({
|
|
40
|
+
queryKey: ["checkout-payment-link-config"],
|
|
41
|
+
queryFn: async () => {
|
|
42
|
+
const response = await fetcher(`${baseUrl}/v1/public/payment-link-config`, {
|
|
43
|
+
headers: { Accept: "application/json" },
|
|
44
|
+
});
|
|
45
|
+
if (!response.ok)
|
|
46
|
+
throw new Error(`config fetch failed: ${response.status}`);
|
|
47
|
+
const body = (await response.json());
|
|
48
|
+
return body.data;
|
|
49
|
+
},
|
|
50
|
+
staleTime: 5 * 60 * 1000,
|
|
51
|
+
});
|
|
52
|
+
const { complete, cancel } = usePaymentSessionMutation();
|
|
53
|
+
// The mutation hook already refreshes finance-owned session/payment/
|
|
54
|
+
// invoice lists; refresh the booking-scoped surfaces here.
|
|
55
|
+
const invalidateBookingSurroundings = React.useCallback(() => {
|
|
56
|
+
void queryClient.invalidateQueries({
|
|
57
|
+
queryKey: financeQueryKeys.adminBookingPayments(bookingId),
|
|
58
|
+
});
|
|
59
|
+
void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.booking(bookingId) });
|
|
60
|
+
void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.actionLedger(bookingId) });
|
|
61
|
+
}, [queryClient, bookingId]);
|
|
62
|
+
const completeMutate = complete.mutate;
|
|
63
|
+
const markReceived = React.useCallback((sessionId) => {
|
|
64
|
+
const now = new Date().toISOString();
|
|
65
|
+
completeMutate({
|
|
66
|
+
id: sessionId,
|
|
67
|
+
input: {
|
|
68
|
+
status: "paid",
|
|
69
|
+
captureMode: "manual",
|
|
70
|
+
paymentMethod: "bank_transfer",
|
|
71
|
+
paymentDate: now,
|
|
72
|
+
authorizedAt: now,
|
|
73
|
+
capturedAt: now,
|
|
74
|
+
},
|
|
75
|
+
}, { onSuccess: invalidateBookingSurroundings });
|
|
76
|
+
}, [completeMutate, invalidateBookingSurroundings]);
|
|
77
|
+
const cancelSession = (sessionId) => {
|
|
78
|
+
cancel.mutate({ id: sessionId }, {
|
|
79
|
+
onSuccess: () => {
|
|
80
|
+
invalidateBookingSurroundings();
|
|
81
|
+
setCancelTarget(null);
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const sessions = data?.data ?? [];
|
|
86
|
+
const columns = React.useMemo(() => [
|
|
87
|
+
{
|
|
88
|
+
accessorKey: "createdAt",
|
|
89
|
+
header: t.columnDate,
|
|
90
|
+
cell: ({ row }) => formatDateTime(row.original.createdAt),
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
accessorKey: "amountCents",
|
|
94
|
+
header: t.columnAmount,
|
|
95
|
+
cell: ({ row }) => (_jsx("span", { className: "font-mono font-medium", children: formatMoney(row.original.amountCents, row.original.currency) })),
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
accessorKey: "status",
|
|
99
|
+
header: t.columnStatus,
|
|
100
|
+
cell: ({ row }) => (_jsx(StatusBadge, { status: row.original.status, children: t.statusLabels[row.original.status] ??
|
|
101
|
+
row.original.status })),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "actions",
|
|
105
|
+
header: "",
|
|
106
|
+
cell: ({ row }) => {
|
|
107
|
+
const session = row.original;
|
|
108
|
+
const isMarkingThis = complete.isPending && complete.variables?.id === session.id;
|
|
109
|
+
return (_jsxs("div", { className: "flex items-center justify-end gap-1", children: [_jsx(IconActionButton, { label: t.copyPaymentLink, icon: _jsx(Copy, { className: "h-3.5 w-3.5" }), onClick: () => void copyPaymentLink(session.id, paymentLinkConfig?.publicCheckoutBaseUrl, t) }), _jsx(IconActionButton, { label: t.markReceived, icon: isMarkingThis ? (_jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" })) : (_jsx(Check, { className: "h-3.5 w-3.5" })), disabled: complete.isPending, onClick: () => markReceived(session.id) }), _jsx(IconActionButton, { label: t.cancelPaymentLink, icon: _jsx(Trash2, { className: "h-3.5 w-3.5" }), className: "text-muted-foreground hover:bg-destructive/10 hover:text-destructive", onClick: () => setCancelTarget(session) })] }));
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
], [formatDateTime, complete.isPending, complete.variables, markReceived, paymentLinkConfig, t]);
|
|
113
|
+
return (_jsxs("div", { "data-slot": "booking-payment-links", className: "flex flex-col gap-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("h2", { className: "flex items-center gap-2 text-base font-semibold", children: [_jsx(Wallet, { className: "h-4 w-4" }), t.pendingTitle] }), onGenerateLink ? (fullyPaidReason ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx("span", { tabIndex: 0, className: "inline-block" }), children: _jsxs(Button, { variant: "outline", size: "sm", disabled: true, className: "pointer-events-none", children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), t.generatePaymentLink] }) }), _jsx(TooltipContent, { children: fullyPaidReason })] })) : (_jsxs(Button, { variant: "outline", size: "sm", onClick: onGenerateLink, children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), t.generatePaymentLink] }))) : null] }), _jsx(DataTable, { columns: columns, data: sessions, emptyMessage: t.empty, showPagination: false }), complete.error ? (_jsx("p", { className: "text-destructive text-xs", children: complete.error instanceof Error ? complete.error.message : t.markReceivedFailed })) : null, _jsx(AlertDialog, { open: Boolean(cancelTarget), onOpenChange: (next) => {
|
|
114
|
+
if (!next && !cancel.isPending)
|
|
115
|
+
setCancelTarget(null);
|
|
116
|
+
}, children: _jsxs(AlertDialogContent, { size: "sm", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: t.cancelConfirmTitle }), _jsx(AlertDialogDescription, { children: t.cancelConfirmDescription })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: cancel.isPending, children: t.cancelConfirmCancel }), _jsx(AlertDialogAction, { variant: "destructive", disabled: cancel.isPending, onClick: () => cancelTarget && cancelSession(cancelTarget.id), children: t.cancelConfirmConfirm })] })] }) })] }));
|
|
117
|
+
}
|
|
118
|
+
async function copyPaymentLink(paymentSessionId, publicCheckoutBaseUrl, messages) {
|
|
119
|
+
if (typeof window === "undefined")
|
|
120
|
+
return;
|
|
121
|
+
const url = buildPaymentLinkUrl(paymentSessionId, {
|
|
122
|
+
baseUrl: publicCheckoutBaseUrl ?? window.location.origin,
|
|
123
|
+
});
|
|
124
|
+
try {
|
|
125
|
+
await navigator.clipboard.writeText(url);
|
|
126
|
+
toast.success(messages.paymentLinkCopied);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
toast.error(messages.paymentLinkCopyFailed);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function formatMoney(cents, currency) {
|
|
133
|
+
try {
|
|
134
|
+
return new Intl.NumberFormat(undefined, { style: "currency", currency }).format(cents / 100);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return `${(cents / 100).toFixed(2)} ${currency}`;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface CreditNoteDialogProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
onOpenChange: (open: boolean) => void;
|
|
4
|
+
invoiceId: string;
|
|
5
|
+
invoiceCurrency: string;
|
|
6
|
+
onSuccess?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function CreditNoteDialog({ open, onOpenChange, invoiceId, invoiceCurrency, onSuccess, }: CreditNoteDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=credit-note-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit-note-dialog.d.ts","sourceRoot":"","sources":["../../src/admin/credit-note-dialog.tsx"],"names":[],"mappings":"AAuCA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AASD,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,eAAe,EACf,SAAS,GACV,EAAE,qBAAqB,2CAsHvB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useOperatorAdminMessages } from "@voyant-travel/admin";
|
|
4
|
+
import { Button, Dialog, DialogBody, DialogContent, DialogFooter, DialogHeader, DialogTitle, Input, Label, Textarea, } from "@voyant-travel/ui/components";
|
|
5
|
+
import { CurrencyCombobox } from "@voyant-travel/ui/components/currency-combobox";
|
|
6
|
+
import { zodResolver } from "@voyant-travel/ui/lib/zod-resolver";
|
|
7
|
+
import { Loader2 } from "lucide-react";
|
|
8
|
+
import { useEffect, useMemo } from "react";
|
|
9
|
+
import { useForm } from "react-hook-form";
|
|
10
|
+
import { z } from "zod/v4";
|
|
11
|
+
import { useInvoiceCreditNoteMutation } from "../index.js";
|
|
12
|
+
function getCreditNoteFormSchema(messages) {
|
|
13
|
+
return z.object({
|
|
14
|
+
creditNoteNumber: z.string().min(1, messages.finance.creditNoteDialog.validationNumberRequired),
|
|
15
|
+
amountCents: z.coerce
|
|
16
|
+
.number()
|
|
17
|
+
.int()
|
|
18
|
+
.min(1, messages.finance.creditNoteDialog.validationAmountMin),
|
|
19
|
+
currency: z.string().min(3).max(3),
|
|
20
|
+
reason: z.string().min(1, messages.finance.creditNoteDialog.validationReasonRequired),
|
|
21
|
+
notes: z.string().optional().nullable(),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function generateCreditNoteNumber() {
|
|
25
|
+
const now = new Date();
|
|
26
|
+
const y = now.getFullYear();
|
|
27
|
+
const seq = String(Math.floor(Math.random() * 9000) + 1000);
|
|
28
|
+
return `CN-${y}-${seq}`;
|
|
29
|
+
}
|
|
30
|
+
export function CreditNoteDialog({ open, onOpenChange, invoiceId, invoiceCurrency, onSuccess, }) {
|
|
31
|
+
const messages = useOperatorAdminMessages();
|
|
32
|
+
const { create } = useInvoiceCreditNoteMutation(invoiceId);
|
|
33
|
+
const creditNoteFormSchema = useMemo(() => getCreditNoteFormSchema(messages), [messages]);
|
|
34
|
+
const form = useForm({
|
|
35
|
+
resolver: zodResolver(creditNoteFormSchema),
|
|
36
|
+
defaultValues: {
|
|
37
|
+
creditNoteNumber: "",
|
|
38
|
+
amountCents: 0,
|
|
39
|
+
currency: invoiceCurrency,
|
|
40
|
+
reason: "",
|
|
41
|
+
notes: "",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (open) {
|
|
46
|
+
form.reset({
|
|
47
|
+
creditNoteNumber: generateCreditNoteNumber(),
|
|
48
|
+
amountCents: 0,
|
|
49
|
+
currency: invoiceCurrency,
|
|
50
|
+
reason: "",
|
|
51
|
+
notes: "",
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, [open, invoiceCurrency, form]);
|
|
55
|
+
const onSubmit = async (values) => {
|
|
56
|
+
await create.mutateAsync({
|
|
57
|
+
creditNoteNumber: values.creditNoteNumber,
|
|
58
|
+
amountCents: values.amountCents,
|
|
59
|
+
currency: values.currency,
|
|
60
|
+
reason: values.reason,
|
|
61
|
+
notes: values.notes || null,
|
|
62
|
+
});
|
|
63
|
+
onOpenChange(false);
|
|
64
|
+
onSuccess?.();
|
|
65
|
+
};
|
|
66
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: messages.finance.creditNoteDialog.title }) }), _jsxs("form", { onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(DialogBody, { className: "grid gap-4", children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.finance.creditNoteDialog.numberLabel }), _jsx(Input, { ...form.register("creditNoteNumber"), placeholder: messages.finance.creditNoteDialog.numberPlaceholder }), form.formState.errors.creditNoteNumber ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.creditNoteNumber.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.finance.creditNoteDialog.currencyLabel }), _jsx(CurrencyCombobox, { value: form.watch("currency") || null, onChange: (next) => form.setValue("currency", next ?? "EUR", {
|
|
67
|
+
shouldValidate: true,
|
|
68
|
+
shouldDirty: true,
|
|
69
|
+
}) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.finance.creditNoteDialog.amountLabel }), _jsx(Input, { ...form.register("amountCents"), type: "number", min: "1" }), form.formState.errors.amountCents ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.amountCents.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.finance.creditNoteDialog.reasonLabel }), _jsx(Textarea, { ...form.register("reason"), placeholder: messages.finance.creditNoteDialog.reasonPlaceholder }), form.formState.errors.reason ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.reason.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.finance.creditNoteDialog.notesLabel }), _jsx(Textarea, { ...form.register("notes"), placeholder: messages.finance.creditNoteDialog.notesPlaceholder })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: messages.finance.creditNoteDialog.cancel }), _jsxs(Button, { type: "submit", disabled: create.isPending, children: [create.isPending ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, messages.finance.creditNoteDialog.submit] })] })] })] }) }));
|
|
70
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { CreditNoteRecord as CreditNoteRow, FinanceNoteRecord as FinanceNote, InvoiceRecord as InvoiceDetail, LineItemRecord as LineItem, PaymentRecord as PaymentRow, } from "../index.js";
|
|
2
|
+
export declare const invoiceStatusVariant: Record<string, "default" | "secondary" | "outline" | "destructive">;
|
|
3
|
+
export declare const paymentStatusVariant: Record<string, "default" | "secondary" | "outline" | "destructive">;
|
|
4
|
+
export declare const creditNoteStatusVariant: Record<string, "default" | "secondary" | "outline" | "destructive">;
|
|
5
|
+
export declare function formatAmount(cents: number, currency: string): string;
|
|
6
|
+
export declare function formatMethod(method: string): string;
|
|
7
|
+
//# sourceMappingURL=finance-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finance-shared.d.ts","sourceRoot":"","sources":["../../src/admin/finance-shared.ts"],"names":[],"mappings":"AAKA,YAAY,EACV,gBAAgB,IAAI,aAAa,EACjC,iBAAiB,IAAI,WAAW,EAChC,aAAa,IAAI,aAAa,EAC9B,cAAc,IAAI,QAAQ,EAC1B,aAAa,IAAI,UAAU,GAC5B,MAAM,aAAa,CAAA;AAEpB,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACvC,MAAM,EACN,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,CASpD,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACvC,MAAM,EACN,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,CAMpD,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,MAAM,EACN,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,CAKpD,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Shared bits of the packaged finance admin pages: status → badge-variant
|
|
2
|
+
// maps and the compact amount/method formatters the operator-grade detail
|
|
3
|
+
// pages use. Kept admin-local — the canonical `InvoiceDetailPage` in
|
|
4
|
+
// `../components` exports its own variants for the embeddable surface.
|
|
5
|
+
export const invoiceStatusVariant = {
|
|
6
|
+
draft: "outline",
|
|
7
|
+
pending_external_allocation: "outline",
|
|
8
|
+
issued: "secondary",
|
|
9
|
+
partially_paid: "secondary",
|
|
10
|
+
paid: "default",
|
|
11
|
+
overdue: "destructive",
|
|
12
|
+
void: "destructive",
|
|
13
|
+
};
|
|
14
|
+
export const paymentStatusVariant = {
|
|
15
|
+
pending: "outline",
|
|
16
|
+
completed: "default",
|
|
17
|
+
failed: "destructive",
|
|
18
|
+
refunded: "secondary",
|
|
19
|
+
};
|
|
20
|
+
export const creditNoteStatusVariant = {
|
|
21
|
+
draft: "outline",
|
|
22
|
+
issued: "default",
|
|
23
|
+
applied: "secondary",
|
|
24
|
+
};
|
|
25
|
+
export function formatAmount(cents, currency) {
|
|
26
|
+
return `${(cents / 100).toFixed(2)} ${currency}`;
|
|
27
|
+
}
|
|
28
|
+
export function formatMethod(method) {
|
|
29
|
+
return method.replace(/_/g, " ");
|
|
30
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type AdminExtension } from "@voyant-travel/admin";
|
|
2
|
+
/**
|
|
3
|
+
* Semantic destinations the finance admin surfaces navigate to
|
|
4
|
+
* (packaged-admin RFC §4.7). Keys shared with other domains
|
|
5
|
+
* (`invoice.detail`, `booking.detail`, `person.detail`,
|
|
6
|
+
* `organization.detail`, `payment.detail`) come from the bookings-ui
|
|
7
|
+
* augmentation bound above; declared here are the finance-owned list
|
|
8
|
+
* targets plus `supplier.detail`, re-declared shape-locked — also declared
|
|
9
|
+
* by `@voyant-travel/catalog-react/admin`, and interface merging requires the
|
|
10
|
+
* member shape to stay identical across packages.
|
|
11
|
+
*/
|
|
12
|
+
declare module "@voyant-travel/admin" {
|
|
13
|
+
interface AdminDestinations {
|
|
14
|
+
/** The invoices list page (the finance area's landing surface). */
|
|
15
|
+
"invoice.list": Record<string, never>;
|
|
16
|
+
/** The payments list page. */
|
|
17
|
+
"payment.list": Record<string, never>;
|
|
18
|
+
/** A supplier's detail page. */
|
|
19
|
+
"supplier.detail": {
|
|
20
|
+
supplierId: string;
|
|
21
|
+
};
|
|
22
|
+
/** The supplier-invoices (accounts payable) list page. */
|
|
23
|
+
"supplierInvoice.list": Record<string, never>;
|
|
24
|
+
/** A supplier invoice's detail page. */
|
|
25
|
+
"supplierInvoice.detail": {
|
|
26
|
+
supplierInvoiceId: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export type { BookingInvoicesWidgetProps } from "./booking-invoices-widget.js";
|
|
31
|
+
export type { BookingPaymentPolicyWidgetProps } from "./booking-payment-policy-widget.js";
|
|
32
|
+
export type { BookingPendingPaymentSessionsWidgetProps } from "./booking-pending-payment-sessions-widget.js";
|
|
33
|
+
export type { CreditNoteDialogProps } from "./credit-note-dialog.js";
|
|
34
|
+
export type { InvoiceDetailHostProps } from "./invoice-detail-host.js";
|
|
35
|
+
export { InvoiceDetailSkeleton } from "./invoice-detail-skeleton.js";
|
|
36
|
+
export type { LineItemDialogProps } from "./line-item-dialog.js";
|
|
37
|
+
export type { PaymentDetailHostProps } from "./payment-detail-host.js";
|
|
38
|
+
export { PaymentDetailSkeleton } from "./payment-detail-skeleton.js";
|
|
39
|
+
export type { PaymentDialogProps } from "./payment-dialog.js";
|
|
40
|
+
export type { RecordPaymentDialogProps } from "./record-payment-dialog.js";
|
|
41
|
+
export type { SupplierPaymentPolicyWidgetProps } from "./supplier-payment-policy-widget.js";
|
|
42
|
+
export type { SupplierPicker } from "./use-supplier-picker.js";
|
|
43
|
+
export interface CreateFinanceAdminExtensionOptions {
|
|
44
|
+
/** Mount path of the finance pages inside the admin workspace. Default `/finance`. */
|
|
45
|
+
basePath?: string;
|
|
46
|
+
/** Localized page titles. Defaults are the English operator nav labels. */
|
|
47
|
+
labels?: {
|
|
48
|
+
invoices?: string;
|
|
49
|
+
invoiceNumberSeries?: string;
|
|
50
|
+
payments?: string;
|
|
51
|
+
supplierInvoices?: string;
|
|
52
|
+
profitability?: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The finance admin contribution (packaged-admin RFC Phase 3,
|
|
57
|
+
* `@voyant-travel/<domain>-ui/admin` convention).
|
|
58
|
+
*
|
|
59
|
+
* NAVIGATION: deliberately none. The Finance nav group (invoices, number
|
|
60
|
+
* series, payments, supplier invoices, profitability) is part of the BASE
|
|
61
|
+
* operator navigation — see `createOperatorAdminNavigation` in
|
|
62
|
+
* `@voyant-travel/admin` — so contributing nav entries here would duplicate them.
|
|
63
|
+
* If the base nav ever drops the finance group, this extension is where the
|
|
64
|
+
* entries move.
|
|
65
|
+
*
|
|
66
|
+
* ROUTES: all eight contributions carry the FULL route implementation
|
|
67
|
+
* (packaged-admin RFC §4.8 endgame) — a lazy `page` module loader, a data
|
|
68
|
+
* loader fed by the host runtime (`baseUrl` + cookie-forwarding fetcher),
|
|
69
|
+
* `ssr: "data-only"`, and the pending skeleton where the operator route had
|
|
70
|
+
* one — so the host needs no per-route files for them. Pages stay
|
|
71
|
+
* code-split: this factory never references a page component statically;
|
|
72
|
+
* each `page:` dynamically imports its specific module (never a barrel), and
|
|
73
|
+
* param-taking pages read the matched `$id` off `AdminRoutePageProps` and
|
|
74
|
+
* bind it onto {@link InvoiceDetailHost} / {@link PaymentDetailHost}.
|
|
75
|
+
* Cross-route links resolve through the semantic destinations declared
|
|
76
|
+
* above. The supplier-invoices pages carry their previously app-owned wiring
|
|
77
|
+
* package-side now: attachment uploads post to the starter-level
|
|
78
|
+
* `/v1/uploads` route through the shared finance provider context (the
|
|
79
|
+
* `BookingInvoicesWidget` precedent), inline supplier creation rides the
|
|
80
|
+
* suppliers package's `useSupplierMutation`, and the allocation dialog's
|
|
81
|
+
* cross-domain target search composes the bookings / products /
|
|
82
|
+
* availability packages' query options through the same context client.
|
|
83
|
+
*
|
|
84
|
+
* WIDGETS: the cycle-resolution piece (RFC §4.7). The booking detail page
|
|
85
|
+
* needs the finance-owned invoices card, but this package peer-depends on
|
|
86
|
+
* `@voyant-travel/bookings-react/ui`, so the bookings host cannot import it. Instead
|
|
87
|
+
* this extension contributes {@link BookingInvoicesWidget} on the
|
|
88
|
+
* `booking.details.invoices-tab` slot the bookings host exposes; the host
|
|
89
|
+
* mounts its Invoices tab whenever a contribution targets that slot and
|
|
90
|
+
* hands the widget its typed slot context as props. The Finance tab's
|
|
91
|
+
* payment-links card ({@link BookingPendingPaymentSessionsWidget}) and
|
|
92
|
+
* payment-policy override card ({@link BookingPaymentPolicyWidget}) travel
|
|
93
|
+
* the same way on `booking.details.finance-start` / `…finance-end`. The
|
|
94
|
+
* same pattern resolves the finance-ui ↔ suppliers-ui cycle: the supplier detail page's
|
|
95
|
+
* customer-payment-policy card ships as {@link SupplierPaymentPolicyWidget}
|
|
96
|
+
* on the `supplier.details.payment-policy` slot the supplier host exposes.
|
|
97
|
+
*/
|
|
98
|
+
export declare function createFinanceAdminExtension(options?: CreateFinanceAdminExtensionOptions): AdminExtension;
|
|
99
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,sBAAsB,CAAA;AA0F7B;;;;;;;;;GASG;AACH,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,iBAAiB;QACzB,mEAAmE;QACnE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACrC,8BAA8B;QAC9B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACrC,gCAAgC;QAChC,iBAAiB,EAAE;YAAE,UAAU,EAAE,MAAM,CAAA;SAAE,CAAA;QACzC,0DAA0D;QAC1D,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QAC7C,wCAAwC;QACxC,wBAAwB,EAAE;YAAE,iBAAiB,EAAE,MAAM,CAAA;SAAE,CAAA;KACxD;CACF;AAUD,YAAY,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AAC9E,YAAY,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAA;AACzF,YAAY,EAAE,wCAAwC,EAAE,MAAM,8CAA8C,CAAA;AAC5G,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AACpE,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,YAAY,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAC1E,YAAY,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAA;AAC3F,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,MAAM,WAAW,kCAAkC;IACjD,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,gBAAgB,CAAC,EAAE,MAAM,CAAA;QACzB,aAAa,CAAC,EAAE,MAAM,CAAA;KACvB,CAAA;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,GAAE,kCAAuC,GAC/C,cAAc,CAiNhB"}
|