@voyant-travel/inventory-react 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/admin/index.d.ts +91 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +132 -0
- package/dist/admin/pages/product-detail-page.d.ts +18 -0
- package/dist/admin/pages/product-detail-page.d.ts.map +1 -0
- package/dist/admin/pages/product-detail-page.js +63 -0
- package/dist/admin/product-categories-host.d.ts +7 -0
- package/dist/admin/product-categories-host.d.ts.map +1 -0
- package/dist/admin/product-categories-host.js +11 -0
- package/dist/admin/product-detail-api.d.ts +22 -0
- package/dist/admin/product-detail-api.d.ts.map +1 -0
- package/dist/admin/product-detail-api.js +58 -0
- package/dist/admin/products-host.d.ts +11 -0
- package/dist/admin/products-host.d.ts.map +1 -0
- package/dist/admin/products-host.js +17 -0
- package/dist/admin/products-list-skeleton.d.ts +10 -0
- package/dist/admin/products-list-skeleton.d.ts.map +1 -0
- package/dist/admin/products-list-skeleton.js +23 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +79 -0
- package/dist/components/option-unit-dialog.d.ts +11 -0
- package/dist/components/option-unit-dialog.d.ts.map +1 -0
- package/dist/components/option-unit-dialog.js +17 -0
- package/dist/components/option-unit-form.d.ts +17 -0
- package/dist/components/option-unit-form.d.ts.map +1 -0
- package/dist/components/option-unit-form.js +123 -0
- package/dist/components/product-action-ledger-card.d.ts +17 -0
- package/dist/components/product-action-ledger-card.d.ts.map +1 -0
- package/dist/components/product-action-ledger-card.js +73 -0
- package/dist/components/product-catalog-card.d.ts +14 -0
- package/dist/components/product-catalog-card.d.ts.map +1 -0
- package/dist/components/product-catalog-card.js +44 -0
- package/dist/components/product-categories-page.d.ts +7 -0
- package/dist/components/product-categories-page.d.ts.map +1 -0
- package/dist/components/product-categories-page.js +9 -0
- package/dist/components/product-category-combobox.d.ts +10 -0
- package/dist/components/product-category-combobox.d.ts.map +1 -0
- package/dist/components/product-category-combobox.js +47 -0
- package/dist/components/product-category-dialog.d.ts +9 -0
- package/dist/components/product-category-dialog.d.ts.map +1 -0
- package/dist/components/product-category-dialog.js +17 -0
- package/dist/components/product-category-form.d.ts +15 -0
- package/dist/components/product-category-form.d.ts.map +1 -0
- package/dist/components/product-category-form.js +82 -0
- package/dist/components/product-category-list.d.ts +5 -0
- package/dist/components/product-category-list.d.ts.map +1 -0
- package/dist/components/product-category-list.js +48 -0
- package/dist/components/product-combobox.d.ts +13 -0
- package/dist/components/product-combobox.d.ts.map +1 -0
- package/dist/components/product-combobox.js +23 -0
- package/dist/components/product-contract-template-combobox.d.ts +9 -0
- package/dist/components/product-contract-template-combobox.d.ts.map +1 -0
- package/dist/components/product-contract-template-combobox.js +97 -0
- package/dist/components/product-day-dialog.d.ts +20 -0
- package/dist/components/product-day-dialog.d.ts.map +1 -0
- package/dist/components/product-day-dialog.js +20 -0
- package/dist/components/product-day-form.d.ts +19 -0
- package/dist/components/product-day-form.d.ts.map +1 -0
- package/dist/components/product-day-form.js +77 -0
- package/dist/components/product-day-media-tray.d.ts +11 -0
- package/dist/components/product-day-media-tray.d.ts.map +1 -0
- package/dist/components/product-day-media-tray.js +74 -0
- package/dist/components/product-day-service-dialog.d.ts +14 -0
- package/dist/components/product-day-service-dialog.d.ts.map +1 -0
- package/dist/components/product-day-service-dialog.js +19 -0
- package/dist/components/product-day-service-form.d.ts +44 -0
- package/dist/components/product-day-service-form.d.ts.map +1 -0
- package/dist/components/product-day-service-form.js +152 -0
- package/dist/components/product-detail/commerce-client.d.ts +314 -0
- package/dist/components/product-detail/commerce-client.d.ts.map +1 -0
- package/dist/components/product-detail/commerce-client.js +261 -0
- package/dist/components/product-detail/host.d.ts +54 -0
- package/dist/components/product-detail/host.d.ts.map +1 -0
- package/dist/components/product-detail/host.js +27 -0
- package/dist/components/product-detail/index.d.ts +6 -0
- package/dist/components/product-detail/index.d.ts.map +1 -0
- package/dist/components/product-detail/index.js +5 -0
- package/dist/components/product-detail/product-activity-section.d.ts +4 -0
- package/dist/components/product-detail/product-activity-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-activity-section.js +37 -0
- package/dist/components/product-detail/product-day-sheet.d.ts +14 -0
- package/dist/components/product-detail/product-day-sheet.d.ts.map +1 -0
- package/dist/components/product-detail/product-day-sheet.js +75 -0
- package/dist/components/product-detail/product-day-translation.d.ts +41 -0
- package/dist/components/product-detail/product-day-translation.d.ts.map +1 -0
- package/dist/components/product-detail/product-day-translation.js +111 -0
- package/dist/components/product-detail/product-departure-dialog.d.ts +11 -0
- package/dist/components/product-detail/product-departure-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-departure-dialog.js +10 -0
- package/dist/components/product-detail/product-departure-form.d.ts +25 -0
- package/dist/components/product-detail/product-departure-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-departure-form.js +241 -0
- package/dist/components/product-detail/product-departure-pricing-override-dialog.d.ts +8 -0
- package/dist/components/product-detail/product-departure-pricing-override-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-departure-pricing-override-dialog.js +126 -0
- package/dist/components/product-detail/product-detail-availability-sections.d.ts +19 -0
- package/dist/components/product-detail/product-detail-availability-sections.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-availability-sections.js +29 -0
- package/dist/components/product-detail/product-detail-channel-section.d.ts +8 -0
- package/dist/components/product-detail/product-detail-channel-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-channel-section.js +16 -0
- package/dist/components/product-detail/product-detail-day-row.d.ts +14 -0
- package/dist/components/product-detail/product-detail-day-row.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-day-row.js +43 -0
- package/dist/components/product-detail/product-detail-dialog.d.ts +10 -0
- package/dist/components/product-detail/product-detail-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-dialog.js +10 -0
- package/dist/components/product-detail/product-detail-form.d.ts +22 -0
- package/dist/components/product-detail/product-detail-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-form.js +205 -0
- package/dist/components/product-detail/product-detail-header.d.ts +12 -0
- package/dist/components/product-detail/product-detail-header.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-header.js +19 -0
- package/dist/components/product-detail/product-detail-itinerary-section.d.ts +4 -0
- package/dist/components/product-detail/product-detail-itinerary-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-itinerary-section.js +201 -0
- package/dist/components/product-detail/product-detail-media-sections.d.ts +15 -0
- package/dist/components/product-detail/product-detail-media-sections.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-media-sections.js +19 -0
- package/dist/components/product-detail/product-detail-organize-section.d.ts +6 -0
- package/dist/components/product-detail/product-detail-organize-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-organize-section.js +18 -0
- package/dist/components/product-detail/product-detail-page.d.ts +4 -0
- package/dist/components/product-detail/product-detail-page.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-page.js +95 -0
- package/dist/components/product-detail/product-detail-section-shell.d.ts +19 -0
- package/dist/components/product-detail/product-detail-section-shell.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-section-shell.js +23 -0
- package/dist/components/product-detail/product-detail-sections.d.ts +7 -0
- package/dist/components/product-detail/product-detail-sections.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-sections.js +6 -0
- package/dist/components/product-detail/product-detail-shared.d.ts +264 -0
- package/dist/components/product-detail/product-detail-shared.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-shared.js +157 -0
- package/dist/components/product-detail/product-detail-skeleton.d.ts +9 -0
- package/dist/components/product-detail/product-detail-skeleton.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-skeleton.js +53 -0
- package/dist/components/product-detail/product-detail-summary-section.d.ts +6 -0
- package/dist/components/product-detail/product-detail-summary-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-detail-summary-section.js +66 -0
- package/dist/components/product-detail/product-extra-dialog.d.ts +21 -0
- package/dist/components/product-detail/product-extra-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-extra-dialog.js +131 -0
- package/dist/components/product-detail/product-itinerary-form.d.ts +16 -0
- package/dist/components/product-detail/product-itinerary-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-itinerary-form.js +38 -0
- package/dist/components/product-detail/product-market-rules-section.d.ts +6 -0
- package/dist/components/product-detail/product-market-rules-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-market-rules-section.js +81 -0
- package/dist/components/product-detail/product-media-gallery.d.ts +19 -0
- package/dist/components/product-detail/product-media-gallery.d.ts.map +1 -0
- package/dist/components/product-detail/product-media-gallery.js +114 -0
- package/dist/components/product-detail/product-option-price-rule-dialog.d.ts +12 -0
- package/dist/components/product-detail/product-option-price-rule-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-option-price-rule-dialog.js +10 -0
- package/dist/components/product-detail/product-option-price-rule-form.d.ts +29 -0
- package/dist/components/product-detail/product-option-price-rule-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-option-price-rule-form.js +122 -0
- package/dist/components/product-detail/product-option-pricing-grid.d.ts +16 -0
- package/dist/components/product-detail/product-option-pricing-grid.d.ts.map +1 -0
- package/dist/components/product-detail/product-option-pricing-grid.js +236 -0
- package/dist/components/product-detail/product-options-extra-price-rules.d.ts +8 -0
- package/dist/components/product-detail/product-options-extra-price-rules.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-extra-price-rules.js +123 -0
- package/dist/components/product-detail/product-options-pricing-helpers.d.ts +14 -0
- package/dist/components/product-detail/product-options-pricing-helpers.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-pricing-helpers.js +49 -0
- package/dist/components/product-detail/product-options-pricing-panel.d.ts +17 -0
- package/dist/components/product-detail/product-options-pricing-panel.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-pricing-panel.js +88 -0
- package/dist/components/product-detail/product-options-pricing.d.ts +5 -0
- package/dist/components/product-detail/product-options-pricing.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-pricing.js +4 -0
- package/dist/components/product-detail/product-options-shared.d.ts +236 -0
- package/dist/components/product-detail/product-options-shared.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-shared.js +57 -0
- package/dist/components/product-detail/product-options-traveler-category-dialog.d.ts +12 -0
- package/dist/components/product-detail/product-options-traveler-category-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-traveler-category-dialog.js +132 -0
- package/dist/components/product-detail/product-options-unit-price-matrix.d.ts +10 -0
- package/dist/components/product-detail/product-options-unit-price-matrix.d.ts.map +1 -0
- package/dist/components/product-detail/product-options-unit-price-matrix.js +103 -0
- package/dist/components/product-detail/product-payment-policy-section.d.ts +17 -0
- package/dist/components/product-detail/product-payment-policy-section.d.ts.map +1 -0
- package/dist/components/product-detail/product-payment-policy-section.js +58 -0
- package/dist/components/product-detail/product-schedule-dialog.d.ts +11 -0
- package/dist/components/product-detail/product-schedule-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-schedule-dialog.js +10 -0
- package/dist/components/product-detail/product-schedule-form.d.ts +17 -0
- package/dist/components/product-detail/product-schedule-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-schedule-form.js +223 -0
- package/dist/components/product-detail/product-service-dialog.d.ts +12 -0
- package/dist/components/product-detail/product-service-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-service-dialog.js +10 -0
- package/dist/components/product-detail/product-service-form.d.ts +22 -0
- package/dist/components/product-detail/product-service-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-service-form.js +154 -0
- package/dist/components/product-detail/product-translation-popover.d.ts +94 -0
- package/dist/components/product-detail/product-translation-popover.d.ts.map +1 -0
- package/dist/components/product-detail/product-translation-popover.js +238 -0
- package/dist/components/product-detail/product-unit-dialog.d.ts +14 -0
- package/dist/components/product-detail/product-unit-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-unit-dialog.js +10 -0
- package/dist/components/product-detail/product-unit-form.d.ts +34 -0
- package/dist/components/product-detail/product-unit-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-unit-form.js +139 -0
- package/dist/components/product-detail/product-unit-price-rule-dialog.d.ts +17 -0
- package/dist/components/product-detail/product-unit-price-rule-dialog.d.ts.map +1 -0
- package/dist/components/product-detail/product-unit-price-rule-dialog.js +10 -0
- package/dist/components/product-detail/product-unit-price-rule-form.d.ts +29 -0
- package/dist/components/product-detail/product-unit-price-rule-form.d.ts.map +1 -0
- package/dist/components/product-detail/product-unit-price-rule-form.js +144 -0
- package/dist/components/product-detail/rrule-labels.d.ts +2 -0
- package/dist/components/product-detail/rrule-labels.d.ts.map +1 -0
- package/dist/components/product-detail/rrule-labels.js +65 -0
- package/dist/components/product-detail/timezone-options.d.ts +9 -0
- package/dist/components/product-detail/timezone-options.d.ts.map +1 -0
- package/dist/components/product-detail/timezone-options.js +28 -0
- package/dist/components/product-detail/use-product-detail-data.d.ts +41 -0
- package/dist/components/product-detail/use-product-detail-data.d.ts.map +1 -0
- package/dist/components/product-detail/use-product-detail-data.js +143 -0
- package/dist/components/product-detail/use-product-detail-dialogs.d.ts +24 -0
- package/dist/components/product-detail/use-product-detail-dialogs.d.ts.map +1 -0
- package/dist/components/product-detail/use-product-detail-dialogs.js +40 -0
- package/dist/components/product-detail/zod-resolver.d.ts +4 -0
- package/dist/components/product-detail/zod-resolver.d.ts.map +1 -0
- package/dist/components/product-detail/zod-resolver.js +39 -0
- package/dist/components/product-detail-page.d.ts +57 -0
- package/dist/components/product-detail-page.d.ts.map +1 -0
- package/dist/components/product-detail-page.js +118 -0
- package/dist/components/product-detail.d.ts +2 -0
- package/dist/components/product-detail.d.ts.map +1 -0
- package/dist/components/product-detail.js +1 -0
- package/dist/components/product-dialog.d.ts +9 -0
- package/dist/components/product-dialog.d.ts.map +1 -0
- package/dist/components/product-dialog.js +13 -0
- package/dist/components/product-facility-combobox.d.ts +9 -0
- package/dist/components/product-facility-combobox.d.ts.map +1 -0
- package/dist/components/product-facility-combobox.js +94 -0
- package/dist/components/product-form.d.ts +14 -0
- package/dist/components/product-form.d.ts.map +1 -0
- package/dist/components/product-form.js +191 -0
- package/dist/components/product-itinerary-day-row.d.ts +22 -0
- package/dist/components/product-itinerary-day-row.d.ts.map +1 -0
- package/dist/components/product-itinerary-day-row.js +17 -0
- package/dist/components/product-itinerary-dialog.d.ts +16 -0
- package/dist/components/product-itinerary-dialog.d.ts.map +1 -0
- package/dist/components/product-itinerary-dialog.js +85 -0
- package/dist/components/product-itinerary-section.d.ts +16 -0
- package/dist/components/product-itinerary-section.d.ts.map +1 -0
- package/dist/components/product-itinerary-section.js +105 -0
- package/dist/components/product-list.d.ts +7 -0
- package/dist/components/product-list.d.ts.map +1 -0
- package/dist/components/product-list.js +155 -0
- package/dist/components/product-media-dialog.d.ts +11 -0
- package/dist/components/product-media-dialog.d.ts.map +1 -0
- package/dist/components/product-media-dialog.js +17 -0
- package/dist/components/product-media-form.d.ts +17 -0
- package/dist/components/product-media-form.d.ts.map +1 -0
- package/dist/components/product-media-form.js +101 -0
- package/dist/components/product-media-lightbox.d.ts +7 -0
- package/dist/components/product-media-lightbox.d.ts.map +1 -0
- package/dist/components/product-media-lightbox.js +31 -0
- package/dist/components/product-media-section.d.ts +27 -0
- package/dist/components/product-media-section.d.ts.map +1 -0
- package/dist/components/product-media-section.js +130 -0
- package/dist/components/product-media-tile.d.ts +17 -0
- package/dist/components/product-media-tile.d.ts.map +1 -0
- package/dist/components/product-media-tile.js +16 -0
- package/dist/components/product-option-dialog.d.ts +11 -0
- package/dist/components/product-option-dialog.d.ts.map +1 -0
- package/dist/components/product-option-dialog.js +17 -0
- package/dist/components/product-option-form.d.ts +17 -0
- package/dist/components/product-option-form.d.ts.map +1 -0
- package/dist/components/product-option-form.js +91 -0
- package/dist/components/product-options-section.d.ts +13 -0
- package/dist/components/product-options-section.d.ts.map +1 -0
- package/dist/components/product-options-section.js +200 -0
- package/dist/components/product-quick-view-sheet.d.ts +23 -0
- package/dist/components/product-quick-view-sheet.d.ts.map +1 -0
- package/dist/components/product-quick-view-sheet.js +65 -0
- package/dist/components/product-tag-dialog.d.ts +9 -0
- package/dist/components/product-tag-dialog.d.ts.map +1 -0
- package/dist/components/product-tag-dialog.js +17 -0
- package/dist/components/product-tag-form.d.ts +15 -0
- package/dist/components/product-tag-form.d.ts.map +1 -0
- package/dist/components/product-tag-form.js +48 -0
- package/dist/components/product-tag-list.d.ts +5 -0
- package/dist/components/product-tag-list.d.ts.map +1 -0
- package/dist/components/product-tag-list.js +44 -0
- package/dist/components/product-tags-page.d.ts +7 -0
- package/dist/components/product-tags-page.d.ts.map +1 -0
- package/dist/components/product-tags-page.js +9 -0
- package/dist/components/product-tax-class-combobox.d.ts +9 -0
- package/dist/components/product-tax-class-combobox.d.ts.map +1 -0
- package/dist/components/product-tax-class-combobox.js +100 -0
- package/dist/components/product-translations-card.d.ts +7 -0
- package/dist/components/product-translations-card.d.ts.map +1 -0
- package/dist/components/product-translations-card.js +188 -0
- package/dist/components/product-type-combobox.d.ts +9 -0
- package/dist/components/product-type-combobox.d.ts.map +1 -0
- package/dist/components/product-type-combobox.js +48 -0
- package/dist/components/product-types-page.d.ts +6 -0
- package/dist/components/product-types-page.d.ts.map +1 -0
- package/dist/components/product-types-page.js +103 -0
- package/dist/components/product-version-dialog.d.ts +8 -0
- package/dist/components/product-version-dialog.d.ts.map +1 -0
- package/dist/components/product-version-dialog.js +39 -0
- package/dist/components/product-versions-section.d.ts +7 -0
- package/dist/components/product-versions-section.d.ts.map +1 -0
- package/dist/components/product-versions-section.js +19 -0
- package/dist/components/products-page.d.ts +8 -0
- package/dist/components/products-page.d.ts.map +1 -0
- package/dist/components/products-page.js +8 -0
- package/dist/extras/client.d.ts +14 -0
- package/dist/extras/client.d.ts.map +1 -0
- package/dist/extras/client.js +58 -0
- package/dist/extras/components/extra-catalog-card.d.ts +13 -0
- package/dist/extras/components/extra-catalog-card.d.ts.map +1 -0
- package/dist/extras/components/extra-catalog-card.js +52 -0
- package/dist/extras/components/product-combobox.d.ts +9 -0
- package/dist/extras/components/product-combobox.d.ts.map +1 -0
- package/dist/extras/components/product-combobox.js +46 -0
- package/dist/extras/hooks/index.d.ts +4 -0
- package/dist/extras/hooks/index.d.ts.map +1 -0
- package/dist/extras/hooks/index.js +3 -0
- package/dist/extras/hooks/use-product-extra-mutation.d.ts +70 -0
- package/dist/extras/hooks/use-product-extra-mutation.d.ts.map +1 -0
- package/dist/extras/hooks/use-product-extra-mutation.js +38 -0
- package/dist/extras/hooks/use-product-extra.d.ts +24 -0
- package/dist/extras/hooks/use-product-extra.d.ts.map +1 -0
- package/dist/extras/hooks/use-product-extra.js +12 -0
- package/dist/extras/hooks/use-product-extras.d.ts +30 -0
- package/dist/extras/hooks/use-product-extras.d.ts.map +1 -0
- package/dist/extras/hooks/use-product-extras.js +12 -0
- package/dist/extras/i18n/en.d.ts +52 -0
- package/dist/extras/i18n/en.d.ts.map +1 -0
- package/dist/extras/i18n/en.js +51 -0
- package/dist/extras/i18n/index.d.ts +5 -0
- package/dist/extras/i18n/index.d.ts.map +1 -0
- package/dist/extras/i18n/index.js +3 -0
- package/dist/extras/i18n/messages.d.ts +37 -0
- package/dist/extras/i18n/messages.d.ts.map +1 -0
- package/dist/extras/i18n/messages.js +1 -0
- package/dist/extras/i18n/provider.d.ts +126 -0
- package/dist/extras/i18n/provider.d.ts.map +1 -0
- package/dist/extras/i18n/provider.js +44 -0
- package/dist/extras/i18n/ro.d.ts +52 -0
- package/dist/extras/i18n/ro.d.ts.map +1 -0
- package/dist/extras/i18n/ro.js +51 -0
- package/dist/extras/index.d.ts +7 -0
- package/dist/extras/index.d.ts.map +1 -0
- package/dist/extras/index.js +6 -0
- package/dist/extras/provider.d.ts +2 -0
- package/dist/extras/provider.d.ts.map +1 -0
- package/dist/extras/provider.js +1 -0
- package/dist/extras/query-keys.d.ts +16 -0
- package/dist/extras/query-keys.d.ts.map +1 -0
- package/dist/extras/query-keys.js +8 -0
- package/dist/extras/query-options.d.ts +455 -0
- package/dist/extras/query-options.d.ts.map +1 -0
- package/dist/extras/query-options.js +44 -0
- package/dist/extras/schemas.d.ts +416 -0
- package/dist/extras/schemas.d.ts.map +1 -0
- package/dist/extras/schemas.js +89 -0
- package/dist/extras/ui.d.ts +3 -0
- package/dist/extras/ui.d.ts.map +1 -0
- package/dist/extras/ui.js +2 -0
- package/dist/extras-compat.d.ts +3 -0
- package/dist/extras-compat.d.ts.map +1 -0
- package/dist/extras-compat.js +1 -0
- package/dist/extras.d.ts +10 -0
- package/dist/extras.d.ts.map +1 -0
- package/dist/extras.js +9 -0
- package/dist/hooks/index.d.ts +36 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +35 -0
- package/dist/hooks/use-duplicate-product-option-mutation.d.ts +19 -0
- package/dist/hooks/use-duplicate-product-option-mutation.d.ts.map +1 -0
- package/dist/hooks/use-duplicate-product-option-mutation.js +65 -0
- package/dist/hooks/use-option-unit-mutation.d.ts +60 -0
- package/dist/hooks/use-option-unit-mutation.d.ts.map +1 -0
- package/dist/hooks/use-option-unit-mutation.js +41 -0
- package/dist/hooks/use-option-unit.d.ts +21 -0
- package/dist/hooks/use-option-unit.d.ts.map +1 -0
- package/dist/hooks/use-option-unit.js +12 -0
- package/dist/hooks/use-option-units.d.ts +27 -0
- package/dist/hooks/use-option-units.d.ts.map +1 -0
- package/dist/hooks/use-option-units.js +12 -0
- package/dist/hooks/use-product-action-ledger.d.ts +48 -0
- package/dist/hooks/use-product-action-ledger.d.ts.map +1 -0
- package/dist/hooks/use-product-action-ledger.js +12 -0
- package/dist/hooks/use-product-categories.d.ts +32 -0
- package/dist/hooks/use-product-categories.d.ts.map +1 -0
- package/dist/hooks/use-product-categories.js +29 -0
- package/dist/hooks/use-product-category-mutation.d.ts +65 -0
- package/dist/hooks/use-product-category-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-category-mutation.js +39 -0
- package/dist/hooks/use-product-category.d.ts +26 -0
- package/dist/hooks/use-product-category.d.ts.map +1 -0
- package/dist/hooks/use-product-category.js +18 -0
- package/dist/hooks/use-product-day-mutation.d.ts +43 -0
- package/dist/hooks/use-product-day-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-day-mutation.js +54 -0
- package/dist/hooks/use-product-day-service-mutation.d.ts +66 -0
- package/dist/hooks/use-product-day-service-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-day-service-mutation.js +41 -0
- package/dist/hooks/use-product-day-services.d.ts +21 -0
- package/dist/hooks/use-product-day-services.d.ts.map +1 -0
- package/dist/hooks/use-product-day-services.js +12 -0
- package/dist/hooks/use-product-day-translation-mutation.d.ts +49 -0
- package/dist/hooks/use-product-day-translation-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-day-translation-mutation.js +38 -0
- package/dist/hooks/use-product-day-translations.d.ts +19 -0
- package/dist/hooks/use-product-day-translations.d.ts.map +1 -0
- package/dist/hooks/use-product-day-translations.js +20 -0
- package/dist/hooks/use-product-days.d.ts +16 -0
- package/dist/hooks/use-product-days.d.ts.map +1 -0
- package/dist/hooks/use-product-days.js +12 -0
- package/dist/hooks/use-product-itineraries.d.ts +15 -0
- package/dist/hooks/use-product-itineraries.d.ts.map +1 -0
- package/dist/hooks/use-product-itineraries.js +12 -0
- package/dist/hooks/use-product-itinerary-days.d.ts +16 -0
- package/dist/hooks/use-product-itinerary-days.d.ts.map +1 -0
- package/dist/hooks/use-product-itinerary-days.js +12 -0
- package/dist/hooks/use-product-itinerary-mutation.d.ts +54 -0
- package/dist/hooks/use-product-itinerary-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-itinerary-mutation.js +63 -0
- package/dist/hooks/use-product-media-mutation.d.ts +101 -0
- package/dist/hooks/use-product-media-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-media-mutation.js +69 -0
- package/dist/hooks/use-product-media.d.ts +26 -0
- package/dist/hooks/use-product-media.d.ts.map +1 -0
- package/dist/hooks/use-product-media.js +12 -0
- package/dist/hooks/use-product-mutation.d.ts +121 -0
- package/dist/hooks/use-product-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-mutation.js +44 -0
- package/dist/hooks/use-product-option-mutation.d.ts +49 -0
- package/dist/hooks/use-product-option-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-option-mutation.js +39 -0
- package/dist/hooks/use-product-option.d.ts +18 -0
- package/dist/hooks/use-product-option.d.ts.map +1 -0
- package/dist/hooks/use-product-option.js +12 -0
- package/dist/hooks/use-product-options.d.ts +24 -0
- package/dist/hooks/use-product-options.d.ts.map +1 -0
- package/dist/hooks/use-product-options.js +12 -0
- package/dist/hooks/use-product-tag-mutation.d.ts +25 -0
- package/dist/hooks/use-product-tag-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-tag-mutation.js +39 -0
- package/dist/hooks/use-product-tag.d.ts +10 -0
- package/dist/hooks/use-product-tag.d.ts.map +1 -0
- package/dist/hooks/use-product-tag.js +18 -0
- package/dist/hooks/use-product-tags.d.ts +16 -0
- package/dist/hooks/use-product-tags.d.ts.map +1 -0
- package/dist/hooks/use-product-tags.js +25 -0
- package/dist/hooks/use-product-translation-mutation.d.ts +52 -0
- package/dist/hooks/use-product-translation-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-translation-mutation.js +47 -0
- package/dist/hooks/use-product-translations.d.ts +28 -0
- package/dist/hooks/use-product-translations.d.ts.map +1 -0
- package/dist/hooks/use-product-translations.js +24 -0
- package/dist/hooks/use-product-type-mutation.d.ts +50 -0
- package/dist/hooks/use-product-type-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-type-mutation.js +47 -0
- package/dist/hooks/use-product-type.d.ts +15 -0
- package/dist/hooks/use-product-type.d.ts.map +1 -0
- package/dist/hooks/use-product-type.js +12 -0
- package/dist/hooks/use-product-types.d.ts +21 -0
- package/dist/hooks/use-product-types.d.ts.map +1 -0
- package/dist/hooks/use-product-types.js +9 -0
- package/dist/hooks/use-product-version-mutation.d.ts +16 -0
- package/dist/hooks/use-product-version-mutation.d.ts.map +1 -0
- package/dist/hooks/use-product-version-mutation.js +22 -0
- package/dist/hooks/use-product-versions.d.ts +15 -0
- package/dist/hooks/use-product-versions.d.ts.map +1 -0
- package/dist/hooks/use-product-versions.js +12 -0
- package/dist/hooks/use-product.d.ts +45 -0
- package/dist/hooks/use-product.d.ts.map +1 -0
- package/dist/hooks/use-product.js +23 -0
- package/dist/hooks/use-products.d.ts +51 -0
- package/dist/hooks/use-products.d.ts.map +1 -0
- package/dist/hooks/use-products.js +38 -0
- package/dist/i18n/en-catalog.d.ts +199 -0
- package/dist/i18n/en-catalog.d.ts.map +1 -0
- package/dist/i18n/en-catalog.js +198 -0
- package/dist/i18n/en-core.d.ts +323 -0
- package/dist/i18n/en-core.d.ts.map +1 -0
- package/dist/i18n/en-core.js +322 -0
- package/dist/i18n/en-operations.d.ts +287 -0
- package/dist/i18n/en-operations.d.ts.map +1 -0
- package/dist/i18n/en-operations.js +286 -0
- package/dist/i18n/en.d.ts +803 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +8 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/message-shared.d.ts +6 -0
- package/dist/i18n/message-shared.d.ts.map +1 -0
- package/dist/i18n/message-shared.js +1 -0
- package/dist/i18n/messages-catalog.d.ts +199 -0
- package/dist/i18n/messages-catalog.d.ts.map +1 -0
- package/dist/i18n/messages-catalog.js +1 -0
- package/dist/i18n/messages-core.d.ts +304 -0
- package/dist/i18n/messages-core.d.ts.map +1 -0
- package/dist/i18n/messages-core.js +1 -0
- package/dist/i18n/messages-operations.d.ts +287 -0
- package/dist/i18n/messages-operations.d.ts.map +1 -0
- package/dist/i18n/messages-operations.js +1 -0
- package/dist/i18n/messages.d.ts +6 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +1 -0
- package/dist/i18n/provider.d.ts +1628 -0
- package/dist/i18n/provider.d.ts.map +1 -0
- package/dist/i18n/provider.js +44 -0
- package/dist/i18n/ro-catalog.d.ts +199 -0
- package/dist/i18n/ro-catalog.d.ts.map +1 -0
- package/dist/i18n/ro-catalog.js +198 -0
- package/dist/i18n/ro-core.d.ts +323 -0
- package/dist/i18n/ro-core.d.ts.map +1 -0
- package/dist/i18n/ro-core.js +322 -0
- package/dist/i18n/ro-operations.d.ts +287 -0
- package/dist/i18n/ro-operations.d.ts.map +1 -0
- package/dist/i18n/ro-operations.js +286 -0
- package/dist/i18n/ro.d.ts +803 -0
- package/dist/i18n/ro.d.ts.map +1 -0
- package/dist/i18n/ro.js +8 -0
- package/dist/i18n-en.d.ts +2 -0
- package/dist/i18n-en.d.ts.map +1 -0
- package/dist/i18n-en.js +1 -0
- package/dist/i18n-ro.d.ts +2 -0
- package/dist/i18n-ro.d.ts.map +1 -0
- package/dist/i18n-ro.js +1 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/operations.d.ts +53 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +13 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +1 -0
- package/dist/query-keys.d.ts +114 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +34 -0
- package/dist/query-options-action-ledger.d.ts +194 -0
- package/dist/query-options-action-ledger.d.ts.map +1 -0
- package/dist/query-options-action-ledger.js +20 -0
- package/dist/query-options.d.ts +1313 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +281 -0
- package/dist/schemas.d.ts +1098 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +320 -0
- package/dist/ui.d.ts +44 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +42 -0
- package/package.json +159 -0
- package/src/styles.css +12 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useAdminNavigate } from "@voyant-travel/admin";
|
|
4
|
+
import { ProductsPage } from "../components/products-page.js";
|
|
5
|
+
/**
|
|
6
|
+
* Packaged admin host for `ProductsPage` (packaged-admin RFC Phase 3).
|
|
7
|
+
*
|
|
8
|
+
* No host route tree is imported — opening a product resolves the
|
|
9
|
+
* `"product.detail"` semantic destination (RFC §4.7) through the resolvers
|
|
10
|
+
* the workspace shell registered. The page keeps its search/paging state
|
|
11
|
+
* locally (no URL search contract), so the host takes no props and route
|
|
12
|
+
* contributions can mount it as a zero-prop page.
|
|
13
|
+
*/
|
|
14
|
+
export function ProductsHost() {
|
|
15
|
+
const navigateTo = useAdminNavigate();
|
|
16
|
+
return (_jsx(ProductsPage, { onProductOpen: (product) => navigateTo("product.detail", { productId: product.id }) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route-level placeholder for the products list page. Matches
|
|
3
|
+
* `ProductsPage`'s header row, the search input, and the 5-column product
|
|
4
|
+
* table exactly. Kept in its own lean module (ui skeleton + table + the
|
|
5
|
+
* operator admin messages hook only) so the extension factory can attach it
|
|
6
|
+
* as a `pendingComponent` without pinning the products data layer into the
|
|
7
|
+
* workspace-chrome chunk.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ProductsListSkeleton(): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=products-list-skeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products-list-skeleton.d.ts","sourceRoot":"","sources":["../../src/admin/products-list-skeleton.tsx"],"names":[],"mappings":"AAgBA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,4CA4DnC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useOperatorAdminMessages } from "@voyant-travel/admin";
|
|
4
|
+
import { Skeleton } from "@voyant-travel/ui/components/skeleton";
|
|
5
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@voyant-travel/ui/components/table";
|
|
6
|
+
const SKELETON_ROWS = 6;
|
|
7
|
+
const COLUMN_WIDTHS = ["w-48", "w-16", "w-24", "w-8", "w-24"];
|
|
8
|
+
/**
|
|
9
|
+
* Route-level placeholder for the products list page. Matches
|
|
10
|
+
* `ProductsPage`'s header row, the search input, and the 5-column product
|
|
11
|
+
* table exactly. Kept in its own lean module (ui skeleton + table + the
|
|
12
|
+
* operator admin messages hook only) so the extension factory can attach it
|
|
13
|
+
* as a `pendingComponent` without pinning the products data layer into the
|
|
14
|
+
* workspace-chrome chunk.
|
|
15
|
+
*/
|
|
16
|
+
export function ProductsListSkeleton() {
|
|
17
|
+
const productMessages = useOperatorAdminMessages().products.core;
|
|
18
|
+
return (_jsxs("div", { className: "flex flex-col gap-6 p-6", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Skeleton, { className: "h-7 w-28" }), _jsx(Skeleton, { className: "h-4 w-64" })] }), _jsx(Skeleton, { className: "h-9 w-36" })] }), _jsx(Skeleton, { className: "h-9 w-full max-w-sm" }), _jsx("div", { className: "rounded-md border", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: productMessages.tableName }), _jsx(TableHead, { children: productMessages.tableStatus }), _jsx(TableHead, { children: productMessages.tableSellAmount }), _jsx(TableHead, { children: productMessages.tablePax }), _jsx(TableHead, { children: productMessages.tableStartDate })] }) }), _jsx(TableBody, { children: Array.from({ length: SKELETON_ROWS }).map((_, row) => (_jsx(TableRow
|
|
19
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: stable placeholders -- owner: inventory-react; existing suppression is intentional pending typed cleanup.
|
|
20
|
+
, { children: COLUMN_WIDTHS.map((width, column) => (_jsx(TableCell
|
|
21
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: stable placeholders -- owner: inventory-react; existing suppression is intentional pending typed cleanup.
|
|
22
|
+
, { children: _jsx(Skeleton, { className: `h-4 ${width}` }) }, column))) }, row))) })] }) }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Skeleton, { className: "h-4 w-40" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Skeleton, { className: "h-8 w-20" }), _jsx(Skeleton, { className: "h-4 w-20" }), _jsx(Skeleton, { className: "h-8 w-16" })] })] })] }));
|
|
23
|
+
}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
export type VoyantFetcher = (url: string, init?: RequestInit) => Promise<Response>;
|
|
3
|
+
export declare const defaultFetcher: VoyantFetcher;
|
|
4
|
+
export declare class VoyantApiError extends Error {
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly body: unknown;
|
|
7
|
+
constructor(message: string, status: number, body: unknown);
|
|
8
|
+
}
|
|
9
|
+
export interface FetchWithValidationOptions {
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
fetcher: VoyantFetcher;
|
|
12
|
+
}
|
|
13
|
+
export type QueryParamValue = string | number | boolean | null | undefined | Array<string | number | boolean>;
|
|
14
|
+
export declare function fetchWithValidation<TOut>(path: string, schema: z.ZodType<TOut>, options: FetchWithValidationOptions, init?: RequestInit): Promise<TOut>;
|
|
15
|
+
export declare function withQueryParams(path: string, query?: object): string;
|
|
16
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAElF,eAAO,MAAM,cAAc,EAAE,aACoB,CAAA;AAEjD,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;gBAEV,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAM3D;AAaD,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,aAAa,CAAA;CACvB;AAED,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAA;AAEpC,wBAAsB,mBAAmB,CAAC,IAAI,EAC5C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EACvB,OAAO,EAAE,0BAA0B,EACnC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,IAAI,CAAC,CAgCf;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAwBpE"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export const defaultFetcher = (url, init) => fetch(url, { credentials: "include", ...init });
|
|
2
|
+
export class VoyantApiError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
body;
|
|
5
|
+
constructor(message, status, body) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "VoyantApiError";
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.body = body;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function extractErrorMessage(status, statusText, body) {
|
|
13
|
+
if (typeof body === "object" && body !== null && "error" in body) {
|
|
14
|
+
const err = body.error;
|
|
15
|
+
if (typeof err === "string")
|
|
16
|
+
return err;
|
|
17
|
+
if (typeof err === "object" && err !== null && "message" in err) {
|
|
18
|
+
return String(err.message);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return `Voyant API error: ${status} ${statusText}`;
|
|
22
|
+
}
|
|
23
|
+
export async function fetchWithValidation(path, schema, options, init) {
|
|
24
|
+
const url = joinUrl(options.baseUrl, path);
|
|
25
|
+
const headers = new Headers(init?.headers);
|
|
26
|
+
if (init?.body !== undefined && !headers.has("Content-Type")) {
|
|
27
|
+
headers.set("Content-Type", "application/json");
|
|
28
|
+
}
|
|
29
|
+
const response = await options.fetcher(url, { ...init, headers });
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
const body = await safeJson(response);
|
|
32
|
+
throw new VoyantApiError(extractErrorMessage(response.status, response.statusText, body), response.status, body);
|
|
33
|
+
}
|
|
34
|
+
if (response.status === 204) {
|
|
35
|
+
return schema.parse(undefined);
|
|
36
|
+
}
|
|
37
|
+
const body = await safeJson(response);
|
|
38
|
+
const parsed = schema.safeParse(body);
|
|
39
|
+
if (!parsed.success) {
|
|
40
|
+
throw new VoyantApiError(`Voyant API response failed validation: ${parsed.error.message}`, response.status, body);
|
|
41
|
+
}
|
|
42
|
+
return parsed.data;
|
|
43
|
+
}
|
|
44
|
+
export function withQueryParams(path, query) {
|
|
45
|
+
if (!query) {
|
|
46
|
+
return path;
|
|
47
|
+
}
|
|
48
|
+
const params = new URLSearchParams();
|
|
49
|
+
for (const [key, value] of Object.entries(query)) {
|
|
50
|
+
if (value === undefined || value === null) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (Array.isArray(value)) {
|
|
54
|
+
for (const item of value) {
|
|
55
|
+
params.append(key, String(item));
|
|
56
|
+
}
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
params.set(key, String(value));
|
|
60
|
+
}
|
|
61
|
+
const serialized = params.toString();
|
|
62
|
+
return serialized ? `${path}?${serialized}` : path;
|
|
63
|
+
}
|
|
64
|
+
async function safeJson(response) {
|
|
65
|
+
const text = await response.text();
|
|
66
|
+
if (!text)
|
|
67
|
+
return undefined;
|
|
68
|
+
try {
|
|
69
|
+
return JSON.parse(text);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return text;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function joinUrl(baseUrl, path) {
|
|
76
|
+
const trimmedBase = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
77
|
+
const trimmedPath = path.startsWith("/") ? path : `/${path}`;
|
|
78
|
+
return `${trimmedBase}${trimmedPath}`;
|
|
79
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OptionUnitRecord } from "../index.js";
|
|
2
|
+
export interface OptionUnitDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
optionId: string;
|
|
6
|
+
unit?: OptionUnitRecord;
|
|
7
|
+
sortOrder?: number;
|
|
8
|
+
onSuccess?: (unit: OptionUnitRecord) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function OptionUnitDialog({ open, onOpenChange, optionId, unit, sortOrder, onSuccess, }: OptionUnitDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=option-unit-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-unit-dialog.d.ts","sourceRoot":"","sources":["../../src/components/option-unit-dialog.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAGnD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAC7C;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,SAAS,GACV,EAAE,qBAAqB,2CA8BvB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@voyant-travel/ui/components/dialog";
|
|
4
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
5
|
+
import { OptionUnitForm } from "./option-unit-form.js";
|
|
6
|
+
export function OptionUnitDialog({ open, onOpenChange, optionId, unit, sortOrder, onSuccess, }) {
|
|
7
|
+
const isEdit = Boolean(unit);
|
|
8
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
9
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-slot": "option-unit-dialog", className: "sm:max-w-[680px]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: isEdit
|
|
10
|
+
? messages.optionUnitDialog.titles.edit
|
|
11
|
+
: messages.optionUnitDialog.titles.create }), _jsx(DialogDescription, { children: isEdit
|
|
12
|
+
? messages.optionUnitDialog.descriptions.edit
|
|
13
|
+
: messages.optionUnitDialog.descriptions.create })] }), _jsx(OptionUnitForm, { mode: unit ? { kind: "edit", unit } : { kind: "create", optionId, sortOrder }, onSuccess: (saved) => {
|
|
14
|
+
onSuccess?.(saved);
|
|
15
|
+
onOpenChange(false);
|
|
16
|
+
}, onCancel: () => onOpenChange(false) })] }) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type OptionUnitRecord } from "../index.js";
|
|
2
|
+
type Mode = {
|
|
3
|
+
kind: "create";
|
|
4
|
+
optionId: string;
|
|
5
|
+
sortOrder?: number;
|
|
6
|
+
} | {
|
|
7
|
+
kind: "edit";
|
|
8
|
+
unit: OptionUnitRecord;
|
|
9
|
+
};
|
|
10
|
+
export interface OptionUnitFormProps {
|
|
11
|
+
mode: Mode;
|
|
12
|
+
onSuccess?: (unit: OptionUnitRecord) => void;
|
|
13
|
+
onCancel?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function OptionUnitForm({ mode, onSuccess, onCancel }: OptionUnitFormProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=option-unit-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-unit-form.d.ts","sourceRoot":"","sources":["../../src/components/option-unit-form.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,aAAa,CAAA;AAEpB,KAAK,IAAI,GACL;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAA;AAE5C,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,IAAI,CAAA;IACV,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC5C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAiGD,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAuOhF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@voyant-travel/ui/components/button";
|
|
4
|
+
import { Input } from "@voyant-travel/ui/components/input";
|
|
5
|
+
import { Label } from "@voyant-travel/ui/components/label";
|
|
6
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@voyant-travel/ui/components/select";
|
|
7
|
+
import { Switch } from "@voyant-travel/ui/components/switch";
|
|
8
|
+
import { Textarea } from "@voyant-travel/ui/components/textarea";
|
|
9
|
+
import { Loader2 } from "lucide-react";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
12
|
+
import { useOptionUnitMutation, } from "../index.js";
|
|
13
|
+
const UNIT_TYPES = [
|
|
14
|
+
{ value: "person" },
|
|
15
|
+
{ value: "group" },
|
|
16
|
+
{ value: "room" },
|
|
17
|
+
{ value: "vehicle" },
|
|
18
|
+
{ value: "service" },
|
|
19
|
+
{ value: "other" },
|
|
20
|
+
];
|
|
21
|
+
function initialState(mode) {
|
|
22
|
+
if (mode.kind === "edit") {
|
|
23
|
+
return {
|
|
24
|
+
name: mode.unit.name,
|
|
25
|
+
code: mode.unit.code ?? "",
|
|
26
|
+
description: mode.unit.description ?? "",
|
|
27
|
+
unitType: mode.unit.unitType,
|
|
28
|
+
minQuantity: mode.unit.minQuantity != null ? String(mode.unit.minQuantity) : "",
|
|
29
|
+
maxQuantity: mode.unit.maxQuantity != null ? String(mode.unit.maxQuantity) : "",
|
|
30
|
+
minAge: mode.unit.minAge != null ? String(mode.unit.minAge) : "",
|
|
31
|
+
maxAge: mode.unit.maxAge != null ? String(mode.unit.maxAge) : "",
|
|
32
|
+
occupancyMin: mode.unit.occupancyMin != null ? String(mode.unit.occupancyMin) : "",
|
|
33
|
+
occupancyMax: mode.unit.occupancyMax != null ? String(mode.unit.occupancyMax) : "",
|
|
34
|
+
isRequired: mode.unit.isRequired,
|
|
35
|
+
isHidden: mode.unit.isHidden,
|
|
36
|
+
sortOrder: String(mode.unit.sortOrder),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
name: "",
|
|
41
|
+
code: "",
|
|
42
|
+
description: "",
|
|
43
|
+
unitType: "person",
|
|
44
|
+
minQuantity: "",
|
|
45
|
+
maxQuantity: "",
|
|
46
|
+
minAge: "",
|
|
47
|
+
maxAge: "",
|
|
48
|
+
occupancyMin: "",
|
|
49
|
+
occupancyMax: "",
|
|
50
|
+
isRequired: false,
|
|
51
|
+
isHidden: false,
|
|
52
|
+
sortOrder: String(mode.sortOrder ?? 0),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function toOptionalString(value) {
|
|
56
|
+
const trimmed = value.trim();
|
|
57
|
+
return trimmed ? trimmed : null;
|
|
58
|
+
}
|
|
59
|
+
function toOptionalNumber(value) {
|
|
60
|
+
const trimmed = value.trim();
|
|
61
|
+
if (!trimmed)
|
|
62
|
+
return null;
|
|
63
|
+
const parsed = Number.parseInt(trimmed, 10);
|
|
64
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
65
|
+
}
|
|
66
|
+
function toPayload(state) {
|
|
67
|
+
const canHaveAge = state.unitType === "person";
|
|
68
|
+
const canHaveOccupancy = state.unitType === "group" || state.unitType === "room" || state.unitType === "vehicle";
|
|
69
|
+
return {
|
|
70
|
+
name: state.name.trim(),
|
|
71
|
+
code: toOptionalString(state.code),
|
|
72
|
+
description: toOptionalString(state.description),
|
|
73
|
+
unitType: state.unitType,
|
|
74
|
+
minQuantity: toOptionalNumber(state.minQuantity),
|
|
75
|
+
maxQuantity: toOptionalNumber(state.maxQuantity),
|
|
76
|
+
minAge: canHaveAge ? toOptionalNumber(state.minAge) : null,
|
|
77
|
+
maxAge: canHaveAge ? toOptionalNumber(state.maxAge) : null,
|
|
78
|
+
occupancyMin: canHaveOccupancy ? toOptionalNumber(state.occupancyMin) : null,
|
|
79
|
+
occupancyMax: canHaveOccupancy ? toOptionalNumber(state.occupancyMax) : null,
|
|
80
|
+
isRequired: state.isRequired,
|
|
81
|
+
isHidden: state.isHidden,
|
|
82
|
+
sortOrder: Number.parseInt(state.sortOrder || "0", 10) || 0,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export function OptionUnitForm({ mode, onSuccess, onCancel }) {
|
|
86
|
+
const [state, setState] = React.useState(() => initialState(mode));
|
|
87
|
+
const [error, setError] = React.useState(null);
|
|
88
|
+
const { create, update } = useOptionUnitMutation();
|
|
89
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
setState(initialState(mode));
|
|
92
|
+
setError(null);
|
|
93
|
+
}, [mode]);
|
|
94
|
+
const isSubmitting = create.isPending || update.isPending;
|
|
95
|
+
const field = (key) => (value) => {
|
|
96
|
+
setState((prev) => ({ ...prev, [key]: value }));
|
|
97
|
+
};
|
|
98
|
+
const handleSubmit = async (event) => {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
setError(null);
|
|
101
|
+
if (!state.name.trim()) {
|
|
102
|
+
setError(messages.optionUnitForm.validation.nameRequired);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const unit = mode.kind === "create"
|
|
107
|
+
? await create.mutateAsync({ optionId: mode.optionId, ...toPayload(state) })
|
|
108
|
+
: await update.mutateAsync({ id: mode.unit.id, input: toPayload(state) });
|
|
109
|
+
onSuccess?.(unit);
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
setError(err instanceof Error ? err.message : messages.optionUnitForm.validation.saveFailed);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const showAgeRange = state.unitType === "person";
|
|
116
|
+
const showOccupancy = state.unitType === "group" || state.unitType === "room" || state.unitType === "vehicle";
|
|
117
|
+
return (_jsxs("form", { "data-slot": "option-unit-form", onSubmit: handleSubmit, className: "flex flex-col gap-4", children: [_jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "option-unit-name", children: messages.optionUnitForm.fields.name }), _jsx(Input, { id: "option-unit-name", required: true, autoFocus: true, value: state.name, onChange: (event) => field("name")(event.target.value), placeholder: messages.optionUnitForm.placeholders.name })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "option-unit-code", children: messages.optionUnitForm.fields.code }), _jsx(Input, { id: "option-unit-code", value: state.code, onChange: (event) => field("code")(event.target.value), placeholder: messages.optionUnitForm.placeholders.code })] })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: messages.optionUnitForm.fields.unitType }), _jsxs(Select, { items: UNIT_TYPES.map((type) => ({
|
|
118
|
+
label: messages.common.optionUnitTypeLabels[type.value],
|
|
119
|
+
value: type.value,
|
|
120
|
+
})), value: state.unitType, onValueChange: (value) => value && field("unitType")(value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: UNIT_TYPES.map((type) => (_jsx(SelectItem, { value: type.value, children: messages.common.optionUnitTypeLabels[type.value] }, type.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "option-unit-sort-order", children: messages.optionUnitForm.fields.sortOrder }), _jsx(Input, { id: "option-unit-sort-order", type: "number", value: state.sortOrder, onChange: (event) => field("sortOrder")(event.target.value) })] })] }), _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: "option-unit-min-quantity", children: messages.optionUnitForm.fields.minQuantity }), _jsx(Input, { id: "option-unit-min-quantity", type: "number", min: "0", value: state.minQuantity, onChange: (event) => field("minQuantity")(event.target.value) })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "option-unit-max-quantity", children: messages.optionUnitForm.fields.maxQuantity }), _jsx(Input, { id: "option-unit-max-quantity", type: "number", min: "0", value: state.maxQuantity, onChange: (event) => field("maxQuantity")(event.target.value) })] })] }), showAgeRange ? (_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: "option-unit-min-age", children: messages.optionUnitForm.fields.minAge }), _jsx(Input, { id: "option-unit-min-age", type: "number", min: "0", value: state.minAge, onChange: (event) => field("minAge")(event.target.value) })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "option-unit-max-age", children: messages.optionUnitForm.fields.maxAge }), _jsx(Input, { id: "option-unit-max-age", type: "number", min: "0", value: state.maxAge, onChange: (event) => field("maxAge")(event.target.value) })] })] })) : null, showOccupancy ? (_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: "option-unit-occupancy-min", children: messages.optionUnitForm.fields.occupancyMin }), _jsx(Input, { id: "option-unit-occupancy-min", type: "number", min: "0", value: state.occupancyMin, onChange: (event) => field("occupancyMin")(event.target.value) })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "option-unit-occupancy-max", children: messages.optionUnitForm.fields.occupancyMax }), _jsx(Input, { id: "option-unit-occupancy-max", type: "number", min: "0", value: state.occupancyMax, onChange: (event) => field("occupancyMax")(event.target.value) })] })] })) : null, _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "option-unit-description", children: messages.optionUnitForm.fields.description }), _jsx(Textarea, { id: "option-unit-description", value: state.description, onChange: (event) => field("description")(event.target.value), placeholder: messages.optionUnitForm.placeholders.description })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Switch, { checked: state.isRequired, onCheckedChange: (checked) => field("isRequired")(checked) }), _jsx(Label, { children: messages.optionUnitForm.fields.required })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Switch, { checked: state.isHidden, onCheckedChange: (checked) => field("isHidden")(checked) }), _jsx(Label, { children: messages.optionUnitForm.fields.hidden })] })] }), error ? _jsx("p", { className: "text-sm text-destructive", children: error }) : null, _jsxs("div", { className: "flex items-center justify-end gap-2", children: [onCancel ? (_jsx(Button, { type: "button", variant: "ghost", onClick: onCancel, disabled: isSubmitting, children: messages.common.cancel })) : null, _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting ? (_jsx(Loader2, { className: "mr-2 size-4 animate-spin", "aria-hidden": "true" })) : null, mode.kind === "create"
|
|
121
|
+
? messages.optionUnitForm.actions.createUnit
|
|
122
|
+
: messages.common.saveChanges] })] })] }));
|
|
123
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ProductActionLedgerCardProps {
|
|
2
|
+
productId: string;
|
|
3
|
+
limit?: number;
|
|
4
|
+
messages?: Partial<ProductActionLedgerCardMessages>;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ProductActionLedgerCardMessages {
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
loadOlder: string;
|
|
11
|
+
empty: string;
|
|
12
|
+
loadFailed: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function ProductActionLedgerCard({ productId, limit, messages: messagesOverride, className, }: ProductActionLedgerCardProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const actionLedgerStatusVariant: Record<string, "default" | "secondary" | "outline" | "destructive">;
|
|
16
|
+
export declare const actionLedgerRiskVariant: Record<string, "default" | "secondary" | "outline" | "destructive">;
|
|
17
|
+
//# sourceMappingURL=product-action-ledger-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-action-ledger-card.d.ts","sourceRoot":"","sources":["../../src/components/product-action-ledger-card.tsx"],"names":[],"mappings":"AAWA,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC,+BAA+B,CAAC,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB;AAUD,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,KAAU,EACV,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,GACV,EAAE,4BAA4B,2CAiE9B;AA4ED,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAC5C,MAAM,EACN,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,CAapD,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,MAAM,EACN,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,CAMpD,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Badge } from "@voyant-travel/ui/components/badge";
|
|
4
|
+
import { Button } from "@voyant-travel/ui/components/button";
|
|
5
|
+
import { cn } from "@voyant-travel/ui/lib/utils";
|
|
6
|
+
import { Activity, Loader2 } from "lucide-react";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { useProductsUiI18nOrDefault } from "../i18n/provider.js";
|
|
9
|
+
import { useProductActionLedger } from "../index.js";
|
|
10
|
+
const defaultProductActionLedgerCardMessages = {
|
|
11
|
+
title: "Activity", // i18n-literal-ok: package-owned fallback copy; callers can override.
|
|
12
|
+
description: "Recent product edits and the actor that made them.", // i18n-literal-ok: package-owned fallback copy; callers can override.
|
|
13
|
+
loadOlder: "Load older activity", // i18n-literal-ok: package-owned fallback copy; callers can override.
|
|
14
|
+
empty: "No product activity recorded.", // i18n-literal-ok: package-owned fallback copy; callers can override.
|
|
15
|
+
loadFailed: "Failed to load product activity.", // i18n-literal-ok: package-owned fallback copy; callers can override.
|
|
16
|
+
};
|
|
17
|
+
export function ProductActionLedgerCard({ productId, limit = 20, messages: messagesOverride, className, }) {
|
|
18
|
+
const messages = { ...defaultProductActionLedgerCardMessages, ...messagesOverride };
|
|
19
|
+
const [cursor, setCursor] = useState(null);
|
|
20
|
+
const actionLedgerQuery = useProductActionLedger(productId, { cursor, limit });
|
|
21
|
+
const { formatDateTime } = useProductsUiI18nOrDefault();
|
|
22
|
+
const [pages, setPages] = useState([]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const page = actionLedgerQuery.data;
|
|
25
|
+
if (!page)
|
|
26
|
+
return;
|
|
27
|
+
setPages((currentPages) => {
|
|
28
|
+
if (currentPages.some((currentPage) => currentPage.data[0]?.id === page.data[0]?.id)) {
|
|
29
|
+
return currentPages;
|
|
30
|
+
}
|
|
31
|
+
return cursor ? [...currentPages, page] : [page];
|
|
32
|
+
});
|
|
33
|
+
}, [actionLedgerQuery.data, cursor]);
|
|
34
|
+
const entries = pages.flatMap((page) => page.data);
|
|
35
|
+
const nextCursor = pages.at(-1)?.pageInfo.nextCursor ?? null;
|
|
36
|
+
return (_jsx(ActionLedgerSection, { title: messages.title, description: messages.description, className: className, children: actionLedgerQuery.isPending && entries.length === 0 ? (_jsx(ActionLedgerLoadingRow, {})) : actionLedgerQuery.isError && entries.length === 0 ? (_jsx(ActionLedgerEmptyRow, { children: messages.loadFailed })) : entries.length === 0 ? (_jsx(ActionLedgerEmptyRow, { children: messages.empty })) : (_jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("ul", { className: "divide-y rounded-md border bg-background", children: entries.map((entry) => (_jsx(ProductActionLedgerEntryItem, { entry: entry, timestamp: formatDateTime(entry.occurredAt) }, entry.id))) }), nextCursor ? (_jsxs(Button, { type: "button", variant: "outline", size: "sm", className: "self-start", disabled: actionLedgerQuery.isFetching, onClick: () => setCursor(nextCursor), children: [actionLedgerQuery.isFetching ? (_jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": "true" })) : null, messages.loadOlder] })) : null] })) }));
|
|
37
|
+
}
|
|
38
|
+
function ProductActionLedgerEntryItem({ entry, timestamp, }) {
|
|
39
|
+
return (_jsxs("li", { className: "flex items-start gap-3 p-3", children: [_jsx(Activity, { className: "mt-0.5 size-4 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-2", children: [_jsx("p", { className: "truncate font-medium text-sm", children: formatActionLedgerName(entry.actionName) }), _jsx(Badge, { variant: actionLedgerStatusVariant[entry.status] ?? "secondary", children: entry.status.replace(/_/g, " ") }), _jsx(Badge, { variant: actionLedgerRiskVariant[entry.evaluatedRisk] ?? "outline", children: entry.evaluatedRisk })] }), _jsxs("p", { className: "mt-1 text-muted-foreground text-xs", children: [entry.principalType, ":", entry.principalId, " - ", timestamp] }), entry.mutationSummary ? (_jsx("p", { className: "mt-1 truncate text-muted-foreground text-xs", children: entry.mutationSummary })) : null] })] }));
|
|
40
|
+
}
|
|
41
|
+
function ActionLedgerSection({ title, description, children, className, }) {
|
|
42
|
+
return (_jsxs("section", { "data-slot": "product-action-ledger-card", className: cn("rounded-md border bg-background", className), children: [_jsxs("div", { className: "space-y-1 border-b px-4 py-3", children: [_jsx("h2", { className: "font-semibold text-sm", children: title }), _jsx("p", { className: "text-muted-foreground text-xs", children: description })] }), _jsx("div", { className: "p-4", children: children })] }));
|
|
43
|
+
}
|
|
44
|
+
function ActionLedgerEmptyRow({ children }) {
|
|
45
|
+
return _jsx("p", { className: "py-6 text-center text-sm text-muted-foreground", children: children });
|
|
46
|
+
}
|
|
47
|
+
function ActionLedgerLoadingRow() {
|
|
48
|
+
return (_jsx("div", { className: "flex justify-center py-6", children: _jsx(Loader2, { className: "size-5 animate-spin text-muted-foreground" }) }));
|
|
49
|
+
}
|
|
50
|
+
function formatActionLedgerName(actionName) {
|
|
51
|
+
const withoutDomain = actionName.replace(/^product\./, "");
|
|
52
|
+
const label = withoutDomain.replace(/[._-]/g, " ");
|
|
53
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
54
|
+
}
|
|
55
|
+
export const actionLedgerStatusVariant = {
|
|
56
|
+
requested: "outline",
|
|
57
|
+
awaiting_approval: "secondary",
|
|
58
|
+
approved: "secondary",
|
|
59
|
+
denied: "destructive",
|
|
60
|
+
succeeded: "default",
|
|
61
|
+
failed: "destructive",
|
|
62
|
+
reversed: "secondary",
|
|
63
|
+
compensated: "secondary",
|
|
64
|
+
expired: "secondary",
|
|
65
|
+
cancelled: "secondary",
|
|
66
|
+
superseded: "secondary",
|
|
67
|
+
};
|
|
68
|
+
export const actionLedgerRiskVariant = {
|
|
69
|
+
low: "outline",
|
|
70
|
+
medium: "secondary",
|
|
71
|
+
high: "destructive",
|
|
72
|
+
critical: "destructive",
|
|
73
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CatalogSearchHit } from "@voyant-travel/catalog-react";
|
|
2
|
+
export interface ProductCatalogCardProps {
|
|
3
|
+
hit: CatalogSearchHit;
|
|
4
|
+
/** Click handler — usually a router push to the product detail page. */
|
|
5
|
+
onClick?: (hit: CatalogSearchHit) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Search-result card for a product hit. Reads `name`, `status`,
|
|
10
|
+
* `productTypeId`, `bookingMode`, `sellAmountCents`, `sellCurrency`,
|
|
11
|
+
* `tags` from the resolved indexer document.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ProductCatalogCard({ hit, onClick, className }: ProductCatalogCardProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=product-catalog-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-catalog-card.d.ts","sourceRoot":"","sources":["../../src/components/product-catalog-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAMpE,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,gBAAgB,CAAA;IACrB,wEAAwE;IACxE,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,uBAAuB,2CAmDtF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Badge } from "@voyant-travel/ui/components/badge";
|
|
4
|
+
import { Card, CardContent } from "@voyant-travel/ui/components/card";
|
|
5
|
+
import { cn } from "@voyant-travel/ui/lib/utils";
|
|
6
|
+
import { useProductsUiI18nOrDefault } from "../i18n/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* Search-result card for a product hit. Reads `name`, `status`,
|
|
9
|
+
* `productTypeId`, `bookingMode`, `sellAmountCents`, `sellCurrency`,
|
|
10
|
+
* `tags` from the resolved indexer document.
|
|
11
|
+
*/
|
|
12
|
+
export function ProductCatalogCard({ hit, onClick, className }) {
|
|
13
|
+
const i18n = useProductsUiI18nOrDefault();
|
|
14
|
+
const fields = hit.document.fields;
|
|
15
|
+
const name = stringOr(fields.name, i18n.messages.catalogCard.untitled);
|
|
16
|
+
const status = stringOr(fields.status, null);
|
|
17
|
+
const bookingMode = stringOr(fields.bookingMode, null);
|
|
18
|
+
const sellAmount = numberOr(fields.sellAmountCents, null);
|
|
19
|
+
const sellCurrency = stringOr(fields.sellCurrency, null);
|
|
20
|
+
const tags = stringArray(fields.tags);
|
|
21
|
+
const price = sellAmount != null && sellCurrency
|
|
22
|
+
? i18n.formatCurrency(sellAmount / 100, sellCurrency, {
|
|
23
|
+
maximumFractionDigits: 0,
|
|
24
|
+
})
|
|
25
|
+
: null;
|
|
26
|
+
return (_jsx(Card, { className: cn("h-full cursor-pointer transition-colors hover:border-primary/40", onClick == null && "cursor-default", className), onClick: onClick ? () => onClick(hit) : undefined, children: _jsxs(CardContent, { className: "flex h-full flex-col gap-2 p-4", children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsx("h3", { className: "line-clamp-2 font-medium text-sm", children: name }), status && (_jsx(Badge, { variant: status === "active" ? "default" : "secondary", className: "shrink-0", children: status }))] }), _jsxs("div", { className: "flex items-center gap-2 text-muted-foreground text-xs", children: [bookingMode && _jsx("span", { children: bookingMode }), price && _jsx("span", { className: "ml-auto font-medium text-foreground", children: price })] }), tags.length > 0 && (_jsx("div", { className: "mt-auto flex flex-wrap gap-1", children: tags.slice(0, 4).map((tag) => (_jsx(Badge, { variant: "outline", className: "text-[10px]", children: tag }, tag))) }))] }) }));
|
|
27
|
+
}
|
|
28
|
+
function stringOr(value, fallback) {
|
|
29
|
+
return typeof value === "string" && value.length > 0 ? value : fallback;
|
|
30
|
+
}
|
|
31
|
+
function numberOr(value, fallback) {
|
|
32
|
+
if (typeof value === "number")
|
|
33
|
+
return value;
|
|
34
|
+
if (typeof value === "string") {
|
|
35
|
+
const n = Number(value);
|
|
36
|
+
return Number.isFinite(n) ? n : fallback;
|
|
37
|
+
}
|
|
38
|
+
return fallback;
|
|
39
|
+
}
|
|
40
|
+
function stringArray(value) {
|
|
41
|
+
if (!Array.isArray(value))
|
|
42
|
+
return [];
|
|
43
|
+
return value.filter((v) => typeof v === "string" && v.length > 0);
|
|
44
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ProductCategoryListProps } from "./product-category-list.js";
|
|
2
|
+
export interface ProductCategoriesPageProps {
|
|
3
|
+
pageSize?: ProductCategoryListProps["pageSize"];
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function ProductCategoriesPage({ pageSize, className }?: ProductCategoriesPageProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=product-categories-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-categories-page.d.ts","sourceRoot":"","sources":["../../src/components/product-categories-page.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAE/F,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAA;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAE,0BAA+B,2CAa7F"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@voyant-travel/ui/lib/utils";
|
|
4
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/index.js";
|
|
5
|
+
import { ProductCategoryList } from "./product-category-list.js";
|
|
6
|
+
export function ProductCategoriesPage({ pageSize, className } = {}) {
|
|
7
|
+
const messages = useProductsUiMessagesOrDefault().productCategoriesPage;
|
|
8
|
+
return (_jsxs("div", { "data-slot": "product-categories-page", className: cn("flex flex-col gap-6 p-6", className), children: [_jsxs("div", { children: [_jsx("h2", { className: "text-lg font-semibold tracking-tight", children: messages.title }), _jsx("p", { className: "text-sm text-muted-foreground", children: messages.description })] }), _jsx(ProductCategoryList, { pageSize: pageSize })] }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
value: string | null | undefined;
|
|
3
|
+
onChange: (value: string | null) => void;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
excludeId?: string | null;
|
|
7
|
+
};
|
|
8
|
+
export declare function ProductCategoryCombobox({ value, onChange, placeholder, disabled, excludeId, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=product-category-combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-category-combobox.d.ts","sourceRoot":"","sources":["../../src/components/product-category-combobox.tsx"],"names":[],"mappings":"AAaA,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACxC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,CAAA;AAID,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,SAAS,GACV,EAAE,KAAK,2CA0EP"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Combobox, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, } from "@voyant-travel/ui/components/combobox";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
5
|
+
import { useProductCategories, useProductCategory } from "../index.js";
|
|
6
|
+
const PAGE_SIZE = 25;
|
|
7
|
+
export function ProductCategoryCombobox({ value, onChange, placeholder, disabled, excludeId, }) {
|
|
8
|
+
const messages = useProductsUiMessagesOrDefault();
|
|
9
|
+
const [search, setSearch] = React.useState("");
|
|
10
|
+
const listQuery = useProductCategories({ search: search || undefined, limit: PAGE_SIZE });
|
|
11
|
+
const selectedQuery = useProductCategory(value, { enabled: !!value });
|
|
12
|
+
const items = React.useMemo(() => {
|
|
13
|
+
const map = new Map();
|
|
14
|
+
for (const item of listQuery.data?.data ?? []) {
|
|
15
|
+
if (item.id !== excludeId)
|
|
16
|
+
map.set(item.id, item);
|
|
17
|
+
}
|
|
18
|
+
if (selectedQuery.data && selectedQuery.data.id !== excludeId) {
|
|
19
|
+
map.set(selectedQuery.data.id, selectedQuery.data);
|
|
20
|
+
}
|
|
21
|
+
return Array.from(map.values());
|
|
22
|
+
}, [excludeId, listQuery.data?.data, selectedQuery.data]);
|
|
23
|
+
const itemMap = React.useMemo(() => new Map(items.map((item) => [item.id, item])), [items]);
|
|
24
|
+
const selected = value ? itemMap.get(value) : undefined;
|
|
25
|
+
const selectedLabel = selected ? selected.name : "";
|
|
26
|
+
const [inputValue, setInputValue] = React.useState(selectedLabel);
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
setInputValue(selectedLabel);
|
|
29
|
+
}, [selectedLabel]);
|
|
30
|
+
return (_jsxs(Combobox, { items: items.map((item) => item.id), value: value ?? null, inputValue: inputValue, autoHighlight: true, disabled: disabled, itemToStringValue: (id) => itemMap.get(id)?.name ?? "", onInputValueChange: (next) => {
|
|
31
|
+
setInputValue(next);
|
|
32
|
+
setSearch(next);
|
|
33
|
+
if (!next)
|
|
34
|
+
onChange(null);
|
|
35
|
+
}, onValueChange: (next) => {
|
|
36
|
+
const id = next ?? null;
|
|
37
|
+
onChange(id);
|
|
38
|
+
setInputValue(id ? (itemMap.get(id)?.name ?? "") : "");
|
|
39
|
+
}, children: [_jsx(ComboboxInput, { placeholder: placeholder ?? messages.comboboxes.productCategory.placeholder, showClear: !!value }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { children: listQuery.isPending || selectedQuery.isPending
|
|
40
|
+
? messages.common.loading
|
|
41
|
+
: messages.comboboxes.productCategory.empty }), _jsx(ComboboxList, { children: _jsx(ComboboxCollection, { children: (id) => {
|
|
42
|
+
const item = itemMap.get(id);
|
|
43
|
+
if (!item)
|
|
44
|
+
return null;
|
|
45
|
+
return (_jsx(ComboboxItem, { value: item.id, children: _jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate font-medium", children: item.name }), _jsx("span", { className: "truncate text-xs text-muted-foreground", children: item.slug })] }) }, item.id));
|
|
46
|
+
} }) })] })] }));
|
|
47
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProductCategoryRecord } from "../index.js";
|
|
2
|
+
export interface ProductCategoryDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
category?: ProductCategoryRecord;
|
|
6
|
+
onSuccess?: (category: ProductCategoryRecord) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ProductCategoryDialog({ open, onOpenChange, category, onSuccess, }: ProductCategoryDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=product-category-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-category-dialog.d.ts","sourceRoot":"","sources":["../../src/components/product-category-dialog.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAGxD,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,QAAQ,CAAC,EAAE,qBAAqB,CAAA;IAChC,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,CAAA;CACtD;AAED,wBAAgB,qBAAqB,CAAC,EACpC,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,SAAS,GACV,EAAE,0BAA0B,2CA8B5B"}
|