@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,154 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { Button, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Textarea, } from "@voyant-travel/ui/components";
4
+ import { CurrencyCombobox } from "@voyant-travel/ui/components/currency-combobox";
5
+ import { Loader2 } from "lucide-react";
6
+ import { useEffect } from "react";
7
+ import { useForm } from "react-hook-form";
8
+ import { z } from "zod/v4";
9
+ import { useProductDetailApi, useProductDetailMessages } from "./host.js";
10
+ import { zodResolver } from "./zod-resolver.js";
11
+ const buildServiceFormSchema = (messages) => z.object({
12
+ serviceType: z.enum(["accommodation", "transfer", "experience", "guide", "meal", "other"]),
13
+ name: z.string().min(1, messages.validationNameRequired),
14
+ description: z.string().optional().nullable(),
15
+ countryCode: z
16
+ .string()
17
+ .trim()
18
+ .max(2, messages.validationCountryCode)
19
+ .optional()
20
+ .or(z.literal(""))
21
+ .nullable(),
22
+ supplierServiceId: z.string().optional().nullable(),
23
+ costCurrency: z.string().min(3).max(3, messages.validationIsoCurrency),
24
+ costAmount: z.coerce.number().min(0, messages.validationCostNonNegative),
25
+ quantity: z.coerce.number().int().positive().default(1),
26
+ sortOrder: z.coerce.number().int().optional().or(z.literal("")).nullable(),
27
+ notes: z.string().optional().nullable(),
28
+ });
29
+ function initialValues(service) {
30
+ if (service) {
31
+ return {
32
+ serviceType: service.serviceType,
33
+ name: service.name,
34
+ description: service.description ?? "",
35
+ countryCode: service.countryCode ?? "",
36
+ supplierServiceId: service.supplierServiceId ?? "",
37
+ costCurrency: service.costCurrency,
38
+ costAmount: service.costAmountCents / 100,
39
+ quantity: service.quantity,
40
+ sortOrder: service.sortOrder ?? "",
41
+ notes: service.notes ?? "",
42
+ };
43
+ }
44
+ return {
45
+ serviceType: "accommodation",
46
+ name: "",
47
+ description: "",
48
+ countryCode: "",
49
+ supplierServiceId: "",
50
+ costCurrency: "EUR",
51
+ costAmount: 0,
52
+ quantity: 1,
53
+ sortOrder: "",
54
+ notes: "",
55
+ };
56
+ }
57
+ function getServiceTypeLabel(type, messages) {
58
+ switch (type) {
59
+ case "accommodation":
60
+ return messages.serviceTypeAccommodation;
61
+ case "transfer":
62
+ return messages.serviceTypeTransfer;
63
+ case "experience":
64
+ return messages.serviceTypeExperience;
65
+ case "guide":
66
+ return messages.serviceTypeGuide;
67
+ case "meal":
68
+ return messages.serviceTypeMeal;
69
+ case "other":
70
+ return messages.serviceTypeOther;
71
+ default:
72
+ return type;
73
+ }
74
+ }
75
+ export function ServiceForm({ productId, dayId, service, onSuccess, onCancel }) {
76
+ const messages = useProductDetailMessages();
77
+ const api = useProductDetailApi();
78
+ const productMessages = messages.products.core;
79
+ const serviceMessages = messages.products.operations.services;
80
+ const isEditing = !!service;
81
+ const serviceFormSchema = buildServiceFormSchema(serviceMessages);
82
+ const serviceTypes = [
83
+ { value: "accommodation", label: serviceMessages.serviceTypeAccommodation },
84
+ { value: "transfer", label: serviceMessages.serviceTypeTransfer },
85
+ { value: "experience", label: serviceMessages.serviceTypeExperience },
86
+ { value: "guide", label: serviceMessages.serviceTypeGuide },
87
+ { value: "meal", label: serviceMessages.serviceTypeMeal },
88
+ { value: "other", label: serviceMessages.serviceTypeOther },
89
+ ];
90
+ const { data: suppliersData } = useQuery({
91
+ queryKey: ["suppliers-for-picker"],
92
+ queryFn: async () => {
93
+ const res = await api.get("/v1/suppliers?limit=100");
94
+ const options = [];
95
+ for (const supplier of res.data) {
96
+ const servicesRes = await api.get(`/v1/suppliers/${supplier.id}/services`);
97
+ for (const svc of servicesRes.data) {
98
+ options.push({
99
+ id: svc.id,
100
+ supplierId: supplier.id,
101
+ supplierName: supplier.name,
102
+ serviceType: svc.serviceType,
103
+ name: svc.name,
104
+ });
105
+ }
106
+ }
107
+ return options;
108
+ },
109
+ });
110
+ const form = useForm({
111
+ resolver: zodResolver(serviceFormSchema),
112
+ defaultValues: initialValues(service),
113
+ });
114
+ useEffect(() => {
115
+ form.reset(initialValues(service));
116
+ }, [service, form]);
117
+ const handleSupplierServiceSelect = (supplierServiceId) => {
118
+ const nextSupplierServiceId = supplierServiceId ?? "";
119
+ form.setValue("supplierServiceId", nextSupplierServiceId);
120
+ const option = suppliersData?.find((o) => o.id === nextSupplierServiceId);
121
+ if (option) {
122
+ form.setValue("name", option.name);
123
+ form.setValue("serviceType", option.serviceType);
124
+ }
125
+ };
126
+ const onSubmit = async (values) => {
127
+ const payload = {
128
+ serviceType: values.serviceType,
129
+ name: values.name,
130
+ description: values.description || null,
131
+ countryCode: values.countryCode?.trim().toUpperCase() || null,
132
+ supplierServiceId: values.supplierServiceId || null,
133
+ costCurrency: values.costCurrency,
134
+ costAmountCents: Math.round(values.costAmount * 100),
135
+ quantity: values.quantity,
136
+ sortOrder: values.sortOrder && typeof values.sortOrder === "number" ? values.sortOrder : null,
137
+ notes: values.notes || null,
138
+ };
139
+ if (isEditing) {
140
+ await api.patch(`/v1/products/${productId}/days/${dayId}/services/${service.id}`, payload);
141
+ }
142
+ else {
143
+ await api.post(`/v1/products/${productId}/days/${dayId}/services`, payload);
144
+ }
145
+ onSuccess();
146
+ };
147
+ return (_jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-1 flex-col gap-4 overflow-hidden", children: [_jsxs("div", { className: "grid gap-4", children: [suppliersData && suppliersData.length > 0 && (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: serviceMessages.supplierServiceLabel }), _jsxs(Select, { value: form.watch("supplierServiceId") ?? "", onValueChange: handleSupplierServiceSelect, items: suppliersData.map((opt) => ({
148
+ value: opt.id,
149
+ label: `${opt.supplierName} — ${opt.name} (${getServiceTypeLabel(opt.serviceType, serviceMessages)})`,
150
+ })), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, { placeholder: serviceMessages.supplierServicePlaceholder }) }), _jsx(SelectContent, { children: suppliersData.map((opt) => (_jsxs(SelectItem, { value: opt.id, children: [opt.supplierName, " \u2014 ", opt.name, " (", getServiceTypeLabel(opt.serviceType, serviceMessages), ")"] }, opt.id))) })] })] })), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: serviceMessages.serviceTypeLabel }), _jsxs(Select, { value: form.watch("serviceType"), onValueChange: (v) => form.setValue("serviceType", v), items: serviceTypes, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: serviceTypes.map((t) => (_jsx(SelectItem, { value: t.value, children: t.label }, t.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: serviceMessages.nameLabel }), _jsx(Input, { ...form.register("name"), placeholder: serviceMessages.namePlaceholder }), form.formState.errors.name && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.name.message }))] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: serviceMessages.descriptionLabel }), _jsx(Textarea, { ...form.register("description"), placeholder: serviceMessages.descriptionPlaceholder })] }), _jsx("div", { className: "grid grid-cols-2 gap-4", children: _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: serviceMessages.countryCodeLabel }), _jsx(Input, { ...form.register("countryCode"), placeholder: serviceMessages.countryCodePlaceholder, maxLength: 2, className: "uppercase" }), form.formState.errors.countryCode && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.countryCode.message }))] }) }), _jsxs("div", { className: "grid grid-cols-3 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: serviceMessages.costCurrencyLabel }), _jsx(CurrencyCombobox, { value: form.watch("costCurrency") || null, onChange: (next) => form.setValue("costCurrency", next ?? "", {
151
+ shouldValidate: true,
152
+ shouldDirty: true,
153
+ }), placeholder: serviceMessages.costCurrencyPlaceholder }), form.formState.errors.costCurrency && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.costCurrency.message }))] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: serviceMessages.costAmountLabel }), _jsx(Input, { ...form.register("costAmount"), type: "number", step: "0.01", min: "0", placeholder: serviceMessages.costAmountPlaceholder }), form.formState.errors.costAmount && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.costAmount.message }))] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: serviceMessages.quantityLabel }), _jsx(Input, { ...form.register("quantity"), type: "number", min: "1", placeholder: serviceMessages.quantityPlaceholder })] })] }), _jsx("div", { className: "grid grid-cols-2 gap-4", children: _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: serviceMessages.sortOrderLabel }), _jsx(Input, { ...form.register("sortOrder"), type: "number", placeholder: serviceMessages.sortOrderPlaceholder })] }) }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: serviceMessages.notesLabel }), _jsx(Textarea, { ...form.register("notes"), placeholder: serviceMessages.notesPlaceholder })] })] }), _jsxs("div", { className: "flex items-center justify-end gap-2", children: [onCancel ? (_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancel, children: productMessages.cancel })) : null, _jsxs(Button, { type: "submit", size: "sm", disabled: form.formState.isSubmitting, children: [form.formState.isSubmitting && _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), isEditing ? productMessages.saveChanges : serviceMessages.create] })] })] }));
154
+ }
@@ -0,0 +1,94 @@
1
+ import type { useProductDetailMessages } from "./host.js";
2
+ type ProductCoreMessages = ReturnType<typeof useProductDetailMessages>["products"]["core"];
3
+ export type TranslatableField = "name" | "description" | "slug" | "inclusionsHtml" | "exclusionsHtml" | "termsHtml";
4
+ export type TranslationDraft = {
5
+ id: string | null;
6
+ languageTag: string;
7
+ name: string;
8
+ description: string;
9
+ slug: string;
10
+ shortDescription: string | null;
11
+ inclusionsHtml: string | null;
12
+ exclusionsHtml: string | null;
13
+ termsHtml: string | null;
14
+ seoTitle: string | null;
15
+ seoDescription: string | null;
16
+ };
17
+ export declare function richTextHasContent(html: string): boolean;
18
+ export declare function languageLabel(tag: string): string;
19
+ export interface PersistTranslationsOptions {
20
+ defaultLanguageTag: string;
21
+ baseName: string;
22
+ baseDescription: string;
23
+ baseInclusionsHtml: string;
24
+ baseExclusionsHtml: string;
25
+ baseTermsHtml: string;
26
+ }
27
+ export interface ProductTranslationDrafts {
28
+ drafts: TranslationDraft[];
29
+ isLoading: boolean;
30
+ setFieldValue: (languageTag: string, field: TranslatableField, value: string) => void;
31
+ addLanguage: (languageTag: string) => void;
32
+ removeLanguage: (languageTag: string) => void;
33
+ persist: (productId: string, options: PersistTranslationsOptions) => Promise<void>;
34
+ }
35
+ /**
36
+ * Manages an in-memory draft of a product's translations so Name/Description/
37
+ * Slug can be edited in context from the edit sheet. Seeds from the saved
38
+ * translation records and persists create/update/delete on save.
39
+ *
40
+ * The base product columns hold the default language's Name/Description, so the
41
+ * default-language translation row (if any) just mirrors them and carries the
42
+ * slug (base has no slug column). Fields we don't edit here (short description,
43
+ * inclusions, SEO, …) are preserved untouched.
44
+ */
45
+ export declare function useProductTranslationDrafts(productId: string | null): ProductTranslationDrafts;
46
+ export interface ContentLanguageSwitcherProps {
47
+ activeLanguage: string;
48
+ defaultLanguageTag: string;
49
+ /** The language tags that currently have a translation draft (excluding the default). */
50
+ languageTags: string[];
51
+ messages: ProductCoreMessages;
52
+ onSelect: (languageTag: string) => void;
53
+ onAddLanguage: (languageTag: string) => void;
54
+ onRemoveLanguage: (languageTag: string) => void;
55
+ }
56
+ /** Top-of-sheet switcher: picks which language every translatable field edits. */
57
+ export declare function ContentLanguageSwitcher({ activeLanguage, defaultLanguageTag, languageTags, messages, onSelect, onAddLanguage, onRemoveLanguage, }: ContentLanguageSwitcherProps): import("react/jsx-runtime").JSX.Element;
58
+ export interface TranslatableFieldProps {
59
+ label: string;
60
+ type: "text" | "richtext";
61
+ field: TranslatableField;
62
+ activeLanguage: string;
63
+ defaultLanguageTag: string;
64
+ /** The base product value (used when the active language is the default). Omit for slug. */
65
+ base?: {
66
+ value: string;
67
+ onChange: (value: string) => void;
68
+ };
69
+ translations: ProductTranslationDrafts;
70
+ messages: ProductCoreMessages;
71
+ placeholder?: string;
72
+ autoFocus?: boolean;
73
+ error?: string;
74
+ }
75
+ /**
76
+ * A field bound to the sheet's active language. When that's the default
77
+ * language (and the field has a base column), it edits the base value;
78
+ * otherwise it edits the active language's translation draft. The globe is an
79
+ * informational indicator (green when the field has any non-default translation).
80
+ */
81
+ export declare function TranslatableField({ label, type, field, activeLanguage, defaultLanguageTag, base, translations, messages, placeholder, autoFocus, error, }: TranslatableFieldProps): import("react/jsx-runtime").JSX.Element;
82
+ export declare function TranslationIndicator({ languages: translatedLanguages, messages, }: {
83
+ languages: string[];
84
+ messages: ProductCoreMessages;
85
+ }): import("react/jsx-runtime").JSX.Element;
86
+ export declare function LanguageCombobox({ value, onValueChange, exclude, placeholder, emptyLabel, }: {
87
+ value: string;
88
+ onValueChange: (languageTag: string) => void;
89
+ exclude?: string[];
90
+ placeholder?: string;
91
+ emptyLabel?: string;
92
+ }): import("react/jsx-runtime").JSX.Element;
93
+ export {};
94
+ //# sourceMappingURL=product-translation-popover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-translation-popover.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-translation-popover.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAEzD,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1F,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,aAAa,GACb,MAAM,GACN,gBAAgB,GAChB,gBAAgB,GAChB,WAAW,CAAA;AASf,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IAEZ,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B,CAAA;AAmCD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOxD;AAQD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGjD;AAED,MAAM,WAAW,0BAA0B;IACzC,kBAAkB,EAAE,MAAM,CAAA;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,aAAa,EAAE,MAAM,CAAA;CACtB;AAUD,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,gBAAgB,EAAE,CAAA;IAC1B,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrF,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7C,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,0BAA0B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACnF;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,wBAAwB,CA+H9F;AAED,MAAM,WAAW,4BAA4B;IAC3C,cAAc,EAAE,MAAM,CAAA;IACtB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,yFAAyF;IACzF,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,aAAa,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;CAChD;AAED,kFAAkF;AAClF,wBAAgB,uBAAuB,CAAC,EACtC,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,gBAAgB,GACjB,EAAE,4BAA4B,2CAqD9B;AAiDD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;IACzB,KAAK,EAAE,iBAAiB,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,4FAA4F;IAC5F,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAA;IAC3D,YAAY,EAAE,wBAAwB,CAAA;IACtC,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,IAAI,EACJ,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,KAAK,GACN,EAAE,sBAAsB,2CA0CxB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,GACT,EAAE;IACD,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,QAAQ,EAAE,mBAAmB,CAAA;CAC9B,2CA4BA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,aAAa,EACb,OAAY,EACZ,WAAW,EACX,UAAU,GACX,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,2CA0BA"}
@@ -0,0 +1,238 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // agent-quality: file-size exception -- owner: inventory-react; existing UI surface stays co-located until a dedicated split preserves behavior and tests.
3
+ import { Button, Input, Label } from "@voyant-travel/ui/components";
4
+ import { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, } from "@voyant-travel/ui/components/combobox";
5
+ import { Popover, PopoverContent, PopoverTrigger } from "@voyant-travel/ui/components/popover";
6
+ import { RichTextEditor } from "@voyant-travel/ui/components/rich-text-editor";
7
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@voyant-travel/ui/components/tooltip";
8
+ import { cn } from "@voyant-travel/ui/lib/utils";
9
+ import { languages } from "@voyant-travel/utils/languages";
10
+ import { Globe, Plus, X } from "lucide-react";
11
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
12
+ import { useProductTranslationMutation, useProductTranslations, } from "../../index.js";
13
+ const RICH_TEXT_FIELDS = new Set([
14
+ "description",
15
+ "inclusionsHtml",
16
+ "exclusionsHtml",
17
+ "termsHtml",
18
+ ]);
19
+ function recordToDraft(record) {
20
+ return {
21
+ id: record.id,
22
+ languageTag: record.languageTag,
23
+ name: record.name,
24
+ description: record.description ?? "",
25
+ slug: record.slug ?? "",
26
+ shortDescription: record.shortDescription,
27
+ inclusionsHtml: record.inclusionsHtml,
28
+ exclusionsHtml: record.exclusionsHtml,
29
+ termsHtml: record.termsHtml,
30
+ seoTitle: record.seoTitle,
31
+ seoDescription: record.seoDescription,
32
+ };
33
+ }
34
+ function emptyDraft(languageTag) {
35
+ return {
36
+ id: null,
37
+ languageTag,
38
+ name: "",
39
+ description: "",
40
+ slug: "",
41
+ shortDescription: null,
42
+ inclusionsHtml: null,
43
+ exclusionsHtml: null,
44
+ termsHtml: null,
45
+ seoTitle: null,
46
+ seoDescription: null,
47
+ };
48
+ }
49
+ // Rich text is "set" only when it has visible text, not just empty markup like <p></p>.
50
+ export function richTextHasContent(html) {
51
+ return (html
52
+ .replace(/<[^>]*>/g, "")
53
+ .replace(/&nbsp;/g, " ")
54
+ .trim().length > 0);
55
+ }
56
+ function fieldHasContent(draft, field) {
57
+ const value = draft[field] ?? "";
58
+ if (RICH_TEXT_FIELDS.has(field))
59
+ return richTextHasContent(value);
60
+ return value.trim().length > 0;
61
+ }
62
+ export function languageLabel(tag) {
63
+ const base = tag.split("-")[0]?.toLowerCase() ?? tag;
64
+ return languages[base] ?? tag;
65
+ }
66
+ // Resolve a rich-text translation column: the default-language row mirrors the
67
+ // base product column (when it has content), every row otherwise uses its own
68
+ // draft, and empty markup collapses to null so the column stays clean.
69
+ function resolveRichText(isDefault, baseValue, draftValue) {
70
+ if (isDefault && richTextHasContent(baseValue))
71
+ return baseValue;
72
+ return richTextHasContent(draftValue ?? "") ? (draftValue ?? "") : null;
73
+ }
74
+ /**
75
+ * Manages an in-memory draft of a product's translations so Name/Description/
76
+ * Slug can be edited in context from the edit sheet. Seeds from the saved
77
+ * translation records and persists create/update/delete on save.
78
+ *
79
+ * The base product columns hold the default language's Name/Description, so the
80
+ * default-language translation row (if any) just mirrors them and carries the
81
+ * slug (base has no slug column). Fields we don't edit here (short description,
82
+ * inclusions, SEO, …) are preserved untouched.
83
+ */
84
+ export function useProductTranslationDrafts(productId) {
85
+ const query = useProductTranslations(productId ?? undefined, {
86
+ limit: 100,
87
+ enabled: !!productId,
88
+ });
89
+ const mutations = useProductTranslationMutation();
90
+ const [drafts, setDrafts] = useState([]);
91
+ const seededKey = useRef(null);
92
+ const existingRef = useRef([]);
93
+ useEffect(() => {
94
+ const key = productId ?? "__new__";
95
+ if (productId && query.isPending)
96
+ return;
97
+ if (seededKey.current === key)
98
+ return;
99
+ const records = query.data?.data ?? [];
100
+ existingRef.current = records;
101
+ setDrafts(records.map(recordToDraft));
102
+ seededKey.current = key;
103
+ }, [productId, query.isPending, query.data]);
104
+ const setFieldValue = useCallback((languageTag, field, value) => {
105
+ setDrafts((prev) => {
106
+ if (prev.some((draft) => draft.languageTag === languageTag)) {
107
+ return prev.map((draft) => draft.languageTag === languageTag ? { ...draft, [field]: value } : draft);
108
+ }
109
+ return [...prev, { ...emptyDraft(languageTag), [field]: value }];
110
+ });
111
+ }, []);
112
+ const addLanguage = useCallback((languageTag) => {
113
+ setDrafts((prev) => prev.some((draft) => draft.languageTag === languageTag)
114
+ ? prev
115
+ : [...prev, emptyDraft(languageTag)]);
116
+ }, []);
117
+ const removeLanguage = useCallback((languageTag) => {
118
+ setDrafts((prev) => prev.filter((draft) => draft.languageTag !== languageTag));
119
+ }, []);
120
+ const persist = useCallback(async (resolvedProductId, options) => {
121
+ const { defaultLanguageTag, baseName, baseDescription, baseInclusionsHtml, baseExclusionsHtml, baseTermsHtml, } = options;
122
+ const original = existingRef.current;
123
+ const currentLanguages = new Set(drafts.map((draft) => draft.languageTag));
124
+ const deletes = original
125
+ .filter((record) => !currentLanguages.has(record.languageTag))
126
+ .map((record) => mutations.remove.mutateAsync({
127
+ productId: resolvedProductId,
128
+ translationId: record.id,
129
+ }));
130
+ const upserts = drafts.map((draft) => {
131
+ const isDefault = draft.languageTag === defaultLanguageTag;
132
+ // The default-language row mirrors the base columns so public serving
133
+ // (which prefers translations) stays consistent with what's edited.
134
+ // When base is empty we keep the row's own value rather than wiping it —
135
+ // legacy products often have empty base columns with content only here.
136
+ const name = isDefault ? baseName : draft.name.trim() || baseName;
137
+ const description = isDefault
138
+ ? richTextHasContent(baseDescription)
139
+ ? baseDescription
140
+ : richTextHasContent(draft.description)
141
+ ? draft.description
142
+ : null
143
+ : richTextHasContent(draft.description)
144
+ ? draft.description
145
+ : null;
146
+ const slug = draft.slug.trim() ? draft.slug.trim() : null;
147
+ const inclusionsHtml = resolveRichText(isDefault, baseInclusionsHtml, draft.inclusionsHtml);
148
+ const exclusionsHtml = resolveRichText(isDefault, baseExclusionsHtml, draft.exclusionsHtml);
149
+ const termsHtml = resolveRichText(isDefault, baseTermsHtml, draft.termsHtml);
150
+ const richInput = { inclusionsHtml, exclusionsHtml, termsHtml };
151
+ if (draft.id) {
152
+ return mutations.update.mutateAsync({
153
+ productId: resolvedProductId,
154
+ translationId: draft.id,
155
+ input: { name, description, slug, ...richInput },
156
+ });
157
+ }
158
+ // A brand-new row is only worth creating once it carries content.
159
+ const hasRichContent = !!inclusionsHtml || !!exclusionsHtml || !!termsHtml;
160
+ const isEmpty = isDefault
161
+ ? !slug && !hasRichContent
162
+ : !draft.name.trim() && !richTextHasContent(draft.description) && !slug && !hasRichContent;
163
+ if (isEmpty)
164
+ return Promise.resolve(null);
165
+ return mutations.create.mutateAsync({
166
+ productId: resolvedProductId,
167
+ input: { languageTag: draft.languageTag, name, description, slug, ...richInput },
168
+ });
169
+ });
170
+ await Promise.all([...deletes, ...upserts]);
171
+ // Force a reseed from the refreshed server state so a second save patches
172
+ // (with real ids) instead of re-creating.
173
+ seededKey.current = null;
174
+ }, [drafts, mutations]);
175
+ return {
176
+ drafts,
177
+ isLoading: !!productId && query.isPending,
178
+ setFieldValue,
179
+ addLanguage,
180
+ removeLanguage,
181
+ persist,
182
+ };
183
+ }
184
+ /** Top-of-sheet switcher: picks which language every translatable field edits. */
185
+ export function ContentLanguageSwitcher({ activeLanguage, defaultLanguageTag, languageTags, messages, onSelect, onAddLanguage, onRemoveLanguage, }) {
186
+ const [addOpen, setAddOpen] = useState(false);
187
+ const otherLanguages = languageTags.filter((tag) => tag !== defaultLanguageTag);
188
+ return (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("span", { className: "text-xs font-medium text-muted-foreground", children: messages.editingLanguageLabel }), _jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [_jsx(LanguageChip, { active: activeLanguage === defaultLanguageTag, languageTag: defaultLanguageTag, badge: messages.defaultBadge, onSelect: () => onSelect(defaultLanguageTag) }), otherLanguages.map((tag) => (_jsx(LanguageChip, { active: activeLanguage === tag, languageTag: tag, onSelect: () => onSelect(tag), onRemove: () => onRemoveLanguage(tag), removeLabel: messages.translationRemoveLanguage }, tag))), _jsxs(Popover, { open: addOpen, onOpenChange: setAddOpen, children: [_jsx(PopoverTrigger, { render: _jsxs(Button, { type: "button", variant: "outline", size: "sm", className: "h-7 border-dashed", children: [_jsx(Plus, { className: "size-3.5" }), messages.addLanguage] }) }), _jsx(PopoverContent, { align: "start", className: "w-64", children: _jsx(LanguageCombobox, { value: "", exclude: [defaultLanguageTag, ...otherLanguages], placeholder: messages.translationLanguageSearch, emptyLabel: messages.translationLanguageEmpty, onValueChange: (code) => {
189
+ if (code) {
190
+ onAddLanguage(code);
191
+ setAddOpen(false);
192
+ }
193
+ } }) })] })] })] }));
194
+ }
195
+ function LanguageChip({ active, languageTag, badge, onSelect, onRemove, removeLabel, }) {
196
+ return (_jsxs("div", { className: cn("inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs transition-colors", active
197
+ ? "border-primary bg-primary/10 text-foreground"
198
+ : "border-input text-muted-foreground hover:bg-accent"), children: [_jsxs("button", { type: "button", onClick: onSelect, className: "inline-flex items-center gap-1.5", children: [_jsx("span", { className: "font-medium", children: languageLabel(languageTag) }), _jsx("span", { className: "font-mono uppercase opacity-70", children: languageTag }), badge ? (_jsx("span", { className: "rounded bg-muted px-1 text-[10px] font-medium uppercase tracking-wide", children: badge })) : null] }), onRemove ? (_jsx("button", { type: "button", onClick: onRemove, "aria-label": removeLabel, className: "text-muted-foreground hover:text-destructive", children: _jsx(X, { className: "size-3" }) })) : null] }));
199
+ }
200
+ /**
201
+ * A field bound to the sheet's active language. When that's the default
202
+ * language (and the field has a base column), it edits the base value;
203
+ * otherwise it edits the active language's translation draft. The globe is an
204
+ * informational indicator (green when the field has any non-default translation).
205
+ */
206
+ export function TranslatableField({ label, type, field, activeLanguage, defaultLanguageTag, base, translations, messages, placeholder, autoFocus, error, }) {
207
+ const usesBase = !!base && activeLanguage === defaultLanguageTag;
208
+ const activeDraft = translations.drafts.find((draft) => draft.languageTag === activeLanguage);
209
+ const defaultDraft = translations.drafts.find((draft) => draft.languageTag === defaultLanguageTag);
210
+ // When editing the default language, show the base value — but fall back to
211
+ // the default-language translation (legacy products keep content only there).
212
+ // Editing writes to the base columns, promoting that content forward.
213
+ const value = usesBase
214
+ ? (base?.value ?? "") || (defaultDraft?.[field] ?? "")
215
+ : (activeDraft?.[field] ?? "");
216
+ const handleChange = usesBase
217
+ ? (base?.onChange ?? (() => { }))
218
+ : (next) => translations.setFieldValue(activeLanguage, field, next);
219
+ const translatedLanguages = translations.drafts
220
+ .filter((draft) => draft.languageTag !== defaultLanguageTag && fieldHasContent(draft, field))
221
+ .map((draft) => draft.languageTag);
222
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx(Label, { children: label }), _jsx(TranslationIndicator, { languages: translatedLanguages, messages: messages })] }), type === "richtext" ? (_jsx(RichTextEditor, { value: value, onChange: handleChange, placeholder: placeholder, editorClassName: "max-h-[280px] overflow-y-auto" })) : (_jsx(Input, { value: value, onChange: (event) => handleChange(event.target.value), placeholder: placeholder, autoFocus: autoFocus })), error ? _jsx("p", { className: "text-xs text-destructive", children: error }) : null] }));
223
+ }
224
+ export function TranslationIndicator({ languages: translatedLanguages, messages, }) {
225
+ const isTranslated = translatedLanguages.length > 0;
226
+ return (_jsx(TooltipProvider, { delay: 150, children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx("button", { type: "button", className: "inline-flex cursor-help items-center", children: _jsx(Globe, { className: cn("size-3.5", isTranslated ? "text-emerald-500" : "text-muted-foreground/50") }) }) }), _jsx(TooltipContent, { children: isTranslated
227
+ ? `${messages.fieldTranslated}: ${translatedLanguages
228
+ .map((tag) => tag.toUpperCase())
229
+ .join(", ")}`
230
+ : messages.fieldNotTranslated })] }) }));
231
+ }
232
+ export function LanguageCombobox({ value, onValueChange, exclude = [], placeholder, emptyLabel, }) {
233
+ const excludeKey = exclude.join("|");
234
+ const options = useMemo(() => Object.entries(languages)
235
+ .filter(([code]) => !excludeKey.split("|").includes(code))
236
+ .map(([code, name]) => ({ value: code, label: name })), [excludeKey]);
237
+ return (_jsxs(Combobox, { value: value, onValueChange: (next) => onValueChange(next ?? ""), children: [_jsx(ComboboxInput, { placeholder: placeholder, className: "w-full" }), _jsx(ComboboxContent, { children: _jsxs(ComboboxList, { children: [options.map((option) => (_jsxs(ComboboxItem, { value: option.value, children: [_jsx("span", { className: "truncate", children: option.label }), _jsx("span", { className: "font-mono text-xs text-muted-foreground", children: option.value })] }, option.value))), _jsx(ComboboxEmpty, { children: emptyLabel })] }) })] }));
238
+ }
@@ -0,0 +1,14 @@
1
+ import { type OptionUnitData } from "./product-unit-form.js";
2
+ export type { OptionUnitData };
3
+ type UnitDialogProps = {
4
+ open: boolean;
5
+ onOpenChange: (open: boolean) => void;
6
+ optionId: string;
7
+ unit?: OptionUnitData;
8
+ defaultUnitType?: OptionUnitData["unitType"];
9
+ lockUnitType?: boolean;
10
+ nextSortOrder?: number;
11
+ onSuccess: () => void;
12
+ };
13
+ export declare function UnitDialog({ open, onOpenChange, optionId, unit, defaultUnitType, lockUnitType, nextSortOrder, onSuccess, }: UnitDialogProps): import("react/jsx-runtime").JSX.Element;
14
+ //# sourceMappingURL=product-unit-dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-unit-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-unit-dialog.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,wBAAwB,CAAA;AAEtE,YAAY,EAAE,cAAc,EAAE,CAAA;AAE9B,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,eAAe,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;IAC5C,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,CAAA;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,eAAe,EACf,YAAY,EACZ,aAAa,EACb,SAAS,GACV,EAAE,eAAe,2CAyBjB"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, } from "@voyant-travel/ui/components";
3
+ import { useProductDetailMessages } from "./host.js";
4
+ import { UnitForm } from "./product-unit-form.js";
5
+ export function UnitDialog({ open, onOpenChange, optionId, unit, defaultUnitType, lockUnitType, nextSortOrder, onSuccess, }) {
6
+ const messages = useProductDetailMessages();
7
+ const unitMessages = messages.products.operations.units;
8
+ const isEditing = !!unit;
9
+ return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { side: "right", size: "lg", children: [_jsx(SheetHeader, { children: _jsx(SheetTitle, { children: isEditing ? unitMessages.editTitle : unitMessages.newTitle }) }), _jsx(SheetBody, { children: _jsx(UnitForm, { optionId: optionId, unit: unit, defaultUnitType: defaultUnitType, lockUnitType: lockUnitType, nextSortOrder: nextSortOrder, onSuccess: onSuccess, onCancel: () => onOpenChange(false) }) })] }) }));
10
+ }
@@ -0,0 +1,34 @@
1
+ export type OptionUnitData = {
2
+ id: string;
3
+ optionId: string;
4
+ name: string;
5
+ code: string | null;
6
+ description: string | null;
7
+ unitType: "person" | "group" | "room" | "vehicle" | "service" | "other";
8
+ minQuantity: number | null;
9
+ maxQuantity: number | null;
10
+ minAge: number | null;
11
+ maxAge: number | null;
12
+ occupancyMin: number | null;
13
+ occupancyMax: number | null;
14
+ isRequired: boolean;
15
+ isHidden: boolean;
16
+ sortOrder: number;
17
+ };
18
+ export interface UnitFormProps {
19
+ optionId: string;
20
+ unit?: OptionUnitData;
21
+ /** Pre-selected unit type for the "add" path (e.g. Room vs Traveler type). */
22
+ defaultUnitType?: OptionUnitData["unitType"];
23
+ /**
24
+ * Hide the unit-type picker entirely. Used when the form is opened from a
25
+ * type-specific context (e.g. "Add room"), so the agent can't turn a room
26
+ * into a vehicle and create a nonsensical mix in the pricing grid.
27
+ */
28
+ lockUnitType?: boolean;
29
+ nextSortOrder?: number;
30
+ onSuccess: () => void;
31
+ onCancel?: () => void;
32
+ }
33
+ export declare function UnitForm({ optionId, unit, defaultUnitType, lockUnitType, nextSortOrder, onSuccess, onCancel, }: UnitFormProps): import("react/jsx-runtime").JSX.Element;
34
+ //# sourceMappingURL=product-unit-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-unit-form.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-unit-form.tsx"],"names":[],"mappings":"AA2EA,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;IACvE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,8EAA8E;IAC9E,eAAe,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;IAC5C;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAyCD,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,IAAI,EACJ,eAAe,EACf,YAAY,EACZ,aAAa,EACb,SAAS,EACT,QAAQ,GACT,EAAE,aAAa,2CA2Lf"}