@voyant-travel/inventory-react 0.1.0
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/dist/admin/index.d.ts +91 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +132 -0
- package/dist/admin/pages/product-detail-page.d.ts +18 -0
- package/dist/admin/pages/product-detail-page.d.ts.map +1 -0
- package/dist/admin/pages/product-detail-page.js +63 -0
- package/dist/admin/product-categories-host.d.ts +7 -0
- package/dist/admin/product-categories-host.d.ts.map +1 -0
- package/dist/admin/product-categories-host.js +11 -0
- package/dist/admin/product-detail-api.d.ts +22 -0
- package/dist/admin/product-detail-api.d.ts.map +1 -0
- package/dist/admin/product-detail-api.js +58 -0
- package/dist/admin/products-host.d.ts +11 -0
- package/dist/admin/products-host.d.ts.map +1 -0
- package/dist/admin/products-host.js +17 -0
- package/dist/admin/products-list-skeleton.d.ts +10 -0
- package/dist/admin/products-list-skeleton.d.ts.map +1 -0
- package/dist/admin/products-list-skeleton.js +23 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +79 -0
- package/dist/components/option-unit-dialog.d.ts +11 -0
- package/dist/components/option-unit-dialog.d.ts.map +1 -0
- package/dist/components/option-unit-dialog.js +17 -0
- package/dist/components/option-unit-form.d.ts +17 -0
- package/dist/components/option-unit-form.d.ts.map +1 -0
- package/dist/components/option-unit-form.js +123 -0
- package/dist/components/product-action-ledger-card.d.ts +17 -0
- package/dist/components/product-action-ledger-card.d.ts.map +1 -0
- package/dist/components/product-action-ledger-card.js +73 -0
- package/dist/components/product-catalog-card.d.ts +14 -0
- package/dist/components/product-catalog-card.d.ts.map +1 -0
- package/dist/components/product-catalog-card.js +44 -0
- package/dist/components/product-categories-page.d.ts +7 -0
- package/dist/components/product-categories-page.d.ts.map +1 -0
- package/dist/components/product-categories-page.js +9 -0
- package/dist/components/product-category-combobox.d.ts +10 -0
- package/dist/components/product-category-combobox.d.ts.map +1 -0
- package/dist/components/product-category-combobox.js +47 -0
- package/dist/components/product-category-dialog.d.ts +9 -0
- package/dist/components/product-category-dialog.d.ts.map +1 -0
- package/dist/components/product-category-dialog.js +17 -0
- package/dist/components/product-category-form.d.ts +15 -0
- package/dist/components/product-category-form.d.ts.map +1 -0
- package/dist/components/product-category-form.js +82 -0
- package/dist/components/product-category-list.d.ts +5 -0
- package/dist/components/product-category-list.d.ts.map +1 -0
- package/dist/components/product-category-list.js +48 -0
- package/dist/components/product-combobox.d.ts +13 -0
- package/dist/components/product-combobox.d.ts.map +1 -0
- package/dist/components/product-combobox.js +23 -0
- package/dist/components/product-contract-template-combobox.d.ts +9 -0
- package/dist/components/product-contract-template-combobox.d.ts.map +1 -0
- package/dist/components/product-contract-template-combobox.js +97 -0
- package/dist/components/product-day-dialog.d.ts +20 -0
- package/dist/components/product-day-dialog.d.ts.map +1 -0
- package/dist/components/product-day-dialog.js +20 -0
- package/dist/components/product-day-form.d.ts +19 -0
- package/dist/components/product-day-form.d.ts.map +1 -0
- package/dist/components/product-day-form.js +77 -0
- package/dist/components/product-day-media-tray.d.ts +11 -0
- package/dist/components/product-day-media-tray.d.ts.map +1 -0
- package/dist/components/product-day-media-tray.js +74 -0
- package/dist/components/product-day-service-dialog.d.ts +14 -0
- package/dist/components/product-day-service-dialog.d.ts.map +1 -0
- package/dist/components/product-day-service-dialog.js +19 -0
- package/dist/components/product-day-service-form.d.ts +44 -0
- package/dist/components/product-day-service-form.d.ts.map +1 -0
- package/dist/components/product-day-service-form.js +152 -0
- package/dist/components/product-detail/commerce-client.d.ts +314 -0
- package/dist/components/product-detail/commerce-client.d.ts.map +1 -0
- package/dist/components/product-detail/commerce-client.js +261 -0
- package/dist/components/product-detail/host.d.ts +54 -0
- package/dist/components/product-detail/host.d.ts.map +1 -0
- package/dist/components/product-detail/host.js +27 -0
- package/dist/components/product-detail/index.d.ts +6 -0
- package/dist/components/product-detail/index.d.ts.map +1 -0
- package/dist/components/product-detail/index.js +5 -0
- package/dist/components/product-detail/product-activity-section.d.ts +4 -0
- package/dist/components/product-detail/product-activity-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-activity-section.js +37 -0
- package/dist/components/product-detail/product-day-sheet.d.ts +14 -0
- package/dist/components/product-detail/product-day-sheet.d.ts.map +1 -0
- package/dist/components/product-detail/product-day-sheet.js +75 -0
- package/dist/components/product-detail/product-day-translation.d.ts +41 -0
- package/dist/components/product-detail/product-day-translation.d.ts.map +1 -0
- package/dist/components/product-detail/product-day-translation.js +111 -0
- package/dist/components/product-detail/product-departure-dialog.d.ts +11 -0
- package/dist/components/product-detail/product-departure-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-departure-dialog.js +10 -0
- package/dist/components/product-detail/product-departure-form.d.ts +25 -0
- package/dist/components/product-detail/product-departure-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-departure-form.js +241 -0
- package/dist/components/product-detail/product-departure-pricing-override-dialog.d.ts +8 -0
- package/dist/components/product-detail/product-departure-pricing-override-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-departure-pricing-override-dialog.js +126 -0
- package/dist/components/product-detail/product-detail-availability-sections.d.ts +19 -0
- package/dist/components/product-detail/product-detail-availability-sections.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-availability-sections.js +29 -0
- package/dist/components/product-detail/product-detail-channel-section.d.ts +8 -0
- package/dist/components/product-detail/product-detail-channel-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-channel-section.js +16 -0
- package/dist/components/product-detail/product-detail-day-row.d.ts +14 -0
- package/dist/components/product-detail/product-detail-day-row.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-day-row.js +43 -0
- package/dist/components/product-detail/product-detail-dialog.d.ts +10 -0
- package/dist/components/product-detail/product-detail-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-dialog.js +10 -0
- package/dist/components/product-detail/product-detail-form.d.ts +22 -0
- package/dist/components/product-detail/product-detail-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-form.js +205 -0
- package/dist/components/product-detail/product-detail-header.d.ts +12 -0
- package/dist/components/product-detail/product-detail-header.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-header.js +19 -0
- package/dist/components/product-detail/product-detail-itinerary-section.d.ts +4 -0
- package/dist/components/product-detail/product-detail-itinerary-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-itinerary-section.js +201 -0
- package/dist/components/product-detail/product-detail-media-sections.d.ts +15 -0
- package/dist/components/product-detail/product-detail-media-sections.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-media-sections.js +19 -0
- package/dist/components/product-detail/product-detail-organize-section.d.ts +6 -0
- package/dist/components/product-detail/product-detail-organize-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-organize-section.js +18 -0
- package/dist/components/product-detail/product-detail-page.d.ts +4 -0
- package/dist/components/product-detail/product-detail-page.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-page.js +95 -0
- package/dist/components/product-detail/product-detail-section-shell.d.ts +19 -0
- package/dist/components/product-detail/product-detail-section-shell.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-section-shell.js +23 -0
- package/dist/components/product-detail/product-detail-sections.d.ts +7 -0
- package/dist/components/product-detail/product-detail-sections.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-sections.js +6 -0
- package/dist/components/product-detail/product-detail-shared.d.ts +264 -0
- package/dist/components/product-detail/product-detail-shared.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-shared.js +157 -0
- package/dist/components/product-detail/product-detail-skeleton.d.ts +9 -0
- package/dist/components/product-detail/product-detail-skeleton.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-skeleton.js +53 -0
- package/dist/components/product-detail/product-detail-summary-section.d.ts +6 -0
- package/dist/components/product-detail/product-detail-summary-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-summary-section.js +66 -0
- package/dist/components/product-detail/product-extra-dialog.d.ts +21 -0
- package/dist/components/product-detail/product-extra-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-extra-dialog.js +131 -0
- package/dist/components/product-detail/product-itinerary-form.d.ts +16 -0
- package/dist/components/product-detail/product-itinerary-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-itinerary-form.js +38 -0
- package/dist/components/product-detail/product-market-rules-section.d.ts +6 -0
- package/dist/components/product-detail/product-market-rules-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-market-rules-section.js +81 -0
- package/dist/components/product-detail/product-media-gallery.d.ts +19 -0
- package/dist/components/product-detail/product-media-gallery.d.ts.map +1 -0
- package/dist/components/product-detail/product-media-gallery.js +114 -0
- package/dist/components/product-detail/product-option-price-rule-dialog.d.ts +12 -0
- package/dist/components/product-detail/product-option-price-rule-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-option-price-rule-dialog.js +10 -0
- package/dist/components/product-detail/product-option-price-rule-form.d.ts +29 -0
- package/dist/components/product-detail/product-option-price-rule-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-option-price-rule-form.js +122 -0
- package/dist/components/product-detail/product-option-pricing-grid.d.ts +16 -0
- package/dist/components/product-detail/product-option-pricing-grid.d.ts.map +1 -0
- package/dist/components/product-detail/product-option-pricing-grid.js +236 -0
- package/dist/components/product-detail/product-options-extra-price-rules.d.ts +8 -0
- package/dist/components/product-detail/product-options-extra-price-rules.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-extra-price-rules.js +123 -0
- package/dist/components/product-detail/product-options-pricing-helpers.d.ts +14 -0
- package/dist/components/product-detail/product-options-pricing-helpers.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-pricing-helpers.js +49 -0
- package/dist/components/product-detail/product-options-pricing-panel.d.ts +17 -0
- package/dist/components/product-detail/product-options-pricing-panel.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-pricing-panel.js +88 -0
- package/dist/components/product-detail/product-options-pricing.d.ts +5 -0
- package/dist/components/product-detail/product-options-pricing.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-pricing.js +4 -0
- package/dist/components/product-detail/product-options-shared.d.ts +236 -0
- package/dist/components/product-detail/product-options-shared.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-shared.js +57 -0
- package/dist/components/product-detail/product-options-traveler-category-dialog.d.ts +12 -0
- package/dist/components/product-detail/product-options-traveler-category-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-traveler-category-dialog.js +132 -0
- package/dist/components/product-detail/product-options-unit-price-matrix.d.ts +10 -0
- package/dist/components/product-detail/product-options-unit-price-matrix.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-unit-price-matrix.js +103 -0
- package/dist/components/product-detail/product-payment-policy-section.d.ts +17 -0
- package/dist/components/product-detail/product-payment-policy-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-payment-policy-section.js +58 -0
- package/dist/components/product-detail/product-schedule-dialog.d.ts +11 -0
- package/dist/components/product-detail/product-schedule-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-schedule-dialog.js +10 -0
- package/dist/components/product-detail/product-schedule-form.d.ts +17 -0
- package/dist/components/product-detail/product-schedule-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-schedule-form.js +223 -0
- package/dist/components/product-detail/product-service-dialog.d.ts +12 -0
- package/dist/components/product-detail/product-service-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-service-dialog.js +10 -0
- package/dist/components/product-detail/product-service-form.d.ts +22 -0
- package/dist/components/product-detail/product-service-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-service-form.js +154 -0
- package/dist/components/product-detail/product-translation-popover.d.ts +94 -0
- package/dist/components/product-detail/product-translation-popover.d.ts.map +1 -0
- package/dist/components/product-detail/product-translation-popover.js +238 -0
- package/dist/components/product-detail/product-unit-dialog.d.ts +14 -0
- package/dist/components/product-detail/product-unit-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-unit-dialog.js +10 -0
- package/dist/components/product-detail/product-unit-form.d.ts +34 -0
- package/dist/components/product-detail/product-unit-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-unit-form.js +139 -0
- package/dist/components/product-detail/product-unit-price-rule-dialog.d.ts +17 -0
- package/dist/components/product-detail/product-unit-price-rule-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-unit-price-rule-dialog.js +10 -0
- package/dist/components/product-detail/product-unit-price-rule-form.d.ts +29 -0
- package/dist/components/product-detail/product-unit-price-rule-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-unit-price-rule-form.js +144 -0
- package/dist/components/product-detail/rrule-labels.d.ts +2 -0
- package/dist/components/product-detail/rrule-labels.d.ts.map +1 -0
- package/dist/components/product-detail/rrule-labels.js +65 -0
- package/dist/components/product-detail/timezone-options.d.ts +9 -0
- package/dist/components/product-detail/timezone-options.d.ts.map +1 -0
- package/dist/components/product-detail/timezone-options.js +28 -0
- package/dist/components/product-detail/use-product-detail-data.d.ts +41 -0
- package/dist/components/product-detail/use-product-detail-data.d.ts.map +1 -0
- package/dist/components/product-detail/use-product-detail-data.js +143 -0
- package/dist/components/product-detail/use-product-detail-dialogs.d.ts +24 -0
- package/dist/components/product-detail/use-product-detail-dialogs.d.ts.map +1 -0
- package/dist/components/product-detail/use-product-detail-dialogs.js +40 -0
- package/dist/components/product-detail/zod-resolver.d.ts +4 -0
- package/dist/components/product-detail/zod-resolver.d.ts.map +1 -0
- package/dist/components/product-detail/zod-resolver.js +39 -0
- package/dist/components/product-detail-page.d.ts +57 -0
- package/dist/components/product-detail-page.d.ts.map +1 -0
- package/dist/components/product-detail-page.js +118 -0
- package/dist/components/product-detail.d.ts +2 -0
- package/dist/components/product-detail.d.ts.map +1 -0
- package/dist/components/product-detail.js +1 -0
- package/dist/components/product-dialog.d.ts +9 -0
- package/dist/components/product-dialog.d.ts.map +1 -0
- package/dist/components/product-dialog.js +13 -0
- package/dist/components/product-facility-combobox.d.ts +9 -0
- package/dist/components/product-facility-combobox.d.ts.map +1 -0
- package/dist/components/product-facility-combobox.js +94 -0
- package/dist/components/product-form.d.ts +14 -0
- package/dist/components/product-form.d.ts.map +1 -0
- package/dist/components/product-form.js +191 -0
- package/dist/components/product-itinerary-day-row.d.ts +22 -0
- package/dist/components/product-itinerary-day-row.d.ts.map +1 -0
- package/dist/components/product-itinerary-day-row.js +17 -0
- package/dist/components/product-itinerary-dialog.d.ts +16 -0
- package/dist/components/product-itinerary-dialog.d.ts.map +1 -0
- package/dist/components/product-itinerary-dialog.js +85 -0
- package/dist/components/product-itinerary-section.d.ts +16 -0
- package/dist/components/product-itinerary-section.d.ts.map +1 -0
- package/dist/components/product-itinerary-section.js +105 -0
- package/dist/components/product-list.d.ts +7 -0
- package/dist/components/product-list.d.ts.map +1 -0
- package/dist/components/product-list.js +155 -0
- package/dist/components/product-media-dialog.d.ts +11 -0
- package/dist/components/product-media-dialog.d.ts.map +1 -0
- package/dist/components/product-media-dialog.js +17 -0
- package/dist/components/product-media-form.d.ts +17 -0
- package/dist/components/product-media-form.d.ts.map +1 -0
- package/dist/components/product-media-form.js +101 -0
- package/dist/components/product-media-lightbox.d.ts +7 -0
- package/dist/components/product-media-lightbox.d.ts.map +1 -0
- package/dist/components/product-media-lightbox.js +31 -0
- package/dist/components/product-media-section.d.ts +27 -0
- package/dist/components/product-media-section.d.ts.map +1 -0
- package/dist/components/product-media-section.js +130 -0
- package/dist/components/product-media-tile.d.ts +17 -0
- package/dist/components/product-media-tile.d.ts.map +1 -0
- package/dist/components/product-media-tile.js +16 -0
- package/dist/components/product-option-dialog.d.ts +11 -0
- package/dist/components/product-option-dialog.d.ts.map +1 -0
- package/dist/components/product-option-dialog.js +17 -0
- package/dist/components/product-option-form.d.ts +17 -0
- package/dist/components/product-option-form.d.ts.map +1 -0
- package/dist/components/product-option-form.js +91 -0
- package/dist/components/product-options-section.d.ts +13 -0
- package/dist/components/product-options-section.d.ts.map +1 -0
- package/dist/components/product-options-section.js +200 -0
- package/dist/components/product-quick-view-sheet.d.ts +23 -0
- package/dist/components/product-quick-view-sheet.d.ts.map +1 -0
- package/dist/components/product-quick-view-sheet.js +65 -0
- package/dist/components/product-tag-dialog.d.ts +9 -0
- package/dist/components/product-tag-dialog.d.ts.map +1 -0
- package/dist/components/product-tag-dialog.js +17 -0
- package/dist/components/product-tag-form.d.ts +15 -0
- package/dist/components/product-tag-form.d.ts.map +1 -0
- package/dist/components/product-tag-form.js +48 -0
- package/dist/components/product-tag-list.d.ts +5 -0
- package/dist/components/product-tag-list.d.ts.map +1 -0
- package/dist/components/product-tag-list.js +44 -0
- package/dist/components/product-tags-page.d.ts +7 -0
- package/dist/components/product-tags-page.d.ts.map +1 -0
- package/dist/components/product-tags-page.js +9 -0
- package/dist/components/product-tax-class-combobox.d.ts +9 -0
- package/dist/components/product-tax-class-combobox.d.ts.map +1 -0
- package/dist/components/product-tax-class-combobox.js +100 -0
- package/dist/components/product-translations-card.d.ts +7 -0
- package/dist/components/product-translations-card.d.ts.map +1 -0
- package/dist/components/product-translations-card.js +188 -0
- package/dist/components/product-type-combobox.d.ts +9 -0
- package/dist/components/product-type-combobox.d.ts.map +1 -0
- package/dist/components/product-type-combobox.js +48 -0
- package/dist/components/product-types-page.d.ts +6 -0
- package/dist/components/product-types-page.d.ts.map +1 -0
- package/dist/components/product-types-page.js +103 -0
- package/dist/components/product-version-dialog.d.ts +8 -0
- package/dist/components/product-version-dialog.d.ts.map +1 -0
- package/dist/components/product-version-dialog.js +39 -0
- package/dist/components/product-versions-section.d.ts +7 -0
- package/dist/components/product-versions-section.d.ts.map +1 -0
- package/dist/components/product-versions-section.js +19 -0
- package/dist/components/products-page.d.ts +8 -0
- package/dist/components/products-page.d.ts.map +1 -0
- package/dist/components/products-page.js +8 -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/hooks/index.d.ts +4 -0
- package/dist/extras/hooks/index.d.ts.map +1 -0
- package/dist/extras/hooks/index.js +3 -0
- package/dist/extras/hooks/use-product-extra-mutation.d.ts +70 -0
- package/dist/extras/hooks/use-product-extra-mutation.d.ts.map +1 -0
- package/dist/extras/hooks/use-product-extra-mutation.js +38 -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/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 +3 -0
- package/dist/extras/ui.d.ts.map +1 -0
- package/dist/extras/ui.js +2 -0
- package/dist/extras-compat.d.ts +3 -0
- package/dist/extras-compat.d.ts.map +1 -0
- package/dist/extras-compat.js +1 -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-duplicate-product-option-mutation.d.ts +19 -0
- package/dist/hooks/use-duplicate-product-option-mutation.d.ts.map +1 -0
- package/dist/hooks/use-duplicate-product-option-mutation.js +65 -0
- package/dist/hooks/use-option-unit-mutation.d.ts +60 -0
- package/dist/hooks/use-option-unit-mutation.d.ts.map +1 -0
- package/dist/hooks/use-option-unit-mutation.js +41 -0
- package/dist/hooks/use-option-unit.d.ts +21 -0
- package/dist/hooks/use-option-unit.d.ts.map +1 -0
- package/dist/hooks/use-option-unit.js +12 -0
- package/dist/hooks/use-option-units.d.ts +27 -0
- package/dist/hooks/use-option-units.d.ts.map +1 -0
- package/dist/hooks/use-option-units.js +12 -0
- package/dist/hooks/use-product-action-ledger.d.ts +48 -0
- package/dist/hooks/use-product-action-ledger.d.ts.map +1 -0
- package/dist/hooks/use-product-action-ledger.js +12 -0
- package/dist/hooks/use-product-categories.d.ts +32 -0
- package/dist/hooks/use-product-categories.d.ts.map +1 -0
- package/dist/hooks/use-product-categories.js +29 -0
- package/dist/hooks/use-product-category-mutation.d.ts +65 -0
- package/dist/hooks/use-product-category-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-category-mutation.js +39 -0
- package/dist/hooks/use-product-category.d.ts +26 -0
- package/dist/hooks/use-product-category.d.ts.map +1 -0
- package/dist/hooks/use-product-category.js +18 -0
- package/dist/hooks/use-product-day-mutation.d.ts +43 -0
- package/dist/hooks/use-product-day-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-day-mutation.js +54 -0
- package/dist/hooks/use-product-day-service-mutation.d.ts +66 -0
- package/dist/hooks/use-product-day-service-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-day-service-mutation.js +41 -0
- package/dist/hooks/use-product-day-services.d.ts +21 -0
- package/dist/hooks/use-product-day-services.d.ts.map +1 -0
- package/dist/hooks/use-product-day-services.js +12 -0
- package/dist/hooks/use-product-day-translation-mutation.d.ts +49 -0
- package/dist/hooks/use-product-day-translation-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-day-translation-mutation.js +38 -0
- package/dist/hooks/use-product-day-translations.d.ts +19 -0
- package/dist/hooks/use-product-day-translations.d.ts.map +1 -0
- package/dist/hooks/use-product-day-translations.js +20 -0
- package/dist/hooks/use-product-days.d.ts +16 -0
- package/dist/hooks/use-product-days.d.ts.map +1 -0
- package/dist/hooks/use-product-days.js +12 -0
- package/dist/hooks/use-product-itineraries.d.ts +15 -0
- package/dist/hooks/use-product-itineraries.d.ts.map +1 -0
- package/dist/hooks/use-product-itineraries.js +12 -0
- package/dist/hooks/use-product-itinerary-days.d.ts +16 -0
- package/dist/hooks/use-product-itinerary-days.d.ts.map +1 -0
- package/dist/hooks/use-product-itinerary-days.js +12 -0
- package/dist/hooks/use-product-itinerary-mutation.d.ts +54 -0
- package/dist/hooks/use-product-itinerary-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-itinerary-mutation.js +63 -0
- package/dist/hooks/use-product-media-mutation.d.ts +101 -0
- package/dist/hooks/use-product-media-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-media-mutation.js +69 -0
- package/dist/hooks/use-product-media.d.ts +26 -0
- package/dist/hooks/use-product-media.d.ts.map +1 -0
- package/dist/hooks/use-product-media.js +12 -0
- package/dist/hooks/use-product-mutation.d.ts +121 -0
- package/dist/hooks/use-product-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-mutation.js +44 -0
- package/dist/hooks/use-product-option-mutation.d.ts +49 -0
- package/dist/hooks/use-product-option-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-option-mutation.js +39 -0
- package/dist/hooks/use-product-option.d.ts +18 -0
- package/dist/hooks/use-product-option.d.ts.map +1 -0
- package/dist/hooks/use-product-option.js +12 -0
- package/dist/hooks/use-product-options.d.ts +24 -0
- package/dist/hooks/use-product-options.d.ts.map +1 -0
- package/dist/hooks/use-product-options.js +12 -0
- package/dist/hooks/use-product-tag-mutation.d.ts +25 -0
- package/dist/hooks/use-product-tag-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-tag-mutation.js +39 -0
- package/dist/hooks/use-product-tag.d.ts +10 -0
- package/dist/hooks/use-product-tag.d.ts.map +1 -0
- package/dist/hooks/use-product-tag.js +18 -0
- package/dist/hooks/use-product-tags.d.ts +16 -0
- package/dist/hooks/use-product-tags.d.ts.map +1 -0
- package/dist/hooks/use-product-tags.js +25 -0
- package/dist/hooks/use-product-translation-mutation.d.ts +52 -0
- package/dist/hooks/use-product-translation-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-translation-mutation.js +47 -0
- package/dist/hooks/use-product-translations.d.ts +28 -0
- package/dist/hooks/use-product-translations.d.ts.map +1 -0
- package/dist/hooks/use-product-translations.js +24 -0
- package/dist/hooks/use-product-type-mutation.d.ts +50 -0
- package/dist/hooks/use-product-type-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-type-mutation.js +47 -0
- package/dist/hooks/use-product-type.d.ts +15 -0
- package/dist/hooks/use-product-type.d.ts.map +1 -0
- package/dist/hooks/use-product-type.js +12 -0
- package/dist/hooks/use-product-types.d.ts +21 -0
- package/dist/hooks/use-product-types.d.ts.map +1 -0
- package/dist/hooks/use-product-types.js +9 -0
- package/dist/hooks/use-product-version-mutation.d.ts +16 -0
- package/dist/hooks/use-product-version-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-version-mutation.js +22 -0
- package/dist/hooks/use-product-versions.d.ts +15 -0
- package/dist/hooks/use-product-versions.d.ts.map +1 -0
- package/dist/hooks/use-product-versions.js +12 -0
- package/dist/hooks/use-product.d.ts +45 -0
- package/dist/hooks/use-product.d.ts.map +1 -0
- package/dist/hooks/use-product.js +23 -0
- package/dist/hooks/use-products.d.ts +51 -0
- package/dist/hooks/use-products.d.ts.map +1 -0
- package/dist/hooks/use-products.js +38 -0
- package/dist/i18n/en-catalog.d.ts +199 -0
- package/dist/i18n/en-catalog.d.ts.map +1 -0
- package/dist/i18n/en-catalog.js +198 -0
- package/dist/i18n/en-core.d.ts +323 -0
- package/dist/i18n/en-core.d.ts.map +1 -0
- package/dist/i18n/en-core.js +322 -0
- package/dist/i18n/en-operations.d.ts +287 -0
- package/dist/i18n/en-operations.d.ts.map +1 -0
- package/dist/i18n/en-operations.js +286 -0
- package/dist/i18n/en.d.ts +803 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +8 -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/message-shared.d.ts +6 -0
- package/dist/i18n/message-shared.d.ts.map +1 -0
- package/dist/i18n/message-shared.js +1 -0
- package/dist/i18n/messages-catalog.d.ts +199 -0
- package/dist/i18n/messages-catalog.d.ts.map +1 -0
- package/dist/i18n/messages-catalog.js +1 -0
- package/dist/i18n/messages-core.d.ts +304 -0
- package/dist/i18n/messages-core.d.ts.map +1 -0
- package/dist/i18n/messages-core.js +1 -0
- package/dist/i18n/messages-operations.d.ts +287 -0
- package/dist/i18n/messages-operations.d.ts.map +1 -0
- package/dist/i18n/messages-operations.js +1 -0
- package/dist/i18n/messages.d.ts +6 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +1 -0
- package/dist/i18n/provider.d.ts +1628 -0
- package/dist/i18n/provider.d.ts.map +1 -0
- package/dist/i18n/provider.js +44 -0
- package/dist/i18n/ro-catalog.d.ts +199 -0
- package/dist/i18n/ro-catalog.d.ts.map +1 -0
- package/dist/i18n/ro-catalog.js +198 -0
- package/dist/i18n/ro-core.d.ts +323 -0
- package/dist/i18n/ro-core.d.ts.map +1 -0
- package/dist/i18n/ro-core.js +322 -0
- package/dist/i18n/ro-operations.d.ts +287 -0
- package/dist/i18n/ro-operations.d.ts.map +1 -0
- package/dist/i18n/ro-operations.js +286 -0
- package/dist/i18n/ro.d.ts +803 -0
- package/dist/i18n/ro.d.ts.map +1 -0
- package/dist/i18n/ro.js +8 -0
- package/dist/i18n-en.d.ts +2 -0
- package/dist/i18n-en.d.ts.map +1 -0
- package/dist/i18n-en.js +1 -0
- package/dist/i18n-ro.d.ts +2 -0
- package/dist/i18n-ro.d.ts.map +1 -0
- package/dist/i18n-ro.js +1 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/operations.d.ts +53 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +13 -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 +114 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +34 -0
- package/dist/query-options-action-ledger.d.ts +194 -0
- package/dist/query-options-action-ledger.d.ts.map +1 -0
- package/dist/query-options-action-ledger.js +20 -0
- package/dist/query-options.d.ts +1313 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +281 -0
- package/dist/schemas.d.ts +1098 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +320 -0
- package/dist/ui.d.ts +44 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +42 -0
- package/package.json +159 -0
- package/src/styles.css +12 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// agent-quality: file-size exception -- owner: inventory-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 { Badge } from "@voyant-travel/ui/components/badge";
|
|
5
|
+
import { Button } from "@voyant-travel/ui/components/button";
|
|
6
|
+
import { CurrencyCombobox } from "@voyant-travel/ui/components/currency-combobox";
|
|
7
|
+
import { Input } from "@voyant-travel/ui/components/input";
|
|
8
|
+
import { Label } from "@voyant-travel/ui/components/label";
|
|
9
|
+
import { RichTextEditor } from "@voyant-travel/ui/components/rich-text-editor";
|
|
10
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@voyant-travel/ui/components/select";
|
|
11
|
+
import { Textarea } from "@voyant-travel/ui/components/textarea";
|
|
12
|
+
import { Loader2, X } from "lucide-react";
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/index.js";
|
|
15
|
+
import { useProductMutation } from "../index.js";
|
|
16
|
+
import { ProductContractTemplateCombobox } from "./product-contract-template-combobox.js";
|
|
17
|
+
import { ProductFacilityCombobox } from "./product-facility-combobox.js";
|
|
18
|
+
import { ProductTaxClassCombobox } from "./product-tax-class-combobox.js";
|
|
19
|
+
import { ProductTypeCombobox } from "./product-type-combobox.js";
|
|
20
|
+
function initialState(mode) {
|
|
21
|
+
if (mode.kind === "edit") {
|
|
22
|
+
const product = mode.product;
|
|
23
|
+
return {
|
|
24
|
+
name: product.name,
|
|
25
|
+
description: product.description ?? "",
|
|
26
|
+
inclusionsHtml: product.inclusionsHtml ?? "",
|
|
27
|
+
exclusionsHtml: product.exclusionsHtml ?? "",
|
|
28
|
+
termsHtml: product.termsHtml ?? "",
|
|
29
|
+
status: product.status,
|
|
30
|
+
bookingMode: product.bookingMode,
|
|
31
|
+
capacityMode: product.capacityMode,
|
|
32
|
+
visibility: product.visibility,
|
|
33
|
+
timezone: product.timezone ?? "",
|
|
34
|
+
facilityId: product.facilityId ?? "__none__",
|
|
35
|
+
productTypeId: product.productTypeId ?? "__none__",
|
|
36
|
+
contractTemplateId: product.contractTemplateId ?? "__none__",
|
|
37
|
+
taxClassId: product.taxClassId ?? "__none__",
|
|
38
|
+
sellCurrency: product.sellCurrency,
|
|
39
|
+
sellAmount: product.sellAmountCents != null ? String(product.sellAmountCents / 100) : "",
|
|
40
|
+
costAmount: product.costAmountCents != null ? String(product.costAmountCents / 100) : "",
|
|
41
|
+
pax: product.pax != null ? String(product.pax) : "",
|
|
42
|
+
reservationTimeoutMinutes: product.reservationTimeoutMinutes != null ? String(product.reservationTimeoutMinutes) : "",
|
|
43
|
+
tags: product.tags ?? [],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
name: "",
|
|
48
|
+
description: "",
|
|
49
|
+
inclusionsHtml: "",
|
|
50
|
+
exclusionsHtml: "",
|
|
51
|
+
termsHtml: "",
|
|
52
|
+
status: "draft",
|
|
53
|
+
bookingMode: "itinerary",
|
|
54
|
+
capacityMode: "limited",
|
|
55
|
+
visibility: "private",
|
|
56
|
+
timezone: "",
|
|
57
|
+
facilityId: "__none__",
|
|
58
|
+
productTypeId: "__none__",
|
|
59
|
+
contractTemplateId: "__none__",
|
|
60
|
+
taxClassId: "__none__",
|
|
61
|
+
sellCurrency: "EUR", // i18n-literal-ok ISO default currency
|
|
62
|
+
sellAmount: "",
|
|
63
|
+
costAmount: "",
|
|
64
|
+
pax: "",
|
|
65
|
+
reservationTimeoutMinutes: "",
|
|
66
|
+
tags: [],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function toAmountCents(value) {
|
|
70
|
+
const trimmed = value.trim();
|
|
71
|
+
if (!trimmed)
|
|
72
|
+
return null;
|
|
73
|
+
const parsed = Number(trimmed);
|
|
74
|
+
if (!Number.isFinite(parsed) || parsed < 0)
|
|
75
|
+
return null;
|
|
76
|
+
return Math.round(parsed * 100);
|
|
77
|
+
}
|
|
78
|
+
function toIntegerOrNull(value) {
|
|
79
|
+
const trimmed = value.trim();
|
|
80
|
+
if (!trimmed)
|
|
81
|
+
return null;
|
|
82
|
+
const parsed = Number(trimmed);
|
|
83
|
+
if (!Number.isInteger(parsed) || parsed < 0)
|
|
84
|
+
return null;
|
|
85
|
+
return parsed;
|
|
86
|
+
}
|
|
87
|
+
function toPositiveIntegerOrNull(value) {
|
|
88
|
+
const parsed = toIntegerOrNull(value);
|
|
89
|
+
return parsed == null || parsed < 1 ? null : parsed;
|
|
90
|
+
}
|
|
91
|
+
function toPayload(state) {
|
|
92
|
+
return {
|
|
93
|
+
name: state.name.trim(),
|
|
94
|
+
description: state.description.trim() || null,
|
|
95
|
+
inclusionsHtml: state.inclusionsHtml.trim() || null,
|
|
96
|
+
exclusionsHtml: state.exclusionsHtml.trim() || null,
|
|
97
|
+
termsHtml: state.termsHtml.trim() || null,
|
|
98
|
+
status: state.status,
|
|
99
|
+
bookingMode: state.bookingMode,
|
|
100
|
+
capacityMode: state.capacityMode,
|
|
101
|
+
visibility: state.visibility,
|
|
102
|
+
timezone: state.timezone.trim() || null,
|
|
103
|
+
facilityId: state.facilityId === "__none__" ? null : state.facilityId,
|
|
104
|
+
productTypeId: state.productTypeId === "__none__" ? null : state.productTypeId,
|
|
105
|
+
contractTemplateId: state.contractTemplateId === "__none__" ? null : state.contractTemplateId,
|
|
106
|
+
taxClassId: state.taxClassId === "__none__" ? null : state.taxClassId,
|
|
107
|
+
sellCurrency: state.sellCurrency.trim().toUpperCase(),
|
|
108
|
+
sellAmountCents: toAmountCents(state.sellAmount),
|
|
109
|
+
costAmountCents: toAmountCents(state.costAmount),
|
|
110
|
+
pax: toPositiveIntegerOrNull(state.pax),
|
|
111
|
+
reservationTimeoutMinutes: toIntegerOrNull(state.reservationTimeoutMinutes),
|
|
112
|
+
tags: state.tags,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export function ProductForm({ mode, onSuccess, onCancel }) {
|
|
116
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
117
|
+
const productMessages = messages.productForm;
|
|
118
|
+
const [state, setState] = React.useState(() => initialState(mode));
|
|
119
|
+
const [tagInput, setTagInput] = React.useState("");
|
|
120
|
+
const [error, setError] = React.useState(null);
|
|
121
|
+
const { create, update } = useProductMutation();
|
|
122
|
+
const isSubmitting = create.isPending || update.isPending;
|
|
123
|
+
const productStatuses = React.useMemo(() => [
|
|
124
|
+
{ value: "draft", label: messages.common.productStatusLabels.draft },
|
|
125
|
+
{ value: "active", label: messages.common.productStatusLabels.active },
|
|
126
|
+
{ value: "archived", label: messages.common.productStatusLabels.archived },
|
|
127
|
+
], [messages]);
|
|
128
|
+
const bookingModes = React.useMemo(() => [
|
|
129
|
+
{ value: "date", label: messages.common.productBookingModeLabels.date },
|
|
130
|
+
{ value: "date_time", label: messages.common.productBookingModeLabels.date_time },
|
|
131
|
+
{ value: "open", label: messages.common.productBookingModeLabels.open },
|
|
132
|
+
{ value: "stay", label: messages.common.productBookingModeLabels.stay },
|
|
133
|
+
{ value: "transfer", label: messages.common.productBookingModeLabels.transfer },
|
|
134
|
+
{ value: "itinerary", label: messages.common.productBookingModeLabels.itinerary },
|
|
135
|
+
{ value: "other", label: messages.common.productBookingModeLabels.other },
|
|
136
|
+
], [messages]);
|
|
137
|
+
const capacityModes = React.useMemo(() => [
|
|
138
|
+
{ value: "free_sale", label: messages.common.productCapacityModeLabels.free_sale },
|
|
139
|
+
{ value: "limited", label: messages.common.productCapacityModeLabels.limited },
|
|
140
|
+
{ value: "on_request", label: messages.common.productCapacityModeLabels.on_request },
|
|
141
|
+
], [messages]);
|
|
142
|
+
const visibilityOptions = React.useMemo(() => [
|
|
143
|
+
{ value: "public", label: messages.common.productVisibilityLabels.public },
|
|
144
|
+
{ value: "private", label: messages.common.productVisibilityLabels.private },
|
|
145
|
+
{ value: "hidden", label: messages.common.productVisibilityLabels.hidden },
|
|
146
|
+
], [messages]);
|
|
147
|
+
const field = (key) => (value) => {
|
|
148
|
+
setState((prev) => ({ ...prev, [key]: value }));
|
|
149
|
+
};
|
|
150
|
+
const handleSubmit = async (event) => {
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
setError(null);
|
|
153
|
+
if (!state.name.trim()) {
|
|
154
|
+
setError(productMessages.validation.nameRequired);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (state.sellCurrency.trim().length !== 3) {
|
|
158
|
+
setError(productMessages.validation.sellCurrencyInvalid);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (state.pax.trim() && toPositiveIntegerOrNull(state.pax) == null) {
|
|
162
|
+
setError(productMessages.validation.paxInvalid);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (state.reservationTimeoutMinutes.trim() &&
|
|
166
|
+
toIntegerOrNull(state.reservationTimeoutMinutes) == null) {
|
|
167
|
+
setError(productMessages.validation.reservationTimeoutInvalid);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const payload = toPayload(state);
|
|
171
|
+
try {
|
|
172
|
+
const product = mode.kind === "create"
|
|
173
|
+
? await create.mutateAsync(payload)
|
|
174
|
+
: await update.mutateAsync({ id: mode.product.id, input: payload });
|
|
175
|
+
onSuccess?.(product);
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
setError(err instanceof Error ? err.message : productMessages.validation.saveFailed);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
return (_jsxs("form", { "data-slot": "product-form", onSubmit: handleSubmit, className: "flex min-h-0 flex-col gap-4 overflow-y-auto pr-1", children: [_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-name", children: productMessages.fields.name }), _jsx(Input, { id: "product-name", required: true, autoFocus: true, value: state.name, onChange: (event) => field("name")(event.target.value), placeholder: productMessages.placeholders.name })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-description", children: productMessages.fields.description }), _jsx(Textarea, { id: "product-description", value: state.description, onChange: (event) => field("description")(event.target.value), placeholder: productMessages.placeholders.description })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-inclusions", children: productMessages.fields.inclusions }), _jsx(RichTextEditor, { value: state.inclusionsHtml, onChange: field("inclusionsHtml"), placeholder: productMessages.placeholders.inclusions, editorClassName: "max-h-[320px] overflow-y-auto" })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-exclusions", children: productMessages.fields.exclusions }), _jsx(RichTextEditor, { value: state.exclusionsHtml, onChange: field("exclusionsHtml"), placeholder: productMessages.placeholders.exclusions, editorClassName: "max-h-[320px] overflow-y-auto" })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-terms", children: productMessages.fields.terms }), _jsx(RichTextEditor, { value: state.termsHtml, onChange: field("termsHtml"), placeholder: productMessages.placeholders.terms, editorClassName: "max-h-[320px] overflow-y-auto" })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: productMessages.fields.tags }), _jsx("div", { className: "flex flex-wrap gap-1.5", children: state.tags.map((tag) => (_jsxs(Badge, { variant: "secondary", className: "gap-1 text-xs", children: [tag, _jsx("button", { type: "button", className: "ml-0.5 rounded-full hover:text-destructive", onClick: () => field("tags")(state.tags.filter((value) => value !== tag)), children: _jsx(X, { className: "size-3", "aria-hidden": "true" }) })] }, tag))) }), _jsx(Input, { value: tagInput, onChange: (event) => setTagInput(event.target.value), onKeyDown: (event) => {
|
|
182
|
+
if (event.key === "Enter" || event.key === ",") {
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
const value = tagInput.trim().replace(/,+$/, "");
|
|
185
|
+
if (value && !state.tags.includes(value)) {
|
|
186
|
+
field("tags")([...state.tags, value]);
|
|
187
|
+
}
|
|
188
|
+
setTagInput("");
|
|
189
|
+
}
|
|
190
|
+
}, placeholder: productMessages.placeholders.tagInput })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: productMessages.fields.status }), _jsxs(Select, { value: state.status, onValueChange: (value) => value && field("status")(value), items: productStatuses, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: productStatuses.map((status) => (_jsx(SelectItem, { value: status.value, children: status.label }, status.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: productMessages.fields.bookingMode }), _jsxs(Select, { items: bookingModes, value: state.bookingMode, onValueChange: (value) => value && field("bookingMode")(value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: bookingModes.map((modeOption) => (_jsx(SelectItem, { value: modeOption.value, children: modeOption.label }, modeOption.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: productMessages.fields.productType }), _jsx(ProductTypeCombobox, { value: state.productTypeId === "__none__" ? null : state.productTypeId, onChange: (value) => field("productTypeId")(value ?? "__none__"), placeholder: productMessages.placeholders.productTypeSearch })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: productMessages.fields.facility }), _jsx(ProductFacilityCombobox, { value: state.facilityId === "__none__" ? null : state.facilityId, onChange: (value) => field("facilityId")(value ?? "__none__"), placeholder: productMessages.placeholders.facilitySearch })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: productMessages.fields.taxClass }), _jsx(ProductTaxClassCombobox, { value: state.taxClassId === "__none__" ? null : state.taxClassId, onChange: (value) => field("taxClassId")(value ?? "__none__"), placeholder: productMessages.placeholders.taxClassSearch })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: productMessages.fields.contractTemplate }), _jsx(ProductContractTemplateCombobox, { value: state.contractTemplateId === "__none__" ? null : state.contractTemplateId, onChange: (value) => field("contractTemplateId")(value ?? "__none__"), placeholder: productMessages.placeholders.contractTemplateSearch })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: productMessages.fields.visibility }), _jsxs(Select, { items: visibilityOptions, value: state.visibility, onValueChange: (value) => value && field("visibility")(value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: visibilityOptions.map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: productMessages.fields.capacityMode }), _jsxs(Select, { items: capacityModes, value: state.capacityMode, onValueChange: (value) => value && field("capacityMode")(value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: capacityModes.map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-timezone", children: productMessages.fields.timezone }), _jsx(Input, { id: "product-timezone", value: state.timezone, onChange: (event) => field("timezone")(event.target.value), placeholder: productMessages.placeholders.timezone })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-pax", children: productMessages.fields.pax }), _jsx(Input, { id: "product-pax", type: "number", min: "1", step: "1", value: state.pax, onChange: (event) => field("pax")(event.target.value), placeholder: productMessages.placeholders.pax })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-reservation-timeout", children: productMessages.fields.reservationTimeout }), _jsx(Input, { id: "product-reservation-timeout", type: "number", min: "0", step: "1", value: state.reservationTimeoutMinutes, onChange: (event) => field("reservationTimeoutMinutes")(event.target.value), placeholder: productMessages.placeholders.reservationTimeout })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: productMessages.fields.sellCurrency }), _jsx(CurrencyCombobox, { value: state.sellCurrency, onChange: (value) => field("sellCurrency")(value ?? ""), placeholder: productMessages.placeholders.currencySearch })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-sell-amount", children: productMessages.fields.sellAmount }), _jsx(Input, { id: "product-sell-amount", type: "number", min: "0", step: "0.01", value: state.sellAmount, onChange: (event) => field("sellAmount")(event.target.value), placeholder: productMessages.placeholders.amount })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-cost-amount", children: productMessages.fields.costAmount }), _jsx(Input, { id: "product-cost-amount", type: "number", min: "0", step: "0.01", value: state.costAmount, onChange: (event) => field("costAmount")(event.target.value), placeholder: productMessages.placeholders.amount })] })] })] }), error ? (_jsx("p", { "data-slot": "product-form-error", className: "text-sm text-destructive", children: error })) : null, _jsxs("div", { className: "flex items-center justify-end gap-2", children: [onCancel ? (_jsx(Button, { type: "button", variant: "ghost", onClick: onCancel, disabled: isSubmitting, children: productMessages.actions.cancel })) : null, _jsx(Button, { type: "submit", disabled: isSubmitting, children: isSubmitting ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 size-4 animate-spin", "aria-hidden": "true" }), productMessages.actions.saving] })) : mode.kind === "create" ? (productMessages.actions.create) : (productMessages.actions.saveChanges) })] })] }));
|
|
191
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ProductDayRecord, type ProductDayServiceRecord } from "../index.js";
|
|
3
|
+
export interface ProductItineraryDayRowRenderContext {
|
|
4
|
+
productId: string;
|
|
5
|
+
day: ProductDayRecord;
|
|
6
|
+
expanded: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ProductItineraryDayRowProps {
|
|
9
|
+
productId: string;
|
|
10
|
+
day: ProductDayRecord;
|
|
11
|
+
expanded: boolean;
|
|
12
|
+
onToggle: () => void;
|
|
13
|
+
onEdit?: () => void;
|
|
14
|
+
onDelete?: () => void;
|
|
15
|
+
onAddService?: () => void;
|
|
16
|
+
onEditService?: (service: ProductDayServiceRecord) => void;
|
|
17
|
+
onDeleteService?: (service: ProductDayServiceRecord) => void;
|
|
18
|
+
renderDayDetails?: (context: ProductItineraryDayRowRenderContext) => React.ReactNode;
|
|
19
|
+
renderServiceActions?: (service: ProductDayServiceRecord) => React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export declare function ProductItineraryDayRow({ productId, day, expanded, onToggle, onEdit, onDelete, onAddService, onEditService, onDeleteService, renderDayDetails, renderServiceActions, }: ProductItineraryDayRowProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=product-itinerary-day-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-itinerary-day-row.d.ts","sourceRoot":"","sources":["../../src/components/product-itinerary-day-row.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAEnC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAE7B,MAAM,aAAa,CAAA;AAEpB,MAAM,WAAW,mCAAmC;IAClD,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,gBAAgB,CAAA;IACrB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,gBAAgB,CAAA;IACrB,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAA;IAC1D,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAA;IAC5D,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,mCAAmC,KAAK,KAAK,CAAC,SAAS,CAAA;IACpF,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,KAAK,CAAC,SAAS,CAAA;CAC7E;AASD,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,oBAAoB,GACrB,EAAE,2BAA2B,2CA+H7B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Badge } from "@voyant-travel/ui/components/badge";
|
|
4
|
+
import { Button } from "@voyant-travel/ui/components/button";
|
|
5
|
+
import { ChevronDown, ChevronRight, Pencil, Plus, Trash2 } from "lucide-react";
|
|
6
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
7
|
+
import { useProductDayServices, } from "../index.js";
|
|
8
|
+
function formatServiceType(serviceType, messages) {
|
|
9
|
+
return messages.serviceTypes[serviceType];
|
|
10
|
+
}
|
|
11
|
+
export function ProductItineraryDayRow({ productId, day, expanded, onToggle, onEdit, onDelete, onAddService, onEditService, onDeleteService, renderDayDetails, renderServiceActions, }) {
|
|
12
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
13
|
+
const rowMessages = messages.productItineraryDayRow;
|
|
14
|
+
const servicesQuery = useProductDayServices(productId, day.id, { enabled: expanded });
|
|
15
|
+
const services = servicesQuery.data?.data ?? [];
|
|
16
|
+
return (_jsxs("div", { "data-slot": "product-itinerary-day-row", className: "rounded-md border bg-background", children: [_jsxs("div", { className: "flex items-center gap-3 px-4 py-3", children: [_jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", onClick: onToggle, children: expanded ? (_jsx(ChevronDown, { className: "size-4", "aria-hidden": "true" })) : (_jsx(ChevronRight, { className: "size-4", "aria-hidden": "true" })) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "truncate text-sm font-medium", children: [rowMessages.dayLabel.replace("{dayNumber}", String(day.dayNumber)), day.title ? `: ${day.title}` : ""] }), day.location ? (_jsx("div", { className: "truncate text-xs text-muted-foreground", children: day.location })) : null] }), _jsxs("div", { className: "flex items-center gap-1", children: [onAddService ? (_jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", onClick: onAddService, children: _jsx(Plus, { className: "size-4", "aria-hidden": "true" }) })) : null, onEdit ? (_jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", onClick: onEdit, children: _jsx(Pencil, { className: "size-4", "aria-hidden": "true" }) })) : null, onDelete ? (_jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", onClick: onDelete, children: _jsx(Trash2, { className: "size-4", "aria-hidden": "true" }) })) : null] })] }), expanded ? (_jsxs("div", { className: "border-t", children: [renderDayDetails ? (_jsx("div", { className: "border-b p-4", children: renderDayDetails({ productId, day, expanded }) })) : null, servicesQuery.isPending ? (_jsx("p", { className: "p-4 text-center text-sm text-muted-foreground", children: messages.common.loading })) : servicesQuery.isError ? (_jsx("p", { className: "p-4 text-center text-sm text-destructive", children: rowMessages.servicesLoadingError })) : services.length === 0 ? (_jsx("p", { className: "p-4 text-center text-sm text-muted-foreground", children: rowMessages.emptyServices })) : (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b bg-muted/30 text-muted-foreground", children: [_jsx("th", { className: "px-4 py-2 text-left font-medium", children: rowMessages.columns.name }), _jsx("th", { className: "px-3 py-2 text-left font-medium", children: rowMessages.columns.type }), _jsx("th", { className: "px-3 py-2 text-left font-medium", children: rowMessages.columns.cost }), _jsx("th", { className: "px-3 py-2 text-left font-medium", children: rowMessages.columns.quantity }), _jsx("th", { className: "w-24 px-3 py-2" })] }) }), _jsx("tbody", { children: services.map((service) => (_jsxs("tr", { className: "border-b last:border-b-0", children: [_jsx("td", { className: "px-4 py-2", children: service.name }), _jsx("td", { className: "px-3 py-2", children: _jsx(Badge, { variant: "outline", children: formatServiceType(service.serviceType, messages.productDayServiceForm) }) }), _jsxs("td", { className: "px-3 py-2 font-mono text-xs", children: [(service.costAmountCents / 100).toFixed(2), " ", service.costCurrency] }), _jsx("td", { className: "px-3 py-2", children: service.quantity }), _jsx("td", { className: "px-3 py-2", children: renderServiceActions ? (renderServiceActions(service)) : (_jsxs("div", { className: "flex items-center justify-end gap-1", children: [onEditService ? (_jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", onClick: () => onEditService(service), children: _jsx(Pencil, { className: "size-4", "aria-hidden": "true" }) })) : null, onDeleteService ? (_jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", onClick: () => onDeleteService(service), children: _jsx(Trash2, { className: "size-4", "aria-hidden": "true" }) })) : null] })) })] }, service.id))) })] }) }))] })) : null] }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type ItineraryData = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
isDefault: boolean;
|
|
5
|
+
};
|
|
6
|
+
export interface ProductItineraryDialogProps {
|
|
7
|
+
open: boolean;
|
|
8
|
+
onOpenChange: (open: boolean) => void;
|
|
9
|
+
productId: string;
|
|
10
|
+
itinerary?: ItineraryData;
|
|
11
|
+
itineraryCount: number;
|
|
12
|
+
onSuccess?: (itineraryId: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function ProductItineraryDialog({ open, onOpenChange, productId, itinerary, itineraryCount, onSuccess, }: ProductItineraryDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=product-itinerary-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-itinerary-dialog.d.ts","sourceRoot":"","sources":["../../src/components/product-itinerary-dialog.tsx"],"names":[],"mappings":"AAkBA,KAAK,aAAa,GAAG;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;CAC1C;AAED,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,SAAS,EACT,cAAc,EACd,SAAS,GACV,EAAE,2BAA2B,2CAuI7B"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@voyant-travel/ui/components/button";
|
|
4
|
+
import { Checkbox } from "@voyant-travel/ui/components/checkbox";
|
|
5
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@voyant-travel/ui/components/dialog";
|
|
6
|
+
import { Input } from "@voyant-travel/ui/components/input";
|
|
7
|
+
import { Label } from "@voyant-travel/ui/components/label";
|
|
8
|
+
import { Loader2 } from "lucide-react";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
11
|
+
import { useProductItineraryMutation } from "../index.js";
|
|
12
|
+
export function ProductItineraryDialog({ open, onOpenChange, productId, itinerary, itineraryCount, onSuccess, }) {
|
|
13
|
+
const isEditing = !!itinerary;
|
|
14
|
+
const isFirstItinerary = !isEditing && itineraryCount === 0;
|
|
15
|
+
const defaultLocked = isEditing && itinerary?.isDefault === true;
|
|
16
|
+
const [name, setName] = React.useState("");
|
|
17
|
+
const [isDefault, setIsDefault] = React.useState(false);
|
|
18
|
+
const [error, setError] = React.useState(null);
|
|
19
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
20
|
+
const { create, update } = useProductItineraryMutation();
|
|
21
|
+
const pending = create.isPending || update.isPending;
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
if (!open)
|
|
24
|
+
return;
|
|
25
|
+
setError(null);
|
|
26
|
+
if (itinerary) {
|
|
27
|
+
setName(itinerary.name);
|
|
28
|
+
setIsDefault(itinerary.isDefault);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
setName("");
|
|
32
|
+
setIsDefault(isFirstItinerary);
|
|
33
|
+
}
|
|
34
|
+
}, [open, itinerary, isFirstItinerary]);
|
|
35
|
+
const handleSubmit = async (event) => {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
setError(null);
|
|
38
|
+
const trimmed = name.trim();
|
|
39
|
+
if (!trimmed) {
|
|
40
|
+
setError(messages.productItineraryDialog.validation.nameRequired);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
if (itinerary) {
|
|
45
|
+
const patch = {};
|
|
46
|
+
if (trimmed !== itinerary.name)
|
|
47
|
+
patch.name = trimmed;
|
|
48
|
+
if (isDefault && !itinerary.isDefault)
|
|
49
|
+
patch.isDefault = true;
|
|
50
|
+
if (Object.keys(patch).length > 0) {
|
|
51
|
+
await update.mutateAsync({
|
|
52
|
+
productId,
|
|
53
|
+
itineraryId: itinerary.id,
|
|
54
|
+
input: patch,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
onSuccess?.(itinerary.id);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const created = await create.mutateAsync({
|
|
61
|
+
productId,
|
|
62
|
+
input: {
|
|
63
|
+
name: trimmed,
|
|
64
|
+
sortOrder: itineraryCount,
|
|
65
|
+
isDefault: itineraryCount === 0 ? true : isDefault,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
onSuccess?.(created.id);
|
|
69
|
+
}
|
|
70
|
+
onOpenChange(false);
|
|
71
|
+
}
|
|
72
|
+
catch (submissionError) {
|
|
73
|
+
setError(submissionError instanceof Error
|
|
74
|
+
? submissionError.message
|
|
75
|
+
: messages.productItineraryDialog.validation.saveFailed);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-slot": "product-itinerary-dialog", className: "sm:max-w-md", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: isEditing
|
|
79
|
+
? messages.productItineraryDialog.titles.edit
|
|
80
|
+
: messages.productItineraryDialog.titles.create }), _jsx(DialogDescription, { children: isEditing
|
|
81
|
+
? messages.productItineraryDialog.descriptions.edit
|
|
82
|
+
: messages.productItineraryDialog.descriptions.create })] }), _jsxs("form", { className: "flex flex-col gap-4", onSubmit: handleSubmit, children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-itinerary-name", children: messages.productItineraryDialog.fields.name }), _jsx(Input, { id: "product-itinerary-name", autoFocus: true, value: name, onChange: (event) => setName(event.target.value), placeholder: messages.productItineraryDialog.placeholders.name })] }), _jsxs("div", { className: "flex items-start gap-2", children: [_jsx(Checkbox, { id: "product-itinerary-default", checked: isDefault, disabled: defaultLocked || isFirstItinerary, onCheckedChange: (checked) => setIsDefault(checked === true) }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Label, { htmlFor: "product-itinerary-default", className: "text-sm font-normal", children: messages.productItineraryDialog.fields.defaultItinerary }), defaultLocked ? (_jsx("p", { className: "text-xs text-muted-foreground", children: messages.productItineraryDialog.fields.notesDefaultLocked })) : isFirstItinerary ? (_jsx("p", { className: "text-xs text-muted-foreground", children: messages.productItineraryDialog.fields.notesFirstDefault })) : null] })] }), error ? _jsx("p", { className: "text-sm text-destructive", children: error }) : null, _jsxs("div", { className: "flex items-center justify-end gap-2", children: [_jsx(Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: messages.common.cancel }), _jsxs(Button, { type: "submit", disabled: pending, children: [pending ? _jsx(Loader2, { className: "mr-2 size-4 animate-spin", "aria-hidden": "true" }) : null, isEditing
|
|
83
|
+
? messages.common.saveChanges
|
|
84
|
+
: messages.productItineraryDialog.actions.createItinerary] })] })] })] }) }));
|
|
85
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type ProductDayServiceRecord } from "../index.js";
|
|
3
|
+
import type { ProductDayServiceFormProps } from "./product-day-service-form.js";
|
|
4
|
+
import { type ProductItineraryDayRowRenderContext } from "./product-itinerary-day-row.js";
|
|
5
|
+
export interface ProductItinerarySectionProps {
|
|
6
|
+
productId: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
renderDayDetails?: (context: ProductItineraryDayRowRenderContext) => React.ReactNode;
|
|
10
|
+
renderServiceActions?: (service: ProductDayServiceRecord) => React.ReactNode;
|
|
11
|
+
renderSupplierServiceField?: ProductDayServiceFormProps["renderSupplierServiceField"];
|
|
12
|
+
onSupplierServiceSelected?: ProductDayServiceFormProps["onSupplierServiceSelected"];
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function ProductItinerarySection({ productId, title, description, renderDayDetails, renderServiceActions, renderSupplierServiceField, onSupplierServiceSelected, className, }: ProductItinerarySectionProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=product-itinerary-section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-itinerary-section.d.ts","sourceRoot":"","sources":["../../src/components/product-itinerary-section.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAEL,KAAK,uBAAuB,EAO7B,MAAM,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAC/E,OAAO,EAEL,KAAK,mCAAmC,EACzC,MAAM,gCAAgC,CAAA;AAGvC,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,mCAAmC,KAAK,KAAK,CAAC,SAAS,CAAA;IACpF,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,KAAK,CAAC,SAAS,CAAA;IAC5E,0BAA0B,CAAC,EAAE,0BAA0B,CAAC,4BAA4B,CAAC,CAAA;IACrF,yBAAyB,CAAC,EAAE,0BAA0B,CAAC,2BAA2B,CAAC,CAAA;IACnF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,SAAS,GACV,EAAE,4BAA4B,2CAuQ9B"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@voyant-travel/ui/components/button";
|
|
4
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@voyant-travel/ui/components/card";
|
|
5
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@voyant-travel/ui/components/select";
|
|
6
|
+
import { Edit, Loader2, Plus, Trash2 } from "lucide-react";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
9
|
+
import { useProductDayMutation, useProductDayServiceMutation, useProductItineraries, useProductItineraryDays, useProductItineraryMutation, } from "../index.js";
|
|
10
|
+
import { ProductDayDialog } from "./product-day-dialog.js";
|
|
11
|
+
import { ProductDayServiceDialog } from "./product-day-service-dialog.js";
|
|
12
|
+
import { ProductItineraryDayRow, } from "./product-itinerary-day-row.js";
|
|
13
|
+
import { ProductItineraryDialog } from "./product-itinerary-dialog.js";
|
|
14
|
+
export function ProductItinerarySection({ productId, title, description, renderDayDetails, renderServiceActions, renderSupplierServiceField, onSupplierServiceSelected, className, }) {
|
|
15
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
16
|
+
const pageMessages = messages.productDetailPage;
|
|
17
|
+
const itinerariesQuery = useProductItineraries(productId);
|
|
18
|
+
const itineraries = React.useMemo(() => (itinerariesQuery.data?.data ?? []).slice().sort((a, b) => a.sortOrder - b.sortOrder), [itinerariesQuery.data?.data]);
|
|
19
|
+
const [selectedItineraryId, setSelectedItineraryId] = React.useState(null);
|
|
20
|
+
const selectedItinerary = itineraries.find((itinerary) => itinerary.id === selectedItineraryId) ?? null;
|
|
21
|
+
const daysQuery = useProductItineraryDays(productId, selectedItineraryId, {
|
|
22
|
+
enabled: Boolean(selectedItineraryId),
|
|
23
|
+
});
|
|
24
|
+
const days = React.useMemo(() => (daysQuery.data?.data ?? []).slice().sort((a, b) => a.dayNumber - b.dayNumber), [daysQuery.data?.data]);
|
|
25
|
+
const itineraryMutation = useProductItineraryMutation();
|
|
26
|
+
const dayMutation = useProductDayMutation();
|
|
27
|
+
const serviceMutation = useProductDayServiceMutation();
|
|
28
|
+
const [itineraryDialogOpen, setItineraryDialogOpen] = React.useState(false);
|
|
29
|
+
const [editingItinerary, setEditingItinerary] = React.useState(null);
|
|
30
|
+
const [dayDialogOpen, setDayDialogOpen] = React.useState(false);
|
|
31
|
+
const [editingDay, setEditingDay] = React.useState(null);
|
|
32
|
+
const [serviceDialogOpen, setServiceDialogOpen] = React.useState(false);
|
|
33
|
+
const [serviceDayId, setServiceDayId] = React.useState(null);
|
|
34
|
+
const [editingService, setEditingService] = React.useState(null);
|
|
35
|
+
const [expandedDayId, setExpandedDayId] = React.useState(null);
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
if (itineraries.length === 0) {
|
|
38
|
+
setSelectedItineraryId(null);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setSelectedItineraryId((current) => {
|
|
42
|
+
if (current && itineraries.some((itinerary) => itinerary.id === current))
|
|
43
|
+
return current;
|
|
44
|
+
return itineraries.find((itinerary) => itinerary.isDefault)?.id ?? itineraries[0]?.id ?? null;
|
|
45
|
+
});
|
|
46
|
+
}, [itineraries]);
|
|
47
|
+
const nextDayNumber = days.length > 0 ? Math.max(...days.map((day) => day.dayNumber)) + 1 : 1;
|
|
48
|
+
return (_jsxs(Card, { "data-slot": "product-itinerary-section", className: className, children: [_jsxs(CardHeader, { className: "flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(CardTitle, { children: title ?? pageMessages.sections.itinerary.title }), _jsx(CardDescription, { children: description ?? pageMessages.sections.itinerary.description })] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [itineraries.length > 0 ? (_jsxs(Select, { value: selectedItineraryId ?? undefined, onValueChange: (value) => setSelectedItineraryId(value), children: [_jsx(SelectTrigger, { className: "w-[220px]", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: itineraries.map((itinerary) => (_jsx(SelectItem, { value: itinerary.id, children: itinerary.name }, itinerary.id))) })] })) : null, _jsxs(Button, { type: "button", variant: "outline", onClick: () => {
|
|
49
|
+
setEditingItinerary(null);
|
|
50
|
+
setItineraryDialogOpen(true);
|
|
51
|
+
}, children: [_jsx(Plus, { className: "mr-2 size-4", "aria-hidden": "true" }), pageMessages.actions.addItinerary] }), selectedItinerary ? (_jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "outline", onClick: () => {
|
|
52
|
+
setEditingItinerary(selectedItinerary);
|
|
53
|
+
setItineraryDialogOpen(true);
|
|
54
|
+
}, children: [_jsx(Edit, { className: "mr-2 size-4", "aria-hidden": "true" }), pageMessages.actions.editItinerary] }), _jsxs(Button, { type: "button", variant: "outline", onClick: () => {
|
|
55
|
+
if (!confirm(pageMessages.states.deleteItineraryConfirm.replace("{name}", selectedItinerary.name))) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
void itineraryMutation.remove.mutateAsync({
|
|
59
|
+
productId,
|
|
60
|
+
itineraryId: selectedItinerary.id,
|
|
61
|
+
});
|
|
62
|
+
}, children: [_jsx(Trash2, { className: "mr-2 size-4", "aria-hidden": "true" }), pageMessages.actions.deleteItinerary] })] })) : null] })] }), _jsx(CardContent, { className: "flex flex-col gap-3", children: itinerariesQuery.isPending ? (_jsx("div", { className: "flex min-h-24 items-center justify-center", children: _jsx(Loader2, { className: "size-4 animate-spin text-muted-foreground", "aria-hidden": "true" }) })) : itinerariesQuery.isError ? (_jsx("p", { className: "text-sm text-destructive", children: pageMessages.states.loadFailed })) : itineraries.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: pageMessages.states.noItineraries })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex justify-end", children: _jsxs(Button, { type: "button", onClick: () => {
|
|
63
|
+
setEditingDay(null);
|
|
64
|
+
setDayDialogOpen(true);
|
|
65
|
+
}, disabled: !selectedItineraryId, children: [_jsx(Plus, { className: "mr-2 size-4", "aria-hidden": "true" }), pageMessages.actions.addDay] }) }), daysQuery.isPending ? (_jsx("div", { className: "flex min-h-24 items-center justify-center", children: _jsx(Loader2, { className: "size-4 animate-spin text-muted-foreground", "aria-hidden": "true" }) })) : daysQuery.isError ? (_jsx("p", { className: "text-sm text-destructive", children: pageMessages.states.loadFailed })) : days.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: pageMessages.states.noDays })) : (days.map((day) => (_jsx(ProductItineraryDayRow, { productId: productId, day: day, expanded: expandedDayId === day.id, onToggle: () => setExpandedDayId((current) => (current === day.id ? null : day.id)), onEdit: () => {
|
|
66
|
+
setEditingDay(day);
|
|
67
|
+
setDayDialogOpen(true);
|
|
68
|
+
}, onDelete: () => {
|
|
69
|
+
if (!confirm(pageMessages.states.deleteDayConfirm.replace("{dayNumber}", String(day.dayNumber)))) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
void dayMutation.remove.mutateAsync({
|
|
73
|
+
productId,
|
|
74
|
+
dayId: day.id,
|
|
75
|
+
itineraryId: day.itineraryId,
|
|
76
|
+
});
|
|
77
|
+
}, onAddService: () => {
|
|
78
|
+
setServiceDayId(day.id);
|
|
79
|
+
setEditingService(null);
|
|
80
|
+
setExpandedDayId(day.id);
|
|
81
|
+
setServiceDialogOpen(true);
|
|
82
|
+
}, onEditService: (service) => {
|
|
83
|
+
setServiceDayId(day.id);
|
|
84
|
+
setEditingService(service);
|
|
85
|
+
setExpandedDayId(day.id);
|
|
86
|
+
setServiceDialogOpen(true);
|
|
87
|
+
}, onDeleteService: (service) => {
|
|
88
|
+
if (!confirm(pageMessages.states.deleteServiceConfirm.replace("{name}", service.name))) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
void serviceMutation.remove.mutateAsync({
|
|
92
|
+
productId,
|
|
93
|
+
dayId: day.id,
|
|
94
|
+
serviceId: service.id,
|
|
95
|
+
});
|
|
96
|
+
}, renderDayDetails: renderDayDetails, renderServiceActions: renderServiceActions }, day.id))))] })) }), _jsx(ProductItineraryDialog, { open: itineraryDialogOpen, onOpenChange: setItineraryDialogOpen, productId: productId, itinerary: editingItinerary ?? undefined, itineraryCount: itineraries.length, onSuccess: (itineraryId) => setSelectedItineraryId(itineraryId) }), selectedItineraryId ? (_jsx(ProductDayDialog, { open: dayDialogOpen, onOpenChange: setDayDialogOpen, productId: productId, itineraryId: selectedItineraryId, day: editingDay ?? undefined, nextDayNumber: nextDayNumber, onSuccess: (day) => {
|
|
97
|
+
setExpandedDayId(day.id);
|
|
98
|
+
setEditingDay(null);
|
|
99
|
+
} })) : null, serviceDayId ? (_jsx(ProductDayServiceDialog, { open: serviceDialogOpen, onOpenChange: (open) => {
|
|
100
|
+
setServiceDialogOpen(open);
|
|
101
|
+
if (!open) {
|
|
102
|
+
setEditingService(null);
|
|
103
|
+
}
|
|
104
|
+
}, productId: productId, dayId: serviceDayId, service: editingService ?? undefined, renderSupplierServiceField: renderSupplierServiceField, onSupplierServiceSelected: onSupplierServiceSelected, onSuccess: () => setEditingService(null) })) : null] }));
|
|
105
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ProductRecord } from "../index.js";
|
|
2
|
+
export interface ProductListProps {
|
|
3
|
+
pageSize?: number;
|
|
4
|
+
onSelectProduct?: (product: ProductRecord) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function ProductList({ pageSize, onSelectProduct }?: ProductListProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=product-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-list.d.ts","sourceRoot":"","sources":["../../src/components/product-list.tsx"],"names":[],"mappings":"AA6BA,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,aAAa,CAAA;AAGpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;CACnD;AA8BD,wBAAgB,WAAW,CAAC,EAAE,QAAa,EAAE,eAAe,EAAE,GAAE,gBAAqB,2CA2YpF"}
|