@voyant-travel/bookings-react 0.119.3
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 +87 -0
- package/dist/admin/booking-contract-dialog.d.ts +22 -0
- package/dist/admin/booking-contract-dialog.d.ts.map +1 -0
- package/dist/admin/booking-contract-dialog.js +161 -0
- package/dist/admin/booking-detail-host.d.ts +103 -0
- package/dist/admin/booking-detail-host.d.ts.map +1 -0
- package/dist/admin/booking-detail-host.js +127 -0
- package/dist/admin/booking-detail-skeleton.d.ts +7 -0
- package/dist/admin/booking-detail-skeleton.d.ts.map +1 -0
- package/dist/admin/booking-detail-skeleton.js +24 -0
- package/dist/admin/booking-documents-table.d.ts +13 -0
- package/dist/admin/booking-documents-table.d.ts.map +1 -0
- package/dist/admin/booking-documents-table.js +259 -0
- package/dist/admin/booking-invoice-sheet.d.ts +18 -0
- package/dist/admin/booking-invoice-sheet.d.ts.map +1 -0
- package/dist/admin/booking-invoice-sheet.js +101 -0
- package/dist/admin/booking-journey-host.d.ts +24 -0
- package/dist/admin/booking-journey-host.d.ts.map +1 -0
- package/dist/admin/booking-journey-host.js +278 -0
- package/dist/admin/bookings-host.d.ts +26 -0
- package/dist/admin/bookings-host.d.ts.map +1 -0
- package/dist/admin/bookings-host.js +18 -0
- package/dist/admin/bookings-list-skeleton.d.ts +10 -0
- package/dist/admin/bookings-list-skeleton.d.ts.map +1 -0
- package/dist/admin/bookings-list-skeleton.js +25 -0
- package/dist/admin/index.d.ts +273 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +331 -0
- package/dist/admin/journey-billing-duplicate-warning.d.ts +3 -0
- package/dist/admin/journey-billing-duplicate-warning.d.ts.map +1 -0
- package/dist/admin/journey-billing-duplicate-warning.js +26 -0
- package/dist/admin/journey-departure-picker.d.ts +7 -0
- package/dist/admin/journey-departure-picker.d.ts.map +1 -0
- package/dist/admin/journey-departure-picker.js +100 -0
- package/dist/admin/journey-units-picker.d.ts +11 -0
- package/dist/admin/journey-units-picker.d.ts.map +1 -0
- package/dist/admin/journey-units-picker.js +60 -0
- package/dist/admin/journey-voucher-picker.d.ts +3 -0
- package/dist/admin/journey-voucher-picker.d.ts.map +1 -0
- package/dist/admin/journey-voucher-picker.js +71 -0
- package/dist/admin/pages/booking-compose-page.d.ts +9 -0
- package/dist/admin/pages/booking-compose-page.d.ts.map +1 -0
- package/dist/admin/pages/booking-compose-page.js +17 -0
- package/dist/admin/pages/booking-detail-page.d.ts +11 -0
- package/dist/admin/pages/booking-detail-page.d.ts.map +1 -0
- package/dist/admin/pages/booking-detail-page.js +14 -0
- package/dist/admin/pages/booking-journey-page.d.ts +12 -0
- package/dist/admin/pages/booking-journey-page.d.ts.map +1 -0
- package/dist/admin/pages/booking-journey-page.js +26 -0
- package/dist/admin/pages/booking-new-page.d.ts +15 -0
- package/dist/admin/pages/booking-new-page.d.ts.map +1 -0
- package/dist/admin/pages/booking-new-page.js +50 -0
- package/dist/admin/pages/bookings-index-page.d.ts +20 -0
- package/dist/admin/pages/bookings-index-page.d.ts.map +1 -0
- package/dist/admin/pages/bookings-index-page.js +18 -0
- package/dist/admin/person-bookings-widget.d.ts +13 -0
- package/dist/admin/person-bookings-widget.d.ts.map +1 -0
- package/dist/admin/person-bookings-widget.js +48 -0
- package/dist/admin/slots.d.ts +31 -0
- package/dist/admin/slots.d.ts.map +1 -0
- package/dist/admin/slots.js +30 -0
- package/dist/admin/use-booking-action-ledger-events.d.ts +15 -0
- package/dist/admin/use-booking-action-ledger-events.d.ts.map +1 -0
- package/dist/admin/use-booking-action-ledger-events.js +66 -0
- package/dist/client.d.ts +14 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +59 -0
- package/dist/components/booking-activity-timeline.d.ts +32 -0
- package/dist/components/booking-activity-timeline.d.ts.map +1 -0
- package/dist/components/booking-activity-timeline.js +147 -0
- package/dist/components/booking-billing-dialog.d.ts +16 -0
- package/dist/components/booking-billing-dialog.d.ts.map +1 -0
- package/dist/components/booking-billing-dialog.js +315 -0
- package/dist/components/booking-cancellation-dialog.d.ts +18 -0
- package/dist/components/booking-cancellation-dialog.d.ts.map +1 -0
- package/dist/components/booking-cancellation-dialog.js +79 -0
- package/dist/components/booking-combobox.d.ts +13 -0
- package/dist/components/booking-combobox.d.ts.map +1 -0
- package/dist/components/booking-combobox.js +44 -0
- package/dist/components/booking-create-form-utils.d.ts +56 -0
- package/dist/components/booking-create-form-utils.d.ts.map +1 -0
- package/dist/components/booking-create-form-utils.js +216 -0
- package/dist/components/booking-create-page.d.ts +14 -0
- package/dist/components/booking-create-page.d.ts.map +1 -0
- package/dist/components/booking-create-page.js +11 -0
- package/dist/components/booking-create-preview-card.d.ts +26 -0
- package/dist/components/booking-create-preview-card.d.ts.map +1 -0
- package/dist/components/booking-create-preview-card.js +107 -0
- package/dist/components/booking-create-product-extras-picker.d.ts +18 -0
- package/dist/components/booking-create-product-extras-picker.d.ts.map +1 -0
- package/dist/components/booking-create-product-extras-picker.js +82 -0
- package/dist/components/booking-create-sheet.d.ts +34 -0
- package/dist/components/booking-create-sheet.d.ts.map +1 -0
- package/dist/components/booking-create-sheet.js +811 -0
- package/dist/components/booking-create-utils.d.ts +66 -0
- package/dist/components/booking-create-utils.d.ts.map +1 -0
- package/dist/components/booking-create-utils.js +185 -0
- package/dist/components/booking-detail-page.d.ts +126 -0
- package/dist/components/booking-detail-page.d.ts.map +1 -0
- package/dist/components/booking-detail-page.js +264 -0
- package/dist/components/booking-dialog.d.ts +28 -0
- package/dist/components/booking-dialog.d.ts.map +1 -0
- package/dist/components/booking-dialog.js +130 -0
- package/dist/components/booking-document-dialog.d.ts +8 -0
- package/dist/components/booking-document-dialog.d.ts.map +1 -0
- package/dist/components/booking-document-dialog.js +83 -0
- package/dist/components/booking-document-list.d.ts +5 -0
- package/dist/components/booking-document-list.d.ts.map +1 -0
- package/dist/components/booking-document-list.js +43 -0
- package/dist/components/booking-group-link-dialog.d.ts +10 -0
- package/dist/components/booking-group-link-dialog.d.ts.map +1 -0
- package/dist/components/booking-group-link-dialog.js +79 -0
- package/dist/components/booking-group-section.d.ts +27 -0
- package/dist/components/booking-group-section.d.ts.map +1 -0
- package/dist/components/booking-group-section.js +51 -0
- package/dist/components/booking-guarantee-dialog.d.ts +10 -0
- package/dist/components/booking-guarantee-dialog.d.ts.map +1 -0
- package/dist/components/booking-guarantee-dialog.js +123 -0
- package/dist/components/booking-guarantee-list.d.ts +5 -0
- package/dist/components/booking-guarantee-list.d.ts.map +1 -0
- package/dist/components/booking-guarantee-list.js +86 -0
- package/dist/components/booking-item-dialog.d.ts +10 -0
- package/dist/components/booking-item-dialog.d.ts.map +1 -0
- package/dist/components/booking-item-dialog.js +155 -0
- package/dist/components/booking-item-list.d.ts +12 -0
- package/dist/components/booking-item-list.d.ts.map +1 -0
- package/dist/components/booking-item-list.js +191 -0
- package/dist/components/booking-item-travelers.d.ts +6 -0
- package/dist/components/booking-item-travelers.d.ts.map +1 -0
- package/dist/components/booking-item-travelers.js +57 -0
- package/dist/components/booking-list-filters.d.ts +43 -0
- package/dist/components/booking-list-filters.d.ts.map +1 -0
- package/dist/components/booking-list-filters.js +192 -0
- package/dist/components/booking-list.d.ts +50 -0
- package/dist/components/booking-list.d.ts.map +1 -0
- package/dist/components/booking-list.js +352 -0
- package/dist/components/booking-note-dialog.d.ts +16 -0
- package/dist/components/booking-note-dialog.d.ts.map +1 -0
- package/dist/components/booking-note-dialog.js +41 -0
- package/dist/components/booking-notes.d.ts +5 -0
- package/dist/components/booking-notes.d.ts.map +1 -0
- package/dist/components/booking-notes.js +45 -0
- package/dist/components/booking-payment-reconciliation-banner.d.ts +5 -0
- package/dist/components/booking-payment-reconciliation-banner.d.ts.map +1 -0
- package/dist/components/booking-payment-reconciliation-banner.js +91 -0
- package/dist/components/booking-payment-schedule-dialog.d.ts +10 -0
- package/dist/components/booking-payment-schedule-dialog.d.ts.map +1 -0
- package/dist/components/booking-payment-schedule-dialog.js +117 -0
- package/dist/components/booking-payment-schedule-list.d.ts +10 -0
- package/dist/components/booking-payment-schedule-list.d.ts.map +1 -0
- package/dist/components/booking-payment-schedule-list.js +217 -0
- package/dist/components/booking-payments-summary.d.ts +83 -0
- package/dist/components/booking-payments-summary.d.ts.map +1 -0
- package/dist/components/booking-payments-summary.js +176 -0
- package/dist/components/booking-quick-view-sheet.d.ts +14 -0
- package/dist/components/booking-quick-view-sheet.d.ts.map +1 -0
- package/dist/components/booking-quick-view-sheet.js +283 -0
- package/dist/components/bookings-page.d.ts +19 -0
- package/dist/components/bookings-page.d.ts.map +1 -0
- package/dist/components/bookings-page.js +9 -0
- package/dist/components/file-dropzone.d.ts +25 -0
- package/dist/components/file-dropzone.d.ts.map +1 -0
- package/dist/components/file-dropzone.js +102 -0
- package/dist/components/icon-action-button.d.ts +18 -0
- package/dist/components/icon-action-button.d.ts.map +1 -0
- package/dist/components/icon-action-button.js +13 -0
- package/dist/components/option-units-stepper-section.d.ts +111 -0
- package/dist/components/option-units-stepper-section.d.ts.map +1 -0
- package/dist/components/option-units-stepper-section.js +276 -0
- package/dist/components/payment-schedule-section.d.ts +91 -0
- package/dist/components/payment-schedule-section.d.ts.map +1 -0
- package/dist/components/payment-schedule-section.js +206 -0
- package/dist/components/person-picker-section.d.ts +71 -0
- package/dist/components/person-picker-section.d.ts.map +1 -0
- package/dist/components/person-picker-section.js +160 -0
- package/dist/components/price-breakdown-section.d.ts +83 -0
- package/dist/components/price-breakdown-section.d.ts.map +1 -0
- package/dist/components/price-breakdown-section.js +278 -0
- package/dist/components/product-picker-section.d.ts +29 -0
- package/dist/components/product-picker-section.d.ts.map +1 -0
- package/dist/components/product-picker-section.js +74 -0
- package/dist/components/shared-room-section.d.ts +40 -0
- package/dist/components/shared-room-section.d.ts.map +1 -0
- package/dist/components/shared-room-section.js +99 -0
- package/dist/components/status-badge.d.ts +24 -0
- package/dist/components/status-badge.d.ts.map +1 -0
- package/dist/components/status-badge.js +65 -0
- package/dist/components/status-change-dialog.d.ts +10 -0
- package/dist/components/status-change-dialog.d.ts.map +1 -0
- package/dist/components/status-change-dialog.js +57 -0
- package/dist/components/supplier-status-dialog.d.ts +10 -0
- package/dist/components/supplier-status-dialog.d.ts.map +1 -0
- package/dist/components/supplier-status-dialog.js +98 -0
- package/dist/components/supplier-status-list.d.ts +5 -0
- package/dist/components/supplier-status-list.d.ts.map +1 -0
- package/dist/components/supplier-status-list.js +115 -0
- package/dist/components/traveler-category-buttons.d.ts +26 -0
- package/dist/components/traveler-category-buttons.d.ts.map +1 -0
- package/dist/components/traveler-category-buttons.js +35 -0
- package/dist/components/traveler-dialog.d.ts +10 -0
- package/dist/components/traveler-dialog.d.ts.map +1 -0
- package/dist/components/traveler-dialog.js +256 -0
- package/dist/components/traveler-list.d.ts +6 -0
- package/dist/components/traveler-list.d.ts.map +1 -0
- package/dist/components/traveler-list.js +295 -0
- package/dist/components/travelers-section-controls.d.ts +52 -0
- package/dist/components/travelers-section-controls.d.ts.map +1 -0
- package/dist/components/travelers-section-controls.js +206 -0
- package/dist/components/travelers-section.d.ts +159 -0
- package/dist/components/travelers-section.d.ts.map +1 -0
- package/dist/components/travelers-section.js +355 -0
- package/dist/components/voucher-picker-section.d.ts +50 -0
- package/dist/components/voucher-picker-section.d.ts.map +1 -0
- package/dist/components/voucher-picker-section.js +79 -0
- package/dist/extras/client.d.ts +14 -0
- package/dist/extras/client.d.ts.map +1 -0
- package/dist/extras/client.js +58 -0
- package/dist/extras/components/extra-catalog-card.d.ts +13 -0
- package/dist/extras/components/extra-catalog-card.d.ts.map +1 -0
- package/dist/extras/components/extra-catalog-card.js +52 -0
- package/dist/extras/components/product-combobox.d.ts +9 -0
- package/dist/extras/components/product-combobox.d.ts.map +1 -0
- package/dist/extras/components/product-combobox.js +46 -0
- package/dist/extras/components/slot-extras-manifest-panel.d.ts +6 -0
- package/dist/extras/components/slot-extras-manifest-panel.d.ts.map +1 -0
- package/dist/extras/components/slot-extras-manifest-panel.js +108 -0
- package/dist/extras/hooks/index.d.ts +5 -0
- package/dist/extras/hooks/index.d.ts.map +1 -0
- package/dist/extras/hooks/index.js +4 -0
- package/dist/extras/hooks/use-product-extra.d.ts +24 -0
- package/dist/extras/hooks/use-product-extra.d.ts.map +1 -0
- package/dist/extras/hooks/use-product-extra.js +12 -0
- package/dist/extras/hooks/use-product-extras.d.ts +30 -0
- package/dist/extras/hooks/use-product-extras.d.ts.map +1 -0
- package/dist/extras/hooks/use-product-extras.js +12 -0
- package/dist/extras/hooks/use-slot-extra-manifest-mutation.d.ts +48 -0
- package/dist/extras/hooks/use-slot-extra-manifest-mutation.d.ts.map +1 -0
- package/dist/extras/hooks/use-slot-extra-manifest-mutation.js +26 -0
- package/dist/extras/hooks/use-slot-extra-manifest.d.ts +68 -0
- package/dist/extras/hooks/use-slot-extra-manifest.d.ts.map +1 -0
- package/dist/extras/hooks/use-slot-extra-manifest.js +11 -0
- package/dist/extras/i18n/en.d.ts +52 -0
- package/dist/extras/i18n/en.d.ts.map +1 -0
- package/dist/extras/i18n/en.js +51 -0
- package/dist/extras/i18n/index.d.ts +5 -0
- package/dist/extras/i18n/index.d.ts.map +1 -0
- package/dist/extras/i18n/index.js +3 -0
- package/dist/extras/i18n/messages.d.ts +37 -0
- package/dist/extras/i18n/messages.d.ts.map +1 -0
- package/dist/extras/i18n/messages.js +1 -0
- package/dist/extras/i18n/provider.d.ts +126 -0
- package/dist/extras/i18n/provider.d.ts.map +1 -0
- package/dist/extras/i18n/provider.js +44 -0
- package/dist/extras/i18n/ro.d.ts +52 -0
- package/dist/extras/i18n/ro.d.ts.map +1 -0
- package/dist/extras/i18n/ro.js +51 -0
- package/dist/extras/index.d.ts +7 -0
- package/dist/extras/index.d.ts.map +1 -0
- package/dist/extras/index.js +6 -0
- package/dist/extras/provider.d.ts +2 -0
- package/dist/extras/provider.d.ts.map +1 -0
- package/dist/extras/provider.js +1 -0
- package/dist/extras/query-keys.d.ts +16 -0
- package/dist/extras/query-keys.d.ts.map +1 -0
- package/dist/extras/query-keys.js +8 -0
- package/dist/extras/query-options.d.ts +455 -0
- package/dist/extras/query-options.d.ts.map +1 -0
- package/dist/extras/query-options.js +44 -0
- package/dist/extras/schemas.d.ts +416 -0
- package/dist/extras/schemas.d.ts.map +1 -0
- package/dist/extras/schemas.js +89 -0
- package/dist/extras/ui.d.ts +4 -0
- package/dist/extras/ui.d.ts.map +1 -0
- package/dist/extras/ui.js +3 -0
- package/dist/extras.d.ts +10 -0
- package/dist/extras.d.ts.map +1 -0
- package/dist/extras.js +9 -0
- package/dist/hooks/index.d.ts +36 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +35 -0
- package/dist/hooks/use-booking-action-ledger.d.ts +63 -0
- package/dist/hooks/use-booking-action-ledger.d.ts.map +1 -0
- package/dist/hooks/use-booking-action-ledger.js +34 -0
- package/dist/hooks/use-booking-activity.d.ts +17 -0
- package/dist/hooks/use-booking-activity.d.ts.map +1 -0
- package/dist/hooks/use-booking-activity.js +12 -0
- package/dist/hooks/use-booking-cancel-mutation.d.ts +69 -0
- package/dist/hooks/use-booking-cancel-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-cancel-mutation.js +24 -0
- package/dist/hooks/use-booking-contract-generation.d.ts +31 -0
- package/dist/hooks/use-booking-contract-generation.d.ts.map +1 -0
- package/dist/hooks/use-booking-contract-generation.js +36 -0
- package/dist/hooks/use-booking-convert-mutation.d.ts +81 -0
- package/dist/hooks/use-booking-convert-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-convert-mutation.js +24 -0
- package/dist/hooks/use-booking-create-mutation.d.ts +337 -0
- package/dist/hooks/use-booking-create-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-create-mutation.js +43 -0
- package/dist/hooks/use-booking-documents.d.ts +41 -0
- package/dist/hooks/use-booking-documents.d.ts.map +1 -0
- package/dist/hooks/use-booking-documents.js +46 -0
- package/dist/hooks/use-booking-dual-create-mutation.d.ts +338 -0
- package/dist/hooks/use-booking-dual-create-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-dual-create-mutation.js +45 -0
- package/dist/hooks/use-booking-group-for-booking.d.ts +24 -0
- package/dist/hooks/use-booking-group-for-booking.d.ts.map +1 -0
- package/dist/hooks/use-booking-group-for-booking.js +12 -0
- package/dist/hooks/use-booking-group-member-mutation.d.ts +27 -0
- package/dist/hooks/use-booking-group-member-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-group-member-mutation.js +38 -0
- package/dist/hooks/use-booking-group-mutation.d.ts +40 -0
- package/dist/hooks/use-booking-group-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-group-mutation.js +32 -0
- package/dist/hooks/use-booking-group.d.ts +85 -0
- package/dist/hooks/use-booking-group.d.ts.map +1 -0
- package/dist/hooks/use-booking-group.js +12 -0
- package/dist/hooks/use-booking-groups.d.ts +21 -0
- package/dist/hooks/use-booking-groups.d.ts.map +1 -0
- package/dist/hooks/use-booking-groups.js +12 -0
- package/dist/hooks/use-booking-item-mutation.d.ts +101 -0
- package/dist/hooks/use-booking-item-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-item-mutation.js +42 -0
- package/dist/hooks/use-booking-item-travelers.d.ts +32 -0
- package/dist/hooks/use-booking-item-travelers.d.ts.map +1 -0
- package/dist/hooks/use-booking-item-travelers.js +48 -0
- package/dist/hooks/use-booking-items.d.ts +36 -0
- package/dist/hooks/use-booking-items.d.ts.map +1 -0
- package/dist/hooks/use-booking-items.js +12 -0
- package/dist/hooks/use-booking-mutation.d.ts +158 -0
- package/dist/hooks/use-booking-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-mutation.js +39 -0
- package/dist/hooks/use-booking-note-mutation.d.ts +39 -0
- package/dist/hooks/use-booking-note-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-note-mutation.js +44 -0
- package/dist/hooks/use-booking-notes.d.ts +15 -0
- package/dist/hooks/use-booking-notes.d.ts.map +1 -0
- package/dist/hooks/use-booking-notes.js +12 -0
- package/dist/hooks/use-booking-primary-product.d.ts +28 -0
- package/dist/hooks/use-booking-primary-product.d.ts.map +1 -0
- package/dist/hooks/use-booking-primary-product.js +20 -0
- package/dist/hooks/use-booking-status-mutation.d.ts +156 -0
- package/dist/hooks/use-booking-status-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-status-mutation.js +54 -0
- package/dist/hooks/use-booking-tax-preview.d.ts +29 -0
- package/dist/hooks/use-booking-tax-preview.d.ts.map +1 -0
- package/dist/hooks/use-booking-tax-preview.js +21 -0
- package/dist/hooks/use-booking.d.ts +67 -0
- package/dist/hooks/use-booking.d.ts.map +1 -0
- package/dist/hooks/use-booking.js +12 -0
- package/dist/hooks/use-bookings.d.ts +71 -0
- package/dist/hooks/use-bookings.d.ts.map +1 -0
- package/dist/hooks/use-bookings.js +12 -0
- package/dist/hooks/use-pricing-preview.d.ts +61 -0
- package/dist/hooks/use-pricing-preview.d.ts.map +1 -0
- package/dist/hooks/use-pricing-preview.js +18 -0
- package/dist/hooks/use-public-booking-session-flow-mutation.d.ts +148 -0
- package/dist/hooks/use-public-booking-session-flow-mutation.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-session-flow-mutation.js +35 -0
- package/dist/hooks/use-public-booking-session-state.d.ts +16 -0
- package/dist/hooks/use-public-booking-session-state.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-session-state.js +12 -0
- package/dist/hooks/use-public-booking-session.d.ts +101 -0
- package/dist/hooks/use-public-booking-session.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-session.js +12 -0
- package/dist/hooks/use-reveal-traveler.d.ts +54 -0
- package/dist/hooks/use-reveal-traveler.d.ts.map +1 -0
- package/dist/hooks/use-reveal-traveler.js +18 -0
- package/dist/hooks/use-sharing-groups.d.ts +41 -0
- package/dist/hooks/use-sharing-groups.d.ts.map +1 -0
- package/dist/hooks/use-sharing-groups.js +20 -0
- package/dist/hooks/use-supplier-status-mutation.d.ts +46 -0
- package/dist/hooks/use-supplier-status-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-status-mutation.js +39 -0
- package/dist/hooks/use-supplier-statuses.d.ts +20 -0
- package/dist/hooks/use-supplier-statuses.d.ts.map +1 -0
- package/dist/hooks/use-supplier-statuses.js +12 -0
- package/dist/hooks/use-traveler-mutation.d.ts +55 -0
- package/dist/hooks/use-traveler-mutation.d.ts.map +1 -0
- package/dist/hooks/use-traveler-mutation.js +42 -0
- package/dist/hooks/use-traveler-with-travel-details-mutation.d.ts +120 -0
- package/dist/hooks/use-traveler-with-travel-details-mutation.d.ts.map +1 -0
- package/dist/hooks/use-traveler-with-travel-details-mutation.js +43 -0
- package/dist/hooks/use-travelers.d.ts +23 -0
- package/dist/hooks/use-travelers.d.ts.map +1 -0
- package/dist/hooks/use-travelers.js +12 -0
- package/dist/i18n/en-base.d.ts +295 -0
- package/dist/i18n/en-base.d.ts.map +1 -0
- package/dist/i18n/en-base.js +294 -0
- package/dist/i18n/en-create-list.d.ts +327 -0
- package/dist/i18n/en-create-list.d.ts.map +1 -0
- package/dist/i18n/en-create-list.js +326 -0
- package/dist/i18n/en-journey.d.ts +229 -0
- package/dist/i18n/en-journey.d.ts.map +1 -0
- package/dist/i18n/en-journey.js +228 -0
- package/dist/i18n/en-operations.d.ts +382 -0
- package/dist/i18n/en-operations.d.ts.map +1 -0
- package/dist/i18n/en-operations.js +381 -0
- package/dist/i18n/en-sections.d.ts +360 -0
- package/dist/i18n/en-sections.d.ts.map +1 -0
- package/dist/i18n/en-sections.js +359 -0
- package/dist/i18n/en.d.ts +1581 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +12 -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-base.d.ts +251 -0
- package/dist/i18n/messages-base.d.ts.map +1 -0
- package/dist/i18n/messages-base.js +1 -0
- package/dist/i18n/messages-create-list.d.ts +310 -0
- package/dist/i18n/messages-create-list.d.ts.map +1 -0
- package/dist/i18n/messages-create-list.js +1 -0
- package/dist/i18n/messages-journey.d.ts +198 -0
- package/dist/i18n/messages-journey.d.ts.map +1 -0
- package/dist/i18n/messages-journey.js +1 -0
- package/dist/i18n/messages-operations.d.ts +362 -0
- package/dist/i18n/messages-operations.d.ts.map +1 -0
- package/dist/i18n/messages-operations.js +1 -0
- package/dist/i18n/messages-sections.d.ts +312 -0
- package/dist/i18n/messages-sections.d.ts.map +1 -0
- package/dist/i18n/messages-sections.js +1 -0
- package/dist/i18n/messages.d.ts +7 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +1 -0
- package/dist/i18n/provider.d.ts +3185 -0
- package/dist/i18n/provider.d.ts.map +1 -0
- package/dist/i18n/provider.js +45 -0
- package/dist/i18n/ro-base.d.ts +295 -0
- package/dist/i18n/ro-base.d.ts.map +1 -0
- package/dist/i18n/ro-base.js +294 -0
- package/dist/i18n/ro-create-list.d.ts +327 -0
- package/dist/i18n/ro-create-list.d.ts.map +1 -0
- package/dist/i18n/ro-create-list.js +326 -0
- package/dist/i18n/ro-journey.d.ts +229 -0
- package/dist/i18n/ro-journey.d.ts.map +1 -0
- package/dist/i18n/ro-journey.js +228 -0
- package/dist/i18n/ro-operations.d.ts +382 -0
- package/dist/i18n/ro-operations.d.ts.map +1 -0
- package/dist/i18n/ro-operations.js +381 -0
- package/dist/i18n/ro-sections.d.ts +360 -0
- package/dist/i18n/ro-sections.d.ts.map +1 -0
- package/dist/i18n/ro-sections.js +359 -0
- package/dist/i18n/ro.d.ts +1581 -0
- package/dist/i18n/ro.d.ts.map +1 -0
- package/dist/i18n/ro.js +12 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/journey/components/booking-journey-rules.d.ts +48 -0
- package/dist/journey/components/booking-journey-rules.d.ts.map +1 -0
- package/dist/journey/components/booking-journey-rules.js +235 -0
- package/dist/journey/components/booking-journey.d.ts +3 -0
- package/dist/journey/components/booking-journey.d.ts.map +1 -0
- package/dist/journey/components/booking-journey.js +368 -0
- package/dist/journey/components/configure-step-skeleton.d.ts +8 -0
- package/dist/journey/components/configure-step-skeleton.d.ts.map +1 -0
- package/dist/journey/components/configure-step-skeleton.js +11 -0
- package/dist/journey/components/contract-preview-dialog.d.ts +47 -0
- package/dist/journey/components/contract-preview-dialog.d.ts.map +1 -0
- package/dist/journey/components/contract-preview-dialog.js +124 -0
- package/dist/journey/components/journey-steps/accommodation-step.d.ts +3 -0
- package/dist/journey/components/journey-steps/accommodation-step.d.ts.map +1 -0
- package/dist/journey/components/journey-steps/accommodation-step.js +71 -0
- package/dist/journey/components/journey-steps/addons-step.d.ts +3 -0
- package/dist/journey/components/journey-steps/addons-step.d.ts.map +1 -0
- package/dist/journey/components/journey-steps/addons-step.js +40 -0
- package/dist/journey/components/journey-steps/billing-step.d.ts +8 -0
- package/dist/journey/components/journey-steps/billing-step.d.ts.map +1 -0
- package/dist/journey/components/journey-steps/billing-step.js +78 -0
- package/dist/journey/components/journey-steps/configure-steps.d.ts +28 -0
- package/dist/journey/components/journey-steps/configure-steps.d.ts.map +1 -0
- package/dist/journey/components/journey-steps/configure-steps.js +232 -0
- package/dist/journey/components/journey-steps/documents-step.d.ts +11 -0
- package/dist/journey/components/journey-steps/documents-step.d.ts.map +1 -0
- package/dist/journey/components/journey-steps/documents-step.js +36 -0
- package/dist/journey/components/journey-steps/payment-step.d.ts +29 -0
- package/dist/journey/components/journey-steps/payment-step.d.ts.map +1 -0
- package/dist/journey/components/journey-steps/payment-step.js +225 -0
- package/dist/journey/components/journey-steps/review-step.d.ts +27 -0
- package/dist/journey/components/journey-steps/review-step.d.ts.map +1 -0
- package/dist/journey/components/journey-steps/review-step.js +18 -0
- package/dist/journey/components/journey-steps/shared.d.ts +75 -0
- package/dist/journey/components/journey-steps/shared.d.ts.map +1 -0
- package/dist/journey/components/journey-steps/shared.js +108 -0
- package/dist/journey/components/journey-steps/travelers-step.d.ts +7 -0
- package/dist/journey/components/journey-steps/travelers-step.d.ts.map +1 -0
- package/dist/journey/components/journey-steps/travelers-step.js +201 -0
- package/dist/journey/components/journey-steps.d.ts +21 -0
- package/dist/journey/components/journey-steps.d.ts.map +1 -0
- package/dist/journey/components/journey-steps.js +20 -0
- package/dist/journey/components/side-panel.d.ts +17 -0
- package/dist/journey/components/side-panel.d.ts.map +1 -0
- package/dist/journey/components/side-panel.js +245 -0
- package/dist/journey/components/stacked-journey.d.ts +30 -0
- package/dist/journey/components/stacked-journey.d.ts.map +1 -0
- package/dist/journey/components/stacked-journey.js +50 -0
- package/dist/journey/components/step-header.d.ts +7 -0
- package/dist/journey/components/step-header.d.ts.map +1 -0
- package/dist/journey/components/step-header.js +12 -0
- package/dist/journey/index.d.ts +18 -0
- package/dist/journey/index.d.ts.map +1 -0
- package/dist/journey/index.js +17 -0
- package/dist/journey/lib/draft-state.d.ts +35 -0
- package/dist/journey/lib/draft-state.d.ts.map +1 -0
- package/dist/journey/lib/draft-state.js +57 -0
- package/dist/journey/lib/pax-band-dependencies.d.ts +27 -0
- package/dist/journey/lib/pax-band-dependencies.d.ts.map +1 -0
- package/dist/journey/lib/pax-band-dependencies.js +50 -0
- package/dist/journey/lib/payment-schedule.d.ts +19 -0
- package/dist/journey/lib/payment-schedule.d.ts.map +1 -0
- package/dist/journey/lib/payment-schedule.js +90 -0
- package/dist/journey/types.d.ts +403 -0
- package/dist/journey/types.d.ts.map +1 -0
- package/dist/journey/types.js +19 -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 +74 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +26 -0
- package/dist/query-options.d.ts +2534 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +233 -0
- package/dist/requirements/client.d.ts +14 -0
- package/dist/requirements/client.d.ts.map +1 -0
- package/dist/requirements/client.js +59 -0
- package/dist/requirements/components/booking-requirements-contact-tab.d.ts +8 -0
- package/dist/requirements/components/booking-requirements-contact-tab.d.ts.map +1 -0
- package/dist/requirements/components/booking-requirements-contact-tab.js +8 -0
- package/dist/requirements/components/booking-requirements-questions-tab.d.ts +14 -0
- package/dist/requirements/components/booking-requirements-questions-tab.d.ts.map +1 -0
- package/dist/requirements/components/booking-requirements-questions-tab.js +17 -0
- package/dist/requirements/constants.d.ts +114 -0
- package/dist/requirements/constants.d.ts.map +1 -0
- package/dist/requirements/constants.js +45 -0
- package/dist/requirements/hooks/index.d.ts +6 -0
- package/dist/requirements/hooks/index.d.ts.map +1 -0
- package/dist/requirements/hooks/index.js +6 -0
- package/dist/requirements/hooks/use-booking-questions.d.ts +24 -0
- package/dist/requirements/hooks/use-booking-questions.d.ts.map +1 -0
- package/dist/requirements/hooks/use-booking-questions.js +9 -0
- package/dist/requirements/hooks/use-contact-requirements.d.ts +22 -0
- package/dist/requirements/hooks/use-contact-requirements.d.ts.map +1 -0
- package/dist/requirements/hooks/use-contact-requirements.js +9 -0
- package/dist/requirements/hooks/use-products.d.ts +16 -0
- package/dist/requirements/hooks/use-products.d.ts.map +1 -0
- package/dist/requirements/hooks/use-products.js +9 -0
- package/dist/requirements/hooks/use-question-options.d.ts +19 -0
- package/dist/requirements/hooks/use-question-options.d.ts.map +1 -0
- package/dist/requirements/hooks/use-question-options.js +9 -0
- package/dist/requirements/hooks/use-transport-requirements.d.ts +30 -0
- package/dist/requirements/hooks/use-transport-requirements.d.ts.map +1 -0
- package/dist/requirements/hooks/use-transport-requirements.js +9 -0
- package/dist/requirements/i18n/en.d.ts +94 -0
- package/dist/requirements/i18n/en.d.ts.map +1 -0
- package/dist/requirements/i18n/en.js +93 -0
- package/dist/requirements/i18n/index.d.ts +5 -0
- package/dist/requirements/i18n/index.d.ts.map +1 -0
- package/dist/requirements/i18n/index.js +3 -0
- package/dist/requirements/i18n/messages.d.ts +59 -0
- package/dist/requirements/i18n/messages.d.ts.map +1 -0
- package/dist/requirements/i18n/messages.js +1 -0
- package/dist/requirements/i18n/provider.d.ts +210 -0
- package/dist/requirements/i18n/provider.d.ts.map +1 -0
- package/dist/requirements/i18n/provider.js +44 -0
- package/dist/requirements/i18n/ro.d.ts +94 -0
- package/dist/requirements/i18n/ro.d.ts.map +1 -0
- package/dist/requirements/i18n/ro.js +93 -0
- package/dist/requirements/index.d.ts +9 -0
- package/dist/requirements/index.d.ts.map +1 -0
- package/dist/requirements/index.js +8 -0
- package/dist/requirements/provider.d.ts +2 -0
- package/dist/requirements/provider.d.ts.map +1 -0
- package/dist/requirements/provider.js +1 -0
- package/dist/requirements/query-keys.d.ts +33 -0
- package/dist/requirements/query-keys.d.ts.map +1 -0
- package/dist/requirements/query-keys.js +13 -0
- package/dist/requirements/query-options.d.ts +371 -0
- package/dist/requirements/query-options.d.ts.map +1 -0
- package/dist/requirements/query-options.js +80 -0
- package/dist/requirements/schemas.d.ts +320 -0
- package/dist/requirements/schemas.d.ts.map +1 -0
- package/dist/requirements/schemas.js +121 -0
- package/dist/requirements/ui.d.ts +4 -0
- package/dist/requirements/ui.d.ts.map +1 -0
- package/dist/requirements/ui.js +3 -0
- package/dist/requirements/utils.d.ts +2 -0
- package/dist/requirements/utils.d.ts.map +1 -0
- package/dist/requirements/utils.js +4 -0
- package/dist/schemas.d.ts +2070 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +507 -0
- package/dist/status-presentation.d.ts +34 -0
- package/dist/status-presentation.d.ts.map +1 -0
- package/dist/status-presentation.js +38 -0
- package/dist/ui.d.ts +43 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +42 -0
- package/package.json +256 -0
- package/src/requirements/styles.css +1 -0
- package/src/styles.css +13 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useBookingPaymentScheduleMutation, } from "@voyant-travel/finance-react";
|
|
4
|
+
import { Button, Dialog, DialogBody, DialogContent, DialogFooter, DialogHeader, DialogTitle, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Textarea, } from "@voyant-travel/ui/components";
|
|
5
|
+
import { CurrencyCombobox } from "@voyant-travel/ui/components/currency-combobox";
|
|
6
|
+
import { CurrencyInput } from "@voyant-travel/ui/components/currency-input";
|
|
7
|
+
import { DatePicker } from "@voyant-travel/ui/components/date-picker";
|
|
8
|
+
import { zodResolver } from "@voyant-travel/ui/lib/zod-resolver";
|
|
9
|
+
import { Loader2 } from "lucide-react";
|
|
10
|
+
import { useEffect, useMemo, useState } from "react";
|
|
11
|
+
import { useForm } from "react-hook-form";
|
|
12
|
+
import { z } from "zod/v4";
|
|
13
|
+
import { useBookingsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
14
|
+
const scheduleTypes = ["deposit", "installment", "balance", "hold", "other"];
|
|
15
|
+
const scheduleStatuses = ["pending", "due", "paid", "waived", "cancelled", "expired"];
|
|
16
|
+
const DEFAULT_CURRENCY = "EUR"; // i18n-literal-ok ISO default currency
|
|
17
|
+
function createScheduleFormSchema(messages) {
|
|
18
|
+
return z.object({
|
|
19
|
+
scheduleType: z.enum(scheduleTypes).default("balance"),
|
|
20
|
+
status: z.enum(scheduleStatuses).default("pending"),
|
|
21
|
+
dueDate: z.string().min(1, messages.paymentScheduleDialog.validation.dueDateRequired),
|
|
22
|
+
currency: z.string().min(3).max(3).default("EUR"),
|
|
23
|
+
amountCents: z.coerce
|
|
24
|
+
.number()
|
|
25
|
+
.int()
|
|
26
|
+
.min(0, messages.paymentScheduleDialog.validation.amountRequired),
|
|
27
|
+
notes: z.string().optional().nullable(),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export function BookingPaymentScheduleDialog({ open, onOpenChange, bookingId, schedule, onSuccess, }) {
|
|
31
|
+
const isEditing = Boolean(schedule);
|
|
32
|
+
const { create, update } = useBookingPaymentScheduleMutation(bookingId);
|
|
33
|
+
const messages = useBookingsUiMessagesOrDefault();
|
|
34
|
+
const scheduleFormSchema = createScheduleFormSchema(messages);
|
|
35
|
+
const typeItems = useMemo(() => scheduleTypes.map((t) => ({
|
|
36
|
+
value: t,
|
|
37
|
+
label: messages.paymentScheduleDialog.scheduleTypeLabels[t],
|
|
38
|
+
})), [messages.paymentScheduleDialog.scheduleTypeLabels]);
|
|
39
|
+
const statusItems = useMemo(() => scheduleStatuses.map((s) => ({
|
|
40
|
+
value: s,
|
|
41
|
+
label: messages.paymentScheduleDialog.scheduleStatusLabels[s],
|
|
42
|
+
})), [messages.paymentScheduleDialog.scheduleStatusLabels]);
|
|
43
|
+
const form = useForm({
|
|
44
|
+
resolver: zodResolver(scheduleFormSchema),
|
|
45
|
+
defaultValues: {
|
|
46
|
+
scheduleType: "balance",
|
|
47
|
+
status: "pending",
|
|
48
|
+
dueDate: "",
|
|
49
|
+
currency: DEFAULT_CURRENCY,
|
|
50
|
+
amountCents: 0,
|
|
51
|
+
notes: "",
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (open && schedule) {
|
|
56
|
+
form.reset({
|
|
57
|
+
scheduleType: schedule.scheduleType,
|
|
58
|
+
status: schedule.status,
|
|
59
|
+
dueDate: schedule.dueDate,
|
|
60
|
+
currency: schedule.currency,
|
|
61
|
+
amountCents: schedule.amountCents,
|
|
62
|
+
notes: schedule.notes ?? "",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else if (open) {
|
|
66
|
+
form.reset();
|
|
67
|
+
}
|
|
68
|
+
}, [form, open, schedule]);
|
|
69
|
+
const [submitError, setSubmitError] = useState(null);
|
|
70
|
+
const onSubmit = async (values) => {
|
|
71
|
+
const payload = {
|
|
72
|
+
scheduleType: values.scheduleType,
|
|
73
|
+
status: values.status,
|
|
74
|
+
dueDate: values.dueDate,
|
|
75
|
+
currency: values.currency,
|
|
76
|
+
amountCents: values.amountCents,
|
|
77
|
+
notes: values.notes || null,
|
|
78
|
+
};
|
|
79
|
+
setSubmitError(null);
|
|
80
|
+
try {
|
|
81
|
+
if (isEditing) {
|
|
82
|
+
await update.mutateAsync({ id: schedule.id, input: payload });
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
await create.mutateAsync(payload);
|
|
86
|
+
}
|
|
87
|
+
onOpenChange(false);
|
|
88
|
+
onSuccess?.();
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
// Server-side validation (e.g. "Cannot mark booking payment
|
|
92
|
+
// schedule as paid without linked completed payment coverage")
|
|
93
|
+
// would otherwise bubble into an unhandled promise rejection and
|
|
94
|
+
// leave the operator staring at a closed dialog with no signal.
|
|
95
|
+
setSubmitError(err instanceof Error ? err.message : String(err));
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (!open)
|
|
100
|
+
setSubmitError(null);
|
|
101
|
+
}, [open]);
|
|
102
|
+
const isSubmitting = create.isPending || update.isPending;
|
|
103
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { size: "lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing
|
|
104
|
+
? messages.paymentScheduleDialog.titles.edit
|
|
105
|
+
: messages.paymentScheduleDialog.titles.create }) }), _jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-1 flex-col overflow-hidden", 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.paymentScheduleDialog.fields.type }), _jsxs(Select, { items: typeItems, value: form.watch("scheduleType"), onValueChange: (v) => form.setValue("scheduleType", (v ?? "balance")), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: scheduleTypes.map((t) => (_jsx(SelectItem, { value: t, children: messages.paymentScheduleDialog.scheduleTypeLabels[t] }, t))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.paymentScheduleDialog.fields.status }), _jsxs(Select, { items: statusItems, value: form.watch("status"), onValueChange: (v) => form.setValue("status", (v ?? "pending")), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: scheduleStatuses.map((s) => (_jsx(SelectItem, { value: s, children: messages.paymentScheduleDialog.scheduleStatusLabels[s] }, s))) })] })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.paymentScheduleDialog.fields.dueDate }), _jsx(DatePicker, { value: form.watch("dueDate") || null, onChange: (next) => form.setValue("dueDate", next ?? "", {
|
|
106
|
+
shouldValidate: true,
|
|
107
|
+
shouldDirty: true,
|
|
108
|
+
}), placeholder: messages.paymentScheduleDialog.placeholders.dueDate, className: "w-full" }), form.formState.errors.dueDate && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.dueDate.message }))] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.paymentScheduleDialog.fields.currency }), _jsx(CurrencyCombobox, { value: form.watch("currency") || null, onChange: (next) => form.setValue("currency", next ?? DEFAULT_CURRENCY, {
|
|
109
|
+
shouldValidate: true,
|
|
110
|
+
shouldDirty: true,
|
|
111
|
+
}) })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.paymentScheduleDialog.fields.amountCents }), _jsx(CurrencyInput, { value: form.watch("amountCents"), onChange: (next) => form.setValue("amountCents", next ?? 0, {
|
|
112
|
+
shouldDirty: true,
|
|
113
|
+
shouldValidate: true,
|
|
114
|
+
}), currency: form.watch("currency") }), form.formState.errors.amountCents && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.amountCents.message }))] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.paymentScheduleDialog.fields.notes }), _jsx(Textarea, { ...form.register("notes"), placeholder: messages.paymentScheduleDialog.placeholders.notes })] }), submitError ? (_jsx("p", { role: "alert", className: "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: submitError })) : null] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => onOpenChange(false), children: messages.common.cancel }), _jsxs(Button, { type: "submit", size: "sm", disabled: isSubmitting, children: [isSubmitting && _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), isEditing
|
|
115
|
+
? messages.common.saveChanges
|
|
116
|
+
: messages.paymentScheduleDialog.actions.addSchedule] })] })] })] }) }));
|
|
117
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface BookingPaymentScheduleListProps {
|
|
2
|
+
/**
|
|
3
|
+
* When set, the Add schedule button renders disabled and its tooltip
|
|
4
|
+
* shows this reason (e.g. "Booking is fully paid.").
|
|
5
|
+
*/
|
|
6
|
+
addScheduleDisabledReason?: string | null;
|
|
7
|
+
bookingId: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function BookingPaymentScheduleList({ bookingId, addScheduleDisabledReason, }: BookingPaymentScheduleListProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=booking-payment-schedule-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-payment-schedule-list.d.ts","sourceRoot":"","sources":["../../src/components/booking-payment-schedule-list.tsx"],"names":[],"mappings":"AAsFA,MAAM,WAAW,+BAA+B;IAC9C;;;OAGG;IACH,yBAAyB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,0BAA0B,CAAC,EACzC,SAAS,EACT,yBAAyB,GAC1B,EAAE,+BAA+B,2CA4TjC"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { financeQueryKeys, useBookingPaymentScheduleMutation, useBookingPaymentSchedules, useInvoiceMutation, useInvoices, } from "@voyant-travel/finance-react";
|
|
5
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, Button, } from "@voyant-travel/ui/components";
|
|
6
|
+
import { DataTable } from "@voyant-travel/ui/components/data-table";
|
|
7
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@voyant-travel/ui/components/dropdown-menu";
|
|
8
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "@voyant-travel/ui/components/tooltip";
|
|
9
|
+
import { CalendarClock, FileText, Loader2, Pencil, Plus, Receipt, Trash2 } from "lucide-react";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { toast } from "sonner";
|
|
12
|
+
import { useBookingsUiI18nOrDefault, useBookingsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
13
|
+
import { useBooking } from "../index.js";
|
|
14
|
+
import { BookingPaymentScheduleDialog } from "./booking-payment-schedule-dialog.js";
|
|
15
|
+
import { IconActionButton } from "./icon-action-button.js";
|
|
16
|
+
import { StatusBadge } from "./status-badge.js";
|
|
17
|
+
const issueDocumentAllocationErrorCodes = [
|
|
18
|
+
"invoice_number_series_not_found",
|
|
19
|
+
"invoice_number_series_inactive",
|
|
20
|
+
"invoice_number_series_scope_mismatch",
|
|
21
|
+
"no_active_series_for_scope",
|
|
22
|
+
];
|
|
23
|
+
function isIssueDocumentAllocationErrorCode(value) {
|
|
24
|
+
return (typeof value === "string" &&
|
|
25
|
+
issueDocumentAllocationErrorCodes.includes(value));
|
|
26
|
+
}
|
|
27
|
+
function extractIssueDocumentAllocationErrorCode(error) {
|
|
28
|
+
if (typeof error === "object" && error !== null && "body" in error) {
|
|
29
|
+
const body = error.body;
|
|
30
|
+
if (typeof body === "object" && body !== null && "error" in body) {
|
|
31
|
+
const apiError = body.error;
|
|
32
|
+
if (isIssueDocumentAllocationErrorCode(apiError))
|
|
33
|
+
return apiError;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (error instanceof Error && isIssueDocumentAllocationErrorCode(error.message)) {
|
|
37
|
+
return error.message;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function getIssueDocumentErrorMessage(error, messages) {
|
|
42
|
+
const code = extractIssueDocumentAllocationErrorCode(error);
|
|
43
|
+
if (code) {
|
|
44
|
+
return messages.bookingPaymentScheduleList.actions.issueDocumentErrors[code];
|
|
45
|
+
}
|
|
46
|
+
return error instanceof Error ? error.message : null;
|
|
47
|
+
}
|
|
48
|
+
export function BookingPaymentScheduleList({ bookingId, addScheduleDisabledReason, }) {
|
|
49
|
+
const [dialogOpen, setDialogOpen] = React.useState(false);
|
|
50
|
+
const [editing, setEditing] = React.useState(undefined);
|
|
51
|
+
const [deleteTarget, setDeleteTarget] = React.useState(null);
|
|
52
|
+
const [generatingInvoiceForId, setGeneratingInvoiceForId] = React.useState(null);
|
|
53
|
+
const { data } = useBookingPaymentSchedules(bookingId);
|
|
54
|
+
const { remove } = useBookingPaymentScheduleMutation(bookingId);
|
|
55
|
+
const { data: bookingData } = useBooking(bookingId);
|
|
56
|
+
const booking = bookingData?.data ?? null;
|
|
57
|
+
// Track which schedules already have an invoice / proforma so the
|
|
58
|
+
// per-row action menu can hide the irrelevant choices and the new
|
|
59
|
+
// Invoice column can link to the doc.
|
|
60
|
+
const { data: invoicesData } = useInvoices({ bookingId, limit: 50 });
|
|
61
|
+
const docsByScheduleId = React.useMemo(() => {
|
|
62
|
+
const map = new Map();
|
|
63
|
+
const invoices = invoicesData?.data ?? [];
|
|
64
|
+
for (const invoice of invoices) {
|
|
65
|
+
if (invoice.status === "void")
|
|
66
|
+
continue;
|
|
67
|
+
const scheduleIds = invoice.bookingPaymentScheduleIds ?? [];
|
|
68
|
+
for (const scheduleId of scheduleIds) {
|
|
69
|
+
const existing = map.get(scheduleId) ?? { invoice: null, proforma: null };
|
|
70
|
+
const ref = { id: invoice.id, invoiceNumber: invoice.invoiceNumber };
|
|
71
|
+
if (invoice.invoiceType === "proforma") {
|
|
72
|
+
if (!existing.proforma)
|
|
73
|
+
existing.proforma = ref;
|
|
74
|
+
}
|
|
75
|
+
else if (invoice.invoiceType !== "credit_note") {
|
|
76
|
+
if (!existing.invoice)
|
|
77
|
+
existing.invoice = ref;
|
|
78
|
+
}
|
|
79
|
+
map.set(scheduleId, existing);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return map;
|
|
83
|
+
}, [invoicesData]);
|
|
84
|
+
const { createFromBooking: createInvoiceFromBooking, render: renderInvoice } = useInvoiceMutation();
|
|
85
|
+
const queryClient = useQueryClient();
|
|
86
|
+
const { formatCurrency, formatDate } = useBookingsUiI18nOrDefault();
|
|
87
|
+
const messages = useBookingsUiMessagesOrDefault();
|
|
88
|
+
const t = messages.bookingPaymentScheduleList;
|
|
89
|
+
const deleteMessages = t.actions.deleteConfirm;
|
|
90
|
+
const schedules = data?.data ?? [];
|
|
91
|
+
const handleGenerateInvoice = React.useCallback(async (schedule, invoiceType) => {
|
|
92
|
+
if (!booking)
|
|
93
|
+
return;
|
|
94
|
+
setGeneratingInvoiceForId(schedule.id);
|
|
95
|
+
try {
|
|
96
|
+
const todayIso = new Date().toISOString().slice(0, 10);
|
|
97
|
+
const dueIso = schedule.dueDate || todayIso;
|
|
98
|
+
const invoice = await createInvoiceFromBooking.mutateAsync({
|
|
99
|
+
bookingId: booking.id,
|
|
100
|
+
bookingPaymentScheduleId: schedule.id,
|
|
101
|
+
issueDate: todayIso,
|
|
102
|
+
dueDate: dueIso,
|
|
103
|
+
notes: schedule.notes ?? null,
|
|
104
|
+
invoiceType,
|
|
105
|
+
});
|
|
106
|
+
await renderInvoice.mutateAsync({ id: invoice.id, input: { format: "pdf" } });
|
|
107
|
+
await queryClient.invalidateQueries({ queryKey: financeQueryKeys.invoices() });
|
|
108
|
+
toast.success(t.actions.issueDocumentSuccess);
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
const errorMessage = getIssueDocumentErrorMessage(err, messages);
|
|
112
|
+
toast.error(errorMessage
|
|
113
|
+
? `${t.actions.issueDocumentFailure}: ${errorMessage}`
|
|
114
|
+
: t.actions.issueDocumentFailure);
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
setGeneratingInvoiceForId(null);
|
|
118
|
+
}
|
|
119
|
+
}, [booking, createInvoiceFromBooking, renderInvoice, queryClient, t, messages]);
|
|
120
|
+
const handleConfirmDelete = async () => {
|
|
121
|
+
if (!deleteTarget)
|
|
122
|
+
return;
|
|
123
|
+
await remove.mutateAsync(deleteTarget.id);
|
|
124
|
+
setDeleteTarget(null);
|
|
125
|
+
};
|
|
126
|
+
const columns = React.useMemo(() => [
|
|
127
|
+
{
|
|
128
|
+
accessorKey: "dueDate",
|
|
129
|
+
header: t.columns.dueDate,
|
|
130
|
+
cell: ({ row }) => row.original.dueDate
|
|
131
|
+
? formatDate(`${row.original.dueDate}T00:00:00`, { dateStyle: "medium" })
|
|
132
|
+
: "—",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
accessorKey: "amountCents",
|
|
136
|
+
header: t.columns.amount,
|
|
137
|
+
cell: ({ row }) => (_jsx("span", { className: "font-mono", children: formatCurrency(row.original.amountCents / 100, row.original.currency) })),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
accessorKey: "scheduleType",
|
|
141
|
+
header: t.columns.type,
|
|
142
|
+
cell: ({ row }) => messages.paymentScheduleDialog.scheduleTypeLabels[row.original.scheduleType],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
accessorKey: "status",
|
|
146
|
+
header: t.columns.status,
|
|
147
|
+
cell: ({ row }) => (_jsx(StatusBadge, { status: row.original.status, children: messages.paymentScheduleDialog.scheduleStatusLabels[row.original.status] })),
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: "invoice",
|
|
151
|
+
header: t.columns.invoice,
|
|
152
|
+
cell: ({ row }) => {
|
|
153
|
+
const docs = docsByScheduleId.get(row.original.id);
|
|
154
|
+
const doc = docs?.invoice ?? docs?.proforma ?? null;
|
|
155
|
+
if (!doc)
|
|
156
|
+
return _jsx("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
157
|
+
return (_jsxs("span", { className: "font-mono text-xs", children: [doc.invoiceNumber, docs?.proforma && !docs.invoice ? (_jsxs("span", { className: "ml-1 text-muted-foreground", children: ["(", t.values.proformaSuffix, ")"] })) : null] }));
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
accessorKey: "notes",
|
|
162
|
+
header: t.columns.notes,
|
|
163
|
+
cell: ({ row }) => (_jsx("span", { className: "block max-w-[200px] truncate text-muted-foreground", children: row.original.notes ?? t.values.notesUnavailable })),
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "actions",
|
|
167
|
+
header: "",
|
|
168
|
+
cell: ({ row }) => {
|
|
169
|
+
const schedule = row.original;
|
|
170
|
+
const issuing = generatingInvoiceForId === schedule.id;
|
|
171
|
+
// Once a schedule is settled (paid / waived / cancelled / expired)
|
|
172
|
+
// there's nothing left to bill, so hide the issue-document menu.
|
|
173
|
+
const canIssue = schedule.status === "pending" || schedule.status === "due";
|
|
174
|
+
const docs = docsByScheduleId.get(schedule.id);
|
|
175
|
+
// Idempotency: a schedule already covered by a final invoice
|
|
176
|
+
// accepts no more documents; a covering proforma blocks new
|
|
177
|
+
// proformas (a final invoice path is still open via the
|
|
178
|
+
// proforma's Convert action). A final invoice always wins
|
|
179
|
+
// over a proforma in the same slot.
|
|
180
|
+
const canIssueInvoice = canIssue && !docs?.invoice;
|
|
181
|
+
const canIssueProforma = canIssue && !docs?.invoice && !docs?.proforma;
|
|
182
|
+
const hasAnyIssueAction = canIssueInvoice || canIssueProforma;
|
|
183
|
+
return (_jsxs("div", { className: "flex items-center justify-end gap-1", children: [hasAnyIssueAction ? (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { disabled: !booking || issuing, render: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": t.actions.issueDocument, title: t.actions.issueDocument }), children: issuing ? (_jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" })) : (_jsx(Receipt, { className: "h-3.5 w-3.5" })) }), _jsxs(DropdownMenuContent, { align: "end", children: [canIssueInvoice ? (_jsxs(DropdownMenuItem, { onClick: () => void handleGenerateInvoice(schedule, "invoice"), children: [_jsx(FileText, { className: "h-4 w-4" }), t.actions.issueInvoice] })) : null, canIssueProforma ? (_jsxs(DropdownMenuItem, { onClick: () => void handleGenerateInvoice(schedule, "proforma"), children: [_jsx(FileText, { className: "h-4 w-4" }), t.actions.issueProforma] })) : null] })] })) : null, _jsx(IconActionButton, { label: t.actions.editSchedule, icon: _jsx(Pencil, { className: "h-3.5 w-3.5" }), onClick: (e) => {
|
|
184
|
+
e.stopPropagation();
|
|
185
|
+
setEditing(schedule);
|
|
186
|
+
setDialogOpen(true);
|
|
187
|
+
} }), _jsx(IconActionButton, { label: t.actions.deleteSchedule, icon: _jsx(Trash2, { className: "h-3.5 w-3.5" }), className: "text-muted-foreground hover:bg-destructive/10 hover:text-destructive", onClick: (e) => {
|
|
188
|
+
e.stopPropagation();
|
|
189
|
+
setDeleteTarget(schedule);
|
|
190
|
+
} })] }));
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
], [
|
|
194
|
+
booking,
|
|
195
|
+
formatCurrency,
|
|
196
|
+
formatDate,
|
|
197
|
+
generatingInvoiceForId,
|
|
198
|
+
handleGenerateInvoice,
|
|
199
|
+
messages,
|
|
200
|
+
t,
|
|
201
|
+
docsByScheduleId,
|
|
202
|
+
]);
|
|
203
|
+
return (_jsxs("div", { "data-slot": "booking-payment-schedule-list", 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(CalendarClock, { className: "h-4 w-4" }), t.title] }), addScheduleDisabledReason ? (_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.addSchedule] }) }), _jsx(TooltipContent, { children: addScheduleDisabledReason })] })) : (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
204
|
+
setEditing(undefined);
|
|
205
|
+
setDialogOpen(true);
|
|
206
|
+
}, children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), t.addSchedule] }))] }), _jsx(DataTable, { columns: columns, data: schedules, emptyMessage: t.empty, showPagination: false }), _jsx(BookingPaymentScheduleDialog, { open: dialogOpen, onOpenChange: (nextOpen) => {
|
|
207
|
+
setDialogOpen(nextOpen);
|
|
208
|
+
if (!nextOpen) {
|
|
209
|
+
setEditing(undefined);
|
|
210
|
+
}
|
|
211
|
+
}, bookingId: bookingId, schedule: editing, onSuccess: () => {
|
|
212
|
+
setEditing(undefined);
|
|
213
|
+
} }), _jsx(AlertDialog, { open: Boolean(deleteTarget), onOpenChange: (next) => {
|
|
214
|
+
if (!next && !remove.isPending)
|
|
215
|
+
setDeleteTarget(null);
|
|
216
|
+
}, children: _jsxs(AlertDialogContent, { size: "sm", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: deleteMessages.title }), _jsx(AlertDialogDescription, { children: deleteMessages.description })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: remove.isPending, children: deleteMessages.cancel }), _jsx(AlertDialogAction, { variant: "destructive", disabled: remove.isPending, onClick: () => void handleConfirmDelete(), children: deleteMessages.confirm })] })] }) })] }));
|
|
217
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type PaymentMethod, type PaymentStatus } from "@voyant-travel/finance-react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface BookingPaymentsSummaryRow {
|
|
4
|
+
id: string;
|
|
5
|
+
invoiceId: string;
|
|
6
|
+
invoiceNumber: string;
|
|
7
|
+
invoiceType?: "invoice" | "proforma" | "credit_note";
|
|
8
|
+
amountCents: number;
|
|
9
|
+
currency: string;
|
|
10
|
+
/** When the customer paid in a different currency than the invoice. */
|
|
11
|
+
baseCurrency?: string | null;
|
|
12
|
+
baseAmountCents?: number | null;
|
|
13
|
+
status: PaymentStatus;
|
|
14
|
+
paymentMethod: PaymentMethod;
|
|
15
|
+
paymentDate: string;
|
|
16
|
+
referenceNumber: string | null;
|
|
17
|
+
notes: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface BookingPaymentsSummaryProps {
|
|
20
|
+
bookingId: string;
|
|
21
|
+
/**
|
|
22
|
+
* Which API surface to fetch from. The customer-portal uses
|
|
23
|
+
* `"public"` (default — hits `/v1/public/finance/bookings/:id/payments`).
|
|
24
|
+
* The operator dashboard must pass `"admin"` because the
|
|
25
|
+
* `/v1/public/*` middleware enforces a non-staff actor guard, so
|
|
26
|
+
* staff sessions get blocked from the public endpoint.
|
|
27
|
+
*/
|
|
28
|
+
variant?: "admin" | "public";
|
|
29
|
+
/**
|
|
30
|
+
* Open the linked invoice in-place (typically a Sheet that renders
|
|
31
|
+
* the invoice detail page). When omitted, the invoice number cell
|
|
32
|
+
* renders as plain text.
|
|
33
|
+
*/
|
|
34
|
+
onInvoiceOpen?: (invoiceId: string, row: BookingPaymentsSummaryRow) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Optional invoice href for hosts that navigate with route links
|
|
37
|
+
* instead of an in-place invoice panel.
|
|
38
|
+
*/
|
|
39
|
+
getInvoiceHref?: (row: BookingPaymentsSummaryRow) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Optional handler for the "View" action in the row menu. Consumers
|
|
42
|
+
* typically call their router's navigate(). Middle-click isn't useful
|
|
43
|
+
* on menu items, so this is a click handler rather than an href.
|
|
44
|
+
*/
|
|
45
|
+
onViewPayment?: (row: BookingPaymentsSummaryRow) => void;
|
|
46
|
+
/** Convert a proforma invoice attached to the payment into a final invoice. */
|
|
47
|
+
onConvertProforma?: (row: BookingPaymentsSummaryRow) => Promise<unknown> | unknown;
|
|
48
|
+
/** Edit handler — typically opens a dialog pre-filled with the row. */
|
|
49
|
+
onEditPayment?: (row: BookingPaymentsSummaryRow) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Delete handler. Must resolve when the deletion is complete (the
|
|
52
|
+
* card closes the confirm dialog on resolve). Throw or reject to
|
|
53
|
+
* keep the dialog open with an error.
|
|
54
|
+
*/
|
|
55
|
+
onDeletePayment?: (row: BookingPaymentsSummaryRow) => Promise<void> | void;
|
|
56
|
+
/**
|
|
57
|
+
* Extra content rendered on the right of the card header (e.g. a
|
|
58
|
+
* `Record payment` button). Keeps section-level actions co-located
|
|
59
|
+
* with the section instead of floating at the top of the tab.
|
|
60
|
+
*/
|
|
61
|
+
headerAction?: React.ReactNode;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Payment-centric view of the money movements recorded against a
|
|
65
|
+
* booking's invoices. Sister card to `BookingInvoicesCard` (operator
|
|
66
|
+
* template) which is invoice-centric — payments and invoices are
|
|
67
|
+
* different concepts, so each gets its own table with its own lead
|
|
68
|
+
* column.
|
|
69
|
+
*
|
|
70
|
+
* Column order here is operator-tested:
|
|
71
|
+
* 1. **Suma** — what came in. Largest, bold, currency-formatted.
|
|
72
|
+
* 2. **Metoda** — how (icon + label).
|
|
73
|
+
* 3. **Status** — completed/pending/failed/refunded badge.
|
|
74
|
+
* 4. **Data** — when.
|
|
75
|
+
* 5. **Referinta** — provider tx id, capture id, etc.
|
|
76
|
+
* 6. **Pentru** — which invoice this paid (secondary; shown last).
|
|
77
|
+
*
|
|
78
|
+
* The invoice number deliberately appears last as a "for" link, not
|
|
79
|
+
* first as the primary identifier — that's the difference between
|
|
80
|
+
* "list of payments" and "list of invoice line-items".
|
|
81
|
+
*/
|
|
82
|
+
export declare function BookingPaymentsSummary({ bookingId, variant, onInvoiceOpen, getInvoiceHref, onViewPayment, onConvertProforma, onEditPayment, onDeletePayment, headerAction, }: BookingPaymentsSummaryProps): import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
//# sourceMappingURL=booking-payments-summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-payments-summary.d.ts","sourceRoot":"","sources":["../../src/components/booking-payments-summary.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAGnB,MAAM,8BAA8B,CAAA;AAarC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,aAAa,CAAA;IACpD,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,MAAM,EAAE,aAAa,CAAA;IACrB,aAAa,EAAE,aAAa,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC5B;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,yBAAyB,KAAK,IAAI,CAAA;IAC3E;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,yBAAyB,KAAK,MAAM,CAAA;IAC3D;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,yBAAyB,KAAK,IAAI,CAAA;IACxD,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,yBAAyB,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAClF,uEAAuE;IACvE,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,yBAAyB,KAAK,IAAI,CAAA;IACxD;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,yBAAyB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC1E;;;;OAIG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,OAAkB,EAClB,aAAa,EACb,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,YAAY,GACb,EAAE,2BAA2B,2CAwQ7B"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useAdminBookingPayments, usePublicBookingPayments, } from "@voyant-travel/finance-react";
|
|
4
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@voyant-travel/ui/components";
|
|
5
|
+
import { DataTable } from "@voyant-travel/ui/components/data-table";
|
|
6
|
+
import { ArrowUpRight, CreditCard, Eye, Pencil, Trash2 } from "lucide-react";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { useBookingsUiI18nOrDefault, useBookingsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
9
|
+
import { IconActionButton } from "./icon-action-button.js";
|
|
10
|
+
import { StatusBadge } from "./status-badge.js";
|
|
11
|
+
/**
|
|
12
|
+
* Payment-centric view of the money movements recorded against a
|
|
13
|
+
* booking's invoices. Sister card to `BookingInvoicesCard` (operator
|
|
14
|
+
* template) which is invoice-centric — payments and invoices are
|
|
15
|
+
* different concepts, so each gets its own table with its own lead
|
|
16
|
+
* column.
|
|
17
|
+
*
|
|
18
|
+
* Column order here is operator-tested:
|
|
19
|
+
* 1. **Suma** — what came in. Largest, bold, currency-formatted.
|
|
20
|
+
* 2. **Metoda** — how (icon + label).
|
|
21
|
+
* 3. **Status** — completed/pending/failed/refunded badge.
|
|
22
|
+
* 4. **Data** — when.
|
|
23
|
+
* 5. **Referinta** — provider tx id, capture id, etc.
|
|
24
|
+
* 6. **Pentru** — which invoice this paid (secondary; shown last).
|
|
25
|
+
*
|
|
26
|
+
* The invoice number deliberately appears last as a "for" link, not
|
|
27
|
+
* first as the primary identifier — that's the difference between
|
|
28
|
+
* "list of payments" and "list of invoice line-items".
|
|
29
|
+
*/
|
|
30
|
+
export function BookingPaymentsSummary({ bookingId, variant = "public", onInvoiceOpen, getInvoiceHref, onViewPayment, onConvertProforma, onEditPayment, onDeletePayment, headerAction, }) {
|
|
31
|
+
const publicQuery = usePublicBookingPayments(bookingId, { enabled: variant === "public" });
|
|
32
|
+
const adminQuery = useAdminBookingPayments(bookingId, { enabled: variant === "admin" });
|
|
33
|
+
const data = variant === "admin" ? adminQuery.data : publicQuery.data;
|
|
34
|
+
const { formatDateTime } = useBookingsUiI18nOrDefault();
|
|
35
|
+
const messages = useBookingsUiMessagesOrDefault();
|
|
36
|
+
const card = messages.bookingPaymentsSummary;
|
|
37
|
+
const payments = data?.data?.payments ?? [];
|
|
38
|
+
const showActionsColumn = Boolean(onViewPayment || onConvertProforma || onEditPayment || onDeletePayment);
|
|
39
|
+
const [deleteTarget, setDeleteTarget] = React.useState(null);
|
|
40
|
+
const [deletePending, setDeletePending] = React.useState(false);
|
|
41
|
+
const handleDeleteConfirm = async () => {
|
|
42
|
+
if (!deleteTarget || !onDeletePayment)
|
|
43
|
+
return;
|
|
44
|
+
setDeletePending(true);
|
|
45
|
+
try {
|
|
46
|
+
await onDeletePayment(deleteTarget);
|
|
47
|
+
setDeleteTarget(null);
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
setDeletePending(false);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const paymentRows = React.useMemo(() => payments.map((payment) => ({
|
|
54
|
+
id: payment.id,
|
|
55
|
+
invoiceId: payment.invoiceId,
|
|
56
|
+
invoiceNumber: payment.invoiceNumber,
|
|
57
|
+
invoiceType: payment.invoiceType,
|
|
58
|
+
amountCents: payment.amountCents,
|
|
59
|
+
currency: payment.currency,
|
|
60
|
+
baseCurrency: payment.baseCurrency ?? null,
|
|
61
|
+
baseAmountCents: payment.baseAmountCents ?? null,
|
|
62
|
+
status: payment.status,
|
|
63
|
+
paymentMethod: payment.paymentMethod,
|
|
64
|
+
paymentDate: payment.paymentDate,
|
|
65
|
+
referenceNumber: payment.referenceNumber,
|
|
66
|
+
notes: payment.notes,
|
|
67
|
+
})), [payments]);
|
|
68
|
+
const columns = React.useMemo(() => {
|
|
69
|
+
const cols = [
|
|
70
|
+
{
|
|
71
|
+
accessorKey: "paymentDate",
|
|
72
|
+
header: card.columns.date,
|
|
73
|
+
cell: ({ row }) => formatDateTime(row.original.paymentDate),
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
accessorKey: "amountCents",
|
|
77
|
+
header: card.columns.amount,
|
|
78
|
+
cell: ({ row }) => (_jsx("span", { className: "font-mono font-medium", children: formatMoney(row.original.amountCents, row.original.currency) })),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "fx",
|
|
82
|
+
header: card.columns.fx,
|
|
83
|
+
cell: ({ row }) => {
|
|
84
|
+
const { baseCurrency, baseAmountCents, currency } = row.original;
|
|
85
|
+
if (!baseCurrency ||
|
|
86
|
+
baseAmountCents == null ||
|
|
87
|
+
baseCurrency.toUpperCase() === currency.toUpperCase()) {
|
|
88
|
+
return _jsx("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
89
|
+
}
|
|
90
|
+
return (_jsxs("span", { className: "font-mono text-xs", children: ["\u2248 ", formatMoney(baseAmountCents, baseCurrency)] }));
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
accessorKey: "paymentMethod",
|
|
95
|
+
header: card.columns.method,
|
|
96
|
+
cell: ({ row }) => card.paymentMethodLabels[row.original.paymentMethod] ?? row.original.paymentMethod,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
accessorKey: "status",
|
|
100
|
+
header: card.columns.status,
|
|
101
|
+
cell: ({ row }) => (_jsx(StatusBadge, { status: row.original.status, children: card.paymentStatusLabels[row.original.status] ?? row.original.status })),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
accessorKey: "referenceNumber",
|
|
105
|
+
header: card.columns.reference,
|
|
106
|
+
cell: ({ row }) => (_jsx("span", { title: row.original.referenceNumber ?? undefined, className: "inline-block max-w-[180px] truncate font-mono text-muted-foreground text-xs", children: row.original.referenceNumber ?? "—" })),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
accessorKey: "invoiceNumber",
|
|
110
|
+
header: card.columns.invoice,
|
|
111
|
+
cell: ({ row }) => {
|
|
112
|
+
if (onInvoiceOpen) {
|
|
113
|
+
return (_jsxs("button", { type: "button", onClick: (e) => {
|
|
114
|
+
e.stopPropagation();
|
|
115
|
+
onInvoiceOpen(row.original.invoiceId, row.original);
|
|
116
|
+
}, className: "inline-flex items-center gap-1 font-mono text-primary text-xs hover:underline", children: [row.original.invoiceNumber, _jsx(ArrowUpRight, { className: "h-3 w-3" })] }));
|
|
117
|
+
}
|
|
118
|
+
if (getInvoiceHref) {
|
|
119
|
+
return (_jsxs("a", { href: getInvoiceHref(row.original), onClick: (e) => e.stopPropagation(), className: "inline-flex items-center gap-1 font-mono text-primary text-xs hover:underline", children: [row.original.invoiceNumber, _jsx(ArrowUpRight, { className: "h-3 w-3" })] }));
|
|
120
|
+
}
|
|
121
|
+
return _jsx("span", { className: "font-mono text-xs", children: row.original.invoiceNumber });
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
if (showActionsColumn) {
|
|
126
|
+
cols.push({
|
|
127
|
+
id: "actions",
|
|
128
|
+
header: () => _jsx("span", { className: "sr-only", children: card.columns.actions }),
|
|
129
|
+
cell: ({ row }) => (_jsxs("div", { className: "flex items-center justify-end gap-1", children: [onViewPayment ? (_jsx(IconActionButton, { label: card.actions.view, icon: _jsx(Eye, { className: "h-3.5 w-3.5" }), onClick: (e) => {
|
|
130
|
+
e.stopPropagation();
|
|
131
|
+
onViewPayment(row.original);
|
|
132
|
+
} })) : null, onConvertProforma && row.original.invoiceType === "proforma" ? (_jsx(IconActionButton, { label: card.actions.convertToInvoice, icon: _jsx(ArrowUpRight, { className: "h-3.5 w-3.5" }), onClick: (e) => {
|
|
133
|
+
e.stopPropagation();
|
|
134
|
+
void onConvertProforma(row.original);
|
|
135
|
+
} })) : null, onEditPayment ? (_jsx(IconActionButton, { label: card.actions.edit, icon: _jsx(Pencil, { className: "h-3.5 w-3.5" }), onClick: (e) => {
|
|
136
|
+
e.stopPropagation();
|
|
137
|
+
onEditPayment(row.original);
|
|
138
|
+
} })) : null, onDeletePayment ? (_jsx(IconActionButton, { label: card.actions.delete, icon: _jsx(Trash2, { className: "h-3.5 w-3.5" }), className: "text-muted-foreground hover:bg-destructive/10 hover:text-destructive", onClick: (e) => {
|
|
139
|
+
e.stopPropagation();
|
|
140
|
+
setDeleteTarget(row.original);
|
|
141
|
+
} })) : null] })),
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return cols;
|
|
145
|
+
}, [
|
|
146
|
+
card,
|
|
147
|
+
formatDateTime,
|
|
148
|
+
getInvoiceHref,
|
|
149
|
+
onInvoiceOpen,
|
|
150
|
+
onConvertProforma,
|
|
151
|
+
onDeletePayment,
|
|
152
|
+
onEditPayment,
|
|
153
|
+
onViewPayment,
|
|
154
|
+
showActionsColumn,
|
|
155
|
+
]);
|
|
156
|
+
return (_jsxs("div", { "data-slot": "booking-payments-summary", className: "flex flex-col gap-3", children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("h2", { className: "flex items-center gap-2 text-base font-semibold", children: [_jsx(CreditCard, { className: "h-4 w-4 text-muted-foreground" }), messages.bookingPaymentsSummary.title] }), headerAction] }), _jsx(DataTable, { columns: columns, data: paymentRows, emptyMessage: messages.bookingPaymentsSummary.empty, showPagination: false }), onDeletePayment ? (_jsx(AlertDialog, { open: Boolean(deleteTarget), onOpenChange: (next) => {
|
|
157
|
+
if (!next && !deletePending)
|
|
158
|
+
setDeleteTarget(null);
|
|
159
|
+
}, children: _jsxs(AlertDialogContent, { size: "sm", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: card.deleteConfirm.title }), _jsx(AlertDialogDescription, { children: deleteTarget
|
|
160
|
+
? card.deleteConfirm.description.replace("{amount}", formatMoney(deleteTarget.amountCents, deleteTarget.currency))
|
|
161
|
+
: "" })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: deletePending, children: card.deleteConfirm.cancel }), _jsx(AlertDialogAction, { variant: "destructive", disabled: deletePending, onClick: () => void handleDeleteConfirm(), children: card.deleteConfirm.confirm })] })] }) })) : null] }));
|
|
162
|
+
}
|
|
163
|
+
function formatMoney(cents, currency) {
|
|
164
|
+
if (!currency) {
|
|
165
|
+
return new Intl.NumberFormat(undefined, {
|
|
166
|
+
minimumFractionDigits: 2,
|
|
167
|
+
maximumFractionDigits: 2,
|
|
168
|
+
}).format(cents / 100);
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
return new Intl.NumberFormat(undefined, { style: "currency", currency }).format(cents / 100);
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return `${(cents / 100).toFixed(2)} ${currency}`;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type BookingRecord } from "../index.js";
|
|
2
|
+
export interface BookingQuickViewSheetProps {
|
|
3
|
+
bookingId: string | null | undefined;
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
/** Wired to the "View full booking" footer button. Receives the booking
|
|
7
|
+
* so the host can route to its detail page. When omitted, the footer
|
|
8
|
+
* action is suppressed. */
|
|
9
|
+
onViewFull?: (booking: BookingRecord) => void;
|
|
10
|
+
/** Optional locale override; defaults to the active i18n locale. */
|
|
11
|
+
locale?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function BookingQuickViewSheet({ bookingId, open, onOpenChange, onViewFull, locale, }: BookingQuickViewSheetProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=booking-quick-view-sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-quick-view-sheet.d.ts","sourceRoot":"","sources":["../../src/components/booking-quick-view-sheet.tsx"],"names":[],"mappings":"AAuDA,OAAO,EACL,KAAK,aAAa,EAQnB,MAAM,aAAa,CAAA;AAEpB,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACpC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC;;+BAE2B;IAC3B,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;IAC7C,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,MAAM,GACP,EAAE,0BAA0B,2CA6D5B"}
|