@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.
Files changed (564) hide show
  1. package/LICENSE +201 -0
  2. package/dist/admin/index.d.ts +91 -0
  3. package/dist/admin/index.d.ts.map +1 -0
  4. package/dist/admin/index.js +132 -0
  5. package/dist/admin/pages/product-detail-page.d.ts +18 -0
  6. package/dist/admin/pages/product-detail-page.d.ts.map +1 -0
  7. package/dist/admin/pages/product-detail-page.js +63 -0
  8. package/dist/admin/product-categories-host.d.ts +7 -0
  9. package/dist/admin/product-categories-host.d.ts.map +1 -0
  10. package/dist/admin/product-categories-host.js +11 -0
  11. package/dist/admin/product-detail-api.d.ts +22 -0
  12. package/dist/admin/product-detail-api.d.ts.map +1 -0
  13. package/dist/admin/product-detail-api.js +58 -0
  14. package/dist/admin/products-host.d.ts +11 -0
  15. package/dist/admin/products-host.d.ts.map +1 -0
  16. package/dist/admin/products-host.js +17 -0
  17. package/dist/admin/products-list-skeleton.d.ts +10 -0
  18. package/dist/admin/products-list-skeleton.d.ts.map +1 -0
  19. package/dist/admin/products-list-skeleton.js +23 -0
  20. package/dist/client.d.ts +16 -0
  21. package/dist/client.d.ts.map +1 -0
  22. package/dist/client.js +79 -0
  23. package/dist/components/option-unit-dialog.d.ts +11 -0
  24. package/dist/components/option-unit-dialog.d.ts.map +1 -0
  25. package/dist/components/option-unit-dialog.js +17 -0
  26. package/dist/components/option-unit-form.d.ts +17 -0
  27. package/dist/components/option-unit-form.d.ts.map +1 -0
  28. package/dist/components/option-unit-form.js +123 -0
  29. package/dist/components/product-action-ledger-card.d.ts +17 -0
  30. package/dist/components/product-action-ledger-card.d.ts.map +1 -0
  31. package/dist/components/product-action-ledger-card.js +73 -0
  32. package/dist/components/product-catalog-card.d.ts +14 -0
  33. package/dist/components/product-catalog-card.d.ts.map +1 -0
  34. package/dist/components/product-catalog-card.js +44 -0
  35. package/dist/components/product-categories-page.d.ts +7 -0
  36. package/dist/components/product-categories-page.d.ts.map +1 -0
  37. package/dist/components/product-categories-page.js +9 -0
  38. package/dist/components/product-category-combobox.d.ts +10 -0
  39. package/dist/components/product-category-combobox.d.ts.map +1 -0
  40. package/dist/components/product-category-combobox.js +47 -0
  41. package/dist/components/product-category-dialog.d.ts +9 -0
  42. package/dist/components/product-category-dialog.d.ts.map +1 -0
  43. package/dist/components/product-category-dialog.js +17 -0
  44. package/dist/components/product-category-form.d.ts +15 -0
  45. package/dist/components/product-category-form.d.ts.map +1 -0
  46. package/dist/components/product-category-form.js +82 -0
  47. package/dist/components/product-category-list.d.ts +5 -0
  48. package/dist/components/product-category-list.d.ts.map +1 -0
  49. package/dist/components/product-category-list.js +48 -0
  50. package/dist/components/product-combobox.d.ts +13 -0
  51. package/dist/components/product-combobox.d.ts.map +1 -0
  52. package/dist/components/product-combobox.js +23 -0
  53. package/dist/components/product-contract-template-combobox.d.ts +9 -0
  54. package/dist/components/product-contract-template-combobox.d.ts.map +1 -0
  55. package/dist/components/product-contract-template-combobox.js +97 -0
  56. package/dist/components/product-day-dialog.d.ts +20 -0
  57. package/dist/components/product-day-dialog.d.ts.map +1 -0
  58. package/dist/components/product-day-dialog.js +20 -0
  59. package/dist/components/product-day-form.d.ts +19 -0
  60. package/dist/components/product-day-form.d.ts.map +1 -0
  61. package/dist/components/product-day-form.js +77 -0
  62. package/dist/components/product-day-media-tray.d.ts +11 -0
  63. package/dist/components/product-day-media-tray.d.ts.map +1 -0
  64. package/dist/components/product-day-media-tray.js +74 -0
  65. package/dist/components/product-day-service-dialog.d.ts +14 -0
  66. package/dist/components/product-day-service-dialog.d.ts.map +1 -0
  67. package/dist/components/product-day-service-dialog.js +19 -0
  68. package/dist/components/product-day-service-form.d.ts +44 -0
  69. package/dist/components/product-day-service-form.d.ts.map +1 -0
  70. package/dist/components/product-day-service-form.js +152 -0
  71. package/dist/components/product-detail/commerce-client.d.ts +314 -0
  72. package/dist/components/product-detail/commerce-client.d.ts.map +1 -0
  73. package/dist/components/product-detail/commerce-client.js +261 -0
  74. package/dist/components/product-detail/host.d.ts +54 -0
  75. package/dist/components/product-detail/host.d.ts.map +1 -0
  76. package/dist/components/product-detail/host.js +27 -0
  77. package/dist/components/product-detail/index.d.ts +6 -0
  78. package/dist/components/product-detail/index.d.ts.map +1 -0
  79. package/dist/components/product-detail/index.js +5 -0
  80. package/dist/components/product-detail/product-activity-section.d.ts +4 -0
  81. package/dist/components/product-detail/product-activity-section.d.ts.map +1 -0
  82. package/dist/components/product-detail/product-activity-section.js +37 -0
  83. package/dist/components/product-detail/product-day-sheet.d.ts +14 -0
  84. package/dist/components/product-detail/product-day-sheet.d.ts.map +1 -0
  85. package/dist/components/product-detail/product-day-sheet.js +75 -0
  86. package/dist/components/product-detail/product-day-translation.d.ts +41 -0
  87. package/dist/components/product-detail/product-day-translation.d.ts.map +1 -0
  88. package/dist/components/product-detail/product-day-translation.js +111 -0
  89. package/dist/components/product-detail/product-departure-dialog.d.ts +11 -0
  90. package/dist/components/product-detail/product-departure-dialog.d.ts.map +1 -0
  91. package/dist/components/product-detail/product-departure-dialog.js +10 -0
  92. package/dist/components/product-detail/product-departure-form.d.ts +25 -0
  93. package/dist/components/product-detail/product-departure-form.d.ts.map +1 -0
  94. package/dist/components/product-detail/product-departure-form.js +241 -0
  95. package/dist/components/product-detail/product-departure-pricing-override-dialog.d.ts +8 -0
  96. package/dist/components/product-detail/product-departure-pricing-override-dialog.d.ts.map +1 -0
  97. package/dist/components/product-detail/product-departure-pricing-override-dialog.js +126 -0
  98. package/dist/components/product-detail/product-detail-availability-sections.d.ts +19 -0
  99. package/dist/components/product-detail/product-detail-availability-sections.d.ts.map +1 -0
  100. package/dist/components/product-detail/product-detail-availability-sections.js +29 -0
  101. package/dist/components/product-detail/product-detail-channel-section.d.ts +8 -0
  102. package/dist/components/product-detail/product-detail-channel-section.d.ts.map +1 -0
  103. package/dist/components/product-detail/product-detail-channel-section.js +16 -0
  104. package/dist/components/product-detail/product-detail-day-row.d.ts +14 -0
  105. package/dist/components/product-detail/product-detail-day-row.d.ts.map +1 -0
  106. package/dist/components/product-detail/product-detail-day-row.js +43 -0
  107. package/dist/components/product-detail/product-detail-dialog.d.ts +10 -0
  108. package/dist/components/product-detail/product-detail-dialog.d.ts.map +1 -0
  109. package/dist/components/product-detail/product-detail-dialog.js +10 -0
  110. package/dist/components/product-detail/product-detail-form.d.ts +22 -0
  111. package/dist/components/product-detail/product-detail-form.d.ts.map +1 -0
  112. package/dist/components/product-detail/product-detail-form.js +205 -0
  113. package/dist/components/product-detail/product-detail-header.d.ts +12 -0
  114. package/dist/components/product-detail/product-detail-header.d.ts.map +1 -0
  115. package/dist/components/product-detail/product-detail-header.js +19 -0
  116. package/dist/components/product-detail/product-detail-itinerary-section.d.ts +4 -0
  117. package/dist/components/product-detail/product-detail-itinerary-section.d.ts.map +1 -0
  118. package/dist/components/product-detail/product-detail-itinerary-section.js +201 -0
  119. package/dist/components/product-detail/product-detail-media-sections.d.ts +15 -0
  120. package/dist/components/product-detail/product-detail-media-sections.d.ts.map +1 -0
  121. package/dist/components/product-detail/product-detail-media-sections.js +19 -0
  122. package/dist/components/product-detail/product-detail-organize-section.d.ts +6 -0
  123. package/dist/components/product-detail/product-detail-organize-section.d.ts.map +1 -0
  124. package/dist/components/product-detail/product-detail-organize-section.js +18 -0
  125. package/dist/components/product-detail/product-detail-page.d.ts +4 -0
  126. package/dist/components/product-detail/product-detail-page.d.ts.map +1 -0
  127. package/dist/components/product-detail/product-detail-page.js +95 -0
  128. package/dist/components/product-detail/product-detail-section-shell.d.ts +19 -0
  129. package/dist/components/product-detail/product-detail-section-shell.d.ts.map +1 -0
  130. package/dist/components/product-detail/product-detail-section-shell.js +23 -0
  131. package/dist/components/product-detail/product-detail-sections.d.ts +7 -0
  132. package/dist/components/product-detail/product-detail-sections.d.ts.map +1 -0
  133. package/dist/components/product-detail/product-detail-sections.js +6 -0
  134. package/dist/components/product-detail/product-detail-shared.d.ts +264 -0
  135. package/dist/components/product-detail/product-detail-shared.d.ts.map +1 -0
  136. package/dist/components/product-detail/product-detail-shared.js +157 -0
  137. package/dist/components/product-detail/product-detail-skeleton.d.ts +9 -0
  138. package/dist/components/product-detail/product-detail-skeleton.d.ts.map +1 -0
  139. package/dist/components/product-detail/product-detail-skeleton.js +53 -0
  140. package/dist/components/product-detail/product-detail-summary-section.d.ts +6 -0
  141. package/dist/components/product-detail/product-detail-summary-section.d.ts.map +1 -0
  142. package/dist/components/product-detail/product-detail-summary-section.js +66 -0
  143. package/dist/components/product-detail/product-extra-dialog.d.ts +21 -0
  144. package/dist/components/product-detail/product-extra-dialog.d.ts.map +1 -0
  145. package/dist/components/product-detail/product-extra-dialog.js +131 -0
  146. package/dist/components/product-detail/product-itinerary-form.d.ts +16 -0
  147. package/dist/components/product-detail/product-itinerary-form.d.ts.map +1 -0
  148. package/dist/components/product-detail/product-itinerary-form.js +38 -0
  149. package/dist/components/product-detail/product-market-rules-section.d.ts +6 -0
  150. package/dist/components/product-detail/product-market-rules-section.d.ts.map +1 -0
  151. package/dist/components/product-detail/product-market-rules-section.js +81 -0
  152. package/dist/components/product-detail/product-media-gallery.d.ts +19 -0
  153. package/dist/components/product-detail/product-media-gallery.d.ts.map +1 -0
  154. package/dist/components/product-detail/product-media-gallery.js +114 -0
  155. package/dist/components/product-detail/product-option-price-rule-dialog.d.ts +12 -0
  156. package/dist/components/product-detail/product-option-price-rule-dialog.d.ts.map +1 -0
  157. package/dist/components/product-detail/product-option-price-rule-dialog.js +10 -0
  158. package/dist/components/product-detail/product-option-price-rule-form.d.ts +29 -0
  159. package/dist/components/product-detail/product-option-price-rule-form.d.ts.map +1 -0
  160. package/dist/components/product-detail/product-option-price-rule-form.js +122 -0
  161. package/dist/components/product-detail/product-option-pricing-grid.d.ts +16 -0
  162. package/dist/components/product-detail/product-option-pricing-grid.d.ts.map +1 -0
  163. package/dist/components/product-detail/product-option-pricing-grid.js +236 -0
  164. package/dist/components/product-detail/product-options-extra-price-rules.d.ts +8 -0
  165. package/dist/components/product-detail/product-options-extra-price-rules.d.ts.map +1 -0
  166. package/dist/components/product-detail/product-options-extra-price-rules.js +123 -0
  167. package/dist/components/product-detail/product-options-pricing-helpers.d.ts +14 -0
  168. package/dist/components/product-detail/product-options-pricing-helpers.d.ts.map +1 -0
  169. package/dist/components/product-detail/product-options-pricing-helpers.js +49 -0
  170. package/dist/components/product-detail/product-options-pricing-panel.d.ts +17 -0
  171. package/dist/components/product-detail/product-options-pricing-panel.d.ts.map +1 -0
  172. package/dist/components/product-detail/product-options-pricing-panel.js +88 -0
  173. package/dist/components/product-detail/product-options-pricing.d.ts +5 -0
  174. package/dist/components/product-detail/product-options-pricing.d.ts.map +1 -0
  175. package/dist/components/product-detail/product-options-pricing.js +4 -0
  176. package/dist/components/product-detail/product-options-shared.d.ts +236 -0
  177. package/dist/components/product-detail/product-options-shared.d.ts.map +1 -0
  178. package/dist/components/product-detail/product-options-shared.js +57 -0
  179. package/dist/components/product-detail/product-options-traveler-category-dialog.d.ts +12 -0
  180. package/dist/components/product-detail/product-options-traveler-category-dialog.d.ts.map +1 -0
  181. package/dist/components/product-detail/product-options-traveler-category-dialog.js +132 -0
  182. package/dist/components/product-detail/product-options-unit-price-matrix.d.ts +10 -0
  183. package/dist/components/product-detail/product-options-unit-price-matrix.d.ts.map +1 -0
  184. package/dist/components/product-detail/product-options-unit-price-matrix.js +103 -0
  185. package/dist/components/product-detail/product-payment-policy-section.d.ts +17 -0
  186. package/dist/components/product-detail/product-payment-policy-section.d.ts.map +1 -0
  187. package/dist/components/product-detail/product-payment-policy-section.js +58 -0
  188. package/dist/components/product-detail/product-schedule-dialog.d.ts +11 -0
  189. package/dist/components/product-detail/product-schedule-dialog.d.ts.map +1 -0
  190. package/dist/components/product-detail/product-schedule-dialog.js +10 -0
  191. package/dist/components/product-detail/product-schedule-form.d.ts +17 -0
  192. package/dist/components/product-detail/product-schedule-form.d.ts.map +1 -0
  193. package/dist/components/product-detail/product-schedule-form.js +223 -0
  194. package/dist/components/product-detail/product-service-dialog.d.ts +12 -0
  195. package/dist/components/product-detail/product-service-dialog.d.ts.map +1 -0
  196. package/dist/components/product-detail/product-service-dialog.js +10 -0
  197. package/dist/components/product-detail/product-service-form.d.ts +22 -0
  198. package/dist/components/product-detail/product-service-form.d.ts.map +1 -0
  199. package/dist/components/product-detail/product-service-form.js +154 -0
  200. package/dist/components/product-detail/product-translation-popover.d.ts +94 -0
  201. package/dist/components/product-detail/product-translation-popover.d.ts.map +1 -0
  202. package/dist/components/product-detail/product-translation-popover.js +238 -0
  203. package/dist/components/product-detail/product-unit-dialog.d.ts +14 -0
  204. package/dist/components/product-detail/product-unit-dialog.d.ts.map +1 -0
  205. package/dist/components/product-detail/product-unit-dialog.js +10 -0
  206. package/dist/components/product-detail/product-unit-form.d.ts +34 -0
  207. package/dist/components/product-detail/product-unit-form.d.ts.map +1 -0
  208. package/dist/components/product-detail/product-unit-form.js +139 -0
  209. package/dist/components/product-detail/product-unit-price-rule-dialog.d.ts +17 -0
  210. package/dist/components/product-detail/product-unit-price-rule-dialog.d.ts.map +1 -0
  211. package/dist/components/product-detail/product-unit-price-rule-dialog.js +10 -0
  212. package/dist/components/product-detail/product-unit-price-rule-form.d.ts +29 -0
  213. package/dist/components/product-detail/product-unit-price-rule-form.d.ts.map +1 -0
  214. package/dist/components/product-detail/product-unit-price-rule-form.js +144 -0
  215. package/dist/components/product-detail/rrule-labels.d.ts +2 -0
  216. package/dist/components/product-detail/rrule-labels.d.ts.map +1 -0
  217. package/dist/components/product-detail/rrule-labels.js +65 -0
  218. package/dist/components/product-detail/timezone-options.d.ts +9 -0
  219. package/dist/components/product-detail/timezone-options.d.ts.map +1 -0
  220. package/dist/components/product-detail/timezone-options.js +28 -0
  221. package/dist/components/product-detail/use-product-detail-data.d.ts +41 -0
  222. package/dist/components/product-detail/use-product-detail-data.d.ts.map +1 -0
  223. package/dist/components/product-detail/use-product-detail-data.js +143 -0
  224. package/dist/components/product-detail/use-product-detail-dialogs.d.ts +24 -0
  225. package/dist/components/product-detail/use-product-detail-dialogs.d.ts.map +1 -0
  226. package/dist/components/product-detail/use-product-detail-dialogs.js +40 -0
  227. package/dist/components/product-detail/zod-resolver.d.ts +4 -0
  228. package/dist/components/product-detail/zod-resolver.d.ts.map +1 -0
  229. package/dist/components/product-detail/zod-resolver.js +39 -0
  230. package/dist/components/product-detail-page.d.ts +57 -0
  231. package/dist/components/product-detail-page.d.ts.map +1 -0
  232. package/dist/components/product-detail-page.js +118 -0
  233. package/dist/components/product-detail.d.ts +2 -0
  234. package/dist/components/product-detail.d.ts.map +1 -0
  235. package/dist/components/product-detail.js +1 -0
  236. package/dist/components/product-dialog.d.ts +9 -0
  237. package/dist/components/product-dialog.d.ts.map +1 -0
  238. package/dist/components/product-dialog.js +13 -0
  239. package/dist/components/product-facility-combobox.d.ts +9 -0
  240. package/dist/components/product-facility-combobox.d.ts.map +1 -0
  241. package/dist/components/product-facility-combobox.js +94 -0
  242. package/dist/components/product-form.d.ts +14 -0
  243. package/dist/components/product-form.d.ts.map +1 -0
  244. package/dist/components/product-form.js +191 -0
  245. package/dist/components/product-itinerary-day-row.d.ts +22 -0
  246. package/dist/components/product-itinerary-day-row.d.ts.map +1 -0
  247. package/dist/components/product-itinerary-day-row.js +17 -0
  248. package/dist/components/product-itinerary-dialog.d.ts +16 -0
  249. package/dist/components/product-itinerary-dialog.d.ts.map +1 -0
  250. package/dist/components/product-itinerary-dialog.js +85 -0
  251. package/dist/components/product-itinerary-section.d.ts +16 -0
  252. package/dist/components/product-itinerary-section.d.ts.map +1 -0
  253. package/dist/components/product-itinerary-section.js +105 -0
  254. package/dist/components/product-list.d.ts +7 -0
  255. package/dist/components/product-list.d.ts.map +1 -0
  256. package/dist/components/product-list.js +155 -0
  257. package/dist/components/product-media-dialog.d.ts +11 -0
  258. package/dist/components/product-media-dialog.d.ts.map +1 -0
  259. package/dist/components/product-media-dialog.js +17 -0
  260. package/dist/components/product-media-form.d.ts +17 -0
  261. package/dist/components/product-media-form.d.ts.map +1 -0
  262. package/dist/components/product-media-form.js +101 -0
  263. package/dist/components/product-media-lightbox.d.ts +7 -0
  264. package/dist/components/product-media-lightbox.d.ts.map +1 -0
  265. package/dist/components/product-media-lightbox.js +31 -0
  266. package/dist/components/product-media-section.d.ts +27 -0
  267. package/dist/components/product-media-section.d.ts.map +1 -0
  268. package/dist/components/product-media-section.js +130 -0
  269. package/dist/components/product-media-tile.d.ts +17 -0
  270. package/dist/components/product-media-tile.d.ts.map +1 -0
  271. package/dist/components/product-media-tile.js +16 -0
  272. package/dist/components/product-option-dialog.d.ts +11 -0
  273. package/dist/components/product-option-dialog.d.ts.map +1 -0
  274. package/dist/components/product-option-dialog.js +17 -0
  275. package/dist/components/product-option-form.d.ts +17 -0
  276. package/dist/components/product-option-form.d.ts.map +1 -0
  277. package/dist/components/product-option-form.js +91 -0
  278. package/dist/components/product-options-section.d.ts +13 -0
  279. package/dist/components/product-options-section.d.ts.map +1 -0
  280. package/dist/components/product-options-section.js +200 -0
  281. package/dist/components/product-quick-view-sheet.d.ts +23 -0
  282. package/dist/components/product-quick-view-sheet.d.ts.map +1 -0
  283. package/dist/components/product-quick-view-sheet.js +65 -0
  284. package/dist/components/product-tag-dialog.d.ts +9 -0
  285. package/dist/components/product-tag-dialog.d.ts.map +1 -0
  286. package/dist/components/product-tag-dialog.js +17 -0
  287. package/dist/components/product-tag-form.d.ts +15 -0
  288. package/dist/components/product-tag-form.d.ts.map +1 -0
  289. package/dist/components/product-tag-form.js +48 -0
  290. package/dist/components/product-tag-list.d.ts +5 -0
  291. package/dist/components/product-tag-list.d.ts.map +1 -0
  292. package/dist/components/product-tag-list.js +44 -0
  293. package/dist/components/product-tags-page.d.ts +7 -0
  294. package/dist/components/product-tags-page.d.ts.map +1 -0
  295. package/dist/components/product-tags-page.js +9 -0
  296. package/dist/components/product-tax-class-combobox.d.ts +9 -0
  297. package/dist/components/product-tax-class-combobox.d.ts.map +1 -0
  298. package/dist/components/product-tax-class-combobox.js +100 -0
  299. package/dist/components/product-translations-card.d.ts +7 -0
  300. package/dist/components/product-translations-card.d.ts.map +1 -0
  301. package/dist/components/product-translations-card.js +188 -0
  302. package/dist/components/product-type-combobox.d.ts +9 -0
  303. package/dist/components/product-type-combobox.d.ts.map +1 -0
  304. package/dist/components/product-type-combobox.js +48 -0
  305. package/dist/components/product-types-page.d.ts +6 -0
  306. package/dist/components/product-types-page.d.ts.map +1 -0
  307. package/dist/components/product-types-page.js +103 -0
  308. package/dist/components/product-version-dialog.d.ts +8 -0
  309. package/dist/components/product-version-dialog.d.ts.map +1 -0
  310. package/dist/components/product-version-dialog.js +39 -0
  311. package/dist/components/product-versions-section.d.ts +7 -0
  312. package/dist/components/product-versions-section.d.ts.map +1 -0
  313. package/dist/components/product-versions-section.js +19 -0
  314. package/dist/components/products-page.d.ts +8 -0
  315. package/dist/components/products-page.d.ts.map +1 -0
  316. package/dist/components/products-page.js +8 -0
  317. package/dist/extras/client.d.ts +14 -0
  318. package/dist/extras/client.d.ts.map +1 -0
  319. package/dist/extras/client.js +58 -0
  320. package/dist/extras/components/extra-catalog-card.d.ts +13 -0
  321. package/dist/extras/components/extra-catalog-card.d.ts.map +1 -0
  322. package/dist/extras/components/extra-catalog-card.js +52 -0
  323. package/dist/extras/components/product-combobox.d.ts +9 -0
  324. package/dist/extras/components/product-combobox.d.ts.map +1 -0
  325. package/dist/extras/components/product-combobox.js +46 -0
  326. package/dist/extras/hooks/index.d.ts +4 -0
  327. package/dist/extras/hooks/index.d.ts.map +1 -0
  328. package/dist/extras/hooks/index.js +3 -0
  329. package/dist/extras/hooks/use-product-extra-mutation.d.ts +70 -0
  330. package/dist/extras/hooks/use-product-extra-mutation.d.ts.map +1 -0
  331. package/dist/extras/hooks/use-product-extra-mutation.js +38 -0
  332. package/dist/extras/hooks/use-product-extra.d.ts +24 -0
  333. package/dist/extras/hooks/use-product-extra.d.ts.map +1 -0
  334. package/dist/extras/hooks/use-product-extra.js +12 -0
  335. package/dist/extras/hooks/use-product-extras.d.ts +30 -0
  336. package/dist/extras/hooks/use-product-extras.d.ts.map +1 -0
  337. package/dist/extras/hooks/use-product-extras.js +12 -0
  338. package/dist/extras/i18n/en.d.ts +52 -0
  339. package/dist/extras/i18n/en.d.ts.map +1 -0
  340. package/dist/extras/i18n/en.js +51 -0
  341. package/dist/extras/i18n/index.d.ts +5 -0
  342. package/dist/extras/i18n/index.d.ts.map +1 -0
  343. package/dist/extras/i18n/index.js +3 -0
  344. package/dist/extras/i18n/messages.d.ts +37 -0
  345. package/dist/extras/i18n/messages.d.ts.map +1 -0
  346. package/dist/extras/i18n/messages.js +1 -0
  347. package/dist/extras/i18n/provider.d.ts +126 -0
  348. package/dist/extras/i18n/provider.d.ts.map +1 -0
  349. package/dist/extras/i18n/provider.js +44 -0
  350. package/dist/extras/i18n/ro.d.ts +52 -0
  351. package/dist/extras/i18n/ro.d.ts.map +1 -0
  352. package/dist/extras/i18n/ro.js +51 -0
  353. package/dist/extras/index.d.ts +7 -0
  354. package/dist/extras/index.d.ts.map +1 -0
  355. package/dist/extras/index.js +6 -0
  356. package/dist/extras/provider.d.ts +2 -0
  357. package/dist/extras/provider.d.ts.map +1 -0
  358. package/dist/extras/provider.js +1 -0
  359. package/dist/extras/query-keys.d.ts +16 -0
  360. package/dist/extras/query-keys.d.ts.map +1 -0
  361. package/dist/extras/query-keys.js +8 -0
  362. package/dist/extras/query-options.d.ts +455 -0
  363. package/dist/extras/query-options.d.ts.map +1 -0
  364. package/dist/extras/query-options.js +44 -0
  365. package/dist/extras/schemas.d.ts +416 -0
  366. package/dist/extras/schemas.d.ts.map +1 -0
  367. package/dist/extras/schemas.js +89 -0
  368. package/dist/extras/ui.d.ts +3 -0
  369. package/dist/extras/ui.d.ts.map +1 -0
  370. package/dist/extras/ui.js +2 -0
  371. package/dist/extras-compat.d.ts +3 -0
  372. package/dist/extras-compat.d.ts.map +1 -0
  373. package/dist/extras-compat.js +1 -0
  374. package/dist/extras.d.ts +10 -0
  375. package/dist/extras.d.ts.map +1 -0
  376. package/dist/extras.js +9 -0
  377. package/dist/hooks/index.d.ts +36 -0
  378. package/dist/hooks/index.d.ts.map +1 -0
  379. package/dist/hooks/index.js +35 -0
  380. package/dist/hooks/use-duplicate-product-option-mutation.d.ts +19 -0
  381. package/dist/hooks/use-duplicate-product-option-mutation.d.ts.map +1 -0
  382. package/dist/hooks/use-duplicate-product-option-mutation.js +65 -0
  383. package/dist/hooks/use-option-unit-mutation.d.ts +60 -0
  384. package/dist/hooks/use-option-unit-mutation.d.ts.map +1 -0
  385. package/dist/hooks/use-option-unit-mutation.js +41 -0
  386. package/dist/hooks/use-option-unit.d.ts +21 -0
  387. package/dist/hooks/use-option-unit.d.ts.map +1 -0
  388. package/dist/hooks/use-option-unit.js +12 -0
  389. package/dist/hooks/use-option-units.d.ts +27 -0
  390. package/dist/hooks/use-option-units.d.ts.map +1 -0
  391. package/dist/hooks/use-option-units.js +12 -0
  392. package/dist/hooks/use-product-action-ledger.d.ts +48 -0
  393. package/dist/hooks/use-product-action-ledger.d.ts.map +1 -0
  394. package/dist/hooks/use-product-action-ledger.js +12 -0
  395. package/dist/hooks/use-product-categories.d.ts +32 -0
  396. package/dist/hooks/use-product-categories.d.ts.map +1 -0
  397. package/dist/hooks/use-product-categories.js +29 -0
  398. package/dist/hooks/use-product-category-mutation.d.ts +65 -0
  399. package/dist/hooks/use-product-category-mutation.d.ts.map +1 -0
  400. package/dist/hooks/use-product-category-mutation.js +39 -0
  401. package/dist/hooks/use-product-category.d.ts +26 -0
  402. package/dist/hooks/use-product-category.d.ts.map +1 -0
  403. package/dist/hooks/use-product-category.js +18 -0
  404. package/dist/hooks/use-product-day-mutation.d.ts +43 -0
  405. package/dist/hooks/use-product-day-mutation.d.ts.map +1 -0
  406. package/dist/hooks/use-product-day-mutation.js +54 -0
  407. package/dist/hooks/use-product-day-service-mutation.d.ts +66 -0
  408. package/dist/hooks/use-product-day-service-mutation.d.ts.map +1 -0
  409. package/dist/hooks/use-product-day-service-mutation.js +41 -0
  410. package/dist/hooks/use-product-day-services.d.ts +21 -0
  411. package/dist/hooks/use-product-day-services.d.ts.map +1 -0
  412. package/dist/hooks/use-product-day-services.js +12 -0
  413. package/dist/hooks/use-product-day-translation-mutation.d.ts +49 -0
  414. package/dist/hooks/use-product-day-translation-mutation.d.ts.map +1 -0
  415. package/dist/hooks/use-product-day-translation-mutation.js +38 -0
  416. package/dist/hooks/use-product-day-translations.d.ts +19 -0
  417. package/dist/hooks/use-product-day-translations.d.ts.map +1 -0
  418. package/dist/hooks/use-product-day-translations.js +20 -0
  419. package/dist/hooks/use-product-days.d.ts +16 -0
  420. package/dist/hooks/use-product-days.d.ts.map +1 -0
  421. package/dist/hooks/use-product-days.js +12 -0
  422. package/dist/hooks/use-product-itineraries.d.ts +15 -0
  423. package/dist/hooks/use-product-itineraries.d.ts.map +1 -0
  424. package/dist/hooks/use-product-itineraries.js +12 -0
  425. package/dist/hooks/use-product-itinerary-days.d.ts +16 -0
  426. package/dist/hooks/use-product-itinerary-days.d.ts.map +1 -0
  427. package/dist/hooks/use-product-itinerary-days.js +12 -0
  428. package/dist/hooks/use-product-itinerary-mutation.d.ts +54 -0
  429. package/dist/hooks/use-product-itinerary-mutation.d.ts.map +1 -0
  430. package/dist/hooks/use-product-itinerary-mutation.js +63 -0
  431. package/dist/hooks/use-product-media-mutation.d.ts +101 -0
  432. package/dist/hooks/use-product-media-mutation.d.ts.map +1 -0
  433. package/dist/hooks/use-product-media-mutation.js +69 -0
  434. package/dist/hooks/use-product-media.d.ts +26 -0
  435. package/dist/hooks/use-product-media.d.ts.map +1 -0
  436. package/dist/hooks/use-product-media.js +12 -0
  437. package/dist/hooks/use-product-mutation.d.ts +121 -0
  438. package/dist/hooks/use-product-mutation.d.ts.map +1 -0
  439. package/dist/hooks/use-product-mutation.js +44 -0
  440. package/dist/hooks/use-product-option-mutation.d.ts +49 -0
  441. package/dist/hooks/use-product-option-mutation.d.ts.map +1 -0
  442. package/dist/hooks/use-product-option-mutation.js +39 -0
  443. package/dist/hooks/use-product-option.d.ts +18 -0
  444. package/dist/hooks/use-product-option.d.ts.map +1 -0
  445. package/dist/hooks/use-product-option.js +12 -0
  446. package/dist/hooks/use-product-options.d.ts +24 -0
  447. package/dist/hooks/use-product-options.d.ts.map +1 -0
  448. package/dist/hooks/use-product-options.js +12 -0
  449. package/dist/hooks/use-product-tag-mutation.d.ts +25 -0
  450. package/dist/hooks/use-product-tag-mutation.d.ts.map +1 -0
  451. package/dist/hooks/use-product-tag-mutation.js +39 -0
  452. package/dist/hooks/use-product-tag.d.ts +10 -0
  453. package/dist/hooks/use-product-tag.d.ts.map +1 -0
  454. package/dist/hooks/use-product-tag.js +18 -0
  455. package/dist/hooks/use-product-tags.d.ts +16 -0
  456. package/dist/hooks/use-product-tags.d.ts.map +1 -0
  457. package/dist/hooks/use-product-tags.js +25 -0
  458. package/dist/hooks/use-product-translation-mutation.d.ts +52 -0
  459. package/dist/hooks/use-product-translation-mutation.d.ts.map +1 -0
  460. package/dist/hooks/use-product-translation-mutation.js +47 -0
  461. package/dist/hooks/use-product-translations.d.ts +28 -0
  462. package/dist/hooks/use-product-translations.d.ts.map +1 -0
  463. package/dist/hooks/use-product-translations.js +24 -0
  464. package/dist/hooks/use-product-type-mutation.d.ts +50 -0
  465. package/dist/hooks/use-product-type-mutation.d.ts.map +1 -0
  466. package/dist/hooks/use-product-type-mutation.js +47 -0
  467. package/dist/hooks/use-product-type.d.ts +15 -0
  468. package/dist/hooks/use-product-type.d.ts.map +1 -0
  469. package/dist/hooks/use-product-type.js +12 -0
  470. package/dist/hooks/use-product-types.d.ts +21 -0
  471. package/dist/hooks/use-product-types.d.ts.map +1 -0
  472. package/dist/hooks/use-product-types.js +9 -0
  473. package/dist/hooks/use-product-version-mutation.d.ts +16 -0
  474. package/dist/hooks/use-product-version-mutation.d.ts.map +1 -0
  475. package/dist/hooks/use-product-version-mutation.js +22 -0
  476. package/dist/hooks/use-product-versions.d.ts +15 -0
  477. package/dist/hooks/use-product-versions.d.ts.map +1 -0
  478. package/dist/hooks/use-product-versions.js +12 -0
  479. package/dist/hooks/use-product.d.ts +45 -0
  480. package/dist/hooks/use-product.d.ts.map +1 -0
  481. package/dist/hooks/use-product.js +23 -0
  482. package/dist/hooks/use-products.d.ts +51 -0
  483. package/dist/hooks/use-products.d.ts.map +1 -0
  484. package/dist/hooks/use-products.js +38 -0
  485. package/dist/i18n/en-catalog.d.ts +199 -0
  486. package/dist/i18n/en-catalog.d.ts.map +1 -0
  487. package/dist/i18n/en-catalog.js +198 -0
  488. package/dist/i18n/en-core.d.ts +323 -0
  489. package/dist/i18n/en-core.d.ts.map +1 -0
  490. package/dist/i18n/en-core.js +322 -0
  491. package/dist/i18n/en-operations.d.ts +287 -0
  492. package/dist/i18n/en-operations.d.ts.map +1 -0
  493. package/dist/i18n/en-operations.js +286 -0
  494. package/dist/i18n/en.d.ts +803 -0
  495. package/dist/i18n/en.d.ts.map +1 -0
  496. package/dist/i18n/en.js +8 -0
  497. package/dist/i18n/index.d.ts +5 -0
  498. package/dist/i18n/index.d.ts.map +1 -0
  499. package/dist/i18n/index.js +3 -0
  500. package/dist/i18n/message-shared.d.ts +6 -0
  501. package/dist/i18n/message-shared.d.ts.map +1 -0
  502. package/dist/i18n/message-shared.js +1 -0
  503. package/dist/i18n/messages-catalog.d.ts +199 -0
  504. package/dist/i18n/messages-catalog.d.ts.map +1 -0
  505. package/dist/i18n/messages-catalog.js +1 -0
  506. package/dist/i18n/messages-core.d.ts +304 -0
  507. package/dist/i18n/messages-core.d.ts.map +1 -0
  508. package/dist/i18n/messages-core.js +1 -0
  509. package/dist/i18n/messages-operations.d.ts +287 -0
  510. package/dist/i18n/messages-operations.d.ts.map +1 -0
  511. package/dist/i18n/messages-operations.js +1 -0
  512. package/dist/i18n/messages.d.ts +6 -0
  513. package/dist/i18n/messages.d.ts.map +1 -0
  514. package/dist/i18n/messages.js +1 -0
  515. package/dist/i18n/provider.d.ts +1628 -0
  516. package/dist/i18n/provider.d.ts.map +1 -0
  517. package/dist/i18n/provider.js +44 -0
  518. package/dist/i18n/ro-catalog.d.ts +199 -0
  519. package/dist/i18n/ro-catalog.d.ts.map +1 -0
  520. package/dist/i18n/ro-catalog.js +198 -0
  521. package/dist/i18n/ro-core.d.ts +323 -0
  522. package/dist/i18n/ro-core.d.ts.map +1 -0
  523. package/dist/i18n/ro-core.js +322 -0
  524. package/dist/i18n/ro-operations.d.ts +287 -0
  525. package/dist/i18n/ro-operations.d.ts.map +1 -0
  526. package/dist/i18n/ro-operations.js +286 -0
  527. package/dist/i18n/ro.d.ts +803 -0
  528. package/dist/i18n/ro.d.ts.map +1 -0
  529. package/dist/i18n/ro.js +8 -0
  530. package/dist/i18n-en.d.ts +2 -0
  531. package/dist/i18n-en.d.ts.map +1 -0
  532. package/dist/i18n-en.js +1 -0
  533. package/dist/i18n-ro.d.ts +2 -0
  534. package/dist/i18n-ro.d.ts.map +1 -0
  535. package/dist/i18n-ro.js +1 -0
  536. package/dist/i18n.d.ts +2 -0
  537. package/dist/i18n.d.ts.map +1 -0
  538. package/dist/i18n.js +1 -0
  539. package/dist/index.d.ts +9 -0
  540. package/dist/index.d.ts.map +1 -0
  541. package/dist/index.js +8 -0
  542. package/dist/operations.d.ts +53 -0
  543. package/dist/operations.d.ts.map +1 -0
  544. package/dist/operations.js +13 -0
  545. package/dist/provider.d.ts +2 -0
  546. package/dist/provider.d.ts.map +1 -0
  547. package/dist/provider.js +1 -0
  548. package/dist/query-keys.d.ts +114 -0
  549. package/dist/query-keys.d.ts.map +1 -0
  550. package/dist/query-keys.js +34 -0
  551. package/dist/query-options-action-ledger.d.ts +194 -0
  552. package/dist/query-options-action-ledger.d.ts.map +1 -0
  553. package/dist/query-options-action-ledger.js +20 -0
  554. package/dist/query-options.d.ts +1313 -0
  555. package/dist/query-options.d.ts.map +1 -0
  556. package/dist/query-options.js +281 -0
  557. package/dist/schemas.d.ts +1098 -0
  558. package/dist/schemas.d.ts.map +1 -0
  559. package/dist/schemas.js +320 -0
  560. package/dist/ui.d.ts +44 -0
  561. package/dist/ui.d.ts.map +1 -0
  562. package/dist/ui.js +42 -0
  563. package/package.json +159 -0
  564. package/src/styles.css +12 -0
