@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,261 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { queryOptions, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@voyant-travel/ui/components";
|
|
5
|
+
import { useOptionalProductDetailHost, useProductDetailApi } from "./host.js";
|
|
6
|
+
const commerceQueryKeys = {
|
|
7
|
+
pricing: ["inventory-product-detail", "commerce", "pricing"],
|
|
8
|
+
markets: ["inventory-product-detail", "commerce", "markets"],
|
|
9
|
+
operations: ["inventory-product-detail", "operations"],
|
|
10
|
+
};
|
|
11
|
+
function toQueryString(filters) {
|
|
12
|
+
const params = new URLSearchParams();
|
|
13
|
+
for (const [key, value] of Object.entries(filters)) {
|
|
14
|
+
if (value === undefined || value === null || value === "")
|
|
15
|
+
continue;
|
|
16
|
+
params.set(key, String(value));
|
|
17
|
+
}
|
|
18
|
+
const qs = params.toString();
|
|
19
|
+
return qs ? `?${qs}` : "";
|
|
20
|
+
}
|
|
21
|
+
async function list(api, path, filters = {}) {
|
|
22
|
+
return api.get(`${path}${toQueryString(filters)}`);
|
|
23
|
+
}
|
|
24
|
+
async function createRecord(api, path, input) {
|
|
25
|
+
const response = await api.post(path, input);
|
|
26
|
+
return response.data;
|
|
27
|
+
}
|
|
28
|
+
async function updateRecord(api, path, id, input) {
|
|
29
|
+
const response = await api.patch(`${path}/${id}`, input);
|
|
30
|
+
return response.data;
|
|
31
|
+
}
|
|
32
|
+
async function deleteRecord(api, path, id) {
|
|
33
|
+
return api.delete(`${path}/${id}`);
|
|
34
|
+
}
|
|
35
|
+
export function getOptionPriceRulesQueryOptions(api, filters = {}) {
|
|
36
|
+
return queryOptions({
|
|
37
|
+
queryKey: [...commerceQueryKeys.pricing, "option-price-rules", filters],
|
|
38
|
+
queryFn: () => list(api, "/v1/pricing/option-price-rules", filters),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export function getOptionUnitPriceRulesQueryOptions(api, filters = {}) {
|
|
42
|
+
return queryOptions({
|
|
43
|
+
queryKey: [...commerceQueryKeys.pricing, "option-unit-price-rules", filters],
|
|
44
|
+
queryFn: () => list(api, "/v1/pricing/option-unit-price-rules", filters),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export function getPricingCategoriesQueryOptions(api, filters = {}) {
|
|
48
|
+
return queryOptions({
|
|
49
|
+
queryKey: [...commerceQueryKeys.pricing, "pricing-categories", filters],
|
|
50
|
+
queryFn: () => list(api, "/v1/pricing/pricing-categories", filters),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export function getPriceCatalogsQueryOptions(api, filters = {}) {
|
|
54
|
+
return queryOptions({
|
|
55
|
+
queryKey: [...commerceQueryKeys.pricing, "price-catalogs", filters],
|
|
56
|
+
queryFn: () => list(api, "/v1/pricing/price-catalogs", filters),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export function getPriceSchedulesQueryOptions(api, filters = {}) {
|
|
60
|
+
return queryOptions({
|
|
61
|
+
queryKey: [...commerceQueryKeys.pricing, "price-schedules", filters],
|
|
62
|
+
queryFn: () => list(api, "/v1/pricing/price-schedules", filters),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export function getCancellationPoliciesQueryOptions(api, filters = {}) {
|
|
66
|
+
return queryOptions({
|
|
67
|
+
queryKey: [...commerceQueryKeys.pricing, "cancellation-policies", filters],
|
|
68
|
+
queryFn: () => list(api, "/v1/pricing/cancellation-policies", filters),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export function getExtraPriceRulesQueryOptions(api, filters = {}) {
|
|
72
|
+
return queryOptions({
|
|
73
|
+
queryKey: [...commerceQueryKeys.pricing, "extra-price-rules", filters],
|
|
74
|
+
queryFn: () => list(api, "/v1/pricing/extra-price-rules", filters),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export function getDeparturePriceOverridesQueryOptions(api, filters = {}) {
|
|
78
|
+
return queryOptions({
|
|
79
|
+
queryKey: [...commerceQueryKeys.pricing, "departure-price-overrides", filters],
|
|
80
|
+
queryFn: () => list(api, "/v1/pricing/departure-price-overrides", filters),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
export function getMarketsQueryOptions(api, filters = {}) {
|
|
84
|
+
return queryOptions({
|
|
85
|
+
queryKey: [...commerceQueryKeys.markets, "markets", filters],
|
|
86
|
+
queryFn: () => list(api, "/v1/markets/markets", filters),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export function getMarketProductRulesQueryOptions(api, filters = {}) {
|
|
90
|
+
return queryOptions({
|
|
91
|
+
queryKey: [...commerceQueryKeys.markets, "product-rules", filters],
|
|
92
|
+
queryFn: () => list(api, "/v1/markets/product-rules", filters),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
export function getProductResourceTemplatesQueryOptions(api, productId) {
|
|
96
|
+
return queryOptions({
|
|
97
|
+
queryKey: [...commerceQueryKeys.operations, "resource-templates", productId],
|
|
98
|
+
queryFn: () => api.get(`/v1/admin/operations/availability/products/${productId}/allocation/resource-templates`),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function useApiMutation(path, cacheKey) {
|
|
102
|
+
const api = useProductDetailApi();
|
|
103
|
+
const queryClient = useQueryClient();
|
|
104
|
+
const invalidate = () => queryClient.invalidateQueries({ queryKey: cacheKey });
|
|
105
|
+
const create = useMutation({
|
|
106
|
+
mutationFn: (input) => createRecord(api, path, input),
|
|
107
|
+
onSuccess: () => void invalidate(),
|
|
108
|
+
});
|
|
109
|
+
const update = useMutation({
|
|
110
|
+
mutationFn: ({ id, input }) => updateRecord(api, path, id, input),
|
|
111
|
+
onSuccess: () => void invalidate(),
|
|
112
|
+
});
|
|
113
|
+
const remove = useMutation({
|
|
114
|
+
mutationFn: (id) => deleteRecord(api, path, id),
|
|
115
|
+
onSuccess: () => void invalidate(),
|
|
116
|
+
});
|
|
117
|
+
return { create, update, remove };
|
|
118
|
+
}
|
|
119
|
+
export function useOptionPriceRuleMutation() {
|
|
120
|
+
return useApiMutation("/v1/pricing/option-price-rules", [
|
|
121
|
+
...commerceQueryKeys.pricing,
|
|
122
|
+
"option-price-rules",
|
|
123
|
+
]);
|
|
124
|
+
}
|
|
125
|
+
export function useOptionUnitPriceRuleMutation() {
|
|
126
|
+
return useApiMutation("/v1/pricing/option-unit-price-rules", [
|
|
127
|
+
...commerceQueryKeys.pricing,
|
|
128
|
+
"option-unit-price-rules",
|
|
129
|
+
]);
|
|
130
|
+
}
|
|
131
|
+
export function usePriceCatalogMutation() {
|
|
132
|
+
return useApiMutation("/v1/pricing/price-catalogs", [
|
|
133
|
+
...commerceQueryKeys.pricing,
|
|
134
|
+
"price-catalogs",
|
|
135
|
+
]);
|
|
136
|
+
}
|
|
137
|
+
export function usePricingCategoryMutation() {
|
|
138
|
+
return useApiMutation("/v1/pricing/pricing-categories", [
|
|
139
|
+
...commerceQueryKeys.pricing,
|
|
140
|
+
"pricing-categories",
|
|
141
|
+
]);
|
|
142
|
+
}
|
|
143
|
+
export function useExtraPriceRuleMutation() {
|
|
144
|
+
return useApiMutation("/v1/pricing/extra-price-rules", [
|
|
145
|
+
...commerceQueryKeys.pricing,
|
|
146
|
+
"extra-price-rules",
|
|
147
|
+
]);
|
|
148
|
+
}
|
|
149
|
+
export function useDeparturePriceOverrideMutation() {
|
|
150
|
+
return useApiMutation("/v1/pricing/departure-price-overrides", [
|
|
151
|
+
...commerceQueryKeys.pricing,
|
|
152
|
+
"departure-price-overrides",
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
export function useMarketProductRuleMutation() {
|
|
156
|
+
return useApiMutation("/v1/markets/product-rules", [
|
|
157
|
+
...commerceQueryKeys.markets,
|
|
158
|
+
"product-rules",
|
|
159
|
+
]);
|
|
160
|
+
}
|
|
161
|
+
export function useExtraPriceRules(filters = {}) {
|
|
162
|
+
const api = useProductDetailApi();
|
|
163
|
+
return useQuery(getExtraPriceRulesQueryOptions(api, filters));
|
|
164
|
+
}
|
|
165
|
+
export function useMarkets(filters) {
|
|
166
|
+
const api = useProductDetailApi();
|
|
167
|
+
return useQuery(getMarketsQueryOptions(api, filters));
|
|
168
|
+
}
|
|
169
|
+
export function useMarketProductRules(filters) {
|
|
170
|
+
const api = useProductDetailApi();
|
|
171
|
+
return useQuery(getMarketProductRulesQueryOptions(api, filters));
|
|
172
|
+
}
|
|
173
|
+
export function useProductResourceTemplates(productId) {
|
|
174
|
+
const api = useProductDetailApi();
|
|
175
|
+
return useQuery({
|
|
176
|
+
...getProductResourceTemplatesQueryOptions(api, productId),
|
|
177
|
+
enabled: Boolean(productId),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
export function useDuplicateOptionPricingMutation(api) {
|
|
181
|
+
const host = useOptionalProductDetailHost();
|
|
182
|
+
const resolvedApi = api ?? host?.api;
|
|
183
|
+
const queryClient = useQueryClient();
|
|
184
|
+
return useMutation({
|
|
185
|
+
mutationFn: async ({ sourceOptionId, targetOptionId, productId, unitIdMap, }) => {
|
|
186
|
+
if (!resolvedApi)
|
|
187
|
+
return;
|
|
188
|
+
const sourceRules = await list(resolvedApi, "/v1/pricing/option-price-rules", { optionId: sourceOptionId, limit: 100 });
|
|
189
|
+
for (const rule of sourceRules.data) {
|
|
190
|
+
const createdRule = await createRecord(resolvedApi, "/v1/pricing/option-price-rules", {
|
|
191
|
+
productId,
|
|
192
|
+
optionId: targetOptionId,
|
|
193
|
+
priceCatalogId: rule.priceCatalogId,
|
|
194
|
+
priceScheduleId: rule.priceScheduleId,
|
|
195
|
+
cancellationPolicyId: rule.cancellationPolicyId,
|
|
196
|
+
code: rule.code ? `${rule.code}-copy` : null,
|
|
197
|
+
name: rule.name,
|
|
198
|
+
description: rule.description,
|
|
199
|
+
pricingMode: rule.pricingMode,
|
|
200
|
+
baseSellAmountCents: rule.baseSellAmountCents,
|
|
201
|
+
baseCostAmountCents: rule.baseCostAmountCents,
|
|
202
|
+
minPerBooking: rule.minPerBooking,
|
|
203
|
+
maxPerBooking: rule.maxPerBooking,
|
|
204
|
+
allPricingCategories: rule.allPricingCategories,
|
|
205
|
+
isDefault: rule.isDefault,
|
|
206
|
+
active: rule.active,
|
|
207
|
+
notes: rule.notes,
|
|
208
|
+
});
|
|
209
|
+
const unitRules = await list(resolvedApi, "/v1/pricing/option-unit-price-rules", { optionPriceRuleId: rule.id, limit: 100 });
|
|
210
|
+
for (const unitRule of unitRules.data) {
|
|
211
|
+
const targetUnitId = unitIdMap[unitRule.unitId];
|
|
212
|
+
if (!targetUnitId)
|
|
213
|
+
continue;
|
|
214
|
+
await createRecord(resolvedApi, "/v1/pricing/option-unit-price-rules", {
|
|
215
|
+
optionPriceRuleId: createdRule.id,
|
|
216
|
+
optionId: targetOptionId,
|
|
217
|
+
unitId: targetUnitId,
|
|
218
|
+
pricingCategoryId: unitRule.pricingCategoryId,
|
|
219
|
+
pricingMode: unitRule.pricingMode,
|
|
220
|
+
sellAmountCents: unitRule.sellAmountCents,
|
|
221
|
+
costAmountCents: unitRule.costAmountCents,
|
|
222
|
+
minQuantity: unitRule.minQuantity,
|
|
223
|
+
maxQuantity: unitRule.maxQuantity,
|
|
224
|
+
sortOrder: unitRule.sortOrder,
|
|
225
|
+
active: unitRule.active,
|
|
226
|
+
notes: unitRule.notes,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
onSuccess: () => {
|
|
232
|
+
void queryClient.invalidateQueries({ queryKey: commerceQueryKeys.pricing });
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function SelectById({ value, onChange, placeholder, disabled, items, }) {
|
|
237
|
+
return (_jsxs(Select, { value: value || undefined, onValueChange: (next) => onChange(next || null), disabled: disabled, items: items.map((item) => ({
|
|
238
|
+
value: item.id,
|
|
239
|
+
label: item.code ? `${item.name} (${item.code})` : item.name,
|
|
240
|
+
})), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, { placeholder: placeholder }) }), _jsx(SelectContent, { children: items.map((item) => (_jsx(SelectItem, { value: item.id, children: item.code ? `${item.name} (${item.code})` : item.name }, item.id))) })] }));
|
|
241
|
+
}
|
|
242
|
+
export function PriceCatalogCombobox(props) {
|
|
243
|
+
const api = useProductDetailApi();
|
|
244
|
+
const query = useQuery(getPriceCatalogsQueryOptions(api, { limit: 100 }));
|
|
245
|
+
return _jsx(SelectById, { ...props, items: query.data?.data ?? [] });
|
|
246
|
+
}
|
|
247
|
+
export function PriceScheduleCombobox({ priceCatalogId, ...props }) {
|
|
248
|
+
const api = useProductDetailApi();
|
|
249
|
+
const query = useQuery(getPriceSchedulesQueryOptions(api, { priceCatalogId: priceCatalogId || undefined, limit: 100 }));
|
|
250
|
+
return (_jsx(SelectById, { ...props, disabled: props.disabled || !priceCatalogId, items: query.data?.data ?? [] }));
|
|
251
|
+
}
|
|
252
|
+
export function CancellationPolicyCombobox(props) {
|
|
253
|
+
const api = useProductDetailApi();
|
|
254
|
+
const query = useQuery(getCancellationPoliciesQueryOptions(api, { limit: 100 }));
|
|
255
|
+
return _jsx(SelectById, { ...props, items: query.data?.data ?? [] });
|
|
256
|
+
}
|
|
257
|
+
export function PricingCategoryCombobox(props) {
|
|
258
|
+
const api = useProductDetailApi();
|
|
259
|
+
const query = useQuery(getPricingCategoriesQueryOptions(api, { active: true, limit: 100 }));
|
|
260
|
+
return _jsx(SelectById, { ...props, items: query.data?.data ?? [] });
|
|
261
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { OperatorAdminMessages } from "@voyant-travel/i18n";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import type { ProductMediaUploadHandler } from "../product-media-section.js";
|
|
4
|
+
/**
|
|
5
|
+
* The product-detail page and its sections are transport- and app-agnostic.
|
|
6
|
+
* The host application injects everything app-specific — localized messages, a
|
|
7
|
+
* REST client, the active locale, navigation, and a media upload handler — via
|
|
8
|
+
* this context so the same page can be mounted by any template.
|
|
9
|
+
*/
|
|
10
|
+
export type ProductDetailMessages = OperatorAdminMessages;
|
|
11
|
+
export interface ProductDetailApi {
|
|
12
|
+
get: <T = unknown>(path: string) => Promise<T>;
|
|
13
|
+
post: <T = unknown>(path: string, body?: unknown) => Promise<T>;
|
|
14
|
+
patch: <T = unknown>(path: string, body?: unknown) => Promise<T>;
|
|
15
|
+
delete: <T = unknown>(path: string) => Promise<T>;
|
|
16
|
+
}
|
|
17
|
+
export interface ProductDetailNavigation {
|
|
18
|
+
toProducts: () => void;
|
|
19
|
+
toProduct: (productId: string) => void;
|
|
20
|
+
toNewBooking: (productId: string) => void;
|
|
21
|
+
toAvailability: (slotId: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface ProductDetailBreadcrumb {
|
|
24
|
+
label: string;
|
|
25
|
+
href?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ProductDetailHostValue {
|
|
28
|
+
messages: ProductDetailMessages;
|
|
29
|
+
api: ProductDetailApi;
|
|
30
|
+
locale: string;
|
|
31
|
+
navigate: ProductDetailNavigation;
|
|
32
|
+
uploadMedia?: ProductMediaUploadHandler;
|
|
33
|
+
/** Optional app-shell breadcrumb sink (e.g. the operator admin shell). */
|
|
34
|
+
setBreadcrumbs?: (items: ProductDetailBreadcrumb[]) => void;
|
|
35
|
+
/** Optional extra content rendered under each product option (e.g. an app-specific resource panel). */
|
|
36
|
+
renderOptionExtras?: (productId: string, optionId: string) => ReactNode;
|
|
37
|
+
}
|
|
38
|
+
export declare function ProductDetailHostProvider({ value, children, }: {
|
|
39
|
+
value: ProductDetailHostValue;
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function useProductDetailHost(): ProductDetailHostValue;
|
|
43
|
+
export declare function useOptionalProductDetailHost(): ProductDetailHostValue | null;
|
|
44
|
+
/**
|
|
45
|
+
* Components keep their `messages.products.*` (and occasional sibling-namespace)
|
|
46
|
+
* access verbatim — the only change at the call site is the hook name
|
|
47
|
+
* (`useAdminMessages` → `useProductDetailMessages`).
|
|
48
|
+
*/
|
|
49
|
+
export type ProductMessagesRoot = ProductDetailMessages;
|
|
50
|
+
export declare function useProductDetailMessages(): ProductMessagesRoot;
|
|
51
|
+
export declare function useProductDetailApi(): ProductDetailApi;
|
|
52
|
+
/** The active locale string (BCP-47), e.g. for `toLocaleString`/`Intl`. */
|
|
53
|
+
export declare function useProductLocale(): string;
|
|
54
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/host.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,EAAiB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAEjE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E;;;;;GAKG;AAKH,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,CAAA;AAEzD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;IAC9C,IAAI,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;IAC/D,KAAK,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;IAChE,MAAM,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;CAClD;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CACzC;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,qBAAqB,CAAA;IAC/B,GAAG,EAAE,gBAAgB,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,uBAAuB,CAAA;IACjC,WAAW,CAAC,EAAE,yBAAyB,CAAA;IACvC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,EAAE,KAAK,IAAI,CAAA;IAC3D,uGAAuG;IACvG,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAA;CACxE;AAID,wBAAgB,yBAAyB,CAAC,EACxC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,sBAAsB,CAAA;IAC7B,QAAQ,EAAE,SAAS,CAAA;CACpB,2CAIA;AAED,wBAAgB,oBAAoB,IAAI,sBAAsB,CAM7D;AAED,wBAAgB,4BAA4B,IAAI,sBAAsB,GAAG,IAAI,CAE5E;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAA;AAEvD,wBAAgB,wBAAwB,IAAI,mBAAmB,CAE9D;AAED,wBAAgB,mBAAmB,IAAI,gBAAgB,CAEtD;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
const ProductDetailHostContext = createContext(null);
|
|
5
|
+
export function ProductDetailHostProvider({ value, children, }) {
|
|
6
|
+
return (_jsx(ProductDetailHostContext.Provider, { value: value, children: children }));
|
|
7
|
+
}
|
|
8
|
+
export function useProductDetailHost() {
|
|
9
|
+
const context = useContext(ProductDetailHostContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error("useProductDetailHost must be used within a ProductDetailHostProvider");
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
export function useOptionalProductDetailHost() {
|
|
16
|
+
return useContext(ProductDetailHostContext);
|
|
17
|
+
}
|
|
18
|
+
export function useProductDetailMessages() {
|
|
19
|
+
return useProductDetailHost().messages;
|
|
20
|
+
}
|
|
21
|
+
export function useProductDetailApi() {
|
|
22
|
+
return useProductDetailHost().api;
|
|
23
|
+
}
|
|
24
|
+
/** The active locale string (BCP-47), e.g. for `toLocaleString`/`Intl`. */
|
|
25
|
+
export function useProductLocale() {
|
|
26
|
+
return useProductDetailHost().locale;
|
|
27
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { type ProductDetailApi, type ProductDetailBreadcrumb, ProductDetailHostProvider, type ProductDetailHostValue, type ProductDetailMessages, type ProductDetailNavigation, useProductDetailHost, } from "./host.js";
|
|
2
|
+
export { ProductDetailPage } from "./product-detail-page.js";
|
|
3
|
+
export { getChannelsQueryOptions, getProductChannelMappingsQueryOptions, getProductMediaQueryOptions, getProductRulesQueryOptions, getProductSlotsQueryOptions, } from "./product-detail-shared.js";
|
|
4
|
+
export { ProductDetailSkeleton } from "./product-detail-skeleton.js";
|
|
5
|
+
export { getPricingCategoriesQueryOptions, getProductOptionsQueryOptions, } from "./product-options-shared.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,yBAAyB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,oBAAoB,GACrB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EACL,uBAAuB,EACvB,qCAAqC,EACrC,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EACL,gCAAgC,EAChC,6BAA6B,GAC9B,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ProductDetailHostProvider, useProductDetailHost, } from "./host.js";
|
|
2
|
+
export { ProductDetailPage } from "./product-detail-page.js";
|
|
3
|
+
export { getChannelsQueryOptions, getProductChannelMappingsQueryOptions, getProductMediaQueryOptions, getProductRulesQueryOptions, getProductSlotsQueryOptions, } from "./product-detail-shared.js";
|
|
4
|
+
export { ProductDetailSkeleton } from "./product-detail-skeleton.js";
|
|
5
|
+
export { getPricingCategoriesQueryOptions, getProductOptionsQueryOptions, } from "./product-options-shared.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-activity-section.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-activity-section.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,sBAAsB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,2CAuE1E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge, Button } from "@voyant-travel/ui/components";
|
|
3
|
+
import { Activity, Loader2 } from "lucide-react";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { useProductActionLedger, } from "../../index.js";
|
|
6
|
+
import { actionLedgerRiskVariant, actionLedgerStatusVariant, } from "../product-action-ledger-card.js";
|
|
7
|
+
import { useProductDetailMessages, useProductLocale } from "./host.js";
|
|
8
|
+
import { Section } from "./product-detail-sections.js";
|
|
9
|
+
function formatActionLedgerName(actionName) {
|
|
10
|
+
const label = actionName.replace(/^product\./, "").replace(/[._-]/g, " ");
|
|
11
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
12
|
+
}
|
|
13
|
+
export function ProductActivitySection({ productId }) {
|
|
14
|
+
const messages = useProductDetailMessages();
|
|
15
|
+
const productMessages = messages.products.core;
|
|
16
|
+
const resolvedLocale = useProductLocale();
|
|
17
|
+
const [cursor, setCursor] = useState(null);
|
|
18
|
+
const ledgerQuery = useProductActionLedger(productId, { cursor, limit: 20 });
|
|
19
|
+
const [pages, setPages] = useState([]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const page = ledgerQuery.data;
|
|
22
|
+
if (!page)
|
|
23
|
+
return;
|
|
24
|
+
setPages((current) => {
|
|
25
|
+
if (current.some((entry) => entry.data[0]?.id === page.data[0]?.id))
|
|
26
|
+
return current;
|
|
27
|
+
return cursor ? [...current, page] : [page];
|
|
28
|
+
});
|
|
29
|
+
}, [ledgerQuery.data, cursor]);
|
|
30
|
+
const entries = pages.flatMap((page) => page.data);
|
|
31
|
+
const nextCursor = pages.at(-1)?.pageInfo.nextCursor ?? null;
|
|
32
|
+
const formatTimestamp = (iso) => new Date(iso).toLocaleString(resolvedLocale, { dateStyle: "medium", timeStyle: "short" });
|
|
33
|
+
return (_jsx(Section, { title: productMessages.activityTitle, contentClassName: "p-0", children: ledgerQuery.isPending && entries.length === 0 ? (_jsx("div", { className: "flex justify-center py-8", children: _jsx(Loader2, { className: "size-5 animate-spin text-muted-foreground", "aria-hidden": "true" }) })) : ledgerQuery.isError && entries.length === 0 ? (_jsx("p", { className: "py-8 text-center text-sm text-muted-foreground", children: productMessages.activityLoadFailed })) : entries.length === 0 ? (_jsx("p", { className: "py-8 text-center text-sm text-muted-foreground", children: productMessages.activityEmpty })) : (_jsxs("div", { className: "max-h-[420px] overflow-y-auto", children: [_jsx("ul", { className: "divide-y", children: entries.map((entry) => (_jsx(ActivityRow, { entry: entry, timestamp: formatTimestamp(entry.occurredAt) }, entry.id))) }), nextCursor ? (_jsx("div", { className: "border-t p-2", children: _jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "w-full", disabled: ledgerQuery.isFetching, onClick: () => setCursor(nextCursor), children: [ledgerQuery.isFetching ? (_jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": "true" })) : null, productMessages.activityLoadMore] }) })) : null] })) }));
|
|
34
|
+
}
|
|
35
|
+
function ActivityRow({ entry, timestamp, }) {
|
|
36
|
+
return (_jsxs("li", { className: "flex items-start gap-2.5 px-4 py-2.5", children: [_jsx(Activity, { className: "mt-0.5 size-3.5 shrink-0 text-muted-foreground", "aria-hidden": "true" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [_jsx("span", { className: "truncate text-xs font-medium", children: formatActionLedgerName(entry.actionName) }), _jsx(Badge, { variant: actionLedgerStatusVariant[entry.status] ?? "secondary", className: "px-1.5 py-0 text-[10px]", children: entry.status.replace(/_/g, " ") }), _jsx(Badge, { variant: actionLedgerRiskVariant[entry.evaluatedRisk] ?? "outline", className: "px-1.5 py-0 text-[10px]", children: entry.evaluatedRisk })] }), _jsxs("p", { className: "mt-0.5 truncate text-[11px] text-muted-foreground", children: [entry.principalType, ":", entry.principalId, " \u00B7 ", timestamp] }), entry.mutationSummary ? (_jsx("p", { className: "mt-0.5 truncate text-[11px] text-muted-foreground", children: entry.mutationSummary })) : null] })] }));
|
|
37
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ProductDayRecord } from "../../index.js";
|
|
2
|
+
import type { ProductMediaUploadHandler } from "../product-media-section.js";
|
|
3
|
+
export interface ProductDaySheetProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
productId: string;
|
|
7
|
+
itineraryId?: string;
|
|
8
|
+
day?: ProductDayRecord;
|
|
9
|
+
nextDayNumber?: number;
|
|
10
|
+
uploadMedia?: ProductMediaUploadHandler;
|
|
11
|
+
onSuccess?: (day: ProductDayRecord) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function ProductDaySheet({ open, onOpenChange, productId, itineraryId, day, nextDayNumber, uploadMedia, onSuccess, }: ProductDaySheetProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=product-day-sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-day-sheet.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-day-sheet.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,gBAAgB,EAAqC,MAAM,gBAAgB,CAAA;AAEzF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAK5E,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,CAAC,EAAE,gBAAgB,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,yBAAyB,CAAA;IACvC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAC5C;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,WAAW,EACX,GAAG,EACH,aAAa,EACb,WAAW,EACX,SAAS,GACV,EAAE,oBAAoB,2CAkLtB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Input, Label, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, } from "@voyant-travel/ui/components";
|
|
3
|
+
import { Loader2 } from "lucide-react";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { ProductsUiMessagesProvider } from "../../i18n/index.js";
|
|
6
|
+
import { useProduct, useProductDayMutation } from "../../index.js";
|
|
7
|
+
import { ProductDayMediaTray } from "../product-day-media-tray.js";
|
|
8
|
+
import { useProductDetailMessages, useProductLocale } from "./host.js";
|
|
9
|
+
import { DayTranslatableField, useProductDayTranslationDrafts } from "./product-day-translation.js";
|
|
10
|
+
import { ContentLanguageSwitcher, richTextHasContent } from "./product-translation-popover.js";
|
|
11
|
+
export function ProductDaySheet({ open, onOpenChange, productId, itineraryId, day, nextDayNumber, uploadMedia, onSuccess, }) {
|
|
12
|
+
const messages = useProductDetailMessages();
|
|
13
|
+
const productMessages = messages.products.core;
|
|
14
|
+
const resolvedLocale = useProductLocale();
|
|
15
|
+
const isEdit = !!day;
|
|
16
|
+
const productQuery = useProduct(productId);
|
|
17
|
+
const adminBaseLocale = resolvedLocale.split("-")[0]?.toLowerCase() || "en";
|
|
18
|
+
const defaultLanguageTag = productQuery.data?.defaultLanguageTag?.trim() || adminBaseLocale;
|
|
19
|
+
const [dayNumber, setDayNumber] = useState("1");
|
|
20
|
+
const [title, setTitle] = useState("");
|
|
21
|
+
const [description, setDescription] = useState("");
|
|
22
|
+
const [location, setLocation] = useState("");
|
|
23
|
+
const [error, setError] = useState(null);
|
|
24
|
+
const dayMutation = useProductDayMutation();
|
|
25
|
+
const translations = useProductDayTranslationDrafts(productId, day?.id ?? null);
|
|
26
|
+
const [activeLanguage, setActiveLanguage] = useState(defaultLanguageTag);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
setActiveLanguage(defaultLanguageTag);
|
|
29
|
+
}, [defaultLanguageTag]);
|
|
30
|
+
// Reset the base fields whenever the sheet opens for a different day.
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!open)
|
|
33
|
+
return;
|
|
34
|
+
setDayNumber(String(day?.dayNumber ?? nextDayNumber ?? 1));
|
|
35
|
+
setTitle(day?.title ?? "");
|
|
36
|
+
setDescription(day?.description ?? "");
|
|
37
|
+
setLocation(day?.location ?? "");
|
|
38
|
+
setError(null);
|
|
39
|
+
}, [open, day, nextDayNumber]);
|
|
40
|
+
const isSubmitting = dayMutation.create.isPending || dayMutation.update.isPending;
|
|
41
|
+
const handleSubmit = async (event) => {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
setError(null);
|
|
44
|
+
const parsedDayNumber = Number.parseInt(dayNumber || "0", 10);
|
|
45
|
+
if (!Number.isFinite(parsedDayNumber) || parsedDayNumber < 1) {
|
|
46
|
+
setError(productMessages.dayNumberMin);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const payload = {
|
|
50
|
+
dayNumber: parsedDayNumber,
|
|
51
|
+
title: title.trim() ? title.trim() : null,
|
|
52
|
+
description: richTextHasContent(description) ? description : null,
|
|
53
|
+
location: location.trim() ? location.trim() : null,
|
|
54
|
+
};
|
|
55
|
+
try {
|
|
56
|
+
const savedDay = isEdit
|
|
57
|
+
? await dayMutation.update.mutateAsync({ productId, dayId: day.id, input: payload })
|
|
58
|
+
: await dayMutation.create.mutateAsync({ productId, itineraryId, ...payload });
|
|
59
|
+
await translations.persist(productId, savedDay.id, defaultLanguageTag);
|
|
60
|
+
onSuccess?.(savedDay);
|
|
61
|
+
onOpenChange(false);
|
|
62
|
+
}
|
|
63
|
+
catch (submissionError) {
|
|
64
|
+
setError(submissionError instanceof Error ? submissionError.message : productMessages.daySaveFailed);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { side: "right", size: "lg", children: [_jsx(SheetHeader, { children: _jsx(SheetTitle, { children: isEdit ? productMessages.daySheetEditTitle : productMessages.daySheetNewTitle }) }), _jsx(SheetBody, { children: _jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-4", children: [_jsx(ContentLanguageSwitcher, { activeLanguage: activeLanguage, defaultLanguageTag: defaultLanguageTag, languageTags: translations.drafts.map((draft) => draft.languageTag), messages: productMessages, onSelect: setActiveLanguage, onAddLanguage: (code) => {
|
|
68
|
+
translations.addLanguage(code);
|
|
69
|
+
setActiveLanguage(code);
|
|
70
|
+
}, onRemoveLanguage: (code) => {
|
|
71
|
+
translations.removeLanguage(code);
|
|
72
|
+
if (activeLanguage === code)
|
|
73
|
+
setActiveLanguage(defaultLanguageTag);
|
|
74
|
+
} }), _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: productMessages.dayNumberLabel }), _jsx(Input, { id: "product-day-number", type: "number", min: "1", required: true, value: dayNumber, onChange: (event) => setDayNumber(event.target.value) })] }), _jsx(DayTranslatableField, { field: "location", type: "text", label: productMessages.dayLocationLabel, activeLanguage: activeLanguage, defaultLanguageTag: defaultLanguageTag, base: { value: location, onChange: setLocation }, drafts: translations, messages: productMessages, placeholder: productMessages.dayLocationPlaceholder })] }), _jsx(DayTranslatableField, { field: "title", type: "text", label: productMessages.dayTitleLabel, activeLanguage: activeLanguage, defaultLanguageTag: defaultLanguageTag, base: { value: title, onChange: setTitle }, drafts: translations, messages: productMessages, placeholder: productMessages.dayTitlePlaceholder, autoFocus: true }), _jsx(DayTranslatableField, { field: "description", type: "richtext", label: productMessages.dayDescriptionLabel, activeLanguage: activeLanguage, defaultLanguageTag: defaultLanguageTag, base: { value: description, onChange: setDescription }, drafts: translations, messages: productMessages, placeholder: productMessages.dayDescriptionPlaceholder }), error ? _jsx("p", { className: "text-sm text-destructive", children: error }) : null, isEdit ? (_jsx("div", { className: "border-t pt-4", children: _jsx(ProductsUiMessagesProvider, { locale: resolvedLocale, children: _jsx(ProductDayMediaTray, { productId: productId, dayId: day.id, uploadMedia: uploadMedia }) }) })) : null, _jsxs("div", { className: "flex items-center justify-end gap-2", children: [_jsx(Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), disabled: isSubmitting, children: productMessages.cancel }), _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting ? (_jsx(Loader2, { className: "mr-2 size-4 animate-spin", "aria-hidden": "true" })) : null, isEdit ? productMessages.saveDay : productMessages.addDay] })] })] }) })] }) }));
|
|
75
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { useProductDetailMessages } from "./host.js";
|
|
2
|
+
type ProductCoreMessages = ReturnType<typeof useProductDetailMessages>["products"]["core"];
|
|
3
|
+
export type DayTranslatableField = "title" | "description" | "location";
|
|
4
|
+
export type DayTranslationDraft = {
|
|
5
|
+
id: string | null;
|
|
6
|
+
languageTag: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
location: string;
|
|
10
|
+
};
|
|
11
|
+
export interface ProductDayTranslationDrafts {
|
|
12
|
+
drafts: DayTranslationDraft[];
|
|
13
|
+
setFieldValue: (languageTag: string, field: DayTranslatableField, value: string) => void;
|
|
14
|
+
addLanguage: (languageTag: string) => void;
|
|
15
|
+
removeLanguage: (languageTag: string) => void;
|
|
16
|
+
persist: (productId: string, dayId: string, defaultLanguageTag: string) => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* In-memory drafts for a day's translations. The default language's content
|
|
20
|
+
* lives in the base day columns (title/description/location all have base
|
|
21
|
+
* columns), so this only manages non-default-language translation rows.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useProductDayTranslationDrafts(productId: string | null, dayId: string | null): ProductDayTranslationDrafts;
|
|
24
|
+
export interface DayTranslatableFieldProps {
|
|
25
|
+
label: string;
|
|
26
|
+
type: "text" | "richtext";
|
|
27
|
+
field: DayTranslatableField;
|
|
28
|
+
activeLanguage: string;
|
|
29
|
+
defaultLanguageTag: string;
|
|
30
|
+
base: {
|
|
31
|
+
value: string;
|
|
32
|
+
onChange: (value: string) => void;
|
|
33
|
+
};
|
|
34
|
+
drafts: ProductDayTranslationDrafts;
|
|
35
|
+
messages: ProductCoreMessages;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
autoFocus?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare function DayTranslatableField({ label, type, field, activeLanguage, defaultLanguageTag, base, drafts, messages, placeholder, autoFocus, }: DayTranslatableFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=product-day-translation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-day-translation.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-day-translation.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAGzD,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1F,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,aAAa,GAAG,UAAU,CAAA;AAEvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAqBD,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,mBAAmB,EAAE,CAAA;IAC7B,aAAa,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxF,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7C,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACzF;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,GAAG,IAAI,GACnB,2BAA2B,CA2F7B;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;IACzB,KAAK,EAAE,oBAAoB,CAAA;IAC3B,cAAc,EAAE,MAAM,CAAA;IACtB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAA;IAC1D,MAAM,EAAE,2BAA2B,CAAA;IACnC,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,IAAI,EACJ,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,GACV,EAAE,yBAAyB,2CAmC3B"}
|