@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,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
5
|
+
import { productsQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { optionUnitListResponse, productOptionSingleResponse, } from "../schemas.js";
|
|
7
|
+
import { useOptionUnitMutation } from "./use-option-unit-mutation.js";
|
|
8
|
+
import { useProductOptionMutation } from "./use-product-option-mutation.js";
|
|
9
|
+
function defaultDuplicateName(name) {
|
|
10
|
+
return `${name} Copy`;
|
|
11
|
+
}
|
|
12
|
+
export function useDuplicateProductOptionMutation() {
|
|
13
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
14
|
+
const queryClient = useQueryClient();
|
|
15
|
+
const { create: createOption } = useProductOptionMutation();
|
|
16
|
+
const { create: createUnit } = useOptionUnitMutation();
|
|
17
|
+
return useMutation({
|
|
18
|
+
mutationFn: async ({ sourceOptionId, productId, name, code, description, status, isDefault, sortOrder, availableFrom, availableTo, }) => {
|
|
19
|
+
const [{ data: sourceOption }, { data: sourceUnits }] = await Promise.all([
|
|
20
|
+
fetchWithValidation(`/v1/products/options/${sourceOptionId}`, productOptionSingleResponse, {
|
|
21
|
+
baseUrl,
|
|
22
|
+
fetcher,
|
|
23
|
+
}),
|
|
24
|
+
fetchWithValidation(`/v1/products/option-units?optionId=${encodeURIComponent(sourceOptionId)}&limit=100`, optionUnitListResponse, { baseUrl, fetcher }),
|
|
25
|
+
]);
|
|
26
|
+
const duplicatedOption = await createOption.mutateAsync({
|
|
27
|
+
productId: productId ?? sourceOption.productId,
|
|
28
|
+
name: name ?? defaultDuplicateName(sourceOption.name),
|
|
29
|
+
code: code === undefined ? null : code,
|
|
30
|
+
description: description ?? sourceOption.description,
|
|
31
|
+
status: status ?? sourceOption.status,
|
|
32
|
+
isDefault: isDefault ?? false,
|
|
33
|
+
sortOrder: sortOrder ?? sourceOption.sortOrder + 1,
|
|
34
|
+
availableFrom: availableFrom ?? sourceOption.availableFrom,
|
|
35
|
+
availableTo: availableTo ?? sourceOption.availableTo,
|
|
36
|
+
});
|
|
37
|
+
const unitIdMap = {};
|
|
38
|
+
for (const unit of [...sourceUnits].sort((a, b) => a.sortOrder - b.sortOrder)) {
|
|
39
|
+
const duplicatedUnit = await createUnit.mutateAsync({
|
|
40
|
+
optionId: duplicatedOption.id,
|
|
41
|
+
name: unit.name,
|
|
42
|
+
code: unit.code,
|
|
43
|
+
description: unit.description,
|
|
44
|
+
unitType: unit.unitType,
|
|
45
|
+
minQuantity: unit.minQuantity,
|
|
46
|
+
maxQuantity: unit.maxQuantity,
|
|
47
|
+
minAge: unit.minAge,
|
|
48
|
+
maxAge: unit.maxAge,
|
|
49
|
+
occupancyMin: unit.occupancyMin,
|
|
50
|
+
occupancyMax: unit.occupancyMax,
|
|
51
|
+
isRequired: unit.isRequired,
|
|
52
|
+
isHidden: unit.isHidden,
|
|
53
|
+
sortOrder: unit.sortOrder,
|
|
54
|
+
});
|
|
55
|
+
unitIdMap[unit.id] = duplicatedUnit.id;
|
|
56
|
+
}
|
|
57
|
+
return { option: duplicatedOption, unitIdMap };
|
|
58
|
+
},
|
|
59
|
+
onSuccess: (data) => {
|
|
60
|
+
void queryClient.invalidateQueries({ queryKey: productsQueryKeys.productOptions() });
|
|
61
|
+
void queryClient.invalidateQueries({ queryKey: productsQueryKeys.optionUnits() });
|
|
62
|
+
queryClient.setQueryData(productsQueryKeys.productOption(data.option.id), data.option);
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export interface CreateOptionUnitInput {
|
|
2
|
+
optionId: string;
|
|
3
|
+
name: string;
|
|
4
|
+
code?: string | null;
|
|
5
|
+
description?: string | null;
|
|
6
|
+
unitType?: "person" | "group" | "room" | "vehicle" | "service" | "other";
|
|
7
|
+
minQuantity?: number | null;
|
|
8
|
+
maxQuantity?: number | null;
|
|
9
|
+
minAge?: number | null;
|
|
10
|
+
maxAge?: number | null;
|
|
11
|
+
occupancyMin?: number | null;
|
|
12
|
+
occupancyMax?: number | null;
|
|
13
|
+
isRequired?: boolean;
|
|
14
|
+
isHidden?: boolean;
|
|
15
|
+
sortOrder?: number;
|
|
16
|
+
}
|
|
17
|
+
export type UpdateOptionUnitInput = Omit<Partial<CreateOptionUnitInput>, "optionId">;
|
|
18
|
+
export declare function useOptionUnitMutation(): {
|
|
19
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
20
|
+
id: string;
|
|
21
|
+
optionId: string;
|
|
22
|
+
name: string;
|
|
23
|
+
code: string | null;
|
|
24
|
+
description: string | null;
|
|
25
|
+
unitType: "person" | "group" | "room" | "vehicle" | "service" | "other";
|
|
26
|
+
minQuantity: number | null;
|
|
27
|
+
maxQuantity: number | null;
|
|
28
|
+
minAge: number | null;
|
|
29
|
+
maxAge: number | null;
|
|
30
|
+
occupancyMin: number | null;
|
|
31
|
+
occupancyMax: number | null;
|
|
32
|
+
isRequired: boolean;
|
|
33
|
+
isHidden: boolean;
|
|
34
|
+
sortOrder: number;
|
|
35
|
+
}, Error, CreateOptionUnitInput, unknown>;
|
|
36
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
37
|
+
id: string;
|
|
38
|
+
optionId: string;
|
|
39
|
+
name: string;
|
|
40
|
+
code: string | null;
|
|
41
|
+
description: string | null;
|
|
42
|
+
unitType: "person" | "group" | "room" | "vehicle" | "service" | "other";
|
|
43
|
+
minQuantity: number | null;
|
|
44
|
+
maxQuantity: number | null;
|
|
45
|
+
minAge: number | null;
|
|
46
|
+
maxAge: number | null;
|
|
47
|
+
occupancyMin: number | null;
|
|
48
|
+
occupancyMax: number | null;
|
|
49
|
+
isRequired: boolean;
|
|
50
|
+
isHidden: boolean;
|
|
51
|
+
sortOrder: number;
|
|
52
|
+
}, Error, {
|
|
53
|
+
id: string;
|
|
54
|
+
input: UpdateOptionUnitInput;
|
|
55
|
+
}, unknown>;
|
|
56
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
57
|
+
success: boolean;
|
|
58
|
+
}, Error, string, unknown>;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=use-option-unit-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-unit-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-unit-mutation.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;IACxE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,UAAU,CAAC,CAAA;AAIpF,wBAAgB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuBO,MAAM;eAAS,qBAAqB;;;;;EA6B/E"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { fetchWithValidation } from "../client.js";
|
|
5
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
6
|
+
import { productsQueryKeys } from "../query-keys.js";
|
|
7
|
+
import { optionUnitSingleResponse } from "../schemas.js";
|
|
8
|
+
const deleteResponseSchema = z.object({ success: z.boolean() });
|
|
9
|
+
export function useOptionUnitMutation() {
|
|
10
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
11
|
+
const queryClient = useQueryClient();
|
|
12
|
+
const create = useMutation({
|
|
13
|
+
mutationFn: async ({ optionId, ...input }) => {
|
|
14
|
+
const { data } = await fetchWithValidation(`/v1/products/options/${optionId}/units`, optionUnitSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
15
|
+
return data;
|
|
16
|
+
},
|
|
17
|
+
onSuccess: (data) => {
|
|
18
|
+
void queryClient.invalidateQueries({ queryKey: productsQueryKeys.optionUnits() });
|
|
19
|
+
void queryClient.invalidateQueries({
|
|
20
|
+
queryKey: productsQueryKeys.productOption(data.optionId),
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const update = useMutation({
|
|
25
|
+
mutationFn: async ({ id, input }) => {
|
|
26
|
+
const { data } = await fetchWithValidation(`/v1/products/units/${id}`, optionUnitSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
27
|
+
return data;
|
|
28
|
+
},
|
|
29
|
+
onSuccess: (data) => {
|
|
30
|
+
void queryClient.invalidateQueries({ queryKey: productsQueryKeys.optionUnits() });
|
|
31
|
+
queryClient.setQueryData(productsQueryKeys.optionUnit(data.id), data);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
const remove = useMutation({
|
|
35
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/products/units/${id}`, deleteResponseSchema, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
36
|
+
onSuccess: () => {
|
|
37
|
+
void queryClient.invalidateQueries({ queryKey: productsQueryKeys.optionUnits() });
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
return { create, update, remove };
|
|
41
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface UseOptionUnitOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useOptionUnit(id: string | undefined, options?: UseOptionUnitOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
id: string;
|
|
6
|
+
optionId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
code: string | null;
|
|
9
|
+
description: string | null;
|
|
10
|
+
unitType: "person" | "group" | "room" | "vehicle" | "service" | "other";
|
|
11
|
+
minQuantity: number | null;
|
|
12
|
+
maxQuantity: number | null;
|
|
13
|
+
minAge: number | null;
|
|
14
|
+
maxAge: number | null;
|
|
15
|
+
occupancyMin: number | null;
|
|
16
|
+
occupancyMax: number | null;
|
|
17
|
+
isRequired: boolean;
|
|
18
|
+
isHidden: boolean;
|
|
19
|
+
sortOrder: number;
|
|
20
|
+
}, Error>;
|
|
21
|
+
//# sourceMappingURL=use-option-unit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-unit.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-unit.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,GAAE,oBAAyB;;;;;;;;;;;;;;;;UAQvF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
4
|
+
import { getOptionUnitQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useOptionUnit(id, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getOptionUnitQueryOptions({ baseUrl, fetcher }, id, options),
|
|
10
|
+
enabled: enabled && !!id,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { OptionUnitsListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseOptionUnitsOptions extends OptionUnitsListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useOptionUnits(options?: UseOptionUnitsOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
id: string;
|
|
8
|
+
optionId: string;
|
|
9
|
+
name: string;
|
|
10
|
+
code: string | null;
|
|
11
|
+
description: string | null;
|
|
12
|
+
unitType: "person" | "group" | "room" | "vehicle" | "service" | "other";
|
|
13
|
+
minQuantity: number | null;
|
|
14
|
+
maxQuantity: number | null;
|
|
15
|
+
minAge: number | null;
|
|
16
|
+
maxAge: number | null;
|
|
17
|
+
occupancyMin: number | null;
|
|
18
|
+
occupancyMax: number | null;
|
|
19
|
+
isRequired: boolean;
|
|
20
|
+
isHidden: boolean;
|
|
21
|
+
sortOrder: number;
|
|
22
|
+
}[];
|
|
23
|
+
total: number;
|
|
24
|
+
limit: number;
|
|
25
|
+
offset: number;
|
|
26
|
+
}, Error>;
|
|
27
|
+
//# sourceMappingURL=use-option-units.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-option-units.d.ts","sourceRoot":"","sources":["../../src/hooks/use-option-units.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAG9D,MAAM,WAAW,qBAAsB,SAAQ,sBAAsB;IACnE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B;;;;;;;;;;;;;;;;;;;;;UAQjE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
4
|
+
import { getOptionUnitsQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useOptionUnits(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getOptionUnitsQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type UseProductActionLedgerOptions } from "../query-options-action-ledger.js";
|
|
2
|
+
export declare function useProductActionLedger(productId: string | null | undefined, options?: UseProductActionLedgerOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
3
|
+
data: {
|
|
4
|
+
id: string;
|
|
5
|
+
occurredAt: string;
|
|
6
|
+
actionName: string;
|
|
7
|
+
actionVersion: string;
|
|
8
|
+
actionKind: "read" | "create" | "update" | "delete" | "execute" | "approve" | "reject" | "reverse" | "compensate" | "duplicate";
|
|
9
|
+
status: "requested" | "awaiting_approval" | "approved" | "denied" | "succeeded" | "failed" | "reversed" | "compensated" | "expired" | "cancelled" | "superseded";
|
|
10
|
+
evaluatedRisk: "low" | "medium" | "high" | "critical";
|
|
11
|
+
actorType: string | null;
|
|
12
|
+
principalType: "user" | "api_key" | "agent" | "workflow" | "system";
|
|
13
|
+
principalId: string;
|
|
14
|
+
principalSubtype: string | null;
|
|
15
|
+
sessionId: string | null;
|
|
16
|
+
apiTokenId: string | null;
|
|
17
|
+
internalRequest: boolean;
|
|
18
|
+
delegatedByPrincipalType: "user" | "api_key" | "agent" | "workflow" | "system" | null;
|
|
19
|
+
delegatedByPrincipalId: string | null;
|
|
20
|
+
delegationId: string | null;
|
|
21
|
+
callerType: string | null;
|
|
22
|
+
organizationId: string | null;
|
|
23
|
+
routeOrToolName: string | null;
|
|
24
|
+
workflowRunId: string | null;
|
|
25
|
+
workflowStepId: string | null;
|
|
26
|
+
correlationId: string | null;
|
|
27
|
+
causationActionId: string | null;
|
|
28
|
+
idempotencyScope: string | null;
|
|
29
|
+
idempotencyKey: string | null;
|
|
30
|
+
idempotencyFingerprint: string | null;
|
|
31
|
+
targetType: string;
|
|
32
|
+
targetId: string;
|
|
33
|
+
capabilityId: string | null;
|
|
34
|
+
capabilityVersion: string | null;
|
|
35
|
+
authorizationSource: string | null;
|
|
36
|
+
approvalId: string | null;
|
|
37
|
+
amendsActionId: string | null;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
mutationSummary: string | null;
|
|
40
|
+
}[];
|
|
41
|
+
pageInfo: {
|
|
42
|
+
nextCursor: {
|
|
43
|
+
occurredAt: string;
|
|
44
|
+
id: string;
|
|
45
|
+
} | null;
|
|
46
|
+
};
|
|
47
|
+
}, Error>;
|
|
48
|
+
//# sourceMappingURL=use-product-action-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-product-action-ledger.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-action-ledger.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,mCAAmC,CAAA;AAE1C,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,6BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAS5C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
4
|
+
import { getProductActionLedgerQueryOptions, } from "../query-options-action-ledger.js";
|
|
5
|
+
export function useProductActionLedger(productId, options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
7
|
+
const { enabled = true } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getProductActionLedgerQueryOptions({ baseUrl, fetcher }, productId, options),
|
|
10
|
+
enabled: enabled && Boolean(productId),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ProductCategoriesListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseProductCategoriesOptions extends ProductCategoriesListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useProductCategories(options?: UseProductCategoriesOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
id: string;
|
|
8
|
+
parentId: string | null;
|
|
9
|
+
name: string;
|
|
10
|
+
slug: string;
|
|
11
|
+
description: string | null;
|
|
12
|
+
sortOrder: number;
|
|
13
|
+
active: boolean;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
customerPaymentPolicy?: {
|
|
17
|
+
deposit: {
|
|
18
|
+
kind: "none" | "percent" | "fixed_cents";
|
|
19
|
+
percent?: number | undefined;
|
|
20
|
+
amountCents?: number | undefined;
|
|
21
|
+
};
|
|
22
|
+
minDaysBeforeDepartureForDeposit: number;
|
|
23
|
+
balanceDueDaysBeforeDeparture: number;
|
|
24
|
+
balanceDueMinDaysFromNow: number;
|
|
25
|
+
} | null | undefined;
|
|
26
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
27
|
+
}[];
|
|
28
|
+
total: number;
|
|
29
|
+
limit: number;
|
|
30
|
+
offset: number;
|
|
31
|
+
}, Error>;
|
|
32
|
+
//# sourceMappingURL=use-product-categories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-product-categories.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-categories.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,4BAA4B,EAAqB,MAAM,kBAAkB,CAAA;AAGvF,MAAM,WAAW,2BAA4B,SAAQ,4BAA4B;IAC/E,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,2BAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;UAsB7E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
5
|
+
import { productsQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { productCategoryListResponse } from "../schemas.js";
|
|
7
|
+
export function useProductCategories(options = {}) {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
9
|
+
const { enabled = true, ...filters } = options;
|
|
10
|
+
return useQuery({
|
|
11
|
+
queryKey: productsQueryKeys.productCategoriesList(filters),
|
|
12
|
+
queryFn: () => {
|
|
13
|
+
const params = new URLSearchParams();
|
|
14
|
+
if (filters.parentId)
|
|
15
|
+
params.set("parentId", filters.parentId);
|
|
16
|
+
if (filters.active !== undefined)
|
|
17
|
+
params.set("active", String(filters.active));
|
|
18
|
+
if (filters.search)
|
|
19
|
+
params.set("search", filters.search);
|
|
20
|
+
if (filters.limit !== undefined)
|
|
21
|
+
params.set("limit", String(filters.limit));
|
|
22
|
+
if (filters.offset !== undefined)
|
|
23
|
+
params.set("offset", String(filters.offset));
|
|
24
|
+
const qs = params.toString();
|
|
25
|
+
return fetchWithValidation(`/v1/products/product-categories${qs ? `?${qs}` : ""}`, productCategoryListResponse, { baseUrl, fetcher });
|
|
26
|
+
},
|
|
27
|
+
enabled,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type ProductCategoryPaymentPolicy } from "../schemas.js";
|
|
2
|
+
export interface CreateProductCategoryInput {
|
|
3
|
+
name: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
parentId?: string | null;
|
|
6
|
+
description?: string | null;
|
|
7
|
+
sortOrder?: number;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
customerPaymentPolicy?: ProductCategoryPaymentPolicy | null;
|
|
10
|
+
metadata?: Record<string, unknown> | null;
|
|
11
|
+
}
|
|
12
|
+
export type UpdateProductCategoryInput = Partial<CreateProductCategoryInput>;
|
|
13
|
+
export declare function useProductCategoryMutation(): {
|
|
14
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
15
|
+
id: string;
|
|
16
|
+
parentId: string | null;
|
|
17
|
+
name: string;
|
|
18
|
+
slug: string;
|
|
19
|
+
description: string | null;
|
|
20
|
+
sortOrder: number;
|
|
21
|
+
active: boolean;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
customerPaymentPolicy?: {
|
|
25
|
+
deposit: {
|
|
26
|
+
kind: "none" | "percent" | "fixed_cents";
|
|
27
|
+
percent?: number | undefined;
|
|
28
|
+
amountCents?: number | undefined;
|
|
29
|
+
};
|
|
30
|
+
minDaysBeforeDepartureForDeposit: number;
|
|
31
|
+
balanceDueDaysBeforeDeparture: number;
|
|
32
|
+
balanceDueMinDaysFromNow: number;
|
|
33
|
+
} | null | undefined;
|
|
34
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
35
|
+
}, Error, CreateProductCategoryInput, unknown>;
|
|
36
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
37
|
+
id: string;
|
|
38
|
+
parentId: string | null;
|
|
39
|
+
name: string;
|
|
40
|
+
slug: string;
|
|
41
|
+
description: string | null;
|
|
42
|
+
sortOrder: number;
|
|
43
|
+
active: boolean;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
updatedAt: string;
|
|
46
|
+
customerPaymentPolicy?: {
|
|
47
|
+
deposit: {
|
|
48
|
+
kind: "none" | "percent" | "fixed_cents";
|
|
49
|
+
percent?: number | undefined;
|
|
50
|
+
amountCents?: number | undefined;
|
|
51
|
+
};
|
|
52
|
+
minDaysBeforeDepartureForDeposit: number;
|
|
53
|
+
balanceDueDaysBeforeDeparture: number;
|
|
54
|
+
balanceDueMinDaysFromNow: number;
|
|
55
|
+
} | null | undefined;
|
|
56
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
57
|
+
}, Error, {
|
|
58
|
+
id: string;
|
|
59
|
+
input: UpdateProductCategoryInput;
|
|
60
|
+
}, unknown>;
|
|
61
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
62
|
+
success: boolean;
|
|
63
|
+
}, Error, string, unknown>;
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=use-product-category-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-product-category-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-category-mutation.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,4BAA4B,EAAiC,MAAM,eAAe,CAAA;AAEhG,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,qBAAqB,CAAC,EAAE,4BAA4B,GAAG,IAAI,CAAA;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAC1C;AAED,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;AAI5E,wBAAgB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAoBE,MAAM;eAAS,0BAA0B;;;;;EA8BpF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { fetchWithValidation } from "../client.js";
|
|
5
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
6
|
+
import { productsQueryKeys } from "../query-keys.js";
|
|
7
|
+
import { productCategorySingleResponse } from "../schemas.js";
|
|
8
|
+
const deleteResponseSchema = z.object({ success: z.boolean() });
|
|
9
|
+
export function useProductCategoryMutation() {
|
|
10
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
11
|
+
const queryClient = useQueryClient();
|
|
12
|
+
const create = useMutation({
|
|
13
|
+
mutationFn: async (input) => {
|
|
14
|
+
const { data } = await fetchWithValidation("/v1/products/product-categories", productCategorySingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
15
|
+
return data;
|
|
16
|
+
},
|
|
17
|
+
onSuccess: () => {
|
|
18
|
+
void queryClient.invalidateQueries({ queryKey: productsQueryKeys.productCategories() });
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const update = useMutation({
|
|
22
|
+
mutationFn: async ({ id, input }) => {
|
|
23
|
+
const { data } = await fetchWithValidation(`/v1/products/product-categories/${id}`, productCategorySingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
24
|
+
return data;
|
|
25
|
+
},
|
|
26
|
+
onSuccess: (data) => {
|
|
27
|
+
void queryClient.invalidateQueries({ queryKey: productsQueryKeys.productCategories() });
|
|
28
|
+
queryClient.setQueryData(productsQueryKeys.productCategory(data.id), data);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
const remove = useMutation({
|
|
32
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/products/product-categories/${id}`, deleteResponseSchema, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
33
|
+
onSuccess: (_data, id) => {
|
|
34
|
+
void queryClient.invalidateQueries({ queryKey: productsQueryKeys.productCategories() });
|
|
35
|
+
queryClient.removeQueries({ queryKey: productsQueryKeys.productCategory(id) });
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
return { create, update, remove };
|
|
39
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface UseProductCategoryOptions {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useProductCategory(id: string | null | undefined, options?: UseProductCategoryOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
5
|
+
id: string;
|
|
6
|
+
parentId: string | null;
|
|
7
|
+
name: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
description: string | null;
|
|
10
|
+
sortOrder: number;
|
|
11
|
+
active: boolean;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
customerPaymentPolicy?: {
|
|
15
|
+
deposit: {
|
|
16
|
+
kind: "none" | "percent" | "fixed_cents";
|
|
17
|
+
percent?: number | undefined;
|
|
18
|
+
amountCents?: number | undefined;
|
|
19
|
+
};
|
|
20
|
+
minDaysBeforeDepartureForDeposit: number;
|
|
21
|
+
balanceDueDaysBeforeDeparture: number;
|
|
22
|
+
balanceDueMinDaysFromNow: number;
|
|
23
|
+
} | null | undefined;
|
|
24
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
25
|
+
}, Error>;
|
|
26
|
+
//# sourceMappingURL=use-product-category.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-product-category.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-category.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,OAAO,GAAE,yBAA8B;;;;;;;;;;;;;;;;;;;;;UAiBxC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
5
|
+
import { productsQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { productCategorySingleResponse } from "../schemas.js";
|
|
7
|
+
export function useProductCategory(id, options = {}) {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
9
|
+
const { enabled = true } = options;
|
|
10
|
+
return useQuery({
|
|
11
|
+
queryKey: productsQueryKeys.productCategory(id ?? "__missing__"),
|
|
12
|
+
queryFn: async () => {
|
|
13
|
+
const { data } = await fetchWithValidation(`/v1/products/product-categories/${id}`, productCategorySingleResponse, { baseUrl, fetcher });
|
|
14
|
+
return data;
|
|
15
|
+
},
|
|
16
|
+
enabled: enabled && Boolean(id),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type UpdateProductDayInput } from "../schemas.js";
|
|
2
|
+
export declare function useProductDayMutation(): {
|
|
3
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
4
|
+
id: string;
|
|
5
|
+
itineraryId: string;
|
|
6
|
+
dayNumber: number;
|
|
7
|
+
title: string | null;
|
|
8
|
+
description: string | null;
|
|
9
|
+
location: string | null;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
}, Error, {
|
|
13
|
+
dayNumber: number;
|
|
14
|
+
title?: string | null | undefined;
|
|
15
|
+
description?: string | null | undefined;
|
|
16
|
+
location?: string | null | undefined;
|
|
17
|
+
} & {
|
|
18
|
+
productId: string;
|
|
19
|
+
itineraryId?: string;
|
|
20
|
+
}, unknown>;
|
|
21
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
22
|
+
id: string;
|
|
23
|
+
itineraryId: string;
|
|
24
|
+
dayNumber: number;
|
|
25
|
+
title: string | null;
|
|
26
|
+
description: string | null;
|
|
27
|
+
location: string | null;
|
|
28
|
+
createdAt: string;
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
}, Error, {
|
|
31
|
+
productId: string;
|
|
32
|
+
dayId: string;
|
|
33
|
+
input: UpdateProductDayInput;
|
|
34
|
+
}, unknown>;
|
|
35
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
36
|
+
success: boolean;
|
|
37
|
+
}, Error, {
|
|
38
|
+
productId: string;
|
|
39
|
+
dayId: string;
|
|
40
|
+
itineraryId?: string;
|
|
41
|
+
}, unknown>;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=use-product-day-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-product-day-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-day-mutation.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAA;AAEtB,wBAAgB,qBAAqB;;;;;;;;;;;;;;;;mBASO,MAAM;sBAAgB,MAAM;;;;;;;;;;;;mBA2BvD,MAAM;eACV,MAAM;eACN,qBAAqB;;;;;mBAyBjB,MAAM;eACV,MAAM;sBACC,MAAM;;EAwBzB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantProductsContext } from "../provider.js";
|
|
5
|
+
import { productsQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { productDayResponse, successEnvelope, } from "../schemas.js";
|
|
7
|
+
export function useProductDayMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantProductsContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async ({ productId, itineraryId, ...input }) => {
|
|
12
|
+
const { data } = await fetchWithValidation(itineraryId
|
|
13
|
+
? `/v1/products/${productId}/itineraries/${itineraryId}/days`
|
|
14
|
+
: `/v1/products/${productId}/days`, productDayResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
15
|
+
return data;
|
|
16
|
+
},
|
|
17
|
+
onSuccess: async (data, variables) => {
|
|
18
|
+
await queryClient.invalidateQueries({
|
|
19
|
+
queryKey: productsQueryKeys.productDays(variables.productId),
|
|
20
|
+
});
|
|
21
|
+
await queryClient.invalidateQueries({
|
|
22
|
+
queryKey: productsQueryKeys.productItineraryDays(variables.productId, data.itineraryId),
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const update = useMutation({
|
|
27
|
+
mutationFn: async ({ productId, dayId, input, }) => {
|
|
28
|
+
const { data } = await fetchWithValidation(`/v1/products/${productId}/days/${dayId}`, productDayResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
29
|
+
return data;
|
|
30
|
+
},
|
|
31
|
+
onSuccess: async (data, variables) => {
|
|
32
|
+
await queryClient.invalidateQueries({
|
|
33
|
+
queryKey: productsQueryKeys.productDays(variables.productId),
|
|
34
|
+
});
|
|
35
|
+
await queryClient.invalidateQueries({
|
|
36
|
+
queryKey: productsQueryKeys.productItineraryDays(variables.productId, data.itineraryId),
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const remove = useMutation({
|
|
41
|
+
mutationFn: async ({ productId, dayId, }) => fetchWithValidation(`/v1/products/${productId}/days/${dayId}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
|
|
42
|
+
onSuccess: async (_data, variables) => {
|
|
43
|
+
await queryClient.invalidateQueries({
|
|
44
|
+
queryKey: productsQueryKeys.productDays(variables.productId),
|
|
45
|
+
});
|
|
46
|
+
if (variables.itineraryId) {
|
|
47
|
+
await queryClient.invalidateQueries({
|
|
48
|
+
queryKey: productsQueryKeys.productItineraryDays(variables.productId, variables.itineraryId),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
return { create, update, remove };
|
|
54
|
+
}
|