@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,111 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Input, Label } from "@voyant-travel/ui/components";
3
+ import { RichTextEditor } from "@voyant-travel/ui/components/rich-text-editor";
4
+ import { useCallback, useEffect, useRef, useState } from "react";
5
+ import { useProductDayTranslationMutation, useProductDayTranslations, } from "../../index.js";
6
+ import { richTextHasContent, TranslationIndicator } from "./product-translation-popover.js";
7
+ function recordToDraft(record) {
8
+ return {
9
+ id: record.id,
10
+ languageTag: record.languageTag,
11
+ title: record.title ?? "",
12
+ description: record.description ?? "",
13
+ location: record.location ?? "",
14
+ };
15
+ }
16
+ function emptyDraft(languageTag) {
17
+ return { id: null, languageTag, title: "", description: "", location: "" };
18
+ }
19
+ function fieldHasContent(draft, field) {
20
+ if (field === "description")
21
+ return richTextHasContent(draft.description);
22
+ return draft[field].trim().length > 0;
23
+ }
24
+ /**
25
+ * In-memory drafts for a day's translations. The default language's content
26
+ * lives in the base day columns (title/description/location all have base
27
+ * columns), so this only manages non-default-language translation rows.
28
+ */
29
+ export function useProductDayTranslationDrafts(productId, dayId) {
30
+ const query = useProductDayTranslations(productId ?? undefined, dayId ?? undefined, {
31
+ enabled: !!productId && !!dayId,
32
+ });
33
+ const mutations = useProductDayTranslationMutation();
34
+ const [drafts, setDrafts] = useState([]);
35
+ const seededKey = useRef(null);
36
+ const existingRef = useRef([]);
37
+ useEffect(() => {
38
+ const key = `${productId ?? ""}:${dayId ?? "__new__"}`;
39
+ if (productId && dayId && query.isPending)
40
+ return;
41
+ if (seededKey.current === key)
42
+ return;
43
+ const records = query.data?.data ?? [];
44
+ existingRef.current = records;
45
+ setDrafts(records.map(recordToDraft));
46
+ seededKey.current = key;
47
+ }, [productId, dayId, query.isPending, query.data]);
48
+ const setFieldValue = useCallback((languageTag, field, value) => {
49
+ setDrafts((prev) => {
50
+ if (prev.some((draft) => draft.languageTag === languageTag)) {
51
+ return prev.map((draft) => draft.languageTag === languageTag ? { ...draft, [field]: value } : draft);
52
+ }
53
+ return [...prev, { ...emptyDraft(languageTag), [field]: value }];
54
+ });
55
+ }, []);
56
+ const addLanguage = useCallback((languageTag) => {
57
+ setDrafts((prev) => prev.some((draft) => draft.languageTag === languageTag)
58
+ ? prev
59
+ : [...prev, emptyDraft(languageTag)]);
60
+ }, []);
61
+ const removeLanguage = useCallback((languageTag) => {
62
+ setDrafts((prev) => prev.filter((draft) => draft.languageTag !== languageTag));
63
+ }, []);
64
+ const persist = useCallback(async (resolvedProductId, resolvedDayId, defaultLanguageTag) => {
65
+ const original = existingRef.current;
66
+ const nonDefault = drafts.filter((draft) => draft.languageTag !== defaultLanguageTag);
67
+ const currentLanguages = new Set(nonDefault.map((draft) => draft.languageTag));
68
+ const deletes = original
69
+ .filter((record) => !currentLanguages.has(record.languageTag))
70
+ .map((record) => mutations.remove.mutateAsync({
71
+ productId: resolvedProductId,
72
+ dayId: resolvedDayId,
73
+ translationId: record.id,
74
+ }));
75
+ const upserts = nonDefault.map((draft) => {
76
+ const title = draft.title.trim() ? draft.title.trim() : null;
77
+ const description = richTextHasContent(draft.description) ? draft.description : null;
78
+ const location = draft.location.trim() ? draft.location.trim() : null;
79
+ if (draft.id) {
80
+ return mutations.update.mutateAsync({
81
+ productId: resolvedProductId,
82
+ dayId: resolvedDayId,
83
+ translationId: draft.id,
84
+ input: { title, description, location },
85
+ });
86
+ }
87
+ if (!title && !description && !location)
88
+ return Promise.resolve(null);
89
+ return mutations.create.mutateAsync({
90
+ productId: resolvedProductId,
91
+ dayId: resolvedDayId,
92
+ input: { languageTag: draft.languageTag, title, description, location },
93
+ });
94
+ });
95
+ await Promise.all([...deletes, ...upserts]);
96
+ seededKey.current = null;
97
+ }, [drafts, mutations]);
98
+ return { drafts, setFieldValue, addLanguage, removeLanguage, persist };
99
+ }
100
+ export function DayTranslatableField({ label, type, field, activeLanguage, defaultLanguageTag, base, drafts, messages, placeholder, autoFocus, }) {
101
+ const usesBase = activeLanguage === defaultLanguageTag;
102
+ const activeDraft = drafts.drafts.find((draft) => draft.languageTag === activeLanguage);
103
+ const value = usesBase ? base.value : (activeDraft?.[field] ?? "");
104
+ const handleChange = usesBase
105
+ ? base.onChange
106
+ : (next) => drafts.setFieldValue(activeLanguage, field, next);
107
+ const translatedLanguages = drafts.drafts
108
+ .filter((draft) => draft.languageTag !== defaultLanguageTag && fieldHasContent(draft, field))
109
+ .map((draft) => draft.languageTag);
110
+ return (_jsxs("div", { className: "flex flex-col gap-1.5", 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-[320px] overflow-y-auto" })) : (_jsx(Input, { value: value, onChange: (event) => handleChange(event.target.value), placeholder: placeholder, autoFocus: autoFocus }))] }));
111
+ }
@@ -0,0 +1,11 @@
1
+ import { type DepartureSlot } from "./product-departure-form.js";
2
+ export type { DepartureSlot };
3
+ type DepartureDialogProps = {
4
+ open: boolean;
5
+ onOpenChange: (open: boolean) => void;
6
+ productId: string;
7
+ slot?: DepartureSlot;
8
+ onSuccess: () => void;
9
+ };
10
+ export declare function DepartureDialog({ open, onOpenChange, productId, slot, onSuccess, }: DepartureDialogProps): import("react/jsx-runtime").JSX.Element;
11
+ //# sourceMappingURL=product-departure-dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-departure-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-departure-dialog.tsx"],"names":[],"mappings":"AASA,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAE/E,YAAY,EAAE,aAAa,EAAE,CAAA;AAE7B,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,2CAwBtB"}
@@ -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 { DepartureForm } from "./product-departure-form.js";
5
+ export function DepartureDialog({ open, onOpenChange, productId, slot, onSuccess, }) {
6
+ const messages = useProductDetailMessages();
7
+ const departureMessages = messages.products.operations.departures;
8
+ const isEditing = !!slot;
9
+ return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { side: "right", size: "lg", children: [_jsx(SheetHeader, { children: _jsx(SheetTitle, { children: isEditing ? departureMessages.editTitle : departureMessages.newTitle }) }), _jsx(SheetBody, { children: _jsx(DepartureForm, { productId: productId, slot: slot, onSuccess: onSuccess, onCancel: () => onOpenChange(false) }) })] }) }));
10
+ }
@@ -0,0 +1,25 @@
1
+ export type DepartureSlot = {
2
+ id: string;
3
+ productId: string;
4
+ optionId: string | null;
5
+ itineraryId: string | null;
6
+ dateLocal: string;
7
+ startsAt: string;
8
+ endsAt: string | null;
9
+ timezone: string;
10
+ status: "open" | "closed" | "sold_out" | "cancelled";
11
+ unlimited: boolean;
12
+ initialPax: number | null;
13
+ remainingPax: number | null;
14
+ nights: number | null;
15
+ days: number | null;
16
+ notes: string | null;
17
+ };
18
+ export interface DepartureFormProps {
19
+ productId: string;
20
+ slot?: DepartureSlot;
21
+ onSuccess: () => void;
22
+ onCancel?: () => void;
23
+ }
24
+ export declare function DepartureForm({ productId, slot, onSuccess, onCancel }: DepartureFormProps): import("react/jsx-runtime").JSX.Element;
25
+ //# sourceMappingURL=product-departure-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-departure-form.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-departure-form.tsx"],"names":[],"mappings":"AAiFA,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAA;IACpD,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAuDD,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAmZzF"}
@@ -0,0 +1,241 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 { formatMessage } from "@voyant-travel/i18n";
4
+ import { Button, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch, Textarea, } from "@voyant-travel/ui/components";
5
+ import { Combobox, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, } from "@voyant-travel/ui/components/combobox";
6
+ import { DatePicker } from "@voyant-travel/ui/components/date-picker";
7
+ import { Loader2 } from "lucide-react";
8
+ import { useEffect, useMemo, useRef } from "react";
9
+ import { useForm } from "react-hook-form";
10
+ import { z } from "zod/v4";
11
+ import { useProductItineraries } from "../../index.js";
12
+ import { useProductResourceTemplates } from "./commerce-client.js";
13
+ import { useProductDetailApi, useProductDetailMessages } from "./host.js";
14
+ import { getTimezoneLabel, TIMEZONE_IDS, TIMEZONE_OPTIONS } from "./timezone-options.js";
15
+ import { zodResolver } from "./zod-resolver.js";
16
+ const buildDepartureFormSchema = (messages) => z
17
+ .object({
18
+ startDate: z.string().min(1, messages.validationStartDateRequired),
19
+ startTime: z.string().min(1, messages.validationStartTimeRequired),
20
+ endDate: z.string().optional().nullable(),
21
+ endTime: z.string().optional().nullable(),
22
+ itineraryId: z.string().optional().nullable(),
23
+ timezone: z.string().min(1, messages.validationTimezoneRequired),
24
+ status: z.enum(["open", "closed", "sold_out", "cancelled"]),
25
+ unlimited: z.boolean(),
26
+ initialPax: z.coerce.number().int().min(0).optional().or(z.literal("")).nullable(),
27
+ nights: z.coerce.number().int().min(0).optional().or(z.literal("")).nullable(),
28
+ days: z.coerce.number().int().min(0).optional().or(z.literal("")).nullable(),
29
+ notes: z.string().optional().nullable(),
30
+ })
31
+ .refine((v) => {
32
+ if (!v.endDate || typeof v.endDate !== "string" || v.endDate.length === 0)
33
+ return true;
34
+ return v.endDate >= v.startDate;
35
+ }, { message: messages.validationEndDateOrder, path: ["endDate"] })
36
+ .refine((v) => {
37
+ const endDate = v.endDate && typeof v.endDate === "string" && v.endDate.length > 0
38
+ ? v.endDate
39
+ : v.startDate;
40
+ const endTime = v.endTime && typeof v.endTime === "string" && v.endTime.length > 0 ? v.endTime : null;
41
+ if (!endTime)
42
+ return true;
43
+ if (endDate > v.startDate)
44
+ return true;
45
+ return endTime >= v.startTime;
46
+ }, { message: messages.validationEndTimeOrder, path: ["endTime"] });
47
+ function combineLocalToIso(date, time) {
48
+ const iso = new Date(`${date}T${time}:00Z`).toISOString();
49
+ return iso;
50
+ }
51
+ function isoToLocalDate(iso) {
52
+ const d = new Date(iso);
53
+ const y = d.getUTCFullYear();
54
+ const m = String(d.getUTCMonth() + 1).padStart(2, "0");
55
+ const day = String(d.getUTCDate()).padStart(2, "0");
56
+ return `${y}-${m}-${day}`;
57
+ }
58
+ function isoToLocalTime(iso) {
59
+ const d = new Date(iso);
60
+ const hh = String(d.getUTCHours()).padStart(2, "0");
61
+ const mm = String(d.getUTCMinutes()).padStart(2, "0");
62
+ return `${hh}:${mm}`;
63
+ }
64
+ function initialValues(slot, defaultTz) {
65
+ if (slot) {
66
+ return {
67
+ startDate: slot.dateLocal,
68
+ startTime: isoToLocalTime(slot.startsAt),
69
+ endDate: slot.endsAt ? isoToLocalDate(slot.endsAt) : "",
70
+ endTime: slot.endsAt ? isoToLocalTime(slot.endsAt) : "",
71
+ itineraryId: slot.itineraryId ?? "",
72
+ timezone: slot.timezone,
73
+ status: slot.status,
74
+ unlimited: slot.unlimited,
75
+ initialPax: slot.initialPax != null ? slot.initialPax : "",
76
+ nights: slot.nights != null ? slot.nights : "",
77
+ days: slot.days != null ? slot.days : "",
78
+ notes: slot.notes ?? "",
79
+ };
80
+ }
81
+ return {
82
+ startDate: "",
83
+ startTime: "09:00",
84
+ endDate: "",
85
+ endTime: "",
86
+ itineraryId: "",
87
+ timezone: defaultTz,
88
+ status: "open",
89
+ unlimited: false,
90
+ initialPax: "",
91
+ nights: "",
92
+ days: "",
93
+ notes: "",
94
+ };
95
+ }
96
+ export function DepartureForm({ productId, slot, onSuccess, onCancel }) {
97
+ const messages = useProductDetailMessages();
98
+ const api = useProductDetailApi();
99
+ const productMessages = messages.products.core;
100
+ const departureMessages = messages.products.operations.departures;
101
+ const itineraryMessages = messages.products.operations.itineraries;
102
+ const isEditing = !!slot;
103
+ const departureFormSchema = buildDepartureFormSchema(departureMessages);
104
+ const slotStatuses = [
105
+ { value: "open", label: productMessages.departureStatusOpen },
106
+ { value: "closed", label: productMessages.departureStatusClosed },
107
+ { value: "sold_out", label: productMessages.departureStatusSoldOut },
108
+ { value: "cancelled", label: productMessages.departureStatusCancelled },
109
+ ];
110
+ const defaultTz = typeof Intl !== "undefined"
111
+ ? (Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC")
112
+ : "UTC";
113
+ const form = useForm({
114
+ resolver: zodResolver(departureFormSchema),
115
+ defaultValues: initialValues(slot, defaultTz),
116
+ });
117
+ const unlimited = form.watch("unlimited");
118
+ const startDate = form.watch("startDate");
119
+ const endDate = form.watch("endDate");
120
+ const timezone = form.watch("timezone");
121
+ const { data: itineraryData } = useProductItineraries(productId);
122
+ const itineraries = itineraryData?.data ?? [];
123
+ const defaultItinerary = itineraries.find((itinerary) => itinerary.isDefault) ?? itineraries[0];
124
+ // Suggested pax = total physical capacity of the configured departure
125
+ // inventory (each room/seat type's count × its capacity, e.g. 20 doubles
126
+ // sleeping 2 = 40). Lets a new departure inherit capacity from the rooms the
127
+ // operator already set up, while staying editable for an override.
128
+ const { data: resourceTemplateData } = useProductResourceTemplates(productId);
129
+ const suggestedPax = useMemo(() => (resourceTemplateData?.data ?? []).reduce((optionTotal, option) => optionTotal +
130
+ option.templates.reduce((sum, template) => sum + (template.defaultCount ?? 0) * template.capacity, 0), 0), [resourceTemplateData?.data]);
131
+ // Pre-fill capacity once for a brand-new departure, only while the field is
132
+ // still untouched — never clobber an edit or an existing slot's value.
133
+ const prefilledPaxRef = useRef(false);
134
+ useEffect(() => {
135
+ if (isEditing || prefilledPaxRef.current || suggestedPax <= 0)
136
+ return;
137
+ const current = form.getValues("initialPax");
138
+ if (current === "" || current == null) {
139
+ form.setValue("initialPax", suggestedPax);
140
+ prefilledPaxRef.current = true;
141
+ }
142
+ }, [isEditing, suggestedPax, form]);
143
+ const nights = (() => {
144
+ if (!startDate || !endDate || typeof endDate !== "string" || endDate.length === 0)
145
+ return 0;
146
+ const start = new Date(`${startDate}T00:00:00Z`).getTime();
147
+ const end = new Date(`${endDate}T00:00:00Z`).getTime();
148
+ const diffDays = Math.round((end - start) / 86_400_000);
149
+ return diffDays > 0 ? diffDays : 0;
150
+ })();
151
+ useEffect(() => {
152
+ form.reset(initialValues(slot, defaultTz));
153
+ }, [slot, form, defaultTz]);
154
+ const onSubmit = async (values) => {
155
+ const startsAt = combineLocalToIso(values.startDate, values.startTime);
156
+ const effectiveEndDate = values.endDate && typeof values.endDate === "string" && values.endDate.length > 0
157
+ ? values.endDate
158
+ : values.startDate;
159
+ const hasEndTime = values.endTime && typeof values.endTime === "string" && values.endTime.length > 0;
160
+ const hasExplicitEndDate = values.endDate && typeof values.endDate === "string" && values.endDate.length > 0;
161
+ const endsAt = hasEndTime || hasExplicitEndDate
162
+ ? combineLocalToIso(effectiveEndDate, hasEndTime ? values.endTime : "18:00")
163
+ : null;
164
+ const initialPax = !values.unlimited && typeof values.initialPax === "number" ? values.initialPax : null;
165
+ // Treat blank / zero overrides as `null` so the slot card doesn't show
166
+ // "0 nights / 0 days" after the operator clears the override (#1087 side
167
+ // bug). The schema accepts `null` for both; sending `0` was the bug.
168
+ const nightsOverride = typeof values.nights === "number" && values.nights > 0 ? values.nights : null;
169
+ const daysOverride = typeof values.days === "number" && values.days > 0 ? values.days : null;
170
+ // `remainingPax` is intentionally omitted on edit — the slot service is
171
+ // the source of truth for that field. Concurrent flows (holds, bookings,
172
+ // refunds) mutate it atomically while a form is open, so any snapshot
173
+ // we computed in JS would be stale by save time (#1087, Codex review on
174
+ // #1088). The backend's `updateSlot` recomputes remaining_pax in the
175
+ // same UPDATE statement when initialPax / unlimited change.
176
+ const baseFields = {
177
+ productId,
178
+ itineraryId: values.itineraryId ? values.itineraryId : null,
179
+ dateLocal: values.startDate,
180
+ startsAt,
181
+ endsAt,
182
+ timezone: values.timezone,
183
+ status: values.status,
184
+ unlimited: values.unlimited,
185
+ initialPax,
186
+ nights: nightsOverride,
187
+ days: daysOverride,
188
+ notes: values.notes || null,
189
+ };
190
+ if (isEditing) {
191
+ await api.patch(`/v1/operations/availability/slots/${slot.id}`, baseFields);
192
+ }
193
+ else {
194
+ // New slots haven't been booked against yet, so seeding remainingPax
195
+ // from initialPax is correct on create.
196
+ await api.post("/v1/operations/availability/slots", {
197
+ ...baseFields,
198
+ remainingPax: initialPax,
199
+ });
200
+ }
201
+ onSuccess();
202
+ };
203
+ return (_jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-1 flex-col gap-6 overflow-hidden", children: [_jsxs("fieldset", { className: "grid gap-3", children: [_jsx("legend", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: departureMessages.scheduleLegend }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: departureMessages.startDateLabel }), _jsx(DatePicker, { value: startDate || null, onChange: (v) => form.setValue("startDate", v ?? "", {
204
+ shouldValidate: true,
205
+ shouldDirty: true,
206
+ }), placeholder: departureMessages.datePlaceholder }), form.formState.errors.startDate && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.startDate.message }))] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: departureMessages.startTimeLabel }), _jsx(Input, { ...form.register("startTime"), type: "time" }), form.formState.errors.startTime && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.startTime.message }))] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs(Label, { children: [departureMessages.endDateLabel, " ", _jsx("span", { className: "text-muted-foreground font-normal", children: departureMessages.endDateOptional })] }), _jsx(DatePicker, { value: typeof endDate === "string" && endDate.length > 0 ? endDate : null, onChange: (v) => form.setValue("endDate", v ?? "", {
207
+ shouldValidate: true,
208
+ shouldDirty: true,
209
+ }), placeholder: departureMessages.datePlaceholder, clearable: true, dateDisabled: startDate ? { before: new Date(`${startDate}T00:00:00`) } : undefined }), form.formState.errors.endDate && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.endDate.message }))] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs(Label, { children: [departureMessages.endTimeLabel, " ", _jsx("span", { className: "text-muted-foreground font-normal", children: departureMessages.endTimeOptional })] }), _jsx(Input, { ...form.register("endTime"), type: "time" }), form.formState.errors.endTime && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.endTime.message }))] })] }), nights > 0 && (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-xs text-muted-foreground", children: formatMessage(departureMessages.multiDayHint, {
210
+ nights,
211
+ nightSuffix: nights === 1 ? "" : "s",
212
+ days: nights + 1,
213
+ }) }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: departureMessages.nightsOverrideLabel }), _jsx(Input, { ...form.register("nights"), type: "number", min: "0", step: "1", placeholder: String(nights) })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: departureMessages.daysOverrideLabel }), _jsx(Input, { ...form.register("days"), type: "number", min: "0", step: "1", placeholder: String(nights + 1) })] })] })] })), itineraries.length > 1 ? (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: itineraryMessages.formLabel }), _jsxs(Select, { items: [
214
+ {
215
+ label: defaultItinerary
216
+ ? formatMessage(itineraryMessages.defaultWithName, {
217
+ name: defaultItinerary.name,
218
+ })
219
+ : itineraryMessages.defaultBadge,
220
+ value: "",
221
+ },
222
+ ...itineraries.map((itinerary) => ({
223
+ label: itinerary.name,
224
+ value: itinerary.id,
225
+ })),
226
+ ], value: form.watch("itineraryId") ?? "", onValueChange: (value) => form.setValue("itineraryId", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "", children: defaultItinerary
227
+ ? formatMessage(itineraryMessages.defaultWithName, {
228
+ name: defaultItinerary.name,
229
+ })
230
+ : itineraryMessages.defaultBadge }), itineraries.map((itinerary) => (_jsx(SelectItem, { value: itinerary.id, children: itinerary.name }, itinerary.id)))] })] }), _jsx("p", { className: "text-xs text-muted-foreground", children: itineraryMessages.overrideHint })] })) : null, _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: departureMessages.timezoneLabel }), _jsxs(Combobox, { items: TIMEZONE_IDS, value: timezone || null, autoHighlight: true, itemToStringValue: (id) => getTimezoneLabel(id), onValueChange: (next) => {
231
+ if (typeof next === "string") {
232
+ form.setValue("timezone", next, {
233
+ shouldValidate: true,
234
+ shouldDirty: true,
235
+ });
236
+ }
237
+ }, children: [_jsx(ComboboxInput, { placeholder: departureMessages.timezoneSearchPlaceholder, className: "w-full" }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { children: departureMessages.timezoneEmpty }), _jsx(ComboboxList, { children: _jsx(ComboboxCollection, { children: (id) => {
238
+ const tz = TIMEZONE_OPTIONS.find((t) => t.id === id);
239
+ return (_jsxs(ComboboxItem, { value: id, children: [_jsx("span", { className: "font-mono text-xs", children: id }), tz ? (_jsx("span", { className: "ml-2 text-xs text-muted-foreground", children: tz.label })) : null] }, id));
240
+ } }) })] })] }), form.formState.errors.timezone && (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.timezone.message }))] })] }), _jsxs("fieldset", { className: "grid gap-3", children: [_jsx("legend", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: departureMessages.availabilityLegend }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: departureMessages.statusLabel }), _jsxs(Select, { value: form.watch("status"), onValueChange: (v) => form.setValue("status", v), items: slotStatuses, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: slotStatuses.map((s) => (_jsx(SelectItem, { value: s.value, children: s.label }, s.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: departureMessages.capacityLabel }), _jsx(Input, { ...form.register("initialPax"), type: "number", min: "0", step: "1", placeholder: "0", disabled: unlimited }), !unlimited && suggestedPax > 0 ? (_jsx("button", { type: "button", onClick: () => form.setValue("initialPax", suggestedPax), className: "text-left text-xs text-muted-foreground hover:text-foreground", children: formatMessage(departureMessages.capacityAutoHint, { count: suggestedPax }) })) : null] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Switch, { id: "unlimited", checked: unlimited, onCheckedChange: (c) => form.setValue("unlimited", c) }), _jsx(Label, { htmlFor: "unlimited", className: "font-normal cursor-pointer", children: departureMessages.unlimitedLabel })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: departureMessages.notesLabel }), _jsx(Textarea, { ...form.register("notes"), placeholder: departureMessages.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 : departureMessages.create] })] })] }));
241
+ }
@@ -0,0 +1,8 @@
1
+ export declare function DeparturePricingOverrideDialog({ open, onOpenChange, departureId, optionId, onSuccess, }: {
2
+ open: boolean;
3
+ onOpenChange: (open: boolean) => void;
4
+ departureId: string | null;
5
+ optionId: string | null;
6
+ onSuccess: () => void;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=product-departure-pricing-override-dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-departure-pricing-override-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-departure-pricing-override-dialog.tsx"],"names":[],"mappings":"AAmDA,wBAAgB,8BAA8B,CAAC,EAC7C,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,SAAS,GACV,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,2CAyNA"}
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useQuery } from "@tanstack/react-query";
4
+ import { Button, Input, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, Switch, } from "@voyant-travel/ui/components";
5
+ import { Trash2 } from "lucide-react";
6
+ import { useEffect, useState } from "react";
7
+ import { useVoyantProductsContext } from "../../index.js";
8
+ import { useDeparturePriceOverrideMutation } from "./commerce-client.js";
9
+ import { useProductDetailApi, useProductDetailMessages } from "./host.js";
10
+ import { getDeparturePriceOverridesQueryOptions, getOptionUnitsQueryOptions, getPriceCatalogsQueryOptions, } from "./product-options-shared.js";
11
+ function centsToInput(value) {
12
+ if (value === null || value === undefined)
13
+ return "";
14
+ return (value / 100).toFixed(2);
15
+ }
16
+ function inputToCents(value) {
17
+ const trimmed = value.trim();
18
+ if (trimmed === "")
19
+ return null;
20
+ const parsed = Number.parseFloat(trimmed);
21
+ if (!Number.isFinite(parsed) || parsed < 0)
22
+ return null;
23
+ return Math.round(parsed * 100);
24
+ }
25
+ export function DeparturePricingOverrideDialog({ open, onOpenChange, departureId, optionId, onSuccess, }) {
26
+ const messages = useProductDetailMessages();
27
+ const productMessages = messages.products.core;
28
+ const productsClient = useVoyantProductsContext();
29
+ const api = useProductDetailApi();
30
+ const enabled = open && !!departureId && !!optionId;
31
+ const { data: unitsData } = useQuery({
32
+ ...getOptionUnitsQueryOptions(productsClient, optionId ?? ""),
33
+ enabled: enabled && !!optionId,
34
+ });
35
+ const { data: overridesData, refetch: refetchOverrides } = useQuery({
36
+ ...getDeparturePriceOverridesQueryOptions(api, departureId ?? ""),
37
+ enabled: enabled && !!departureId,
38
+ });
39
+ const { data: catalogsData } = useQuery({
40
+ ...getPriceCatalogsQueryOptions(api),
41
+ enabled,
42
+ });
43
+ const { create, update, remove } = useDeparturePriceOverrideMutation();
44
+ const catalog = catalogsData?.data.find((c) => c.catalogType === "public" && c.isDefault) ??
45
+ catalogsData?.data.find((c) => c.catalogType === "public") ??
46
+ null;
47
+ const [rows, setRows] = useState([]);
48
+ const [saving, setSaving] = useState(false);
49
+ useEffect(() => {
50
+ if (!open)
51
+ return;
52
+ const units = (unitsData?.data ?? []).slice().sort((a, b) => a.sortOrder - b.sortOrder);
53
+ const overrides = overridesData?.data ?? [];
54
+ const next = units.map((unit) => {
55
+ const existing = overrides.find((o) => o.optionUnitId === unit.id) ?? null;
56
+ return {
57
+ unitId: unit.id,
58
+ unitName: unit.name,
59
+ sortOrder: unit.sortOrder,
60
+ overrideId: existing?.id ?? null,
61
+ sellInput: existing ? centsToInput(existing.sellAmountCents) : "",
62
+ costInput: existing ? centsToInput(existing.costAmountCents) : "",
63
+ active: existing ? existing.active : true,
64
+ dirty: false,
65
+ };
66
+ });
67
+ setRows(next);
68
+ }, [open, unitsData, overridesData]);
69
+ if (!enabled) {
70
+ return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsx(SheetContent, { side: "right", children: _jsx(SheetHeader, { children: _jsx(SheetTitle, { children: productMessages.departureOverrideTitle }) }) }) }));
71
+ }
72
+ const updateRow = (unitId, patch) => {
73
+ setRows((prev) => prev.map((r) => (r.unitId === unitId ? { ...r, ...patch, dirty: true } : r)));
74
+ };
75
+ const handleSave = async () => {
76
+ if (!catalog || !departureId || !optionId)
77
+ return;
78
+ setSaving(true);
79
+ try {
80
+ for (const row of rows) {
81
+ const sellCents = inputToCents(row.sellInput);
82
+ const costCents = inputToCents(row.costInput);
83
+ if (row.overrideId && sellCents === null) {
84
+ await remove.mutateAsync(row.overrideId);
85
+ continue;
86
+ }
87
+ if (sellCents === null)
88
+ continue;
89
+ if (row.overrideId) {
90
+ if (!row.dirty)
91
+ continue;
92
+ await update.mutateAsync({
93
+ id: row.overrideId,
94
+ input: {
95
+ sellAmountCents: sellCents,
96
+ costAmountCents: costCents,
97
+ active: row.active,
98
+ },
99
+ });
100
+ }
101
+ else {
102
+ await create.mutateAsync({
103
+ departureId,
104
+ optionId,
105
+ optionUnitId: row.unitId,
106
+ priceCatalogId: catalog.id,
107
+ sellAmountCents: sellCents,
108
+ costAmountCents: costCents,
109
+ active: row.active,
110
+ });
111
+ }
112
+ }
113
+ await refetchOverrides();
114
+ onSuccess();
115
+ }
116
+ finally {
117
+ setSaving(false);
118
+ }
119
+ };
120
+ const handleClearRow = (unitId) => {
121
+ updateRow(unitId, { sellInput: "", costInput: "" });
122
+ };
123
+ const noUnits = rows.length === 0;
124
+ const noCatalog = !catalog;
125
+ return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { side: "right", size: "lg", children: [_jsx(SheetHeader, { children: _jsx(SheetTitle, { children: productMessages.departureOverrideTitle }) }), _jsxs(SheetBody, { className: "space-y-4", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: productMessages.departureOverrideDescription }), noCatalog ? (_jsx("p", { className: "rounded border border-destructive/40 bg-destructive/10 p-3 text-xs text-destructive", children: productMessages.departureOverrideNoCatalog })) : null, noUnits ? (_jsx("p", { className: "rounded border bg-muted/30 p-3 text-xs text-muted-foreground", children: productMessages.departureOverrideNoUnits })) : (_jsx("div", { className: "overflow-x-auto rounded border", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-muted/50 text-xs text-muted-foreground", children: _jsxs("tr", { children: [_jsx("th", { className: "p-2 text-left font-medium", children: productMessages.departureOverrideUnitColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: productMessages.departureOverrideSellColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: productMessages.departureOverrideCostColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: productMessages.departureOverrideActiveColumn }), _jsx("th", { className: "w-10 p-2" })] }) }), _jsx("tbody", { children: rows.map((row) => (_jsxs("tr", { className: "border-b last:border-b-0", children: [_jsx("td", { className: "p-2 font-medium", children: row.unitName }), _jsx("td", { className: "p-2", children: _jsx(Input, { type: "number", step: "0.01", min: "0", inputMode: "decimal", value: row.sellInput, onChange: (e) => updateRow(row.unitId, { sellInput: e.target.value }), className: "h-8 w-28", disabled: noCatalog }) }), _jsx("td", { className: "p-2", children: _jsx(Input, { type: "number", step: "0.01", min: "0", inputMode: "decimal", value: row.costInput, onChange: (e) => updateRow(row.unitId, { costInput: e.target.value }), className: "h-8 w-28", disabled: noCatalog }) }), _jsx("td", { className: "p-2", children: _jsx(Switch, { checked: row.active, onCheckedChange: (active) => updateRow(row.unitId, { active }), disabled: noCatalog }) }), _jsx("td", { className: "p-2", children: row.sellInput ? (_jsx(Button, { variant: "ghost", size: "icon", onClick: () => handleClearRow(row.unitId), "aria-label": productMessages.departureOverrideClear, children: _jsx(Trash2, { className: "h-4 w-4" }) })) : null })] }, row.unitId))) })] }) })), _jsx("div", { className: "flex justify-end", children: _jsx(Button, { onClick: handleSave, disabled: noUnits || noCatalog || saving, children: productMessages.departureOverrideSave }) })] })] }) }));
126
+ }
@@ -0,0 +1,19 @@
1
+ import type { DepartureSlot } from "./product-departure-dialog.js";
2
+ import { type AvailabilityRule } from "./product-detail-shared.js";
3
+ export declare function ProductDeparturesSection({ slots, itineraryNameById, slotIdsWithOverrides, onCreate, onEdit, onOverridePrice, onManageAvailability, onDelete, }: {
4
+ slots: DepartureSlot[];
5
+ itineraryNameById: Map<string, string>;
6
+ slotIdsWithOverrides?: ReadonlySet<string>;
7
+ onCreate: () => void;
8
+ onEdit: (slot: DepartureSlot) => void;
9
+ onOverridePrice?: (slot: DepartureSlot) => void;
10
+ onManageAvailability?: (slot: DepartureSlot) => void;
11
+ onDelete: (slotId: string) => void;
12
+ }): import("react/jsx-runtime").JSX.Element;
13
+ export declare function ProductSchedulesSection({ rules, onCreate, onEdit, onDelete, }: {
14
+ rules: AvailabilityRule[];
15
+ onCreate: () => void;
16
+ onEdit: (rule: AvailabilityRule) => void;
17
+ onDelete: (ruleId: string) => void;
18
+ }): import("react/jsx-runtime").JSX.Element;
19
+ //# sourceMappingURL=product-detail-availability-sections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-detail-availability-sections.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-detail-availability-sections.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAElE,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,4BAA4B,CAAA;AAGnC,wBAAgB,wBAAwB,CAAC,EACvC,KAAK,EACL,iBAAiB,EACjB,oBAAoB,EACpB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,oBAAoB,EACpB,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,aAAa,EAAE,CAAA;IACtB,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,oBAAoB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC1C,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAA;IACrC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAA;IAC/C,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAA;IACpD,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,2CAoHA;AAED,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,gBAAgB,EAAE,CAAA;IACzB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACxC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,2CA+DA"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { formatMessage } from "@voyant-travel/i18n";
3
+ import { Badge, DropdownMenuItem, DropdownMenuSeparator } from "@voyant-travel/ui/components";
4
+ import { CalendarRange, DollarSign, Pencil, Plus, Trash2 } from "lucide-react";
5
+ import { useProductDetailMessages } from "./host.js";
6
+ import { ActionMenu, EmptyState, Section } from "./product-detail-section-shell.js";
7
+ import { formatCapacityLabel, formatDuration, formatSlotDate, formatSlotTime, getDepartureStatusLabel, slotStatusVariant, } from "./product-detail-shared.js";
8
+ import { describeRRule } from "./rrule-labels.js";
9
+ export function ProductDeparturesSection({ slots, itineraryNameById, slotIdsWithOverrides, onCreate, onEdit, onOverridePrice, onManageAvailability, onDelete, }) {
10
+ const messages = useProductDetailMessages();
11
+ const productMessages = messages.products.core;
12
+ return (_jsx(Section, { title: productMessages.departuresTitle, actions: _jsx(ActionMenu, { children: _jsxs(DropdownMenuItem, { onClick: onCreate, children: [_jsx(Plus, { className: "h-4 w-4" }), productMessages.newDeparture] }) }), contentClassName: "", children: slots.length === 0 ? (_jsx(EmptyState, { message: productMessages.departuresEmpty })) : (_jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b text-muted-foreground", children: [_jsx("th", { className: "py-2.5 pl-6 pr-3 text-left font-medium", children: productMessages.departureStartColumn }), _jsx("th", { className: "px-3 py-2.5 text-left font-medium", children: productMessages.departureEndColumn }), _jsx("th", { className: "px-3 py-2.5 text-left font-medium", children: "Itinerary" }), _jsx("th", { className: "px-3 py-2.5 text-left font-medium", children: productMessages.departureDurationColumn }), _jsx("th", { className: "px-3 py-2.5 text-left font-medium", children: productMessages.departureStatusColumn }), _jsx("th", { className: "px-3 py-2.5 text-left font-medium", children: productMessages.departureCapacityColumn }), _jsx("th", { className: "w-10 px-3 py-2.5" })] }) }), _jsx("tbody", { children: slots.map((slot) => (_jsxs("tr", { className: "border-b last:border-b-0", children: [_jsxs("td", { className: "py-2.5 pl-6 pr-3", children: [_jsx("div", { className: "font-mono text-xs", children: slot.dateLocal }), _jsx("div", { className: "text-xs text-muted-foreground", children: formatSlotTime(slot.startsAt) })] }), _jsx("td", { className: "px-3 py-2.5", children: slot.endsAt ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "font-mono text-xs", children: formatSlotDate(slot.endsAt) }), _jsx("div", { className: "text-xs text-muted-foreground", children: formatSlotTime(slot.endsAt) })] })) : (_jsx("span", { className: "text-muted-foreground", children: productMessages.noValue })) }), _jsx("td", { className: "px-3 py-2.5 text-xs", children: slot.itineraryId
13
+ ? (itineraryNameById.get(slot.itineraryId) ??
14
+ messages.products.operations.itineraries.customOverride)
15
+ : messages.products.operations.itineraries.defaultBadge }), _jsx("td", { className: "px-3 py-2.5 text-xs", children: formatDuration(slot) }), _jsx("td", { className: "px-3 py-2.5", children: _jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx(Badge, { variant: slotStatusVariant[slot.status], className: "text-xs", children: getDepartureStatusLabel(slot.status, messages) }), slotIdsWithOverrides?.has(slot.id) ? (_jsx(Badge, { variant: "outline", className: "text-xs", children: productMessages.departureOverrideBadge })) : null] }) }), _jsx("td", { className: "px-3 py-2.5 font-mono text-xs", children: formatCapacityLabel(slot, messages) }), _jsx("td", { className: "px-3 py-2.5", children: _jsxs(ActionMenu, { children: [_jsxs(DropdownMenuItem, { onClick: () => onEdit(slot), children: [_jsx(Pencil, { className: "h-4 w-4" }), productMessages.edit] }), onManageAvailability ? (_jsxs(DropdownMenuItem, { onClick: () => onManageAvailability(slot), children: [_jsx(CalendarRange, { className: "h-4 w-4" }), productMessages.departureManageAvailability] })) : null, onOverridePrice ? (_jsxs(DropdownMenuItem, { onClick: () => onOverridePrice(slot), children: [_jsx(DollarSign, { className: "h-4 w-4" }), productMessages.departureOverridePricing] })) : null, _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { variant: "destructive", onClick: () => onDelete(slot.id), children: [_jsx(Trash2, { className: "h-4 w-4" }), productMessages.delete] })] }) })] }, slot.id))) })] })) }));
16
+ }
17
+ export function ProductSchedulesSection({ rules, onCreate, onEdit, onDelete, }) {
18
+ const messages = useProductDetailMessages();
19
+ const productMessages = messages.products.core;
20
+ return (_jsx(Section, { title: productMessages.schedulesTitle, actions: _jsx(ActionMenu, { children: _jsxs(DropdownMenuItem, { onClick: onCreate, children: [_jsx(Plus, { className: "h-4 w-4" }), productMessages.newSchedule] }) }), children: rules.length === 0 ? (_jsx(EmptyState, { message: productMessages.schedulesEmpty })) : (_jsx("div", { className: "flex flex-col divide-y", children: rules.map((rule) => (_jsxs("div", { className: "flex items-center justify-between py-3 first:pt-0 last:pb-0", children: [_jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium", children: describeRRule(rule.recurrenceRule) }), !rule.active ? (_jsx(Badge, { variant: "outline", className: "text-xs", children: productMessages.inactiveBadge })) : null] }), _jsx("p", { className: "mt-0.5 text-xs text-muted-foreground", children: formatMessage(productMessages.scheduleSummary, {
21
+ maxCapacity: rule.maxCapacity,
22
+ timezone: rule.timezone,
23
+ cutoff: rule.cutoffMinutes != null
24
+ ? formatMessage(productMessages.scheduleCutoffSuffix, {
25
+ minutes: rule.cutoffMinutes,
26
+ })
27
+ : "",
28
+ }) })] }), _jsxs(ActionMenu, { children: [_jsxs(DropdownMenuItem, { onClick: () => onEdit(rule), children: [_jsx(Pencil, { className: "h-4 w-4" }), productMessages.edit] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { variant: "destructive", onClick: () => onDelete(rule.id), children: [_jsx(Trash2, { className: "h-4 w-4" }), productMessages.delete] })] })] }, rule.id))) })) }));
29
+ }