@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,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@voyant-travel/ui/components/dialog";
|
|
4
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
5
|
+
import { ProductCategoryForm } from "./product-category-form.js";
|
|
6
|
+
export function ProductCategoryDialog({ open, onOpenChange, category, onSuccess, }) {
|
|
7
|
+
const isEdit = Boolean(category);
|
|
8
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
9
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-slot": "product-category-dialog", className: "sm:max-w-[640px]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: isEdit
|
|
10
|
+
? messages.productCategoryDialog.titles.edit
|
|
11
|
+
: messages.productCategoryDialog.titles.create }), _jsx(DialogDescription, { children: isEdit
|
|
12
|
+
? messages.productCategoryDialog.descriptions.edit
|
|
13
|
+
: messages.productCategoryDialog.descriptions.create })] }), _jsx(ProductCategoryForm, { mode: category ? { kind: "edit", category } : { kind: "create" }, onSuccess: (saved) => {
|
|
14
|
+
onSuccess?.(saved);
|
|
15
|
+
onOpenChange(false);
|
|
16
|
+
}, onCancel: () => onOpenChange(false) })] }) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ProductCategoryRecord } from "../index.js";
|
|
2
|
+
type Mode = {
|
|
3
|
+
kind: "create";
|
|
4
|
+
} | {
|
|
5
|
+
kind: "edit";
|
|
6
|
+
category: ProductCategoryRecord;
|
|
7
|
+
};
|
|
8
|
+
export interface ProductCategoryFormProps {
|
|
9
|
+
mode: Mode;
|
|
10
|
+
onSuccess?: (category: ProductCategoryRecord) => void;
|
|
11
|
+
onCancel?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function ProductCategoryForm({ mode, onSuccess, onCancel }: ProductCategoryFormProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=product-category-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-category-form.d.ts","sourceRoot":"","sources":["../../src/components/product-category-form.tsx"],"names":[],"mappings":"AAYA,OAAO,EAGL,KAAK,qBAAqB,EAE3B,MAAM,aAAa,CAAA;AAGpB,KAAK,IAAI,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,qBAAqB,CAAA;CAAE,CAAA;AAElF,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,IAAI,CAAA;IACV,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,CAAA;IACrD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAmDD,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,wBAAwB,2CAsJ1F"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { PaymentPolicyForm, PaymentPolicyPreview } from "@voyant-travel/finance-react/ui";
|
|
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 { Switch } from "@voyant-travel/ui/components/switch";
|
|
8
|
+
import { Textarea } from "@voyant-travel/ui/components/textarea";
|
|
9
|
+
import { Loader2 } from "lucide-react";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
12
|
+
import { useProductCategoryMutation, } from "../index.js";
|
|
13
|
+
import { ProductCategoryCombobox } from "./product-category-combobox.js";
|
|
14
|
+
function initialState(mode) {
|
|
15
|
+
if (mode.kind === "edit") {
|
|
16
|
+
const category = mode.category;
|
|
17
|
+
return {
|
|
18
|
+
name: category.name,
|
|
19
|
+
slug: category.slug,
|
|
20
|
+
parentId: category.parentId ?? "__none__",
|
|
21
|
+
description: category.description ?? "",
|
|
22
|
+
sortOrder: String(category.sortOrder),
|
|
23
|
+
active: category.active,
|
|
24
|
+
customerPaymentPolicy: category.customerPaymentPolicy ?? null,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
name: "",
|
|
29
|
+
slug: "",
|
|
30
|
+
parentId: "__none__",
|
|
31
|
+
description: "",
|
|
32
|
+
sortOrder: "0",
|
|
33
|
+
active: true,
|
|
34
|
+
customerPaymentPolicy: null,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function toPayload(state) {
|
|
38
|
+
return {
|
|
39
|
+
name: state.name.trim(),
|
|
40
|
+
slug: state.slug.trim(),
|
|
41
|
+
parentId: state.parentId === "__none__" ? null : state.parentId,
|
|
42
|
+
description: state.description.trim() || null,
|
|
43
|
+
sortOrder: Number(state.sortOrder) || 0,
|
|
44
|
+
active: state.active,
|
|
45
|
+
customerPaymentPolicy: state.customerPaymentPolicy ?? null,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function ProductCategoryForm({ mode, onSuccess, onCancel }) {
|
|
49
|
+
const [state, setState] = React.useState(() => initialState(mode));
|
|
50
|
+
const [error, setError] = React.useState(null);
|
|
51
|
+
const { create, update } = useProductCategoryMutation();
|
|
52
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
setState(initialState(mode));
|
|
55
|
+
setError(null);
|
|
56
|
+
}, [mode]);
|
|
57
|
+
const isSubmitting = create.isPending || update.isPending;
|
|
58
|
+
const handleSubmit = async (event) => {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
setError(null);
|
|
61
|
+
if (!state.name.trim()) {
|
|
62
|
+
setError(messages.productCategoryForm.validation.nameRequired);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (!state.slug.trim()) {
|
|
66
|
+
setError(messages.productCategoryForm.validation.slugRequired);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const category = mode.kind === "create"
|
|
71
|
+
? await create.mutateAsync(toPayload(state))
|
|
72
|
+
: await update.mutateAsync({ id: mode.category.id, input: toPayload(state) });
|
|
73
|
+
onSuccess?.(category);
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
setError(err instanceof Error ? err.message : messages.productCategoryForm.validation.saveFailed);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return (_jsxs("form", { "data-slot": "product-category-form", onSubmit: handleSubmit, className: "flex flex-col gap-4", children: [_jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-category-name", children: messages.productCategoryForm.fields.name }), _jsx(Input, { id: "product-category-name", required: true, autoFocus: true, value: state.name, onChange: (event) => setState((prev) => ({ ...prev, name: event.target.value })), placeholder: messages.productCategoryForm.placeholders.name })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-category-slug", children: messages.productCategoryForm.fields.slug }), _jsx(Input, { id: "product-category-slug", required: true, value: state.slug, onChange: (event) => setState((prev) => ({ ...prev, slug: event.target.value })), placeholder: messages.productCategoryForm.placeholders.slug })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: messages.productCategoryForm.fields.parentCategory }), _jsx(ProductCategoryCombobox, { value: state.parentId === "__none__" ? null : state.parentId, onChange: (value) => setState((prev) => ({ ...prev, parentId: value ?? "__none__" })), excludeId: mode.kind === "edit" ? mode.category.id : null, placeholder: messages.productCategoryForm.placeholders.parentCategory })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-category-description", children: messages.productCategoryForm.fields.description }), _jsx(Textarea, { id: "product-category-description", value: state.description, onChange: (event) => setState((prev) => ({ ...prev, description: event.target.value })), placeholder: messages.productCategoryForm.placeholders.description })] }), _jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-category-sort-order", children: messages.productCategoryForm.fields.sortOrder }), _jsx(Input, { id: "product-category-sort-order", type: "number", value: state.sortOrder, onChange: (event) => setState((prev) => ({ ...prev, sortOrder: event.target.value })) })] }), _jsxs("div", { className: "flex items-center gap-2 pt-7", children: [_jsx(Switch, { checked: state.active, onCheckedChange: (active) => setState((prev) => ({ ...prev, active })) }), _jsx(Label, { children: messages.productCategoryForm.fields.active })] })] }), _jsxs("div", { className: "flex flex-col gap-3 rounded-md border bg-muted/10 p-4", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-sm font-medium", children: messages.productCategoryForm.fields.customerPaymentPolicy }), _jsx("p", { className: "text-muted-foreground text-xs", children: messages.productCategoryForm.descriptions.customerPaymentPolicy })] }), _jsxs("div", { className: "grid gap-4 lg:grid-cols-[2fr_1fr]", children: [_jsx(PaymentPolicyForm, { value: state.customerPaymentPolicy, onChange: (next) => setState((prev) => ({ ...prev, customerPaymentPolicy: next })), inheritable: true, disabled: isSubmitting }), _jsx(PaymentPolicyPreview, { policy: state.customerPaymentPolicy })] })] }), error ? _jsx("p", { 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, children: messages.common.cancel })) : null, _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting ? (_jsx(Loader2, { className: "mr-2 size-4 animate-spin", "aria-hidden": "true" })) : null, mode.kind === "edit"
|
|
80
|
+
? messages.common.saveChanges
|
|
81
|
+
: messages.productCategoryForm.actions.createCategory] })] })] }));
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-category-list.d.ts","sourceRoot":"","sources":["../../src/components/product-category-list.tsx"],"names":[],"mappings":"AA8BA,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,mBAAmB,CAAC,EAAE,QAAc,EAAE,GAAE,wBAA6B,2CAsKpF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@voyant-travel/ui/components/dropdown-menu";
|
|
6
|
+
import { Input } from "@voyant-travel/ui/components/input";
|
|
7
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@voyant-travel/ui/components/table";
|
|
8
|
+
import { CheckCircle2, Loader2, MoreHorizontal, Pencil, Plus, Search, Trash2 } from "lucide-react";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
11
|
+
import { useProductCategories, useProductCategoryMutation, } from "../index.js";
|
|
12
|
+
import { ProductCategoryDialog } from "./product-category-dialog.js";
|
|
13
|
+
export function ProductCategoryList({ pageSize = 200 } = {}) {
|
|
14
|
+
const [search, setSearch] = React.useState("");
|
|
15
|
+
const [offset, setOffset] = React.useState(0);
|
|
16
|
+
const [dialogOpen, setDialogOpen] = React.useState(false);
|
|
17
|
+
const [editing, setEditing] = React.useState(undefined);
|
|
18
|
+
const { data, isPending, isError } = useProductCategories({
|
|
19
|
+
search: search || undefined,
|
|
20
|
+
limit: pageSize,
|
|
21
|
+
offset,
|
|
22
|
+
});
|
|
23
|
+
const { remove } = useProductCategoryMutation();
|
|
24
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
25
|
+
const categories = data?.data ?? [];
|
|
26
|
+
const total = data?.total ?? 0;
|
|
27
|
+
const page = Math.floor(offset / pageSize) + 1;
|
|
28
|
+
const pageCount = Math.max(1, Math.ceil(total / pageSize));
|
|
29
|
+
const categoryById = new Map(categories.map((category) => [category.id, category]));
|
|
30
|
+
return (_jsxs("div", { "data-slot": "product-category-list", className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "relative w-full max-w-sm", children: [_jsx(Search, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { placeholder: messages.productCategoryList.searchPlaceholder, value: search, onChange: (event) => {
|
|
31
|
+
setSearch(event.target.value);
|
|
32
|
+
setOffset(0);
|
|
33
|
+
}, className: "pl-9" })] }), _jsxs(Button, { onClick: () => {
|
|
34
|
+
setEditing(undefined);
|
|
35
|
+
setDialogOpen(true);
|
|
36
|
+
}, children: [_jsx(Plus, { className: "mr-2 size-4", "aria-hidden": "true" }), messages.productCategoryList.addCategory] })] }), _jsx("div", { className: "rounded-md border", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: messages.productCategoryList.columns.name }), _jsx(TableHead, { children: messages.productCategoryList.columns.slug }), _jsx(TableHead, { children: messages.productCategoryList.columns.parent }), _jsx(TableHead, { children: messages.productCategoryList.columns.status }), _jsx(TableHead, { className: "w-[80px] text-right", children: messages.productCategoryList.columns.actions })] }) }), _jsx(TableBody, { children: isPending ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 5, className: "h-24 text-center", children: _jsx(Loader2, { className: "mx-auto size-4 animate-spin text-muted-foreground" }) }) })) : isError ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 5, className: "h-24 text-center text-sm text-destructive", children: messages.productCategoryList.loadingError }) })) : categories.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 5, className: "h-24 text-center text-sm text-muted-foreground", children: messages.productCategoryList.empty }) })) : (categories.map((category) => (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: category.name }), _jsx(TableCell, { children: category.slug }), _jsx(TableCell, { children: category.parentId
|
|
37
|
+
? (categoryById.get(category.parentId)?.name ?? messages.common.none)
|
|
38
|
+
: messages.common.none }), _jsx(TableCell, { children: category.active ? (_jsxs(Badge, { variant: "default", className: "gap-1", children: [_jsx(CheckCircle2, { className: "size-3.5" }), messages.common.active] })) : (_jsx(Badge, { variant: "secondary", children: messages.common.inactive })) }), _jsx(TableCell, { className: "text-right", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { className: "inline-flex size-8 items-center justify-center rounded-md text-muted-foreground outline-hidden hover:bg-accent hover:text-accent-foreground", children: _jsx(MoreHorizontal, { className: "size-4" }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onClick: () => {
|
|
39
|
+
setEditing(category);
|
|
40
|
+
setDialogOpen(true);
|
|
41
|
+
}, children: [_jsx(Pencil, { className: "size-4" }), messages.productCategoryList.edit] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { variant: "destructive", onClick: () => {
|
|
42
|
+
if (confirm(messages.productCategoryList.deleteConfirm)) {
|
|
43
|
+
remove.mutate(category.id);
|
|
44
|
+
}
|
|
45
|
+
}, children: [_jsx(Trash2, { className: "size-4" }), messages.productCategoryList.delete] })] })] }) })] }, category.id)))) })] }) }), _jsxs("div", { className: "flex items-center justify-between text-sm text-muted-foreground", children: [_jsx("span", { children: messages.productCategoryList.showingSummary
|
|
46
|
+
.replace("{count}", String(categories.length))
|
|
47
|
+
.replace("{total}", String(total)) }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { variant: "outline", size: "sm", disabled: offset === 0, onClick: () => setOffset((prev) => Math.max(0, prev - pageSize)), children: messages.common.previous }), _jsxs("span", { children: [messages.common.page, " ", page, " / ", pageCount] }), _jsx(Button, { variant: "outline", size: "sm", disabled: offset + pageSize >= total, onClick: () => setOffset((prev) => prev + pageSize), children: messages.common.next })] })] }), _jsx(ProductCategoryDialog, { open: dialogOpen, onOpenChange: setDialogOpen, category: editing })] }));
|
|
48
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ProductComboboxProps {
|
|
2
|
+
value: string | null | undefined;
|
|
3
|
+
onChange: (value: string | null) => void;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
emptyText?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
triggerClassName?: string;
|
|
9
|
+
clearable?: boolean;
|
|
10
|
+
limit?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function ProductCombobox({ value, onChange, placeholder, emptyText, disabled, className, triggerClassName, clearable, limit, }: ProductComboboxProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=product-combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-combobox.d.ts","sourceRoot":"","sources":["../../src/components/product-combobox.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACxC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAYD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,SAAgB,EAChB,KAAqB,GACtB,EAAE,oBAAoB,2CA6BtB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { AsyncCombobox } from "@voyant-travel/ui/components/async-combobox";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
6
|
+
import { useProduct, useProducts } from "../index.js";
|
|
7
|
+
const DEFAULT_LIMIT = 20;
|
|
8
|
+
function compact(parts) {
|
|
9
|
+
return parts.map((part) => part?.trim()).filter(Boolean);
|
|
10
|
+
}
|
|
11
|
+
function formatProductSecondary(product) {
|
|
12
|
+
return compact([product.status, product.bookingMode, product.sellCurrency]).join(" - ");
|
|
13
|
+
}
|
|
14
|
+
export function ProductCombobox({ value, onChange, placeholder, emptyText, disabled, className, triggerClassName, clearable = true, limit = DEFAULT_LIMIT, }) {
|
|
15
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
16
|
+
const comboboxMessages = messages.comboboxes.product;
|
|
17
|
+
const [search, setSearch] = React.useState("");
|
|
18
|
+
const listQuery = useProducts({ search: search || undefined, limit });
|
|
19
|
+
const selectedQuery = useProduct(value ?? undefined, { enabled: Boolean(value) });
|
|
20
|
+
return (_jsx(AsyncCombobox, { value: value ?? null, onChange: onChange, items: listQuery.data?.data ?? [], selectedItem: selectedQuery.data ?? null, getKey: (product) => product.id, getLabel: (product) => product.name, getSecondary: formatProductSecondary, onSearchChange: setSearch, placeholder: placeholder ?? comboboxMessages.placeholder, emptyText: listQuery.isPending || selectedQuery.isPending
|
|
21
|
+
? messages.common.loading
|
|
22
|
+
: (emptyText ?? comboboxMessages.empty), disabled: disabled, className: className, triggerClassName: triggerClassName, clearable: clearable }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
value: string | null | undefined;
|
|
3
|
+
onChange: (value: string | null) => void;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function ProductContractTemplateCombobox({ value, onChange, placeholder, disabled }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=product-contract-template-combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-contract-template-combobox.d.ts","sourceRoot":"","sources":["../../src/components/product-contract-template-combobox.tsx"],"names":[],"mappings":"AAiBA,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACxC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAiED,wBAAgB,+BAA+B,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,KAAK,2CA4EhG"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
import { Combobox, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, } from "@voyant-travel/ui/components/combobox";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
8
|
+
import { fetchWithValidation, useVoyantProductsContext } from "../index.js";
|
|
9
|
+
const PAGE_SIZE = 100;
|
|
10
|
+
const contractTemplateRecordSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
id: z.string(),
|
|
13
|
+
name: z.string(),
|
|
14
|
+
slug: z.string(),
|
|
15
|
+
scope: z.string(),
|
|
16
|
+
language: z.string(),
|
|
17
|
+
active: z.boolean(),
|
|
18
|
+
isDefault: z.boolean().optional(),
|
|
19
|
+
})
|
|
20
|
+
.passthrough();
|
|
21
|
+
const contractTemplateListResponse = z.object({
|
|
22
|
+
data: z.array(contractTemplateRecordSchema),
|
|
23
|
+
total: z.number().int(),
|
|
24
|
+
limit: z.number().int(),
|
|
25
|
+
offset: z.number().int(),
|
|
26
|
+
});
|
|
27
|
+
const contractTemplateSingleResponse = z.object({ data: contractTemplateRecordSchema });
|
|
28
|
+
function useContractTemplateOptions(search) {
|
|
29
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
30
|
+
return useQuery({
|
|
31
|
+
queryKey: ["voyant", "products-ui", "contract-template-combobox", "list", search],
|
|
32
|
+
queryFn: () => {
|
|
33
|
+
const params = new URLSearchParams();
|
|
34
|
+
params.set("limit", String(PAGE_SIZE));
|
|
35
|
+
params.set("scope", "customer");
|
|
36
|
+
params.set("active", "true");
|
|
37
|
+
if (search.trim())
|
|
38
|
+
params.set("search", search.trim());
|
|
39
|
+
return fetchWithValidation(`/v1/admin/legal/contracts/templates?${params}`, contractTemplateListResponse, { baseUrl, fetcher });
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function useSelectedContractTemplate(id) {
|
|
44
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
45
|
+
return useQuery({
|
|
46
|
+
queryKey: ["voyant", "products-ui", "contract-template-combobox", "detail", id],
|
|
47
|
+
queryFn: async () => {
|
|
48
|
+
if (!id)
|
|
49
|
+
throw new Error("useSelectedContractTemplate requires an id");
|
|
50
|
+
const { data } = await fetchWithValidation(`/v1/admin/legal/contracts/templates/${id}`, contractTemplateSingleResponse, { baseUrl, fetcher });
|
|
51
|
+
return data;
|
|
52
|
+
},
|
|
53
|
+
enabled: Boolean(id),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export function ProductContractTemplateCombobox({ value, onChange, placeholder, disabled }) {
|
|
57
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
58
|
+
const [search, setSearch] = React.useState("");
|
|
59
|
+
const listQuery = useContractTemplateOptions(search);
|
|
60
|
+
const selectedQuery = useSelectedContractTemplate(value);
|
|
61
|
+
const items = React.useMemo(() => {
|
|
62
|
+
const map = new Map();
|
|
63
|
+
for (const item of listQuery.data?.data ?? [])
|
|
64
|
+
map.set(item.id, item);
|
|
65
|
+
if (selectedQuery.data)
|
|
66
|
+
map.set(selectedQuery.data.id, selectedQuery.data);
|
|
67
|
+
return Array.from(map.values());
|
|
68
|
+
}, [listQuery.data?.data, selectedQuery.data]);
|
|
69
|
+
const itemMap = React.useMemo(() => new Map(items.map((item) => [item.id, item])), [items]);
|
|
70
|
+
const selected = value ? itemMap.get(value) : selectedQuery.data;
|
|
71
|
+
const selectedLabel = selected ? `${selected.name} · ${selected.language}` : "";
|
|
72
|
+
const [inputValue, setInputValue] = React.useState(selectedLabel);
|
|
73
|
+
React.useEffect(() => {
|
|
74
|
+
setInputValue(selectedLabel);
|
|
75
|
+
}, [selectedLabel]);
|
|
76
|
+
return (_jsxs(Combobox, { items: items.map((item) => item.id), value: value ?? null, inputValue: inputValue, autoHighlight: true, disabled: disabled, itemToStringValue: (id) => {
|
|
77
|
+
const item = itemMap.get(id);
|
|
78
|
+
return item ? `${item.name} · ${item.language}` : "";
|
|
79
|
+
}, onInputValueChange: (next) => {
|
|
80
|
+
setInputValue(next);
|
|
81
|
+
setSearch(next);
|
|
82
|
+
if (!next)
|
|
83
|
+
onChange(null);
|
|
84
|
+
}, onValueChange: (next) => {
|
|
85
|
+
const id = next ?? null;
|
|
86
|
+
onChange(id);
|
|
87
|
+
const item = id ? itemMap.get(id) : null;
|
|
88
|
+
setInputValue(item ? `${item.name} · ${item.language}` : "");
|
|
89
|
+
}, children: [_jsx(ComboboxInput, { placeholder: placeholder ?? messages.comboboxes.contractTemplate.placeholder, showClear: !!value }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { children: listQuery.isPending || selectedQuery.isPending
|
|
90
|
+
? messages.common.loading
|
|
91
|
+
: messages.comboboxes.contractTemplate.empty }), _jsx(ComboboxList, { children: _jsx(ComboboxCollection, { children: (id) => {
|
|
92
|
+
const item = itemMap.get(id);
|
|
93
|
+
if (!item)
|
|
94
|
+
return null;
|
|
95
|
+
return (_jsx(ComboboxItem, { value: item.id, children: _jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate font-medium", children: item.name }), _jsxs("span", { className: "truncate text-xs text-muted-foreground", children: [item.slug, " \u00B7 ", item.language] })] }) }, item.id));
|
|
96
|
+
} }) })] })] }));
|
|
97
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ProductDayRecord } from "../index.js";
|
|
2
|
+
import type { ProductMediaUploadHandler } from "./product-media-section.js";
|
|
3
|
+
export interface ProductDayDialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
productId: string;
|
|
7
|
+
/** Optional. When set, new days are created against this itinerary. */
|
|
8
|
+
itineraryId?: string;
|
|
9
|
+
day?: ProductDayRecord;
|
|
10
|
+
nextDayNumber?: number;
|
|
11
|
+
onSuccess?: (day: ProductDayRecord) => void;
|
|
12
|
+
/**
|
|
13
|
+
* When provided, the dialog renders a media tray below the form (edit
|
|
14
|
+
* mode only — new days don't have an id yet, so there's nothing to
|
|
15
|
+
* attach media to until after first save).
|
|
16
|
+
*/
|
|
17
|
+
uploadMedia?: ProductMediaUploadHandler;
|
|
18
|
+
}
|
|
19
|
+
export declare function ProductDayDialog({ open, onOpenChange, productId, itineraryId, day, nextDayNumber, onSuccess, uploadMedia, }: ProductDayDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=product-day-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-day-dialog.d.ts","sourceRoot":"","sources":["../../src/components/product-day-dialog.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAGnD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAE3E,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,CAAC,EAAE,gBAAgB,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC3C;;;;OAIG;IACH,WAAW,CAAC,EAAE,yBAAyB,CAAA;CACxC;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,WAAW,EACX,GAAG,EACH,aAAa,EACb,SAAS,EACT,WAAW,GACZ,EAAE,qBAAqB,2CA4CvB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@voyant-travel/ui/components/dialog";
|
|
4
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
5
|
+
import { ProductDayForm } from "./product-day-form.js";
|
|
6
|
+
import { ProductDayMediaTray } from "./product-day-media-tray.js";
|
|
7
|
+
export function ProductDayDialog({ open, onOpenChange, productId, itineraryId, day, nextDayNumber, onSuccess, uploadMedia, }) {
|
|
8
|
+
const isEdit = Boolean(day);
|
|
9
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
10
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-slot": "product-day-dialog", className: "flex max-h-[90vh] flex-col gap-4 sm:max-w-[640px]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: isEdit
|
|
11
|
+
? messages.productDayDialog.titles.edit
|
|
12
|
+
: messages.productDayDialog.titles.create }), _jsx(DialogDescription, { children: isEdit
|
|
13
|
+
? messages.productDayDialog.descriptions.edit
|
|
14
|
+
: messages.productDayDialog.descriptions.create })] }), _jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto", children: [_jsx(ProductDayForm, { mode: day
|
|
15
|
+
? { kind: "edit", productId, day }
|
|
16
|
+
: { kind: "create", productId, itineraryId, nextDayNumber }, onSuccess: (savedDay) => {
|
|
17
|
+
onSuccess?.(savedDay);
|
|
18
|
+
onOpenChange(false);
|
|
19
|
+
}, onCancel: () => onOpenChange(false) }), day ? (_jsx("div", { className: "border-t pt-4", children: _jsx(ProductDayMediaTray, { productId: productId, dayId: day.id, uploadMedia: uploadMedia }) })) : null] })] }) }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ProductDayRecord } from "../index.js";
|
|
2
|
+
type Mode = {
|
|
3
|
+
kind: "create";
|
|
4
|
+
productId: string;
|
|
5
|
+
itineraryId?: string;
|
|
6
|
+
nextDayNumber?: number;
|
|
7
|
+
} | {
|
|
8
|
+
kind: "edit";
|
|
9
|
+
productId: string;
|
|
10
|
+
day: ProductDayRecord;
|
|
11
|
+
};
|
|
12
|
+
export interface ProductDayFormProps {
|
|
13
|
+
mode: Mode;
|
|
14
|
+
onSuccess?: (day: ProductDayRecord) => void;
|
|
15
|
+
onCancel?: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function ProductDayForm({ mode, onSuccess, onCancel }: ProductDayFormProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=product-day-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-day-form.d.ts","sourceRoot":"","sources":["../../src/components/product-day-form.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,gBAAgB,EAAyB,MAAM,aAAa,CAAA;AAE1E,KAAK,IAAI,GACL;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GACnF;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,gBAAgB,CAAA;CAAE,CAAA;AAE9D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,IAAI,CAAA;IACV,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC3C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AA2BD,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CA8HhF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { Input } from "@voyant-travel/ui/components/input";
|
|
5
|
+
import { Label } from "@voyant-travel/ui/components/label";
|
|
6
|
+
import { RichTextEditor } from "@voyant-travel/ui/components/rich-text-editor";
|
|
7
|
+
import { Loader2 } from "lucide-react";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
10
|
+
import { useProductDayMutation } from "../index.js";
|
|
11
|
+
function initialState(mode) {
|
|
12
|
+
if (mode.kind === "edit") {
|
|
13
|
+
return {
|
|
14
|
+
dayNumber: String(mode.day.dayNumber),
|
|
15
|
+
title: mode.day.title ?? "",
|
|
16
|
+
description: mode.day.description ?? "",
|
|
17
|
+
location: mode.day.location ?? "",
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
dayNumber: String(mode.nextDayNumber ?? 1),
|
|
22
|
+
title: "",
|
|
23
|
+
description: "",
|
|
24
|
+
location: "",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function ProductDayForm({ mode, onSuccess, onCancel }) {
|
|
28
|
+
const [state, setState] = React.useState(() => initialState(mode));
|
|
29
|
+
const [error, setError] = React.useState(null);
|
|
30
|
+
const { create, update } = useProductDayMutation();
|
|
31
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
setState(initialState(mode));
|
|
34
|
+
setError(null);
|
|
35
|
+
}, [mode]);
|
|
36
|
+
const isSubmitting = create.isPending || update.isPending;
|
|
37
|
+
const field = (key) => (value) => {
|
|
38
|
+
setState((previous) => ({ ...previous, [key]: value }));
|
|
39
|
+
};
|
|
40
|
+
const handleSubmit = async (event) => {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
setError(null);
|
|
43
|
+
const dayNumber = Number.parseInt(state.dayNumber || "0", 10);
|
|
44
|
+
if (!Number.isFinite(dayNumber) || dayNumber < 1) {
|
|
45
|
+
setError(messages.productDayForm.validation.dayNumberMin);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const payload = {
|
|
49
|
+
dayNumber,
|
|
50
|
+
title: state.title.trim() ? state.title.trim() : null,
|
|
51
|
+
description: state.description.trim() ? state.description.trim() : null,
|
|
52
|
+
location: state.location.trim() ? state.location.trim() : null,
|
|
53
|
+
};
|
|
54
|
+
try {
|
|
55
|
+
const day = mode.kind === "create"
|
|
56
|
+
? await create.mutateAsync({
|
|
57
|
+
productId: mode.productId,
|
|
58
|
+
itineraryId: mode.itineraryId,
|
|
59
|
+
...payload,
|
|
60
|
+
})
|
|
61
|
+
: await update.mutateAsync({
|
|
62
|
+
productId: mode.productId,
|
|
63
|
+
dayId: mode.day.id,
|
|
64
|
+
input: payload,
|
|
65
|
+
});
|
|
66
|
+
onSuccess?.(day);
|
|
67
|
+
}
|
|
68
|
+
catch (submissionError) {
|
|
69
|
+
setError(submissionError instanceof Error
|
|
70
|
+
? submissionError.message
|
|
71
|
+
: messages.productDayForm.validation.saveFailed);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return (_jsxs("form", { "data-slot": "product-day-form", onSubmit: handleSubmit, className: "flex flex-col gap-4", children: [_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, { htmlFor: "product-day-number", children: messages.productDayForm.fields.dayNumber }), _jsx(Input, { id: "product-day-number", type: "number", min: "1", autoFocus: true, required: true, value: state.dayNumber, onChange: (event) => field("dayNumber")(event.target.value) })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-location", children: messages.productDayForm.fields.location }), _jsx(Input, { id: "product-day-location", value: state.location, onChange: (event) => field("location")(event.target.value), placeholder: messages.productDayForm.placeholders.location })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-title", children: messages.productDayForm.fields.title }), _jsx(Input, { id: "product-day-title", value: state.title, onChange: (event) => field("title")(event.target.value), placeholder: messages.productDayForm.placeholders.title })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-description", children: messages.productDayForm.fields.description }), _jsx(RichTextEditor, { value: state.description, onChange: field("description"), placeholder: messages.productDayForm.placeholders.description, editorClassName: "max-h-[320px] overflow-y-auto" })] }), error ? _jsx("p", { 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: messages.common.cancel })) : null, _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting ? (_jsx(Loader2, { className: "mr-2 size-4 animate-spin", "aria-hidden": "true" })) : null, mode.kind === "create"
|
|
75
|
+
? messages.productDayForm.actions.addDay
|
|
76
|
+
: messages.productDayForm.actions.saveDay] })] })] }));
|
|
77
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ProductMediaUploadHandler } from "./product-media-section.js";
|
|
3
|
+
export interface ProductDayMediaTrayProps {
|
|
4
|
+
productId: string;
|
|
5
|
+
dayId: string;
|
|
6
|
+
uploadMedia?: ProductMediaUploadHandler;
|
|
7
|
+
uploadAccept?: string;
|
|
8
|
+
emptyState?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function ProductDayMediaTray({ productId, dayId, uploadMedia, uploadAccept, emptyState, }: ProductDayMediaTrayProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=product-day-media-tray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-day-media-tray.d.ts","sourceRoot":"","sources":["../../src/components/product-day-media-tray.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAE3E,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,yBAAyB,CAAA;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,KAAK,EACL,WAAW,EACX,YAAgD,EAChD,UAAU,GACX,EAAE,wBAAwB,2CAqM1B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Badge } from "@voyant-travel/ui/components/badge";
|
|
4
|
+
import { Button } from "@voyant-travel/ui/components/button";
|
|
5
|
+
import { ImageIcon, Loader2, Pencil, Plus, Star, Trash2, Upload } from "lucide-react";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
8
|
+
import { useProductMedia, useProductMediaMutation } from "../index.js";
|
|
9
|
+
import { ProductMediaDialog } from "./product-media-dialog.js";
|
|
10
|
+
export function ProductDayMediaTray({ productId, dayId, uploadMedia, uploadAccept = "image/*,video/*,application/pdf", emptyState, }) {
|
|
11
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
12
|
+
const [dialogOpen, setDialogOpen] = React.useState(false);
|
|
13
|
+
const [editingMedia, setEditingMedia] = React.useState();
|
|
14
|
+
const [isUploading, setIsUploading] = React.useState(false);
|
|
15
|
+
const [uploadError, setUploadError] = React.useState(null);
|
|
16
|
+
const fileInputRef = React.useRef(null);
|
|
17
|
+
const { data, isPending, isError } = useProductMedia(productId, { dayId, limit: 50 });
|
|
18
|
+
const { create, remove, setCover } = useProductMediaMutation();
|
|
19
|
+
const media = React.useMemo(() => (data?.data ?? [])
|
|
20
|
+
.slice()
|
|
21
|
+
.sort((left, right) => Number(right.isCover) - Number(left.isCover) || left.sortOrder - right.sortOrder), [data?.data]);
|
|
22
|
+
const handleUpload = async (file) => {
|
|
23
|
+
if (!uploadMedia)
|
|
24
|
+
return;
|
|
25
|
+
setUploadError(null);
|
|
26
|
+
setIsUploading(true);
|
|
27
|
+
try {
|
|
28
|
+
const uploaded = await uploadMedia(file, { productId, dayId });
|
|
29
|
+
const mimeType = uploaded.mimeType?.trim() || file.type || null;
|
|
30
|
+
const mediaType = uploaded.mediaType ??
|
|
31
|
+
(mimeType?.startsWith("video/")
|
|
32
|
+
? "video"
|
|
33
|
+
: mimeType?.startsWith("image/")
|
|
34
|
+
? "image"
|
|
35
|
+
: "document");
|
|
36
|
+
await create.mutateAsync({
|
|
37
|
+
productId,
|
|
38
|
+
dayId,
|
|
39
|
+
mediaType,
|
|
40
|
+
name: uploaded.name?.trim() || file.name,
|
|
41
|
+
url: uploaded.url,
|
|
42
|
+
storageKey: uploaded.storageKey ?? null,
|
|
43
|
+
mimeType,
|
|
44
|
+
fileSize: uploaded.fileSize ?? (file.size || null),
|
|
45
|
+
altText: uploaded.altText ?? null,
|
|
46
|
+
sortOrder: uploaded.sortOrder ?? media.length,
|
|
47
|
+
isCover: uploaded.isCover ?? media.length === 0,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
setUploadError(error instanceof Error ? error.message : messages.productMediaSection.uploadFailed);
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
setIsUploading(false);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return (_jsxs("div", { "data-slot": "product-day-media-tray", className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("div", { className: "text-sm font-medium", children: messages.productMediaSection.titles.dayMedia }), _jsxs("div", { className: "flex items-center gap-1", children: [uploadMedia ? (_jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "outline", size: "sm", disabled: isUploading, onClick: () => fileInputRef.current?.click(), children: [isUploading ? (_jsx(Loader2, { className: "mr-2 size-4 animate-spin", "aria-hidden": "true" })) : (_jsx(Upload, { className: "mr-2 size-4", "aria-hidden": "true" })), messages.productMediaSection.actions.upload] }), _jsx("input", { ref: fileInputRef, type: "file", accept: uploadAccept, className: "hidden", onChange: (event) => {
|
|
58
|
+
const file = event.target.files?.[0];
|
|
59
|
+
if (file) {
|
|
60
|
+
void handleUpload(file);
|
|
61
|
+
event.target.value = "";
|
|
62
|
+
}
|
|
63
|
+
} })] })) : null, _jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: () => {
|
|
64
|
+
setEditingMedia(undefined);
|
|
65
|
+
setDialogOpen(true);
|
|
66
|
+
}, children: [_jsx(Plus, { className: "mr-2 size-4", "aria-hidden": "true" }), messages.productMediaSection.actions.addMedia] })] })] }), uploadError ? _jsx("p", { className: "text-sm text-destructive", children: uploadError }) : null, isPending ? (_jsx("div", { className: "flex min-h-20 items-center justify-center rounded-md border border-dashed", children: _jsx(Loader2, { className: "size-4 animate-spin text-muted-foreground" }) })) : isError ? (_jsx("p", { className: "text-sm text-destructive", children: messages.productMediaSection.loadingError })) : media.length === 0 ? (_jsx("div", { className: "rounded-md border border-dashed p-3 text-sm text-muted-foreground", children: emptyState ?? messages.productMediaSection.empty })) : (_jsx("div", { className: "flex gap-2 overflow-x-auto pb-1", children: media.map((item) => (_jsxs("div", { className: "w-36 shrink-0 rounded-md border bg-background", children: [item.mediaType === "image" ? (_jsx("img", { src: item.url, alt: item.altText ?? item.name, className: "h-20 w-full rounded-t-md object-cover" })) : (_jsx("div", { className: "flex h-20 w-full items-center justify-center rounded-t-md bg-muted text-muted-foreground", children: _jsx(ImageIcon, { className: "size-5", "aria-hidden": "true" }) })), _jsxs("div", { className: "space-y-2 p-2", children: [_jsx("div", { className: "truncate text-xs font-medium", children: item.name }), _jsxs("div", { className: "flex items-center justify-between gap-1", children: [item.isCover ? (_jsx(Badge, { className: "text-[10px]", children: messages.productMediaSection.coverBadge })) : (_jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", onClick: () => setCover.mutate(item.id), "aria-label": messages.productMediaSection.actions.markCover, children: _jsx(Star, { className: "size-4", "aria-hidden": "true" }) })), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", onClick: () => {
|
|
67
|
+
setEditingMedia(item);
|
|
68
|
+
setDialogOpen(true);
|
|
69
|
+
}, "aria-label": messages.productMediaSection.actions.edit, children: _jsx(Pencil, { className: "size-4", "aria-hidden": "true" }) }), _jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", onClick: () => {
|
|
70
|
+
if (confirm(messages.productMediaSection.deleteConfirm)) {
|
|
71
|
+
remove.mutate(item.id);
|
|
72
|
+
}
|
|
73
|
+
}, "aria-label": messages.productMediaSection.actions.delete, children: _jsx(Trash2, { className: "size-4", "aria-hidden": "true" }) })] })] })] })] }, item.id))) })), _jsx(ProductMediaDialog, { open: dialogOpen, onOpenChange: setDialogOpen, productId: productId, dayId: dayId, media: editingMedia, onSuccess: () => setEditingMedia(undefined) })] }));
|
|
74
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ProductDayServiceRecord } from "../index.js";
|
|
2
|
+
import { type ProductDayServiceFormProps } from "./product-day-service-form.js";
|
|
3
|
+
export interface ProductDayServiceDialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
productId: string;
|
|
7
|
+
dayId: string;
|
|
8
|
+
service?: ProductDayServiceRecord;
|
|
9
|
+
onSuccess?: (service: ProductDayServiceRecord) => void;
|
|
10
|
+
renderSupplierServiceField?: ProductDayServiceFormProps["renderSupplierServiceField"];
|
|
11
|
+
onSupplierServiceSelected?: ProductDayServiceFormProps["onSupplierServiceSelected"];
|
|
12
|
+
}
|
|
13
|
+
export declare function ProductDayServiceDialog({ open, onOpenChange, productId, dayId, service, onSuccess, renderSupplierServiceField, onSupplierServiceSelected, }: ProductDayServiceDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=product-day-service-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-day-service-dialog.d.ts","sourceRoot":"","sources":["../../src/components/product-day-service-dialog.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,+BAA+B,CAAA;AAEtC,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,uBAAuB,CAAA;IACjC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAA;IACtD,0BAA0B,CAAC,EAAE,0BAA0B,CAAC,4BAA4B,CAAC,CAAA;IACrF,yBAAyB,CAAC,EAAE,0BAA0B,CAAC,2BAA2B,CAAC,CAAA;CACpF;AAED,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,EACT,0BAA0B,EAC1B,yBAAyB,GAC1B,EAAE,4BAA4B,2CAoC9B"}
|