@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,352 @@
|
|
|
1
|
+
// agent-quality: file-size exception -- owner: bookings-react; existing UI surface stays co-located until a dedicated split preserves behavior and tests.
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
+
import { Button } from "@voyant-travel/ui/components/button";
|
|
5
|
+
import { Input } from "@voyant-travel/ui/components/input";
|
|
6
|
+
import { Label } from "@voyant-travel/ui/components/label";
|
|
7
|
+
import { Pagination, PaginationContent, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, } from "@voyant-travel/ui/components/pagination";
|
|
8
|
+
import { Skeleton } from "@voyant-travel/ui/components/skeleton";
|
|
9
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@voyant-travel/ui/components/table";
|
|
10
|
+
import { ArrowDown, ArrowUp, ArrowUpDown, Plus, Search } from "lucide-react";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { formatMessage, useBookingsUiI18nOrDefault, useBookingsUiMessagesOrDefault, } from "../i18n/provider.js";
|
|
13
|
+
import { useBookings, } from "../index.js";
|
|
14
|
+
import { BookingDialog } from "./booking-dialog.js";
|
|
15
|
+
import { BOOKING_STATUS_ALL, BookingListFiltersPopover } from "./booking-list-filters.js";
|
|
16
|
+
import { StatusBadge } from "./status-badge.js";
|
|
17
|
+
function stripUndefined(input) {
|
|
18
|
+
const result = {};
|
|
19
|
+
for (const [key, value] of Object.entries(input)) {
|
|
20
|
+
if (value !== undefined)
|
|
21
|
+
result[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
const DEFAULT_FILTERS = {
|
|
26
|
+
search: "",
|
|
27
|
+
status: BOOKING_STATUS_ALL,
|
|
28
|
+
productId: null,
|
|
29
|
+
optionId: null,
|
|
30
|
+
supplierId: null,
|
|
31
|
+
productCategoryId: null,
|
|
32
|
+
personId: null,
|
|
33
|
+
organizationId: null,
|
|
34
|
+
availabilitySlotId: null,
|
|
35
|
+
dateFrom: null,
|
|
36
|
+
dateTo: null,
|
|
37
|
+
paxMin: "",
|
|
38
|
+
paxMax: "",
|
|
39
|
+
sortBy: "createdAt",
|
|
40
|
+
sortDir: "desc",
|
|
41
|
+
offset: 0,
|
|
42
|
+
};
|
|
43
|
+
const SORTABLE_COLUMNS = {
|
|
44
|
+
bookingNumber: "bookingNumber",
|
|
45
|
+
status: "status",
|
|
46
|
+
sellAmount: "sellAmount",
|
|
47
|
+
pax: "pax",
|
|
48
|
+
startDate: "startDate",
|
|
49
|
+
endDate: "endDate",
|
|
50
|
+
createdAt: "createdAt",
|
|
51
|
+
};
|
|
52
|
+
const SKELETON_ROW_COUNT = 6;
|
|
53
|
+
const TABLE_COLUMN_COUNT = 8;
|
|
54
|
+
export function BookingList({ pageSize = 25, onSelectBooking, onCreateBooking, headerActions, initialFilters, onFiltersChange, } = {}) {
|
|
55
|
+
// Single bag of filter / sort / paging state so we can hand the host
|
|
56
|
+
// a snapshot whenever anything changes. We seed once from
|
|
57
|
+
// `initialFilters` and don't re-seed if the prop later mutates —
|
|
58
|
+
// hosts that want to drive controlled changes can just remount.
|
|
59
|
+
//
|
|
60
|
+
// Strip `undefined` keys before merging: a host passing
|
|
61
|
+
// `{ status: undefined }` would otherwise clobber the
|
|
62
|
+
// `BOOKING_STATUS_ALL` default and show "2" active filters on an
|
|
63
|
+
// empty URL.
|
|
64
|
+
const [filters, setFilters] = React.useState(() => ({
|
|
65
|
+
...DEFAULT_FILTERS,
|
|
66
|
+
...stripUndefined(initialFilters ?? {}),
|
|
67
|
+
}));
|
|
68
|
+
const onFiltersChangeRef = React.useRef(onFiltersChange);
|
|
69
|
+
React.useEffect(() => {
|
|
70
|
+
onFiltersChangeRef.current = onFiltersChange;
|
|
71
|
+
});
|
|
72
|
+
// Notify the host on every state change. Skip the initial render
|
|
73
|
+
// because the URL already reflects whatever was passed in via
|
|
74
|
+
// `initialFilters`.
|
|
75
|
+
const isFirstRender = React.useRef(true);
|
|
76
|
+
React.useEffect(() => {
|
|
77
|
+
if (isFirstRender.current) {
|
|
78
|
+
isFirstRender.current = false;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
onFiltersChangeRef.current?.(filters);
|
|
82
|
+
}, [filters]);
|
|
83
|
+
const updateFilters = React.useCallback((patch) => setFilters((prev) => ({ ...prev, ...patch })), []);
|
|
84
|
+
const { search, status, productId, optionId, supplierId, productCategoryId, personId, organizationId, availabilitySlotId, dateFrom, dateTo, paxMin, paxMax, sortBy, sortDir, offset, } = filters;
|
|
85
|
+
const dateRange = dateFrom != null || dateTo != null ? { from: dateFrom, to: dateTo } : null;
|
|
86
|
+
const [filterPopoverOpen, setFilterPopoverOpen] = React.useState(false);
|
|
87
|
+
const [dialogOpen, setDialogOpen] = React.useState(false);
|
|
88
|
+
const [editing, setEditing] = React.useState(undefined);
|
|
89
|
+
const { formatDate, formatDateTime, formatNumber, locale } = useBookingsUiI18nOrDefault();
|
|
90
|
+
const messages = useBookingsUiMessagesOrDefault();
|
|
91
|
+
const paxMinNumber = paxMin === "" ? undefined : Number.parseInt(paxMin, 10);
|
|
92
|
+
const paxMaxNumber = paxMax === "" ? undefined : Number.parseInt(paxMax, 10);
|
|
93
|
+
// "All" hides drafts + expired by default — they're rarely actionable
|
|
94
|
+
// and crowd the operator's queue. Explicit selection of either status
|
|
95
|
+
// (or any other) opts back in.
|
|
96
|
+
const excludeStatuses = status === BOOKING_STATUS_ALL ? ["draft", "expired"] : undefined;
|
|
97
|
+
const { data, isPending, isFetching, isError } = useBookings({
|
|
98
|
+
search: search || undefined,
|
|
99
|
+
status: status === BOOKING_STATUS_ALL ? undefined : status,
|
|
100
|
+
excludeStatuses,
|
|
101
|
+
productId: productId ?? undefined,
|
|
102
|
+
optionId: optionId ?? undefined,
|
|
103
|
+
availabilitySlotId: availabilitySlotId ?? undefined,
|
|
104
|
+
supplierId: supplierId ?? undefined,
|
|
105
|
+
productCategoryId: productCategoryId ?? undefined,
|
|
106
|
+
personId: personId ?? undefined,
|
|
107
|
+
organizationId: organizationId ?? undefined,
|
|
108
|
+
dateFrom: dateRange?.from ?? undefined,
|
|
109
|
+
dateTo: dateRange?.to ?? undefined,
|
|
110
|
+
paxMin: Number.isFinite(paxMinNumber) ? paxMinNumber : undefined,
|
|
111
|
+
paxMax: Number.isFinite(paxMaxNumber) ? paxMaxNumber : undefined,
|
|
112
|
+
sortBy,
|
|
113
|
+
sortDir,
|
|
114
|
+
limit: pageSize,
|
|
115
|
+
offset,
|
|
116
|
+
});
|
|
117
|
+
const bookings = data?.data ?? [];
|
|
118
|
+
const total = data?.total ?? 0;
|
|
119
|
+
const page = Math.floor(offset / pageSize) + 1;
|
|
120
|
+
const pageCount = Math.max(1, Math.ceil(total / pageSize));
|
|
121
|
+
const showSkeleton = isPending || (isFetching && bookings.length === 0);
|
|
122
|
+
const handleSelect = (booking) => {
|
|
123
|
+
if (onSelectBooking) {
|
|
124
|
+
onSelectBooking(booking);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
setEditing(booking);
|
|
128
|
+
setDialogOpen(true);
|
|
129
|
+
};
|
|
130
|
+
const resetOffset = () => updateFilters({ offset: 0 });
|
|
131
|
+
const handleSort = (field) => {
|
|
132
|
+
if (sortBy !== field) {
|
|
133
|
+
updateFilters({ offset: 0, sortBy: field, sortDir: "asc" });
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (sortDir === "asc") {
|
|
137
|
+
updateFilters({ offset: 0, sortDir: "desc" });
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
updateFilters({ offset: 0, sortBy: "createdAt", sortDir: "desc" });
|
|
141
|
+
};
|
|
142
|
+
const activeFilterCount = (status !== BOOKING_STATUS_ALL ? 1 : 0) +
|
|
143
|
+
(productId !== null ? 1 : 0) +
|
|
144
|
+
(optionId !== null ? 1 : 0) +
|
|
145
|
+
(availabilitySlotId !== null ? 1 : 0) +
|
|
146
|
+
(supplierId !== null ? 1 : 0) +
|
|
147
|
+
(productCategoryId !== null ? 1 : 0) +
|
|
148
|
+
(personId !== null ? 1 : 0) +
|
|
149
|
+
(organizationId !== null ? 1 : 0) +
|
|
150
|
+
(dateRange?.from || dateRange?.to ? 1 : 0) +
|
|
151
|
+
(paxMin !== "" || paxMax !== "" ? 1 : 0);
|
|
152
|
+
const hasActiveFilters = activeFilterCount > 0 || search !== "";
|
|
153
|
+
const clearFilters = () => {
|
|
154
|
+
updateFilters({
|
|
155
|
+
search: "",
|
|
156
|
+
status: BOOKING_STATUS_ALL,
|
|
157
|
+
productId: null,
|
|
158
|
+
optionId: null,
|
|
159
|
+
availabilitySlotId: null,
|
|
160
|
+
supplierId: null,
|
|
161
|
+
productCategoryId: null,
|
|
162
|
+
personId: null,
|
|
163
|
+
organizationId: null,
|
|
164
|
+
dateFrom: null,
|
|
165
|
+
dateTo: null,
|
|
166
|
+
paxMin: "",
|
|
167
|
+
paxMax: "",
|
|
168
|
+
offset: 0,
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
const columnMessages = messages.bookingList.columns;
|
|
172
|
+
const statusLabels = messages.common.bookingStatusLabels;
|
|
173
|
+
return (_jsxs("div", { "data-slot": "booking-list", className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs("div", { className: "relative min-w-[14rem] flex-1", children: [_jsx(Label, { htmlFor: "bookings-search", className: "sr-only", children: messages.bookingList.searchPlaceholder }), _jsx(Search, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { id: "bookings-search", placeholder: messages.bookingList.searchPlaceholder, value: search, onChange: (event) => updateFilters({ search: event.target.value, offset: 0 }), className: "pl-9" })] }), _jsx(BookingListFiltersPopover, { open: filterPopoverOpen, onOpenChange: setFilterPopoverOpen, activeFilterCount: activeFilterCount, status: status, onStatusChange: (next) => updateFilters({ status: next }), productId: productId, onProductIdChange: (next) =>
|
|
174
|
+
// Slot picker is product-scoped; clear when the product changes.
|
|
175
|
+
updateFilters({ productId: next, availabilitySlotId: null }), optionId: optionId, onOptionIdChange: (next) => updateFilters({ optionId: next }), availabilitySlotId: availabilitySlotId, onAvailabilitySlotIdChange: (next) => updateFilters({ availabilitySlotId: next }), supplierId: supplierId, onSupplierIdChange: (next) => updateFilters({ supplierId: next }), productCategoryId: productCategoryId, onProductCategoryIdChange: (next) => updateFilters({ productCategoryId: next }), personId: personId, onPersonIdChange: (next) => updateFilters({ personId: next }), organizationId: organizationId, onOrganizationIdChange: (next) => updateFilters({ organizationId: next }), dateRange: dateRange, onDateRangeChange: (next) => updateFilters({ dateFrom: next?.from ?? null, dateTo: next?.to ?? null }), paxMin: paxMin, onPaxMinChange: (next) => updateFilters({ paxMin: next }), paxMax: paxMax, onPaxMaxChange: (next) => updateFilters({ paxMax: next }), onFiltersChanged: resetOffset, hasActiveFilters: hasActiveFilters, onClearFilters: clearFilters }), _jsxs("div", { className: "ml-auto flex items-center gap-2", children: [headerActions, _jsxs(Button, { onClick: () => {
|
|
176
|
+
if (onCreateBooking) {
|
|
177
|
+
onCreateBooking();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
setEditing(undefined);
|
|
181
|
+
setDialogOpen(true);
|
|
182
|
+
}, children: [_jsx(Plus, { className: "mr-2 size-4" }), messages.bookingList.newBooking] })] })] }), _jsx("div", { className: "rounded-md border", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: _jsx(SortHeader, { label: columnMessages.bookingNumber, field: SORTABLE_COLUMNS.bookingNumber, sortBy: sortBy, sortDir: sortDir, onSort: handleSort }) }), _jsx(TableHead, { children: _jsx(SortHeader, { label: columnMessages.createdAt, field: SORTABLE_COLUMNS.createdAt, sortBy: sortBy, sortDir: sortDir, onSort: handleSort }) }), _jsx(TableHead, { children: columnMessages.lead }), _jsx(TableHead, { children: columnMessages.whatBooked }), _jsx(TableHead, { children: _jsx(SortHeader, { label: columnMessages.status, field: SORTABLE_COLUMNS.status, sortBy: sortBy, sortDir: sortDir, onSort: handleSort }) }), _jsx(TableHead, { children: _jsx(SortHeader, { label: columnMessages.sellAmount, field: SORTABLE_COLUMNS.sellAmount, sortBy: sortBy, sortDir: sortDir, onSort: handleSort }) }), _jsx(TableHead, { children: _jsx(SortHeader, { label: columnMessages.pax, field: SORTABLE_COLUMNS.pax, sortBy: sortBy, sortDir: sortDir, onSort: handleSort }) }), _jsx(TableHead, { children: _jsx(SortHeader, { label: columnMessages.startDate, field: SORTABLE_COLUMNS.startDate, sortBy: sortBy, sortDir: sortDir, onSort: handleSort }) })] }) }), _jsx(TableBody, { children: showSkeleton ? (_jsx(BookingTableSkeleton, { rows: SKELETON_ROW_COUNT })) : isError ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: TABLE_COLUMN_COUNT, className: "h-24 text-center text-sm text-destructive", children: messages.bookingList.loadingError }) })) : bookings.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: TABLE_COLUMN_COUNT, className: "h-24 text-center text-sm text-muted-foreground", children: messages.bookingList.empty }) })) : (bookings.map((booking) => (_jsxs(TableRow, { onClick: () => handleSelect(booking), className: "cursor-pointer", children: [_jsx(TableCell, { className: "font-medium", children: booking.bookingNumber }), _jsx(TableCell, { children: formatBookingDateTime(booking.createdAt, formatDateTime) }), _jsx(TableCell, { children: formatLead(booking) }), _jsx(TableCell, { children: formatBookingItems(booking, messages.bookingList.itemsMore, messages.bookingList.itemDays) }), _jsx(TableCell, { children: _jsx(StatusBadge, { status: booking.status, children: statusLabels[booking.status] }) }), _jsx(TableCell, { children: booking.sellAmountCents == null
|
|
183
|
+
? "—"
|
|
184
|
+
: `${formatNumber(booking.sellAmountCents / 100, {
|
|
185
|
+
minimumFractionDigits: 2,
|
|
186
|
+
maximumFractionDigits: 2,
|
|
187
|
+
})} ${booking.sellCurrency}` }), _jsx(TableCell, { children: booking.pax ?? "—" }), _jsx(TableCell, { className: "whitespace-nowrap", children: formatBookingDateRange(booking.startsAt ?? booking.startDate, booking.endsAt ?? booking.endDate, formatDate, locale) })] }, booking.id)))) })] }) }), _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 text-sm text-muted-foreground", children: [_jsx("span", { children: formatMessage(messages.bookingList.showingSummary, {
|
|
188
|
+
count: bookings.length,
|
|
189
|
+
total,
|
|
190
|
+
}) }), pageCount > 1 ? (_jsx(BookingListPagination, { page: page, pageCount: pageCount, previousLabel: messages.bookingList.previousPage, nextLabel: messages.bookingList.nextPage, onPageChange: (nextPage) => updateFilters({ offset: (nextPage - 1) * pageSize }) })) : null] }), _jsx(BookingDialog, { open: dialogOpen, onOpenChange: setDialogOpen, booking: editing, onSuccess: (booking) => {
|
|
191
|
+
onSelectBooking?.(booking);
|
|
192
|
+
} })] }));
|
|
193
|
+
}
|
|
194
|
+
function BookingListPagination({ page, pageCount, previousLabel, nextLabel, onPageChange, }) {
|
|
195
|
+
const canPrev = page > 1;
|
|
196
|
+
const canNext = page < pageCount;
|
|
197
|
+
const pages = computePageWindow(page, pageCount);
|
|
198
|
+
return (_jsx(Pagination, { className: "mx-0 w-auto justify-end", children: _jsxs(PaginationContent, { children: [_jsx(PaginationItem, { children: _jsx(PaginationPrevious, { href: "#", text: previousLabel, "aria-disabled": !canPrev, tabIndex: canPrev ? 0 : -1, className: canPrev ? undefined : "pointer-events-none opacity-50", onClick: (event) => {
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
if (canPrev)
|
|
201
|
+
onPageChange(page - 1);
|
|
202
|
+
} }) }), pages.map((entry, idx) => (_jsx(PaginationItem
|
|
203
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: ellipsis sentinels collide on value alone -- owner: bookings-react; existing suppression is intentional pending typed cleanup.
|
|
204
|
+
, { children: entry === "…" ? (_jsx("span", { className: "px-2 text-muted-foreground", "aria-hidden": true, children: "\u2026" })) : (_jsx(PaginationLink, { href: "#", isActive: entry === page, onClick: (event) => {
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
if (entry !== page)
|
|
207
|
+
onPageChange(entry);
|
|
208
|
+
}, children: entry })) }, `${entry}-${idx}`))), _jsx(PaginationItem, { children: _jsx(PaginationNext, { href: "#", text: nextLabel, "aria-disabled": !canNext, tabIndex: canNext ? 0 : -1, className: canNext ? undefined : "pointer-events-none opacity-50", onClick: (event) => {
|
|
209
|
+
event.preventDefault();
|
|
210
|
+
if (canNext)
|
|
211
|
+
onPageChange(page + 1);
|
|
212
|
+
} }) })] }) }));
|
|
213
|
+
}
|
|
214
|
+
/** Build a 1-indexed page list with ellipses for tables with many
|
|
215
|
+
* pages. Always shows first, last, current, and one neighbour on
|
|
216
|
+
* either side. */
|
|
217
|
+
function computePageWindow(page, pageCount) {
|
|
218
|
+
if (pageCount <= 7) {
|
|
219
|
+
return Array.from({ length: pageCount }, (_, i) => i + 1);
|
|
220
|
+
}
|
|
221
|
+
const out = [1];
|
|
222
|
+
const start = Math.max(2, page - 1);
|
|
223
|
+
const end = Math.min(pageCount - 1, page + 1);
|
|
224
|
+
if (start > 2)
|
|
225
|
+
out.push("…");
|
|
226
|
+
for (let i = start; i <= end; i += 1)
|
|
227
|
+
out.push(i);
|
|
228
|
+
if (end < pageCount - 1)
|
|
229
|
+
out.push("…");
|
|
230
|
+
out.push(pageCount);
|
|
231
|
+
return out;
|
|
232
|
+
}
|
|
233
|
+
function SortHeader({ label, field, sortBy, sortDir, onSort }) {
|
|
234
|
+
const active = sortBy === field;
|
|
235
|
+
const Icon = active ? (sortDir === "asc" ? ArrowUp : ArrowDown) : ArrowUpDown;
|
|
236
|
+
return (_jsxs("button", { type: "button", onClick: () => onSort(field), className: "-ml-2 inline-flex h-8 items-center gap-1 rounded-sm px-2 hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [_jsx("span", { children: label }), _jsx(Icon, { className: `size-3.5 ${active ? "text-foreground" : "text-muted-foreground/60"}`, "aria-hidden": true })] }));
|
|
237
|
+
}
|
|
238
|
+
function BookingTableSkeleton({ rows }) {
|
|
239
|
+
return (_jsx(_Fragment, { children: Array.from({ length: rows }).map((_, idx) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsx(Skeleton, { className: "h-4 w-24" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-4 w-48" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-5 w-20 rounded-full" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-4 w-20" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-4 w-8" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-4 w-32" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-4 w-32" }) })] }, `skeleton-${idx}`))) }));
|
|
240
|
+
}
|
|
241
|
+
function formatBookingItems(booking, moreTemplate, daysTemplate) {
|
|
242
|
+
const items = booking.items ?? [];
|
|
243
|
+
if (items.length === 0)
|
|
244
|
+
return _jsx("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
245
|
+
const [first, ...rest] = items;
|
|
246
|
+
if (!first)
|
|
247
|
+
return _jsx("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
248
|
+
const label = first.productName ?? first.title;
|
|
249
|
+
const days = computeItemDays(first.startsAt, first.endsAt);
|
|
250
|
+
const daysSuffix = days > 0 ? ` ${formatMessage(daysTemplate, { count: days })}` : "";
|
|
251
|
+
const moreSuffix = rest.length === 0 ? "" : ` ${formatMessage(moreTemplate, { count: rest.length })}`;
|
|
252
|
+
return (_jsxs("div", { className: "max-w-[320px] truncate", title: `${label}${daysSuffix}${moreSuffix}`, children: [label, days > 0 ? (_jsx("span", { className: "ml-1 text-xs text-muted-foreground", children: formatMessage(daysTemplate, { count: days }) })) : null, rest.length > 0 ? (_jsx("span", { className: "ml-1 text-xs text-muted-foreground", children: formatMessage(moreTemplate, { count: rest.length }) })) : null] }));
|
|
253
|
+
}
|
|
254
|
+
/** Inclusive day-count between two ISO timestamps, rounded up so a
|
|
255
|
+
* trip spanning two calendar days reads "2 days". Returns 0 when
|
|
256
|
+
* either bound is missing so the caller can drop the tag entirely. */
|
|
257
|
+
function computeItemDays(startValue, endValue) {
|
|
258
|
+
const start = toDate(startValue);
|
|
259
|
+
const end = toDate(endValue);
|
|
260
|
+
if (!start || !end)
|
|
261
|
+
return 0;
|
|
262
|
+
const ms = end.getTime() - start.getTime();
|
|
263
|
+
if (!Number.isFinite(ms) || ms < 0)
|
|
264
|
+
return 0;
|
|
265
|
+
const days = Math.ceil(ms / (1000 * 60 * 60 * 24));
|
|
266
|
+
return Math.max(1, days);
|
|
267
|
+
}
|
|
268
|
+
function formatBookingDateTime(value, formatDateTime) {
|
|
269
|
+
if (!value)
|
|
270
|
+
return "—";
|
|
271
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
272
|
+
return formatDateTime(`${value}T00:00:00`);
|
|
273
|
+
}
|
|
274
|
+
return formatDateTime(value);
|
|
275
|
+
}
|
|
276
|
+
function toDate(value) {
|
|
277
|
+
if (!value)
|
|
278
|
+
return null;
|
|
279
|
+
const iso = /^\d{4}-\d{2}-\d{2}$/.test(value) ? `${value}T00:00:00` : value;
|
|
280
|
+
const date = new Date(iso);
|
|
281
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Compact date-range formatter for the bookings table — collapses
|
|
285
|
+
* shared month/year so a 3-day trip reads "Jun 15 – 20, 2026" in
|
|
286
|
+
* English and "15 – 20 iun., 2026" in Romanian. Output respects the
|
|
287
|
+
* locale's day/month order.
|
|
288
|
+
*
|
|
289
|
+
* NOTE: `Intl.DateTimeFormat` produces nonsense (e.g.
|
|
290
|
+
* `"2026 (day: 20)"`) for incomplete combinations like `{ day, year }`
|
|
291
|
+
* without a month. We build the compact range from named parts
|
|
292
|
+
* instead of asking Intl to skip the month.
|
|
293
|
+
*/
|
|
294
|
+
function formatBookingDateRange(startValue, endValue, formatDate, locale) {
|
|
295
|
+
const start = toDate(startValue);
|
|
296
|
+
const end = toDate(endValue);
|
|
297
|
+
if (!start && !end)
|
|
298
|
+
return "—";
|
|
299
|
+
if (start && !end)
|
|
300
|
+
return formatDate(start, { month: "short", day: "numeric", year: "numeric" });
|
|
301
|
+
if (!start || !end)
|
|
302
|
+
return formatDate(end, { month: "short", day: "numeric", year: "numeric" });
|
|
303
|
+
const s = start;
|
|
304
|
+
const e = end;
|
|
305
|
+
const sameDay = s.getFullYear() === e.getFullYear() &&
|
|
306
|
+
s.getMonth() === e.getMonth() &&
|
|
307
|
+
s.getDate() === e.getDate();
|
|
308
|
+
if (sameDay)
|
|
309
|
+
return formatDate(s, { month: "short", day: "numeric", year: "numeric" });
|
|
310
|
+
const sameYear = s.getFullYear() === e.getFullYear();
|
|
311
|
+
const sameMonth = sameYear && s.getMonth() === e.getMonth();
|
|
312
|
+
// For collapsed ranges we need to know whether the locale puts the
|
|
313
|
+
// month before or after the day (en-US: "Jun 15", ro-RO: "15 iun.")
|
|
314
|
+
// so the result reads naturally.
|
|
315
|
+
const dayFirst = isLocaleDayFirst(locale);
|
|
316
|
+
const monthShortStart = formatDate(s, { month: "short" });
|
|
317
|
+
const monthShortEnd = formatDate(e, { month: "short" });
|
|
318
|
+
const startDay = formatDate(s, { day: "numeric" });
|
|
319
|
+
const endDay = formatDate(e, { day: "numeric" });
|
|
320
|
+
if (sameMonth) {
|
|
321
|
+
const body = dayFirst
|
|
322
|
+
? `${startDay} – ${endDay} ${monthShortStart}`
|
|
323
|
+
: `${monthShortStart} ${startDay} – ${endDay}`;
|
|
324
|
+
return `${body}, ${e.getFullYear()}`;
|
|
325
|
+
}
|
|
326
|
+
if (sameYear) {
|
|
327
|
+
const body = dayFirst
|
|
328
|
+
? `${startDay} ${monthShortStart} – ${endDay} ${monthShortEnd}`
|
|
329
|
+
: `${monthShortStart} ${startDay} – ${monthShortEnd} ${endDay}`;
|
|
330
|
+
return `${body}, ${e.getFullYear()}`;
|
|
331
|
+
}
|
|
332
|
+
return `${formatDate(s, { month: "short", day: "numeric", year: "numeric" })} – ${formatDate(e, { month: "short", day: "numeric", year: "numeric" })}`;
|
|
333
|
+
}
|
|
334
|
+
/** Detect whether the locale renders the day before the month in a
|
|
335
|
+
* short date format (e.g. ro-RO: "15 iun." vs en-US: "Jun 15"). */
|
|
336
|
+
function isLocaleDayFirst(locale) {
|
|
337
|
+
const parts = new Intl.DateTimeFormat(locale, {
|
|
338
|
+
month: "short",
|
|
339
|
+
day: "numeric",
|
|
340
|
+
}).formatToParts(new Date(2026, 0, 15));
|
|
341
|
+
const dayIndex = parts.findIndex((p) => p.type === "day");
|
|
342
|
+
const monthIndex = parts.findIndex((p) => p.type === "month");
|
|
343
|
+
if (dayIndex === -1 || monthIndex === -1)
|
|
344
|
+
return false;
|
|
345
|
+
return dayIndex < monthIndex;
|
|
346
|
+
}
|
|
347
|
+
function formatLead(booking) {
|
|
348
|
+
const name = [booking.contactFirstName, booking.contactLastName].filter(Boolean).join(" ").trim();
|
|
349
|
+
if (name)
|
|
350
|
+
return name;
|
|
351
|
+
return booking.contactEmail ?? "—";
|
|
352
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type BookingNoteRecord } from "../index.js";
|
|
2
|
+
export interface BookingNoteDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
bookingId: string;
|
|
6
|
+
/** When set, the dialog opens in edit mode against this note. */
|
|
7
|
+
note?: BookingNoteRecord | null;
|
|
8
|
+
onSuccess?: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Add / edit a booking note. Mirrors the supplier-status / traveler
|
|
12
|
+
* dialog pattern so the activity tab is consistent with the rest of
|
|
13
|
+
* the booking-detail surface.
|
|
14
|
+
*/
|
|
15
|
+
export declare function BookingNoteDialog({ open, onOpenChange, bookingId, note, onSuccess, }: BookingNoteDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=booking-note-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-note-dialog.d.ts","sourceRoot":"","sources":["../../src/components/booking-note-dialog.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,iBAAiB,EAA0B,MAAM,aAAa,CAAA;AAE5E,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,iEAAiE;IACjE,IAAI,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,IAAI,EACJ,SAAS,GACV,EAAE,sBAAsB,2CA6DxB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button, Dialog, DialogBody, DialogContent, DialogFooter, DialogHeader, DialogTitle, Label, Textarea, } from "@voyant-travel/ui/components";
|
|
4
|
+
import { Loader2 } from "lucide-react";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { useBookingsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
7
|
+
import { useBookingNoteMutation } from "../index.js";
|
|
8
|
+
/**
|
|
9
|
+
* Add / edit a booking note. Mirrors the supplier-status / traveler
|
|
10
|
+
* dialog pattern so the activity tab is consistent with the rest of
|
|
11
|
+
* the booking-detail surface.
|
|
12
|
+
*/
|
|
13
|
+
export function BookingNoteDialog({ open, onOpenChange, bookingId, note, onSuccess, }) {
|
|
14
|
+
const [content, setContent] = React.useState("");
|
|
15
|
+
const messages = useBookingsUiMessagesOrDefault();
|
|
16
|
+
const dialog = messages.bookingNotes.dialog;
|
|
17
|
+
const mutation = useBookingNoteMutation(bookingId);
|
|
18
|
+
const isEditing = Boolean(note);
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (open)
|
|
21
|
+
setContent(note?.content ?? "");
|
|
22
|
+
}, [note, open]);
|
|
23
|
+
const submit = async () => {
|
|
24
|
+
const trimmed = content.trim();
|
|
25
|
+
if (!trimmed)
|
|
26
|
+
return;
|
|
27
|
+
if (note) {
|
|
28
|
+
await mutation.update.mutateAsync({ id: note.id, content: trimmed });
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
await mutation.create.mutateAsync({ content: trimmed });
|
|
32
|
+
}
|
|
33
|
+
onOpenChange(false);
|
|
34
|
+
onSuccess?.();
|
|
35
|
+
};
|
|
36
|
+
const pending = isEditing ? mutation.update.isPending : mutation.create.isPending;
|
|
37
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing ? dialog.editTitle : dialog.createTitle }) }), _jsxs("form", { onSubmit: (e) => {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
void submit();
|
|
40
|
+
}, className: "flex flex-1 flex-col overflow-hidden", children: [_jsxs(DialogBody, { className: "grid gap-2", children: [_jsx(Label, { htmlFor: "booking-note-content", children: dialog.contentLabel }), _jsx(Textarea, { id: "booking-note-content", placeholder: dialog.contentPlaceholder, value: content, onChange: (e) => setContent(e.target.value), className: "min-h-[120px]" })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => onOpenChange(false), children: dialog.cancel }), _jsxs(Button, { type: "submit", size: "sm", disabled: !content.trim() || pending, children: [pending ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, isEditing ? dialog.save : dialog.create] })] })] })] }) }));
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-notes.d.ts","sourceRoot":"","sources":["../../src/components/booking-notes.tsx"],"names":[],"mappings":"AAwBA,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,iBAAiB,2CAmG5D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, Button, } from "@voyant-travel/ui/components";
|
|
4
|
+
import { Pencil, Plus, StickyNote, Trash2 } from "lucide-react";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { formatMessage, useBookingsUiI18nOrDefault, useBookingsUiMessagesOrDefault, } from "../i18n/provider.js";
|
|
7
|
+
import { useBookingNoteMutation, useBookingNotes } from "../index.js";
|
|
8
|
+
import { BookingNoteDialog } from "./booking-note-dialog.js";
|
|
9
|
+
import { IconActionButton } from "./icon-action-button.js";
|
|
10
|
+
export function BookingNotes({ bookingId }) {
|
|
11
|
+
const [dialogOpen, setDialogOpen] = React.useState(false);
|
|
12
|
+
const [editing, setEditing] = React.useState(null);
|
|
13
|
+
const [deleteTarget, setDeleteTarget] = React.useState(null);
|
|
14
|
+
const { data } = useBookingNotes(bookingId);
|
|
15
|
+
const mutation = useBookingNoteMutation(bookingId);
|
|
16
|
+
const { formatDateTime } = useBookingsUiI18nOrDefault();
|
|
17
|
+
const messages = useBookingsUiMessagesOrDefault();
|
|
18
|
+
const card = messages.bookingNotes;
|
|
19
|
+
const notes = (data?.data ?? []);
|
|
20
|
+
const handleConfirmDelete = async () => {
|
|
21
|
+
if (!deleteTarget)
|
|
22
|
+
return;
|
|
23
|
+
await mutation.remove.mutateAsync(deleteTarget.id);
|
|
24
|
+
setDeleteTarget(null);
|
|
25
|
+
};
|
|
26
|
+
return (_jsxs("div", { "data-slot": "booking-notes", 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(StickyNote, { className: "h-4 w-4 text-muted-foreground" }), card.title] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
27
|
+
setEditing(null);
|
|
28
|
+
setDialogOpen(true);
|
|
29
|
+
}, children: [_jsx(Plus, { className: "mr-1 h-3.5 w-3.5" }), card.addAction] })] }), notes.length === 0 ? (_jsx("div", { className: "rounded-md border bg-background p-6 text-center", children: _jsx("p", { className: "text-sm text-muted-foreground", children: card.empty }) })) : (_jsx("div", { className: "grid gap-2 md:grid-cols-2", children: notes.map((note) => (_jsx(NoteCard, { note: note, authorTemplate: card.authorLabel, editLabel: card.actions.edit, deleteLabel: card.actions.delete, formatDateTime: formatDateTime, onEdit: () => {
|
|
30
|
+
setEditing(note);
|
|
31
|
+
setDialogOpen(true);
|
|
32
|
+
}, onDelete: () => setDeleteTarget(note) }, note.id))) })), _jsx(BookingNoteDialog, { open: dialogOpen, onOpenChange: (next) => {
|
|
33
|
+
setDialogOpen(next);
|
|
34
|
+
if (!next)
|
|
35
|
+
setEditing(null);
|
|
36
|
+
}, bookingId: bookingId, note: editing }), _jsx(AlertDialog, { open: Boolean(deleteTarget), onOpenChange: (next) => {
|
|
37
|
+
if (!next && !mutation.remove.isPending)
|
|
38
|
+
setDeleteTarget(null);
|
|
39
|
+
}, children: _jsxs(AlertDialogContent, { size: "sm", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: card.deleteConfirm.title }), _jsx(AlertDialogDescription, { children: card.deleteConfirm.description })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: mutation.remove.isPending, children: card.deleteConfirm.cancel }), _jsx(AlertDialogAction, { variant: "destructive", disabled: mutation.remove.isPending, onClick: () => void handleConfirmDelete(), children: card.deleteConfirm.confirm })] })] }) })] }));
|
|
40
|
+
}
|
|
41
|
+
function NoteCard({ note, authorTemplate, editLabel, deleteLabel, formatDateTime, onEdit, onDelete, }) {
|
|
42
|
+
return (_jsxs("div", { className: "group flex flex-col gap-2 rounded-md border bg-background p-3", children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsx("p", { className: "whitespace-pre-wrap text-sm", children: note.content }), _jsxs("div", { className: "flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100", children: [_jsx(IconActionButton, { label: editLabel, icon: _jsx(Pencil, { className: "h-3.5 w-3.5" }), onClick: onEdit }), _jsx(IconActionButton, { label: deleteLabel, icon: _jsx(Trash2, { className: "h-3.5 w-3.5" }), onClick: onDelete })] })] }), _jsxs("p", { className: "text-muted-foreground text-xs", children: [formatMessage(authorTemplate, {
|
|
43
|
+
actor: note.authorName || note.authorEmail || note.authorId,
|
|
44
|
+
}), " ", "\u00B7 ", formatDateTime(note.createdAt)] })] }));
|
|
45
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface BookingPaymentReconciliationBannerProps {
|
|
2
|
+
bookingId: string;
|
|
3
|
+
}
|
|
4
|
+
export declare function BookingPaymentReconciliationBanner({ bookingId, }: BookingPaymentReconciliationBannerProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=booking-payment-reconciliation-banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-payment-reconciliation-banner.d.ts","sourceRoot":"","sources":["../../src/components/booking-payment-reconciliation-banner.tsx"],"names":[],"mappings":"AAeA,MAAM,WAAW,uCAAuC;IACtD,SAAS,EAAE,MAAM,CAAA;CAClB;AAID,wBAAgB,kCAAkC,CAAC,EACjD,SAAS,GACV,EAAE,uCAAuC,2CA4FzC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useAdminBookingPayments, useBookingPaymentSchedules, useInvoices, } from "@voyant-travel/finance-react";
|
|
4
|
+
import { Badge, cn } from "@voyant-travel/ui/components";
|
|
5
|
+
import { AlertTriangle, CheckCircle2, Loader2 } from "lucide-react";
|
|
6
|
+
import { useBookingsUiI18nOrDefault, useBookingsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
7
|
+
export function BookingPaymentReconciliationBanner({ bookingId, }) {
|
|
8
|
+
const invoicesQuery = useInvoices({ bookingId, limit: 50 });
|
|
9
|
+
const paymentsQuery = useAdminBookingPayments(bookingId);
|
|
10
|
+
const schedulesQuery = useBookingPaymentSchedules(bookingId);
|
|
11
|
+
const { formatCurrency } = useBookingsUiI18nOrDefault();
|
|
12
|
+
const messages = useBookingsUiMessagesOrDefault().bookingPaymentReconciliationBanner;
|
|
13
|
+
const invoices = invoicesQuery.data?.data ?? [];
|
|
14
|
+
const payments = paymentsQuery.data?.data?.payments ?? [];
|
|
15
|
+
const schedules = schedulesQuery.data?.data ?? [];
|
|
16
|
+
const isLoading = invoicesQuery.isLoading || paymentsQuery.isLoading || schedulesQuery.isLoading;
|
|
17
|
+
const billedTotals = sumInvoiceTotals(invoices, "totalCents");
|
|
18
|
+
const invoicePaidTotals = sumInvoiceTotals(invoices, "paidCents");
|
|
19
|
+
const completedPaymentTotals = sumCompletedPayments(payments);
|
|
20
|
+
const paidScheduleTotals = sumPaidSchedules(schedules);
|
|
21
|
+
const driftTotals = calculateDriftTotals([
|
|
22
|
+
invoicePaidTotals,
|
|
23
|
+
completedPaymentTotals,
|
|
24
|
+
paidScheduleTotals,
|
|
25
|
+
]);
|
|
26
|
+
const hasRecords = invoices.length > 0 || payments.length > 0 || schedules.length > 0;
|
|
27
|
+
const hasDrift = Array.from(driftTotals.values()).some((cents) => cents > 0);
|
|
28
|
+
if (isLoading && !hasRecords) {
|
|
29
|
+
return (_jsx("section", { className: "rounded-md border bg-muted/30 p-4", "aria-live": "polite", children: _jsxs("div", { className: "flex items-center gap-2 text-muted-foreground text-sm", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }), messages.loading] }) }));
|
|
30
|
+
}
|
|
31
|
+
return (_jsxs("section", { className: cn("rounded-md border p-4", hasDrift
|
|
32
|
+
? "border-amber-300 bg-amber-50 text-amber-950 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-100"
|
|
33
|
+
: "bg-muted/30"), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-2", children: [hasDrift ? (_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-600", "aria-hidden": "true" })) : (_jsx(CheckCircle2, { className: "mt-0.5 h-4 w-4 shrink-0 text-emerald-600", "aria-hidden": "true" })), _jsxs("div", { children: [_jsx("h3", { className: "font-medium text-sm", children: messages.title }), _jsx("p", { className: "mt-1 max-w-3xl text-sm opacity-80", children: !hasRecords
|
|
34
|
+
? messages.empty
|
|
35
|
+
: hasDrift
|
|
36
|
+
? messages.driftDescription
|
|
37
|
+
: messages.reconciledDescription })] })] }), _jsx(Badge, { variant: hasDrift ? "destructive" : "outline", children: hasDrift ? messages.driftBadge : messages.reconciledBadge })] }), _jsxs("dl", { className: "mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-5", children: [_jsx(ReconciliationMetric, { label: messages.billed, value: formatMoneyTotals(billedTotals, formatCurrency, messages.emptyValue) }), _jsx(ReconciliationMetric, { label: messages.invoicePaid, value: formatMoneyTotals(invoicePaidTotals, formatCurrency, messages.emptyValue) }), _jsx(ReconciliationMetric, { label: messages.recordedPayments, value: formatMoneyTotals(completedPaymentTotals, formatCurrency, messages.emptyValue) }), _jsx(ReconciliationMetric, { label: messages.schedulePaid, value: formatMoneyTotals(paidScheduleTotals, formatCurrency, messages.emptyValue) }), _jsx(ReconciliationMetric, { label: messages.drift, value: formatMoneyTotals(driftTotals, formatCurrency, messages.emptyValue), emphasis: hasDrift })] })] }));
|
|
38
|
+
}
|
|
39
|
+
function ReconciliationMetric({ label, value, emphasis = false, }) {
|
|
40
|
+
return (_jsxs("div", { children: [_jsx("dt", { className: "text-muted-foreground text-xs", children: label }), _jsx("dd", { className: emphasis ? "mt-1 font-mono font-semibold text-sm" : "mt-1 font-mono text-sm", children: value })] }));
|
|
41
|
+
}
|
|
42
|
+
function sumInvoiceTotals(invoices, field) {
|
|
43
|
+
const totals = new Map();
|
|
44
|
+
for (const invoice of invoices) {
|
|
45
|
+
if (invoice.status === "void" || invoice.invoiceType === "credit_note")
|
|
46
|
+
continue;
|
|
47
|
+
addMoney(totals, invoice.currency, invoice[field]);
|
|
48
|
+
}
|
|
49
|
+
return totals;
|
|
50
|
+
}
|
|
51
|
+
function sumCompletedPayments(payments) {
|
|
52
|
+
const totals = new Map();
|
|
53
|
+
for (const payment of payments) {
|
|
54
|
+
if (payment.status !== "completed")
|
|
55
|
+
continue;
|
|
56
|
+
addMoney(totals, payment.currency, payment.amountCents);
|
|
57
|
+
}
|
|
58
|
+
return totals;
|
|
59
|
+
}
|
|
60
|
+
function sumPaidSchedules(schedules) {
|
|
61
|
+
const totals = new Map();
|
|
62
|
+
for (const schedule of schedules) {
|
|
63
|
+
if (schedule.status !== "paid")
|
|
64
|
+
continue;
|
|
65
|
+
addMoney(totals, schedule.currency, schedule.amountCents);
|
|
66
|
+
}
|
|
67
|
+
return totals;
|
|
68
|
+
}
|
|
69
|
+
function calculateDriftTotals(sources) {
|
|
70
|
+
const currencies = new Set(sources.flatMap((source) => Array.from(source.keys())));
|
|
71
|
+
const drift = new Map();
|
|
72
|
+
for (const currency of currencies) {
|
|
73
|
+
const amounts = sources.map((source) => source.get(currency) ?? 0);
|
|
74
|
+
drift.set(currency, Math.max(...amounts) - Math.min(...amounts));
|
|
75
|
+
}
|
|
76
|
+
return drift;
|
|
77
|
+
}
|
|
78
|
+
function addMoney(totals, currency, cents) {
|
|
79
|
+
if (cents === 0)
|
|
80
|
+
return;
|
|
81
|
+
totals.set(currency, (totals.get(currency) ?? 0) + cents);
|
|
82
|
+
}
|
|
83
|
+
function formatMoneyTotals(totals, formatCurrency, emptyValue) {
|
|
84
|
+
const entries = Array.from(totals.entries()).filter(([, cents]) => cents > 0);
|
|
85
|
+
if (entries.length === 0)
|
|
86
|
+
return emptyValue;
|
|
87
|
+
return entries
|
|
88
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
89
|
+
.map(([currency, cents]) => formatCurrency(cents / 100, currency))
|
|
90
|
+
.join(" / ");
|
|
91
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type BookingPaymentScheduleRecord } from "@voyant-travel/finance-react";
|
|
2
|
+
export interface BookingPaymentScheduleDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
bookingId: string;
|
|
6
|
+
schedule?: BookingPaymentScheduleRecord;
|
|
7
|
+
onSuccess?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function BookingPaymentScheduleDialog({ open, onOpenChange, bookingId, schedule, onSuccess, }: BookingPaymentScheduleDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=booking-payment-schedule-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-payment-schedule-dialog.d.ts","sourceRoot":"","sources":["../../src/components/booking-payment-schedule-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,4BAA4B,EAElC,MAAM,8BAA8B,CAAA;AAgDrC,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,4BAA4B,CAAA;IACvC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,GACV,EAAE,iCAAiC,2CAuOnC"}
|