@@ -0,0 +1,88 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMutation, useQuery } from "@tanstack/react-query";
3
+ import { formatMessage } from "@voyant-travel/i18n";
4
+ import { Badge, Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@voyant-travel/ui/components";
5
+ import { ChevronDown, ChevronRight, MoreHorizontal, Pencil, Plus, Trash2 } from "lucide-react";
6
+ import { useState } from "react";
7
+ import { useOptionPriceRuleMutation } from "./commerce-client.js";
8
+ import { useProductDetailApi, useProductDetailMessages } from "./host.js";
9
+ import { OptionPriceRuleDialog } from "./product-option-price-rule-dialog.js";
10
+ import { OptionPricingGrid } from "./product-option-pricing-grid.js";
11
+ import { ExtraPriceRulesPanel } from "./product-options-extra-price-rules.js";
12
+ import { formatProductMoney } from "./product-options-pricing-helpers.js";
13
+ import { getOptionPriceRulesQueryOptions, } from "./product-options-shared.js";
14
+ import { UnitPriceMatrix } from "./product-options-unit-price-matrix.js";
15
+ function getRulePricingModeLabel(value, messages) {
16
+ switch (value) {
17
+ case "per_person":
18
+ return messages.pricingModePerPerson;
19
+ case "per_booking":
20
+ return messages.pricingModePerBooking;
21
+ case "starting_from":
22
+ return messages.pricingModeStartingFrom;
23
+ case "free":
24
+ return messages.pricingModeFree;
25
+ case "on_request":
26
+ return messages.pricingModeOnRequest;
27
+ default:
28
+ return value;
29
+ }
30
+ }
31
+ function ActionMenu({ children }) {
32
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-8 w-8 text-muted-foreground", children: _jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }), _jsx(DropdownMenuContent, { align: "end", children: children })] }));
33
+ }
34
+ /**
35
+ * Per-option pricing surface. The everyday view is the merged rooms/seats
36
+ * grid; the full rate-plan machinery (multiple plans, catalogs, cost prices,
37
+ * cancellation) plus any injected per-departure inventory live behind an
38
+ * Advanced disclosure so low-tech agents never have to see them.
39
+ */
40
+ export function PricingPanel({ productId, optionId, optionName, productCurrency, layout, extras, }) {
41
+ const messages = useProductDetailMessages();
42
+ const gridMessages = messages.products.operations.pricingGrid;
43
+ const [advancedOpen, setAdvancedOpen] = useState(false);
44
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(OptionPricingGrid, { productId: productId, optionId: optionId, optionName: optionName, productCurrency: productCurrency, layout: layout }), _jsxs("div", { className: "rounded-md border bg-background/60", children: [_jsxs("button", { type: "button", onClick: () => setAdvancedOpen((open) => !open), className: "flex w-full items-center gap-2 px-3 py-2 text-left text-xs font-medium text-muted-foreground transition-colors hover:text-foreground", children: [advancedOpen ? (_jsx(ChevronDown, { className: "h-3.5 w-3.5" })) : (_jsx(ChevronRight, { className: "h-3.5 w-3.5" })), _jsx("span", { children: gridMessages.advancedToggle }), !advancedOpen ? (_jsxs("span", { className: "font-normal normal-case", children: ["\u2014 ", gridMessages.advancedHint] })) : null] }), advancedOpen ? (_jsx("div", { className: "flex flex-col gap-4 border-t p-3", children: _jsx(AdvancedRatePlans, { productId: productId, optionId: optionId, productCurrency: productCurrency }) })) : null] }), extras] }));
45
+ }
46
+ function AdvancedRatePlans({ productId, optionId, productCurrency, }) {
47
+ const messages = useProductDetailMessages();
48
+ const api = useProductDetailApi();
49
+ const priceRuleMessages = messages.products.operations.priceRules;
50
+ const [ruleDialogOpen, setRuleDialogOpen] = useState(false);
51
+ const [editingRule, setEditingRule] = useState();
52
+ const { data, refetch } = useQuery(getOptionPriceRulesQueryOptions(api, optionId));
53
+ const { remove: removeRule } = useOptionPriceRuleMutation();
54
+ const deleteMutation = useMutation({
55
+ mutationFn: (id) => removeRule.mutateAsync(id),
56
+ onSuccess: () => void refetch(),
57
+ });
58
+ const rules = data?.data ?? [];
59
+ // The default rate plan IS the everyday grid above — don't re-render its
60
+ // identical matrix here. Advanced only manages the *extra* plans (net,
61
+ // contract, promo) plus the default plan's hidden settings (cost,
62
+ // cancellation, catalog) via "Edit default pricing".
63
+ const defaultRule = rules.find((rule) => rule.isDefault) ?? rules[0];
64
+ const additionalRules = rules.filter((rule) => rule.id !== defaultRule?.id);
65
+ return (_jsxs("div", { children: [_jsxs("div", { className: "mb-2 flex items-center justify-between gap-3", children: [_jsxs("div", { children: [_jsx("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: priceRuleMessages.additionalSectionTitle }), _jsx("p", { className: "text-xs text-muted-foreground", children: priceRuleMessages.additionalSectionDescription })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [defaultRule ? (_jsx(Button, { variant: "outline", size: "sm", onClick: () => {
66
+ setEditingRule(defaultRule);
67
+ setRuleDialogOpen(true);
68
+ }, children: priceRuleMessages.editDefaultAction })) : null, _jsxs(Button, { variant: "outline", size: "sm", onClick: () => {
69
+ setEditingRule(undefined);
70
+ setRuleDialogOpen(true);
71
+ }, children: [_jsx(Plus, { className: "mr-1 h-3 w-3" }), priceRuleMessages.addAction] })] })] }), additionalRules.length === 0 ? (_jsx("p", { className: "py-2 text-center text-xs text-muted-foreground", children: priceRuleMessages.additionalEmpty })) : (_jsx("div", { className: "flex flex-col gap-3", children: additionalRules.map((rule) => (_jsx(PriceRuleCard, { rule: rule, productId: productId, optionId: optionId, productCurrency: productCurrency, onEdit: () => {
72
+ setEditingRule(rule);
73
+ setRuleDialogOpen(true);
74
+ }, onDelete: () => {
75
+ if (confirm(formatMessage(priceRuleMessages.deleteRuleConfirm, { name: rule.name }))) {
76
+ deleteMutation.mutate(rule.id);
77
+ }
78
+ } }, rule.id))) })), _jsx(OptionPriceRuleDialog, { open: ruleDialogOpen, onOpenChange: setRuleDialogOpen, productId: productId, optionId: optionId, rule: editingRule, onSuccess: () => {
79
+ setRuleDialogOpen(false);
80
+ setEditingRule(undefined);
81
+ void refetch();
82
+ } })] }));
83
+ }
84
+ function PriceRuleCard({ rule, productId, optionId, productCurrency, onEdit, onDelete, }) {
85
+ const messages = useProductDetailMessages();
86
+ const priceRuleMessages = messages.products.operations.priceRules;
87
+ return (_jsxs("div", { className: "rounded-lg border bg-background p-4", children: [_jsxs("div", { className: "flex items-start justify-between", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium", children: rule.name }), _jsx(Badge, { variant: "outline", className: "text-xs capitalize", children: getRulePricingModeLabel(rule.pricingMode, priceRuleMessages) }), rule.isDefault && _jsx(Badge, { variant: "secondary", children: priceRuleMessages.defaultBadge }), _jsx(Badge, { variant: rule.active ? "default" : "outline", children: rule.active ? priceRuleMessages.activeBadge : priceRuleMessages.inactiveBadge })] }), _jsxs("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [_jsxs("span", { children: [priceRuleMessages.baseSellLabel, ":", " ", _jsx("span", { className: "font-mono text-foreground", children: formatProductMoney(rule.baseSellAmountCents, productCurrency) })] }), _jsxs("span", { children: [priceRuleMessages.baseCostLabel, ":", " ", _jsx("span", { className: "font-mono text-foreground", children: formatProductMoney(rule.baseCostAmountCents, productCurrency) })] }), rule.allPricingCategories && _jsx("span", { children: priceRuleMessages.allCategoriesLabel })] })] }), _jsxs(ActionMenu, { children: [_jsxs(DropdownMenuItem, { onClick: onEdit, children: [_jsx(Pencil, { className: "h-4 w-4" }), priceRuleMessages.editAction] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { variant: "destructive", onClick: onDelete, children: [_jsx(Trash2, { className: "h-4 w-4" }), priceRuleMessages.deleteAction] })] })] }), _jsxs("div", { className: "mt-3", children: [_jsx(UnitPriceMatrix, { productId: productId, optionPriceRuleId: rule.id, optionId: optionId, pricingMode: rule.pricingMode, allPricingCategories: rule.allPricingCategories, productCurrency: productCurrency }), _jsx(ExtraPriceRulesPanel, { productId: productId, optionId: optionId, optionPriceRuleId: rule.id, productCurrency: productCurrency })] })] }));
88
+ }
@@ -0,0 +1,5 @@
1
+ export { ExtraPriceRulesPanel } from "./product-options-extra-price-rules.js";
2
+ export { categoryAppliesToUnit, formatProductMoney, getCategoryCondition, getUnitTypeLabel, isTravelerCategory, } from "./product-options-pricing-helpers.js";
3
+ export { PricingPanel } from "./product-options-pricing-panel.js";
4
+ export { TravelerCategoryDialog } from "./product-options-traveler-category-dialog.js";
5
+ //# sourceMappingURL=product-options-pricing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-options-pricing.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-options-pricing.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAC7E,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { ExtraPriceRulesPanel } from "./product-options-extra-price-rules.js";
2
+ export { categoryAppliesToUnit, formatProductMoney, getCategoryCondition, getUnitTypeLabel, isTravelerCategory, } from "./product-options-pricing-helpers.js";
3
+ export { PricingPanel } from "./product-options-pricing-panel.js";
4
+ export { TravelerCategoryDialog } from "./product-options-traveler-category-dialog.js";
@@ -0,0 +1,236 @@
1
+ import { type VoyantProductsContextValue } from "../../index.js";
2
+ import type { ProductDetailApi } from "./host.js";
3
+ /**
4
+ * The same configured `{ baseUrl, fetcher }` client (from `useVoyantProductsContext()`)
5
+ * drives both the products and pricing query-options — they hit the same API and
6
+ * auth. Callers pass it in so this module stays free of app-specific fetchers.
7
+ */
8
+ export type OptionsClient = VoyantProductsContextValue;
9
+ export declare const optionStatusVariant: Record<string, "default" | "secondary" | "outline" | "destructive">;
10
+ /**
11
+ * Which pricing layout an option shows. "rooms" = a room×traveler-type grid
12
+ * (accommodation / multi-day). "seats" = a flat traveler-type price list
13
+ * (single-day excursions, transfers). Derived from the product's bookingMode
14
+ * so the agent never picks a pricing model directly.
15
+ */
16
+ export type OptionPricingLayout = "rooms" | "seats";
17
+ /**
18
+ * Derive the pricing layout from the product's booking mode. Multi-day /
19
+ * overnight modes imply rooms; single-day activity modes imply per-person
20
+ * seats. `dayCount` is a fallback for the ambiguous `other` mode (>1 day →
21
+ * rooms), matching the operator rule "more than one day means rooms".
22
+ */
23
+ export declare function deriveOptionPricingLayout(bookingMode: string | null | undefined, dayCount?: number): OptionPricingLayout;
24
+ export declare function getProductOptionsQueryOptions(client: OptionsClient, productId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
25
+ data: {
26
+ id: string;
27
+ productId: string;
28
+ name: string;
29
+ code: string | null;
30
+ description: string | null;
31
+ status: "draft" | "active" | "archived";
32
+ isDefault: boolean;
33
+ sortOrder: number;
34
+ availableFrom: string | null;
35
+ availableTo: string | null;
36
+ createdAt: string;
37
+ updatedAt: string;
38
+ }[];
39
+ total: number;
40
+ limit: number;
41
+ offset: number;
42
+ }, Error, {
43
+ data: {
44
+ id: string;
45
+ productId: string;
46
+ name: string;
47
+ code: string | null;
48
+ description: string | null;
49
+ status: "draft" | "active" | "archived";
50
+ isDefault: boolean;
51
+ sortOrder: number;
52
+ availableFrom: string | null;
53
+ availableTo: string | null;
54
+ createdAt: string;
55
+ updatedAt: string;
56
+ }[];
57
+ total: number;
58
+ limit: number;
59
+ offset: number;
60
+ }, readonly ["voyant", "products", "product-options", "list", import("../../query-keys.js").ProductOptionsListFilters]>, "queryFn"> & {
61
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
62
+ data: {
63
+ id: string;
64
+ productId: string;
65
+ name: string;
66
+ code: string | null;
67
+ description: string | null;
68
+ status: "draft" | "active" | "archived";
69
+ isDefault: boolean;
70
+ sortOrder: number;
71
+ availableFrom: string | null;
72
+ availableTo: string | null;
73
+ createdAt: string;
74
+ updatedAt: string;
75
+ }[];
76
+ total: number;
77
+ limit: number;
78
+ offset: number;
79
+ }, readonly ["voyant", "products", "product-options", "list", import("../../query-keys.js").ProductOptionsListFilters], never> | undefined;
80
+ } & {
81
+ queryKey: readonly ["voyant", "products", "product-options", "list", import("../../query-keys.js").ProductOptionsListFilters] & {
82
+ [dataTagSymbol]: {
83
+ data: {
84
+ id: string;
85
+ productId: string;
86
+ name: string;
87
+ code: string | null;
88
+ description: string | null;
89
+ status: "draft" | "active" | "archived";
90
+ isDefault: boolean;
91
+ sortOrder: number;
92
+ availableFrom: string | null;
93
+ availableTo: string | null;
94
+ createdAt: string;
95
+ updatedAt: string;
96
+ }[];
97
+ total: number;
98
+ limit: number;
99
+ offset: number;
100
+ };
101
+ [dataTagErrorSymbol]: Error;
102
+ };
103
+ };
104
+ export declare function getOptionUnitsQueryOptions(client: OptionsClient, optionId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
105
+ data: {
106
+ id: string;
107
+ optionId: string;
108
+ name: string;
109
+ code: string | null;
110
+ description: string | null;
111
+ unitType: "person" | "group" | "room" | "vehicle" | "service" | "other";
112
+ minQuantity: number | null;
113
+ maxQuantity: number | null;
114
+ minAge: number | null;
115
+ maxAge: number | null;
116
+ occupancyMin: number | null;
117
+ occupancyMax: number | null;
118
+ isRequired: boolean;
119
+ isHidden: boolean;
120
+ sortOrder: number;
121
+ }[];
122
+ total: number;
123
+ limit: number;
124
+ offset: number;
125
+ }, Error, {
126
+ data: {
127
+ id: string;
128
+ optionId: string;
129
+ name: string;
130
+ code: string | null;
131
+ description: string | null;
132
+ unitType: "person" | "group" | "room" | "vehicle" | "service" | "other";
133
+ minQuantity: number | null;
134
+ maxQuantity: number | null;
135
+ minAge: number | null;
136
+ maxAge: number | null;
137
+ occupancyMin: number | null;
138
+ occupancyMax: number | null;
139
+ isRequired: boolean;
140
+ isHidden: boolean;
141
+ sortOrder: number;
142
+ }[];
143
+ total: number;
144
+ limit: number;
145
+ offset: number;
146
+ }, readonly ["voyant", "products", "option-units", "list", import("../../query-keys.js").OptionUnitsListFilters]>, "queryFn"> & {
147
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
148
+ data: {
149
+ id: string;
150
+ optionId: string;
151
+ name: string;
152
+ code: string | null;
153
+ description: string | null;
154
+ unitType: "person" | "group" | "room" | "vehicle" | "service" | "other";
155
+ minQuantity: number | null;
156
+ maxQuantity: number | null;
157
+ minAge: number | null;
158
+ maxAge: number | null;
159
+ occupancyMin: number | null;
160
+ occupancyMax: number | null;
161
+ isRequired: boolean;
162
+ isHidden: boolean;
163
+ sortOrder: number;
164
+ }[];
165
+ total: number;
166
+ limit: number;
167
+ offset: number;
168
+ }, readonly ["voyant", "products", "option-units", "list", import("../../query-keys.js").OptionUnitsListFilters], never> | undefined;
169
+ } & {
170
+ queryKey: readonly ["voyant", "products", "option-units", "list", import("../../query-keys.js").OptionUnitsListFilters] & {
171
+ [dataTagSymbol]: {
172
+ data: {
173
+ id: string;
174
+ optionId: string;
175
+ name: string;
176
+ code: string | null;
177
+ description: string | null;
178
+ unitType: "person" | "group" | "room" | "vehicle" | "service" | "other";
179
+ minQuantity: number | null;
180
+ maxQuantity: number | null;
181
+ minAge: number | null;
182
+ maxAge: number | null;
183
+ occupancyMin: number | null;
184
+ occupancyMax: number | null;
185
+ isRequired: boolean;
186
+ isHidden: boolean;
187
+ sortOrder: number;
188
+ }[];
189
+ total: number;
190
+ limit: number;
191
+ offset: number;
192
+ };
193
+ [dataTagErrorSymbol]: Error;
194
+ };
195
+ };
196
+ export declare function getOptionPriceRulesQueryOptions(client: ProductDetailApi, optionId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").OptionPriceRuleRecord>, Error, import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").OptionPriceRuleRecord>, readonly ["inventory-product-detail", "commerce", "pricing", "option-price-rules", Record<string, string | number | boolean | null | undefined>]>, "queryFn"> & {
197
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").OptionPriceRuleRecord>, readonly ["inventory-product-detail", "commerce", "pricing", "option-price-rules", Record<string, string | number | boolean | null | undefined>], never> | undefined;
198
+ } & {
199
+ queryKey: readonly ["inventory-product-detail", "commerce", "pricing", "option-price-rules", Record<string, string | number | boolean | null | undefined>] & {
200
+ [dataTagSymbol]: import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").OptionPriceRuleRecord>;
201
+ [dataTagErrorSymbol]: Error;
202
+ };
203
+ };
204
+ export declare function getPricingCategoriesQueryOptions(client: ProductDetailApi): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").PricingCategoryRecord>, Error, import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").PricingCategoryRecord>, readonly ["inventory-product-detail", "commerce", "pricing", "pricing-categories", Record<string, string | number | boolean | null | undefined>]>, "queryFn"> & {
205
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").PricingCategoryRecord>, readonly ["inventory-product-detail", "commerce", "pricing", "pricing-categories", Record<string, string | number | boolean | null | undefined>], never> | undefined;
206
+ } & {
207
+ queryKey: readonly ["inventory-product-detail", "commerce", "pricing", "pricing-categories", Record<string, string | number | boolean | null | undefined>] & {
208
+ [dataTagSymbol]: import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").PricingCategoryRecord>;
209
+ [dataTagErrorSymbol]: Error;
210
+ };
211
+ };
212
+ export declare function getOptionUnitPriceRulesQueryOptions(client: ProductDetailApi, optionPriceRuleId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").OptionUnitPriceRuleRecord>, Error, import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").OptionUnitPriceRuleRecord>, readonly ["inventory-product-detail", "commerce", "pricing", "option-unit-price-rules", Record<string, string | number | boolean | null | undefined>]>, "queryFn"> & {
213
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").OptionUnitPriceRuleRecord>, readonly ["inventory-product-detail", "commerce", "pricing", "option-unit-price-rules", Record<string, string | number | boolean | null | undefined>], never> | undefined;
214
+ } & {
215
+ queryKey: readonly ["inventory-product-detail", "commerce", "pricing", "option-unit-price-rules", Record<string, string | number | boolean | null | undefined>] & {
216
+ [dataTagSymbol]: import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").OptionUnitPriceRuleRecord>;
217
+ [dataTagErrorSymbol]: Error;
218
+ };
219
+ };
220
+ export declare function getPriceCatalogsQueryOptions(client: ProductDetailApi): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").PriceCatalogRecord>, Error, import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").PriceCatalogRecord>, readonly ["inventory-product-detail", "commerce", "pricing", "price-catalogs", Record<string, string | number | boolean | null | undefined>]>, "queryFn"> & {
221
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").PriceCatalogRecord>, readonly ["inventory-product-detail", "commerce", "pricing", "price-catalogs", Record<string, string | number | boolean | null | undefined>], never> | undefined;
222
+ } & {
223
+ queryKey: readonly ["inventory-product-detail", "commerce", "pricing", "price-catalogs", Record<string, string | number | boolean | null | undefined>] & {
224
+ [dataTagSymbol]: import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").PriceCatalogRecord>;
225
+ [dataTagErrorSymbol]: Error;
226
+ };
227
+ };
228
+ export declare function getDeparturePriceOverridesQueryOptions(client: ProductDetailApi, departureId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").DeparturePriceOverrideRecord>, Error, import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").DeparturePriceOverrideRecord>, readonly ["inventory-product-detail", "commerce", "pricing", "departure-price-overrides", Record<string, string | number | boolean | null | undefined>]>, "queryFn"> & {
229
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").DeparturePriceOverrideRecord>, readonly ["inventory-product-detail", "commerce", "pricing", "departure-price-overrides", Record<string, string | number | boolean | null | undefined>], never> | undefined;
230
+ } & {
231
+ queryKey: readonly ["inventory-product-detail", "commerce", "pricing", "departure-price-overrides", Record<string, string | number | boolean | null | undefined>] & {
232
+ [dataTagSymbol]: import("./commerce-client.js").PaginatedEnvelope<import("./commerce-client.js").DeparturePriceOverrideRecord>;
233
+ [dataTagErrorSymbol]: Error;
234
+ };
235
+ };
236
+ //# sourceMappingURL=product-options-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-options-shared.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-options-shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,gBAAgB,CAAA;AAQvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,0BAA0B,CAAA;AAEtD,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,MAAM,EACN,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,CAKpD,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,OAAO,CAAA;AAEnD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,QAAQ,CAAC,EAAE,MAAM,GAChB,mBAAmB,CAarB;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAErF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjF;AAED,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM;;;;;;;EAKzF;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,gBAAgB;;;;;;;EAExE;AAED,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,gBAAgB,EACxB,iBAAiB,EAAE,MAAM;;;;;;;EAM1B;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,gBAAgB;;;;;;;EAEpE;AAED,wBAAgB,sCAAsC,CACpD,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,MAAM;;;;;;;EAMpB"}
@@ -0,0 +1,57 @@
1
+ import { getOptionUnitsQueryOptions as getSharedOptionUnitsQueryOptions, getProductOptionsQueryOptions as getSharedProductOptionsQueryOptions, } from "../../index.js";
2
+ import { getDeparturePriceOverridesQueryOptions as getSharedDeparturePriceOverridesQueryOptions, getOptionPriceRulesQueryOptions as getSharedOptionPriceRulesQueryOptions, getOptionUnitPriceRulesQueryOptions as getSharedOptionUnitPriceRulesQueryOptions, getPriceCatalogsQueryOptions as getSharedPriceCatalogsQueryOptions, getPricingCategoriesQueryOptions as getSharedPricingCategoriesQueryOptions, } from "./commerce-client.js";
3
+ export const optionStatusVariant = {
4
+ draft: "outline",
5
+ active: "default",
6
+ archived: "secondary",
7
+ };
8
+ /**
9
+ * Derive the pricing layout from the product's booking mode. Multi-day /
10
+ * overnight modes imply rooms; single-day activity modes imply per-person
11
+ * seats. `dayCount` is a fallback for the ambiguous `other` mode (>1 day →
12
+ * rooms), matching the operator rule "more than one day means rooms".
13
+ */
14
+ export function deriveOptionPricingLayout(bookingMode, dayCount) {
15
+ switch (bookingMode) {
16
+ case "stay":
17
+ case "itinerary":
18
+ return "rooms";
19
+ case "date":
20
+ case "date_time":
21
+ case "open":
22
+ case "transfer":
23
+ return "seats";
24
+ default:
25
+ return dayCount != null && dayCount > 1 ? "rooms" : "seats";
26
+ }
27
+ }
28
+ export function getProductOptionsQueryOptions(client, productId) {
29
+ return getSharedProductOptionsQueryOptions(client, { productId, limit: 100 });
30
+ }
31
+ export function getOptionUnitsQueryOptions(client, optionId) {
32
+ return getSharedOptionUnitsQueryOptions(client, { optionId, limit: 100 });
33
+ }
34
+ export function getOptionPriceRulesQueryOptions(client, optionId) {
35
+ return getSharedOptionPriceRulesQueryOptions(client, {
36
+ optionId,
37
+ limit: 100,
38
+ });
39
+ }
40
+ export function getPricingCategoriesQueryOptions(client) {
41
+ return getSharedPricingCategoriesQueryOptions(client, { limit: 100 });
42
+ }
43
+ export function getOptionUnitPriceRulesQueryOptions(client, optionPriceRuleId) {
44
+ return getSharedOptionUnitPriceRulesQueryOptions(client, {
45
+ optionPriceRuleId,
46
+ limit: 100,
47
+ });
48
+ }
49
+ export function getPriceCatalogsQueryOptions(client) {
50
+ return getSharedPriceCatalogsQueryOptions(client, { limit: 100 });
51
+ }
52
+ export function getDeparturePriceOverridesQueryOptions(client, departureId) {
53
+ return getSharedDeparturePriceOverridesQueryOptions(client, {
54
+ departureId,
55
+ limit: 100,
56
+ });
57
+ }
@@ -0,0 +1,12 @@
1
+ import { type PricingCategoryRecord } from "./commerce-client.js";
2
+ import type { OptionUnitData } from "./product-unit-dialog.js";
3
+ export declare function TravelerCategoryDialog({ open, onOpenChange, productId, units, nextSortOrder, category, onSuccess, }: {
4
+ open: boolean;
5
+ onOpenChange: (open: boolean) => void;
6
+ productId: string;
7
+ units: OptionUnitData[];
8
+ nextSortOrder: number;
9
+ category?: PricingCategoryRecord;
10
+ onSuccess: () => void;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ //# sourceMappingURL=product-options-traveler-category-dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-options-traveler-category-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-options-traveler-category-dialog.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAE,KAAK,qBAAqB,EAA8B,MAAM,sBAAsB,CAAA;AAE7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAiD9D,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,KAAK,EACL,aAAa,EACb,QAAQ,EACR,SAAS,GACV,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,qBAAqB,CAAA;IAChC,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,2CAiOA"}
@@ -0,0 +1,132 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Dialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Textarea, } from "@voyant-travel/ui/components";
3
+ import { Checkbox } from "@voyant-travel/ui/components/checkbox";
4
+ import { useEffect, useState } from "react";
5
+ import { usePricingCategoryMutation } from "./commerce-client.js";
6
+ import { useProductDetailMessages } from "./host.js";
7
+ function initialTravelerCategoryState() {
8
+ return {
9
+ name: "",
10
+ code: "",
11
+ categoryType: "child",
12
+ minAge: "",
13
+ maxAge: "",
14
+ condition: "",
15
+ allowedUnitIds: [],
16
+ };
17
+ }
18
+ function stateFromCategory(category) {
19
+ const metadata = category.metadata ?? {};
20
+ const allowedUnitIds = Array.isArray(metadata.allowedUnitIds)
21
+ ? metadata.allowedUnitIds.filter((id) => typeof id === "string")
22
+ : [];
23
+ return {
24
+ name: category.name,
25
+ code: category.code ?? "",
26
+ categoryType: category.categoryType,
27
+ minAge: category.minAge != null ? String(category.minAge) : "",
28
+ maxAge: category.maxAge != null ? String(category.maxAge) : "",
29
+ condition: typeof metadata.condition === "string" ? metadata.condition : "",
30
+ allowedUnitIds,
31
+ };
32
+ }
33
+ function parseOptionalInteger(value) {
34
+ const trimmed = value.trim();
35
+ if (!trimmed)
36
+ return null;
37
+ const parsed = Number(trimmed);
38
+ return Number.isFinite(parsed) ? Math.trunc(parsed) : null;
39
+ }
40
+ export function TravelerCategoryDialog({ open, onOpenChange, productId, units, nextSortOrder, category, onSuccess, }) {
41
+ const messages = useProductDetailMessages();
42
+ const priceRuleMessages = messages.products.operations.priceRules;
43
+ const pricingCategoryMessages = messages.pricing.categories;
44
+ const { create, update } = usePricingCategoryMutation();
45
+ const isEditing = !!category;
46
+ const [state, setState] = useState(() => initialTravelerCategoryState());
47
+ const [error, setError] = useState(null);
48
+ const travelerCategoryTypes = [
49
+ { value: "adult", label: pricingCategoryMessages.typeAdult },
50
+ { value: "child", label: pricingCategoryMessages.typeChild },
51
+ { value: "infant", label: pricingCategoryMessages.typeInfant },
52
+ { value: "senior", label: pricingCategoryMessages.typeSenior },
53
+ { value: "group", label: pricingCategoryMessages.typeGroup },
54
+ { value: "other", label: pricingCategoryMessages.typeOther },
55
+ ];
56
+ useEffect(() => {
57
+ if (open) {
58
+ setState(category ? stateFromCategory(category) : initialTravelerCategoryState());
59
+ setError(null);
60
+ }
61
+ }, [open, category]);
62
+ const toggleUnit = (unitId, checked) => {
63
+ setState((prev) => ({
64
+ ...prev,
65
+ allowedUnitIds: checked
66
+ ? [...prev.allowedUnitIds, unitId]
67
+ : prev.allowedUnitIds.filter((id) => id !== unitId),
68
+ }));
69
+ };
70
+ const save = async () => {
71
+ const name = state.name.trim();
72
+ if (!name) {
73
+ setError(priceRuleMessages.travelerCategoryNameRequired);
74
+ return;
75
+ }
76
+ const selectedUnits = units.filter((unit) => state.allowedUnitIds.includes(unit.id));
77
+ const minAge = parseOptionalInteger(state.minAge);
78
+ const maxAge = parseOptionalInteger(state.maxAge);
79
+ const condition = state.condition.trim();
80
+ const metadata = {};
81
+ if (condition)
82
+ metadata.condition = condition;
83
+ if (selectedUnits.length > 0) {
84
+ metadata.allowedUnitIds = selectedUnits.map((unit) => unit.id);
85
+ metadata.allowedUnitCodes = selectedUnits.map((unit) => unit.code).filter(Boolean);
86
+ metadata.allowedUnitNames = selectedUnits.map((unit) => unit.name);
87
+ }
88
+ const payload = {
89
+ // On edit, preserve the category's existing scope — re-stamping a shared
90
+ // (global) category with this product's id would silently steal it from
91
+ // every other product that relies on it. Only a freshly created category
92
+ // is scoped to the current product.
93
+ productId: category ? (category.productId ?? null) : productId,
94
+ optionId: category ? (category.optionId ?? null) : null,
95
+ unitId: null,
96
+ name,
97
+ code: state.code.trim() || null,
98
+ categoryType: state.categoryType,
99
+ seatOccupancy: 1,
100
+ isAgeQualified: minAge != null || maxAge != null,
101
+ minAge,
102
+ maxAge,
103
+ internalUseOnly: false,
104
+ active: true,
105
+ sortOrder: category?.sortOrder ?? nextSortOrder,
106
+ metadata: Object.keys(metadata).length > 0 ? metadata : null,
107
+ };
108
+ try {
109
+ if (category) {
110
+ await update.mutateAsync({ id: category.id, input: payload });
111
+ }
112
+ else {
113
+ await create.mutateAsync(payload);
114
+ }
115
+ onSuccess();
116
+ }
117
+ catch (err) {
118
+ setError(err instanceof Error ? err.message : priceRuleMessages.travelerCategorySaveFailed);
119
+ }
120
+ };
121
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: isEditing
122
+ ? priceRuleMessages.travelerCategoryEditTitle
123
+ : priceRuleMessages.travelerCategoryDialogTitle }), _jsx(DialogDescription, { children: priceRuleMessages.travelerCategoryDialogDescription })] }), _jsxs(DialogBody, { className: "grid gap-4", children: [_jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "traveler-category-name", children: pricingCategoryMessages.nameLabel }), _jsx(Input, { id: "traveler-category-name", autoFocus: true, value: state.name, placeholder: priceRuleMessages.travelerCategoryNamePlaceholder, onChange: (event) => setState((prev) => ({ ...prev, name: event.target.value })) })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "traveler-category-code", children: pricingCategoryMessages.codeLabel }), _jsx(Input, { id: "traveler-category-code", value: state.code, placeholder: priceRuleMessages.travelerCategoryCodePlaceholder, onChange: (event) => setState((prev) => ({ ...prev, code: event.target.value })) })] })] }), _jsxs("div", { className: "grid gap-4 sm:grid-cols-3", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: pricingCategoryMessages.typeLabel }), _jsxs(Select, { value: state.categoryType, onValueChange: (value) => setState((prev) => ({
124
+ ...prev,
125
+ categoryType: (value ?? "child"),
126
+ })), items: travelerCategoryTypes, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: travelerCategoryTypes.map((type) => (_jsx(SelectItem, { value: type.value, children: type.label }, type.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "traveler-category-min-age", children: pricingCategoryMessages.minAgeLabel }), _jsx(Input, { id: "traveler-category-min-age", type: "number", min: "0", value: state.minAge, onChange: (event) => setState((prev) => ({ ...prev, minAge: event.target.value })) })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "traveler-category-max-age", children: pricingCategoryMessages.maxAgeLabel }), _jsx(Input, { id: "traveler-category-max-age", type: "number", min: "0", value: state.maxAge, onChange: (event) => setState((prev) => ({ ...prev, maxAge: event.target.value })) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: priceRuleMessages.travelerCategoryAppliesToLabel }), _jsx("div", { className: "grid gap-2 rounded border p-3 sm:grid-cols-3", children: units.map((unit) => {
127
+ const checkboxId = `traveler-category-unit-${unit.id}`;
128
+ return (_jsxs("div", { className: "flex items-center gap-2 text-sm", children: [_jsx(Checkbox, { id: checkboxId, checked: state.allowedUnitIds.includes(unit.id), onCheckedChange: (checked) => toggleUnit(unit.id, checked === true) }), _jsx(Label, { htmlFor: checkboxId, className: "font-normal", children: unit.name })] }, unit.id));
129
+ }) }), _jsx("p", { className: "text-muted-foreground text-xs", children: priceRuleMessages.travelerCategoryAppliesToHint })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "traveler-category-condition", children: priceRuleMessages.travelerCategoryConditionLabel }), _jsx(Textarea, { id: "traveler-category-condition", value: state.condition, placeholder: priceRuleMessages.travelerCategoryConditionPlaceholder, onChange: (event) => setState((prev) => ({ ...prev, condition: event.target.value })) })] }), error ? _jsx("p", { className: "text-sm text-destructive", children: error }) : null] }), _jsxs(DialogFooter, { className: "-mx-6 -mb-6", children: [_jsx(Button, { variant: "ghost", onClick: () => onOpenChange(false), children: pricingCategoryMessages.cancel }), _jsx(Button, { onClick: () => void save(), disabled: create.isPending || update.isPending, children: isEditing
130
+ ? priceRuleMessages.updateTravelerCategory
131
+ : priceRuleMessages.createTravelerCategory })] })] }) }));
132
+ }
@@ -0,0 +1,10 @@
1
+ import type { OptionPriceRuleData } from "./product-option-price-rule-dialog.js";
2
+ export declare function UnitPriceMatrix({ productId, optionPriceRuleId, optionId, pricingMode, allPricingCategories, productCurrency, }: {
3
+ productId: string;
4
+ optionPriceRuleId: string;
5
+ optionId: string;
6
+ pricingMode: OptionPriceRuleData["pricingMode"];
7
+ allPricingCategories: boolean;
8
+ productCurrency: string;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=product-options-unit-price-matrix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-options-unit-price-matrix.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-options-unit-price-matrix.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAiBhF,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,eAAe,GAChB,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,iBAAiB,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAC/C,oBAAoB,EAAE,OAAO,CAAA;IAC7B,eAAe,EAAE,MAAM,CAAA;CACxB,2CA0NA"}