@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,103 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { Button } from "@voyant-travel/ui/components";
|
|
4
|
+
import { Plus, Trash2 } from "lucide-react";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { useVoyantProductsContext } from "../../index.js";
|
|
7
|
+
import { useOptionUnitPriceRuleMutation } from "./commerce-client.js";
|
|
8
|
+
import { useProductDetailApi, useProductDetailMessages } from "./host.js";
|
|
9
|
+
import { categoryAppliesToUnit, formatProductMoney, getCategoryCondition, getUnitTypeLabel, isTravelerCategory, } from "./product-options-pricing-helpers.js";
|
|
10
|
+
import { getOptionUnitPriceRulesQueryOptions, getOptionUnitsQueryOptions, getPricingCategoriesQueryOptions, } from "./product-options-shared.js";
|
|
11
|
+
import { TravelerCategoryDialog } from "./product-options-traveler-category-dialog.js";
|
|
12
|
+
import { UnitPriceRuleDialog } from "./product-unit-price-rule-dialog.js";
|
|
13
|
+
export function UnitPriceMatrix({ productId, optionPriceRuleId, optionId, pricingMode, allPricingCategories, productCurrency, }) {
|
|
14
|
+
const messages = useProductDetailMessages();
|
|
15
|
+
const productsClient = useVoyantProductsContext();
|
|
16
|
+
const api = useProductDetailApi();
|
|
17
|
+
const priceRuleMessages = messages.products.operations.priceRules;
|
|
18
|
+
const unitMessages = messages.products.operations.units;
|
|
19
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
20
|
+
const [editingCell, setEditingCell] = useState();
|
|
21
|
+
const [preselectedUnitId, setPreselectedUnitId] = useState();
|
|
22
|
+
const [preselectedCategoryId, setPreselectedCategoryId] = useState();
|
|
23
|
+
const [categoryDialogOpen, setCategoryDialogOpen] = useState(false);
|
|
24
|
+
const { data: unitsData } = useQuery(getOptionUnitsQueryOptions(productsClient, optionId));
|
|
25
|
+
const { data: categoriesData, refetch: refetchCategories } = useQuery(getPricingCategoriesQueryOptions(api));
|
|
26
|
+
const { data: cellsData, refetch: refetchCells } = useQuery(getOptionUnitPriceRulesQueryOptions(api, optionPriceRuleId));
|
|
27
|
+
const { remove } = useOptionUnitPriceRuleMutation();
|
|
28
|
+
const deleteMutation = useMutation({
|
|
29
|
+
mutationFn: (id) => remove.mutateAsync(id),
|
|
30
|
+
onSuccess: () => void refetchCells(),
|
|
31
|
+
});
|
|
32
|
+
const units = (unitsData?.data ?? []).slice().sort((a, b) => a.sortOrder - b.sortOrder);
|
|
33
|
+
const cells = cellsData?.data ?? [];
|
|
34
|
+
const referencedCategoryIds = new Set(cells.flatMap((cell) => (cell.pricingCategoryId ? [cell.pricingCategoryId] : [])));
|
|
35
|
+
const categories = (categoriesData?.data ?? []).filter((category) => category.active &&
|
|
36
|
+
((isTravelerCategory(category) &&
|
|
37
|
+
(category.productId == null || category.productId === productId) &&
|
|
38
|
+
(category.optionId == null || category.optionId === optionId)) ||
|
|
39
|
+
referencedCategoryIds.has(category.id)));
|
|
40
|
+
const isPersonOnly = units.length > 0 && units.every((unit) => unit.unitType === "person");
|
|
41
|
+
const findCell = (unitId, categoryId) => cells.find((cell) => cell.unitId === unitId && (cell.pricingCategoryId ?? null) === categoryId) ?? null;
|
|
42
|
+
if (units.length === 0) {
|
|
43
|
+
return _jsx("p", { className: "text-xs italic text-muted-foreground", children: priceRuleMessages.addUnitsHint });
|
|
44
|
+
}
|
|
45
|
+
if (pricingMode === "per_booking") {
|
|
46
|
+
return (_jsx("p", { className: "text-xs italic text-muted-foreground", children: priceRuleMessages.perBookingFlatHint }));
|
|
47
|
+
}
|
|
48
|
+
// Per-pax tour with no category cross-cut: render a simple unit-only table
|
|
49
|
+
// (Sell / Cost) instead of the unit×category matrix. Operators on
|
|
50
|
+
// accommodation products (or rules with allPricingCategories=false) still
|
|
51
|
+
// get the full matrix.
|
|
52
|
+
const useSimpleTable = pricingMode === "per_person" && allPricingCategories;
|
|
53
|
+
const tableTitle = useSimpleTable
|
|
54
|
+
? isPersonOnly
|
|
55
|
+
? priceRuleMessages.personUnitPricingTitle
|
|
56
|
+
: priceRuleMessages.unitPricingTitle
|
|
57
|
+
: isPersonOnly
|
|
58
|
+
? priceRuleMessages.personUnitCategoryTitle
|
|
59
|
+
: priceRuleMessages.unitCategoryTitle;
|
|
60
|
+
const unitColumnLabel = isPersonOnly
|
|
61
|
+
? priceRuleMessages.tableTravelerUnit
|
|
62
|
+
: priceRuleMessages.tableUnit;
|
|
63
|
+
const columns = useSimpleTable
|
|
64
|
+
? [{ id: null, name: priceRuleMessages.tableSell }]
|
|
65
|
+
: categories.length > 0
|
|
66
|
+
? categories.map((category) => ({
|
|
67
|
+
id: category.id,
|
|
68
|
+
name: category.name,
|
|
69
|
+
metadata: category.metadata,
|
|
70
|
+
}))
|
|
71
|
+
: [{ id: null, name: priceRuleMessages.defaultBadge }];
|
|
72
|
+
return (_jsxs("div", { children: [_jsxs("div", { className: "mb-2 flex items-center justify-between", children: [_jsx("p", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: tableTitle }), !useSimpleTable ? (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setCategoryDialogOpen(true), children: [_jsx(Plus, { className: "mr-1 h-3 w-3" }), priceRuleMessages.addTravelerCategory] })) : null] }), _jsx("div", { className: "overflow-x-auto rounded border", children: _jsxs("table", { className: "w-full text-xs", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b bg-muted/50 text-muted-foreground", children: [_jsx("th", { className: "p-2 text-left font-medium", children: unitColumnLabel }), columns.map((category) => {
|
|
73
|
+
const condition = getCategoryCondition(category.metadata);
|
|
74
|
+
return (_jsxs("th", { className: "p-2 text-left font-medium", children: [_jsx("div", { children: category.name }), condition ? (_jsx("div", { className: "mt-0.5 max-w-[220px] text-[10px] font-normal leading-snug text-muted-foreground normal-case", children: condition })) : null] }, category.id ?? "__default__"));
|
|
75
|
+
})] }) }), _jsx("tbody", { children: units.map((unit) => (_jsxs("tr", { className: "border-b last:border-b-0", children: [_jsxs("td", { className: "p-2 font-medium", children: [unit.name, _jsxs("span", { className: "ml-1 text-[10px] text-muted-foreground", children: ["(", getUnitTypeLabel(unit.unitType, unitMessages), ")"] })] }), columns.map((category) => {
|
|
76
|
+
const cell = findCell(unit.id, category.id);
|
|
77
|
+
const canPriceCategory = categoryAppliesToUnit(category, unit);
|
|
78
|
+
return (_jsx("td", { className: "p-2", children: cell ? (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("button", { type: "button", onClick: () => {
|
|
79
|
+
setEditingCell(cell);
|
|
80
|
+
setPreselectedUnitId(undefined);
|
|
81
|
+
setPreselectedCategoryId(undefined);
|
|
82
|
+
setDialogOpen(true);
|
|
83
|
+
}, className: "font-mono text-foreground hover:underline", children: formatProductMoney(cell.sellAmountCents, productCurrency) }), _jsx("button", { type: "button", onClick: () => {
|
|
84
|
+
if (confirm(priceRuleMessages.deleteCellConfirm)) {
|
|
85
|
+
deleteMutation.mutate(cell.id);
|
|
86
|
+
}
|
|
87
|
+
}, className: "text-muted-foreground hover:text-destructive", children: _jsx(Trash2, { className: "h-3 w-3" }) })] })) : canPriceCategory ? (_jsx("button", { type: "button", onClick: () => {
|
|
88
|
+
setEditingCell(undefined);
|
|
89
|
+
setPreselectedUnitId(unit.id);
|
|
90
|
+
setPreselectedCategoryId(category.id);
|
|
91
|
+
setDialogOpen(true);
|
|
92
|
+
}, className: "text-muted-foreground hover:text-foreground", children: _jsx(Plus, { className: "h-3 w-3" }) })) : (_jsx("span", { className: "text-muted-foreground", children: "-" })) }, category.id ?? "__default__"));
|
|
93
|
+
})] }, unit.id))) })] }) }), _jsx(TravelerCategoryDialog, { open: categoryDialogOpen, onOpenChange: setCategoryDialogOpen, productId: productId, units: units, nextSortOrder: categories.length > 0 ? Math.max(...categories.map((c) => c.sortOrder)) + 1 : 0, onSuccess: () => {
|
|
94
|
+
setCategoryDialogOpen(false);
|
|
95
|
+
void refetchCategories();
|
|
96
|
+
} }), _jsx(UnitPriceRuleDialog, { open: dialogOpen, onOpenChange: setDialogOpen, optionPriceRuleId: optionPriceRuleId, optionId: optionId, units: units, productCurrency: productCurrency, preselectedUnitId: preselectedUnitId, preselectedCategoryId: preselectedCategoryId, cell: editingCell, onSuccess: () => {
|
|
97
|
+
setDialogOpen(false);
|
|
98
|
+
setEditingCell(undefined);
|
|
99
|
+
setPreselectedUnitId(undefined);
|
|
100
|
+
setPreselectedCategoryId(undefined);
|
|
101
|
+
void refetchCells();
|
|
102
|
+
} })] }));
|
|
103
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ProductRecord } from "../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Per-listing customer payment policy override for a product.
|
|
4
|
+
*
|
|
5
|
+
* Wins over the product's category and supplier policies in the
|
|
6
|
+
* cascade — use this when a single product has stricter / looser
|
|
7
|
+
* terms than the rest of its catalog group (a luxury-tier offering,
|
|
8
|
+
* a flash sale, etc.).
|
|
9
|
+
*
|
|
10
|
+
* Inherit by default; flipping the toggle off saves an explicit
|
|
11
|
+
* policy on the product row.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ProductPaymentPolicySection({ product, onSuccess, }: {
|
|
14
|
+
product: ProductRecord;
|
|
15
|
+
onSuccess?: () => void;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=product-payment-policy-section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-payment-policy-section.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-payment-policy-section.tsx"],"names":[],"mappings":"AASA,OAAO,EAA6B,KAAK,aAAa,EAAsB,MAAM,gBAAgB,CAAA;AAWlG;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,OAAO,EACP,SAAS,GACV,EAAE;IACD,OAAO,EAAE,aAAa,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB,2CAwFA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { PaymentPolicyForm, PaymentPolicyPreview } from "@voyant-travel/finance-react/ui";
|
|
4
|
+
import { Badge, Button, Label, Switch } from "@voyant-travel/ui/components";
|
|
5
|
+
import { Separator } from "@voyant-travel/ui/components/separator";
|
|
6
|
+
import { Loader2 } from "lucide-react";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { toast } from "sonner";
|
|
9
|
+
import { useProductMutation } from "../../index.js";
|
|
10
|
+
import { useProductDetailMessages } from "./host.js";
|
|
11
|
+
import { Section } from "./product-detail-sections.js";
|
|
12
|
+
const DEFAULT_POLICY = {
|
|
13
|
+
deposit: { kind: "percent", percent: 50 },
|
|
14
|
+
minDaysBeforeDepartureForDeposit: 30,
|
|
15
|
+
balanceDueDaysBeforeDeparture: 30,
|
|
16
|
+
balanceDueMinDaysFromNow: 7,
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Per-listing customer payment policy override for a product.
|
|
20
|
+
*
|
|
21
|
+
* Wins over the product's category and supplier policies in the
|
|
22
|
+
* cascade — use this when a single product has stricter / looser
|
|
23
|
+
* terms than the rest of its catalog group (a luxury-tier offering,
|
|
24
|
+
* a flash sale, etc.).
|
|
25
|
+
*
|
|
26
|
+
* Inherit by default; flipping the toggle off saves an explicit
|
|
27
|
+
* policy on the product row.
|
|
28
|
+
*/
|
|
29
|
+
export function ProductPaymentPolicySection({ product, onSuccess, }) {
|
|
30
|
+
const t = useProductDetailMessages().products.operations.paymentPolicy;
|
|
31
|
+
const persisted = product.customerPaymentPolicy ?? null;
|
|
32
|
+
const [draft, setDraft] = useState(persisted);
|
|
33
|
+
const { update } = useProductMutation();
|
|
34
|
+
// One-way sync: when the persisted policy reference changes (after
|
|
35
|
+
// a save → query invalidation, or external edit), refresh the
|
|
36
|
+
// draft. Mid-flight typing is preserved because we don't depend on
|
|
37
|
+
// setState callbacks running on every render.
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
setDraft(persisted);
|
|
40
|
+
}, [persisted]);
|
|
41
|
+
const isInheriting = draft === null;
|
|
42
|
+
const isDirty = JSON.stringify(draft) !== JSON.stringify(persisted);
|
|
43
|
+
const save = () => {
|
|
44
|
+
update.mutate({
|
|
45
|
+
id: product.id,
|
|
46
|
+
input: { customerPaymentPolicy: draft ?? null },
|
|
47
|
+
}, {
|
|
48
|
+
onSuccess: () => {
|
|
49
|
+
toast.success(t.savedToast);
|
|
50
|
+
onSuccess?.();
|
|
51
|
+
},
|
|
52
|
+
onError: (err) => toast.error(err instanceof Error ? err.message : t.saveFailed),
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
return (_jsx(Section, { title: t.title, actions: _jsxs(Button, { size: "sm", disabled: !isDirty || update.isPending, onClick: save, children: [update.isPending ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, t.save] }), children: _jsxs("div", { className: "flex flex-col gap-5", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Label, { htmlFor: "payment-policy-inherit", className: "text-sm font-medium", children: t.inheritLabel }), _jsx(Badge, { variant: isInheriting ? "secondary" : "outline", className: "text-[10px]", children: isInheriting ? t.inheritingBadge : t.customBadge })] }), _jsx("p", { className: "text-xs text-muted-foreground", children: t.inheritHint })] }), _jsx(Switch, { id: "payment-policy-inherit", checked: isInheriting, onCheckedChange: (checked) => {
|
|
56
|
+
setDraft(checked ? null : (draft ?? DEFAULT_POLICY));
|
|
57
|
+
}, disabled: update.isPending })] }), isInheriting ? null : (_jsxs(_Fragment, { children: [_jsx(Separator, {}), _jsx(PaymentPolicyForm, { value: draft, onChange: setDraft, inheritable: false, currency: product.sellCurrency, disabled: update.isPending }), _jsx(Separator, {}), _jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: t.previewHeading }), _jsx(PaymentPolicyPreview, { policy: draft, currency: product.sellCurrency })] })] }))] }) }));
|
|
58
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type AvailabilityRule } from "./product-schedule-form.js";
|
|
2
|
+
export type { AvailabilityRule };
|
|
3
|
+
type ScheduleDialogProps = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
productId: string;
|
|
7
|
+
rule?: AvailabilityRule;
|
|
8
|
+
onSuccess: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function ScheduleDialog({ open, onOpenChange, productId, rule, onSuccess, }: ScheduleDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=product-schedule-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-schedule-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-schedule-dialog.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,gBAAgB,EAAgB,MAAM,4BAA4B,CAAA;AAEhF,YAAY,EAAE,gBAAgB,EAAE,CAAA;AAEhC,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,CAAA;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,IAAI,EACJ,SAAS,GACV,EAAE,mBAAmB,2CAwBrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, } from "@voyant-travel/ui/components";
|
|
3
|
+
import { useProductDetailMessages } from "./host.js";
|
|
4
|
+
import { ScheduleForm } from "./product-schedule-form.js";
|
|
5
|
+
export function ScheduleDialog({ open, onOpenChange, productId, rule, onSuccess, }) {
|
|
6
|
+
const messages = useProductDetailMessages();
|
|
7
|
+
const scheduleMessages = messages.products.operations.schedules;
|
|
8
|
+
const isEditing = !!rule;
|
|
9
|
+
return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { side: "right", size: "lg", children: [_jsx(SheetHeader, { children: _jsx(SheetTitle, { children: isEditing ? scheduleMessages.editTitle : scheduleMessages.newTitle }) }), _jsx(SheetBody, { children: _jsx(ScheduleForm, { productId: productId, rule: rule, onSuccess: onSuccess, onCancel: () => onOpenChange(false) }) })] }) }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type AvailabilityRule = {
|
|
2
|
+
id: string;
|
|
3
|
+
productId: string;
|
|
4
|
+
timezone: string;
|
|
5
|
+
recurrenceRule: string;
|
|
6
|
+
maxCapacity: number;
|
|
7
|
+
cutoffMinutes: number | null;
|
|
8
|
+
active: boolean;
|
|
9
|
+
};
|
|
10
|
+
export interface ScheduleFormProps {
|
|
11
|
+
productId: string;
|
|
12
|
+
rule?: AvailabilityRule;
|
|
13
|
+
onSuccess: () => void;
|
|
14
|
+
onCancel?: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function ScheduleForm({ productId, rule, onSuccess, onCancel }: ScheduleFormProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=product-schedule-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-schedule-form.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-schedule-form.tsx"],"names":[],"mappings":"AAwEA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,MAAM,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAgID,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAgSvF"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// agent-quality: file-size exception -- owner: inventory-react; existing UI surface stays co-located until a dedicated split preserves behavior and tests.
|
|
3
|
+
import { formatMessage } from "@voyant-travel/i18n";
|
|
4
|
+
import { Button, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch, } from "@voyant-travel/ui/components";
|
|
5
|
+
import { Combobox, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, } from "@voyant-travel/ui/components/combobox";
|
|
6
|
+
import { ToggleGroup, ToggleGroupItem } from "@voyant-travel/ui/components/toggle-group";
|
|
7
|
+
import { Loader2 } from "lucide-react";
|
|
8
|
+
import { useEffect, useMemo } from "react";
|
|
9
|
+
import { useForm } from "react-hook-form";
|
|
10
|
+
import { z } from "zod/v4";
|
|
11
|
+
import { useProductDetailApi, useProductDetailMessages } from "./host.js";
|
|
12
|
+
import { getTimezoneLabel, TIMEZONE_IDS, TIMEZONE_OPTIONS } from "./timezone-options.js";
|
|
13
|
+
import { zodResolver } from "./zod-resolver.js";
|
|
14
|
+
const WEEKDAY_VALUES = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"];
|
|
15
|
+
const FREQUENCY_OPTIONS = ["DAILY", "WEEKLY", "MONTHLY"];
|
|
16
|
+
const buildScheduleFormSchema = (messages) => z
|
|
17
|
+
.object({
|
|
18
|
+
timezone: z.string().min(1, messages.validationTimezoneRequired),
|
|
19
|
+
frequency: z.enum(FREQUENCY_OPTIONS),
|
|
20
|
+
interval: z.coerce.number().int().min(1).max(365),
|
|
21
|
+
byWeekdays: z.array(z.enum(WEEKDAY_VALUES)),
|
|
22
|
+
byMonthDays: z.array(z.coerce.number().int().min(1).max(31)),
|
|
23
|
+
maxCapacity: z.coerce.number().int().min(0),
|
|
24
|
+
cutoffMinutes: z.coerce.number().int().min(0).optional().or(z.literal("")).nullable(),
|
|
25
|
+
active: z.boolean(),
|
|
26
|
+
})
|
|
27
|
+
.refine((v) => {
|
|
28
|
+
if (v.frequency !== "WEEKLY")
|
|
29
|
+
return true;
|
|
30
|
+
return v.byWeekdays.length > 0;
|
|
31
|
+
}, { message: messages.validationWeekdayRequired, path: ["byWeekdays"] })
|
|
32
|
+
.refine((v) => {
|
|
33
|
+
if (v.frequency !== "MONTHLY")
|
|
34
|
+
return true;
|
|
35
|
+
return v.byMonthDays.length > 0;
|
|
36
|
+
}, { message: messages.validationMonthdayRequired, path: ["byMonthDays"] });
|
|
37
|
+
function parseRRule(rrule) {
|
|
38
|
+
const parts = rrule
|
|
39
|
+
.split(";")
|
|
40
|
+
.map((p) => p.trim())
|
|
41
|
+
.filter(Boolean);
|
|
42
|
+
const map = new Map();
|
|
43
|
+
for (const part of parts) {
|
|
44
|
+
const [key, value] = part.split("=");
|
|
45
|
+
if (key && value !== undefined)
|
|
46
|
+
map.set(key.toUpperCase(), value);
|
|
47
|
+
}
|
|
48
|
+
const rawFreq = (map.get("FREQ") ?? "DAILY").toUpperCase();
|
|
49
|
+
const frequency = rawFreq === "WEEKLY" || rawFreq === "MONTHLY" ? rawFreq : "DAILY";
|
|
50
|
+
const interval = Number.parseInt(map.get("INTERVAL") ?? "1", 10) || 1;
|
|
51
|
+
const byday = map.get("BYDAY") ?? "";
|
|
52
|
+
const byWeekdays = byday
|
|
53
|
+
.split(",")
|
|
54
|
+
.map((d) => d.trim().toUpperCase())
|
|
55
|
+
.filter((d) => WEEKDAY_VALUES.includes(d));
|
|
56
|
+
const bymonthday = map.get("BYMONTHDAY") ?? "";
|
|
57
|
+
const byMonthDays = bymonthday
|
|
58
|
+
.split(",")
|
|
59
|
+
.map((d) => Number.parseInt(d.trim(), 10))
|
|
60
|
+
.filter((n) => Number.isFinite(n) && n >= 1 && n <= 31);
|
|
61
|
+
return { frequency, interval, byWeekdays, byMonthDays };
|
|
62
|
+
}
|
|
63
|
+
function buildRRule(values) {
|
|
64
|
+
const parts = [`FREQ=${values.frequency}`];
|
|
65
|
+
if (values.interval > 1)
|
|
66
|
+
parts.push(`INTERVAL=${values.interval}`);
|
|
67
|
+
if (values.frequency === "WEEKLY" && values.byWeekdays.length > 0) {
|
|
68
|
+
const ordered = WEEKDAY_VALUES.filter((d) => values.byWeekdays.includes(d));
|
|
69
|
+
parts.push(`BYDAY=${ordered.join(",")}`);
|
|
70
|
+
}
|
|
71
|
+
if (values.frequency === "MONTHLY" && values.byMonthDays.length > 0) {
|
|
72
|
+
const ordered = [...values.byMonthDays].sort((a, b) => a - b);
|
|
73
|
+
parts.push(`BYMONTHDAY=${ordered.join(",")}`);
|
|
74
|
+
}
|
|
75
|
+
return parts.join(";");
|
|
76
|
+
}
|
|
77
|
+
function describeRRule(values, messages, weekdayOptions) {
|
|
78
|
+
const { frequency, interval, byWeekdays, byMonthDays } = values;
|
|
79
|
+
const cadence = frequency === "DAILY"
|
|
80
|
+
? interval > 1
|
|
81
|
+
? formatMessage(messages.previewEveryDays, { interval })
|
|
82
|
+
: messages.previewEveryDay
|
|
83
|
+
: frequency === "WEEKLY"
|
|
84
|
+
? interval > 1
|
|
85
|
+
? formatMessage(messages.previewEveryWeeks, { interval })
|
|
86
|
+
: messages.previewEveryWeek
|
|
87
|
+
: interval > 1
|
|
88
|
+
? formatMessage(messages.previewEveryMonths, { interval })
|
|
89
|
+
: messages.previewEveryMonth;
|
|
90
|
+
if (frequency === "WEEKLY") {
|
|
91
|
+
if (byWeekdays.length === 0)
|
|
92
|
+
return `${cadence}${messages.previewPickWeekday}`;
|
|
93
|
+
const labels = weekdayOptions.filter((d) => byWeekdays.includes(d.value)).map((d) => d.label);
|
|
94
|
+
return formatMessage(messages.previewWeekly, { cadence, days: labels.join(", ") });
|
|
95
|
+
}
|
|
96
|
+
if (frequency === "MONTHLY") {
|
|
97
|
+
if (byMonthDays.length === 0)
|
|
98
|
+
return `${cadence}${messages.previewPickMonthday}`;
|
|
99
|
+
const ordered = [...byMonthDays].sort((a, b) => a - b);
|
|
100
|
+
return formatMessage(messages.previewMonthly, {
|
|
101
|
+
cadence,
|
|
102
|
+
suffix: ordered.length === 1 ? "" : messages.previewSuffixDays,
|
|
103
|
+
days: ordered.join(", "),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return cadence;
|
|
107
|
+
}
|
|
108
|
+
const MONTH_DAYS = Array.from({ length: 31 }, (_, i) => i + 1);
|
|
109
|
+
function initialValues(rule, defaultTz) {
|
|
110
|
+
if (rule) {
|
|
111
|
+
const parsed = parseRRule(rule.recurrenceRule);
|
|
112
|
+
return {
|
|
113
|
+
timezone: rule.timezone,
|
|
114
|
+
frequency: parsed.frequency,
|
|
115
|
+
interval: parsed.interval,
|
|
116
|
+
byWeekdays: parsed.byWeekdays,
|
|
117
|
+
byMonthDays: parsed.byMonthDays,
|
|
118
|
+
maxCapacity: rule.maxCapacity,
|
|
119
|
+
cutoffMinutes: rule.cutoffMinutes ?? "",
|
|
120
|
+
active: rule.active,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
timezone: defaultTz,
|
|
125
|
+
frequency: "WEEKLY",
|
|
126
|
+
interval: 1,
|
|
127
|
+
byWeekdays: ["MO"],
|
|
128
|
+
byMonthDays: [],
|
|
129
|
+
maxCapacity: 0,
|
|
130
|
+
cutoffMinutes: "",
|
|
131
|
+
active: true,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
export function ScheduleForm({ productId, rule, onSuccess, onCancel }) {
|
|
135
|
+
const messages = useProductDetailMessages();
|
|
136
|
+
const api = useProductDetailApi();
|
|
137
|
+
const productMessages = messages.products.core;
|
|
138
|
+
const scheduleMessages = messages.products.operations.schedules;
|
|
139
|
+
const isEditing = !!rule;
|
|
140
|
+
const scheduleFormSchema = buildScheduleFormSchema(scheduleMessages);
|
|
141
|
+
const weekdayOptions = [
|
|
142
|
+
{ value: "MO", label: scheduleMessages.weekdayMon },
|
|
143
|
+
{ value: "TU", label: scheduleMessages.weekdayTue },
|
|
144
|
+
{ value: "WE", label: scheduleMessages.weekdayWed },
|
|
145
|
+
{ value: "TH", label: scheduleMessages.weekdayThu },
|
|
146
|
+
{ value: "FR", label: scheduleMessages.weekdayFri },
|
|
147
|
+
{ value: "SA", label: scheduleMessages.weekdaySat },
|
|
148
|
+
{ value: "SU", label: scheduleMessages.weekdaySun },
|
|
149
|
+
];
|
|
150
|
+
const frequencyOptions = [
|
|
151
|
+
{ value: "DAILY", label: scheduleMessages.frequencyDaily },
|
|
152
|
+
{ value: "WEEKLY", label: scheduleMessages.frequencyWeekly },
|
|
153
|
+
{ value: "MONTHLY", label: scheduleMessages.frequencyMonthly },
|
|
154
|
+
];
|
|
155
|
+
const defaultTz = typeof Intl !== "undefined"
|
|
156
|
+
? (Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC")
|
|
157
|
+
: "UTC";
|
|
158
|
+
const form = useForm({
|
|
159
|
+
resolver: zodResolver(scheduleFormSchema),
|
|
160
|
+
defaultValues: initialValues(rule, defaultTz),
|
|
161
|
+
});
|
|
162
|
+
const active = form.watch("active");
|
|
163
|
+
const timezone = form.watch("timezone");
|
|
164
|
+
const frequency = form.watch("frequency");
|
|
165
|
+
const interval = form.watch("interval");
|
|
166
|
+
const byWeekdays = form.watch("byWeekdays");
|
|
167
|
+
const byMonthDays = form.watch("byMonthDays");
|
|
168
|
+
const preview = useMemo(() => describeRRule({
|
|
169
|
+
frequency,
|
|
170
|
+
interval: typeof interval === "number" ? interval : Number(interval) || 1,
|
|
171
|
+
byWeekdays,
|
|
172
|
+
byMonthDays,
|
|
173
|
+
}, scheduleMessages, weekdayOptions), [byMonthDays, byWeekdays, frequency, interval, scheduleMessages, weekdayOptions]);
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
form.reset(initialValues(rule, defaultTz));
|
|
176
|
+
}, [rule, form, defaultTz]);
|
|
177
|
+
const onSubmit = async (values) => {
|
|
178
|
+
const cutoffMinutes = typeof values.cutoffMinutes === "number" ? values.cutoffMinutes : null;
|
|
179
|
+
const recurrenceRule = buildRRule({
|
|
180
|
+
frequency: values.frequency,
|
|
181
|
+
interval: values.interval,
|
|
182
|
+
byWeekdays: values.byWeekdays,
|
|
183
|
+
byMonthDays: values.byMonthDays,
|
|
184
|
+
});
|
|
185
|
+
const payload = {
|
|
186
|
+
productId,
|
|
187
|
+
timezone: values.timezone,
|
|
188
|
+
recurrenceRule,
|
|
189
|
+
maxCapacity: values.maxCapacity,
|
|
190
|
+
cutoffMinutes,
|
|
191
|
+
active: values.active,
|
|
192
|
+
};
|
|
193
|
+
if (isEditing) {
|
|
194
|
+
await api.patch(`/v1/operations/availability/rules/${rule.id}`, payload);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
await api.post("/v1/operations/availability/rules", payload);
|
|
198
|
+
}
|
|
199
|
+
onSuccess();
|
|
200
|
+
};
|
|
201
|
+
const unitLabel = frequency === "DAILY"
|
|
202
|
+
? scheduleMessages.unitDays
|
|
203
|
+
: frequency === "WEEKLY"
|
|
204
|
+
? scheduleMessages.unitWeeks
|
|
205
|
+
: scheduleMessages.unitMonths;
|
|
206
|
+
return (_jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-1 flex-col gap-4 overflow-hidden", children: [_jsxs("div", { className: "grid gap-4", children: [_jsxs("div", { className: "grid grid-cols-[160px_1fr] gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: scheduleMessages.repeatsLabel }), _jsxs(Select, { value: frequency, onValueChange: (v) => form.setValue("frequency", v, {
|
|
207
|
+
shouldValidate: true,
|
|
208
|
+
shouldDirty: true,
|
|
209
|
+
}), items: frequencyOptions, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: frequencyOptions.map((f) => (_jsx(SelectItem, { value: f.value, children: f.label }, f.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: scheduleMessages.everyLabel }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { ...form.register("interval"), type: "number", min: "1", max: "365", step: "1", className: "w-24" }), _jsx("span", { className: "text-sm text-muted-foreground", children: unitLabel })] }), form.formState.errors.interval && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.interval.message }))] })] }), frequency === "WEEKLY" && (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: scheduleMessages.weeklyDaysLabel }), _jsx(ToggleGroup, { multiple: true, value: byWeekdays, onValueChange: (next) => form.setValue("byWeekdays", next, {
|
|
210
|
+
shouldValidate: true,
|
|
211
|
+
shouldDirty: true,
|
|
212
|
+
}), variant: "outline", spacing: 1, children: weekdayOptions.map((d) => (_jsx(ToggleGroupItem, { value: d.value, className: "w-14", children: d.label }, d.value))) }), form.formState.errors.byWeekdays && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.byWeekdays.message }))] })), frequency === "MONTHLY" && (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: scheduleMessages.monthlyDaysLabel }), _jsx(ToggleGroup, { multiple: true, value: byMonthDays.map(String), onValueChange: (next) => form.setValue("byMonthDays", next.map((n) => Number.parseInt(n, 10)), { shouldValidate: true, shouldDirty: true }), variant: "outline", spacing: 1, className: "flex-wrap", children: MONTH_DAYS.map((d) => (_jsx(ToggleGroupItem, { value: String(d), className: "w-10", children: d }, d))) }), form.formState.errors.byMonthDays && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.byMonthDays.message }))] })), _jsx("p", { className: "text-xs text-muted-foreground", children: preview }), _jsxs("div", { className: "grid grid-cols-3 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: scheduleMessages.timezoneLabel }), _jsxs(Combobox, { items: TIMEZONE_IDS, value: timezone || null, autoHighlight: true, itemToStringValue: (id) => getTimezoneLabel(id), onValueChange: (next) => {
|
|
213
|
+
if (typeof next === "string") {
|
|
214
|
+
form.setValue("timezone", next, {
|
|
215
|
+
shouldValidate: true,
|
|
216
|
+
shouldDirty: true,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}, children: [_jsx(ComboboxInput, { placeholder: scheduleMessages.timezoneSearchPlaceholder }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { children: scheduleMessages.timezoneEmpty }), _jsx(ComboboxList, { children: _jsx(ComboboxCollection, { children: (id) => {
|
|
220
|
+
const tz = TIMEZONE_OPTIONS.find((t) => t.id === id);
|
|
221
|
+
return (_jsxs(ComboboxItem, { value: id, children: [_jsx("span", { className: "font-mono text-xs", children: id }), tz ? (_jsx("span", { className: "ml-2 text-xs text-muted-foreground", children: tz.label })) : null] }, id));
|
|
222
|
+
} }) })] })] }), form.formState.errors.timezone && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.timezone.message }))] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: scheduleMessages.maxCapacityLabel }), _jsx(Input, { ...form.register("maxCapacity"), type: "number", min: "0", step: "1" }), form.formState.errors.maxCapacity && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.maxCapacity.message }))] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: scheduleMessages.cutoffLabel }), _jsx(Input, { ...form.register("cutoffMinutes"), type: "number", min: "0", step: "1", placeholder: "0" })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Switch, { id: "schedule-active", checked: active, onCheckedChange: (c) => form.setValue("active", c) }), _jsx(Label, { htmlFor: "schedule-active", className: "font-normal cursor-pointer", children: scheduleMessages.activeDescription })] })] }), _jsxs("div", { className: "flex items-center justify-end gap-2", children: [onCancel ? (_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancel, children: productMessages.cancel })) : null, _jsxs(Button, { type: "submit", size: "sm", disabled: form.formState.isSubmitting, children: [form.formState.isSubmitting && _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), isEditing ? productMessages.saveChanges : scheduleMessages.create] })] })] }));
|
|
223
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type DayServiceData } from "./product-service-form.js";
|
|
2
|
+
export type { DayServiceData };
|
|
3
|
+
type ServiceDialogProps = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
productId: string;
|
|
7
|
+
dayId: string;
|
|
8
|
+
service?: DayServiceData;
|
|
9
|
+
onSuccess: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function ServiceDialog({ open, onOpenChange, productId, dayId, service, onSuccess, }: ServiceDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=product-service-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-service-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-service-dialog.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,2BAA2B,CAAA;AAE5E,YAAY,EAAE,cAAc,EAAE,CAAA;AAE9B,KAAK,kBAAkB,GAAG;IACxB,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,cAAc,CAAA;IACxB,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,CAAA;AAED,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,GACV,EAAE,kBAAkB,2CAyBpB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, } from "@voyant-travel/ui/components";
|
|
3
|
+
import { useProductDetailMessages } from "./host.js";
|
|
4
|
+
import { ServiceForm } from "./product-service-form.js";
|
|
5
|
+
export function ServiceDialog({ open, onOpenChange, productId, dayId, service, onSuccess, }) {
|
|
6
|
+
const messages = useProductDetailMessages();
|
|
7
|
+
const serviceMessages = messages.products.operations.services;
|
|
8
|
+
const isEditing = !!service;
|
|
9
|
+
return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { side: "right", size: "lg", children: [_jsx(SheetHeader, { children: _jsx(SheetTitle, { children: isEditing ? serviceMessages.editTitle : serviceMessages.newTitle }) }), _jsx(SheetBody, { children: _jsx(ServiceForm, { productId: productId, dayId: dayId, service: service, onSuccess: onSuccess, onCancel: () => onOpenChange(false) }) })] }) }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type DayServiceData = {
|
|
2
|
+
id: string;
|
|
3
|
+
serviceType: "accommodation" | "transfer" | "experience" | "guide" | "meal" | "other";
|
|
4
|
+
name: string;
|
|
5
|
+
description: string | null;
|
|
6
|
+
countryCode: string | null;
|
|
7
|
+
supplierServiceId: string | null;
|
|
8
|
+
costCurrency: string;
|
|
9
|
+
costAmountCents: number;
|
|
10
|
+
quantity: number;
|
|
11
|
+
sortOrder: number | null;
|
|
12
|
+
notes: string | null;
|
|
13
|
+
};
|
|
14
|
+
export interface ServiceFormProps {
|
|
15
|
+
productId: string;
|
|
16
|
+
dayId: string;
|
|
17
|
+
service?: DayServiceData;
|
|
18
|
+
onSuccess: () => void;
|
|
19
|
+
onCancel?: () => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function ServiceForm({ productId, dayId, service, onSuccess, onCancel }: ServiceFormProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=product-service-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-service-form.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-service-form.tsx"],"names":[],"mappings":"AAgDA,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,eAAe,GAAG,UAAU,GAAG,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAA;IACrF,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAUD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAkDD,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAwP/F"}
|