@voyant-travel/finance-react 0.119.5

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 (517) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +75 -0
  3. package/dist/admin/booking-invoices-widget.d.ts +19 -0
  4. package/dist/admin/booking-invoices-widget.d.ts.map +1 -0
  5. package/dist/admin/booking-invoices-widget.js +204 -0
  6. package/dist/admin/booking-payment-policy-widget.d.ts +21 -0
  7. package/dist/admin/booking-payment-policy-widget.d.ts.map +1 -0
  8. package/dist/admin/booking-payment-policy-widget.js +128 -0
  9. package/dist/admin/booking-pending-payment-sessions-widget.d.ts +24 -0
  10. package/dist/admin/booking-pending-payment-sessions-widget.d.ts.map +1 -0
  11. package/dist/admin/booking-pending-payment-sessions-widget.js +139 -0
  12. package/dist/admin/credit-note-dialog.d.ts +9 -0
  13. package/dist/admin/credit-note-dialog.d.ts.map +1 -0
  14. package/dist/admin/credit-note-dialog.js +70 -0
  15. package/dist/admin/finance-shared.d.ts +7 -0
  16. package/dist/admin/finance-shared.d.ts.map +1 -0
  17. package/dist/admin/finance-shared.js +30 -0
  18. package/dist/admin/index.d.ts +99 -0
  19. package/dist/admin/index.d.ts.map +1 -0
  20. package/dist/admin/index.js +286 -0
  21. package/dist/admin/invoice-detail-host.d.ts +19 -0
  22. package/dist/admin/invoice-detail-host.d.ts.map +1 -0
  23. package/dist/admin/invoice-detail-host.js +147 -0
  24. package/dist/admin/invoice-detail-sections.d.ts +31 -0
  25. package/dist/admin/invoice-detail-sections.d.ts.map +1 -0
  26. package/dist/admin/invoice-detail-sections.js +109 -0
  27. package/dist/admin/invoice-detail-skeleton.d.ts +11 -0
  28. package/dist/admin/invoice-detail-skeleton.d.ts.map +1 -0
  29. package/dist/admin/invoice-detail-skeleton.js +33 -0
  30. package/dist/admin/line-item-dialog.d.ts +10 -0
  31. package/dist/admin/line-item-dialog.d.ts.map +1 -0
  32. package/dist/admin/line-item-dialog.js +91 -0
  33. package/dist/admin/pages/invoice-detail.d.ts +8 -0
  34. package/dist/admin/pages/invoice-detail.d.ts.map +1 -0
  35. package/dist/admin/pages/invoice-detail.js +11 -0
  36. package/dist/admin/pages/invoices-index.d.ts +8 -0
  37. package/dist/admin/pages/invoices-index.d.ts.map +1 -0
  38. package/dist/admin/pages/invoices-index.js +14 -0
  39. package/dist/admin/pages/payment-detail.d.ts +8 -0
  40. package/dist/admin/pages/payment-detail.d.ts.map +1 -0
  41. package/dist/admin/pages/payment-detail.js +11 -0
  42. package/dist/admin/pages/payments-index.d.ts +9 -0
  43. package/dist/admin/pages/payments-index.d.ts.map +1 -0
  44. package/dist/admin/pages/payments-index.js +21 -0
  45. package/dist/admin/pages/profitability.d.ts +10 -0
  46. package/dist/admin/pages/profitability.d.ts.map +1 -0
  47. package/dist/admin/pages/profitability.js +32 -0
  48. package/dist/admin/pages/supplier-invoice-detail.d.ts +20 -0
  49. package/dist/admin/pages/supplier-invoice-detail.d.ts.map +1 -0
  50. package/dist/admin/pages/supplier-invoice-detail.js +102 -0
  51. package/dist/admin/pages/supplier-invoices-index.d.ts +9 -0
  52. package/dist/admin/pages/supplier-invoices-index.d.ts.map +1 -0
  53. package/dist/admin/pages/supplier-invoices-index.js +16 -0
  54. package/dist/admin/payment-detail-host.d.ts +12 -0
  55. package/dist/admin/payment-detail-host.d.ts.map +1 -0
  56. package/dist/admin/payment-detail-host.js +108 -0
  57. package/dist/admin/payment-detail-skeleton.d.ts +8 -0
  58. package/dist/admin/payment-detail-skeleton.d.ts.map +1 -0
  59. package/dist/admin/payment-detail-skeleton.js +15 -0
  60. package/dist/admin/payment-dialog.d.ts +9 -0
  61. package/dist/admin/payment-dialog.d.ts.map +1 -0
  62. package/dist/admin/payment-dialog.js +99 -0
  63. package/dist/admin/record-payment-dialog.d.ts +16 -0
  64. package/dist/admin/record-payment-dialog.d.ts.map +1 -0
  65. package/dist/admin/record-payment-dialog.js +219 -0
  66. package/dist/admin/supplier-payment-policy-widget.d.ts +18 -0
  67. package/dist/admin/supplier-payment-policy-widget.d.ts.map +1 -0
  68. package/dist/admin/supplier-payment-policy-widget.js +31 -0
  69. package/dist/admin/use-supplier-picker.d.ts +19 -0
  70. package/dist/admin/use-supplier-picker.d.ts.map +1 -0
  71. package/dist/admin/use-supplier-picker.js +30 -0
  72. package/dist/checkout-components/collect-payment-dialog.d.ts +45 -0
  73. package/dist/checkout-components/collect-payment-dialog.d.ts.map +1 -0
  74. package/dist/checkout-components/collect-payment-dialog.js +121 -0
  75. package/dist/checkout-components/payment-link-landing-page.d.ts +76 -0
  76. package/dist/checkout-components/payment-link-landing-page.d.ts.map +1 -0
  77. package/dist/checkout-components/payment-link-landing-page.js +173 -0
  78. package/dist/checkout-components/payment-step.d.ts +42 -0
  79. package/dist/checkout-components/payment-step.d.ts.map +1 -0
  80. package/dist/checkout-components/payment-step.js +113 -0
  81. package/dist/checkout-hooks/index.d.ts +5 -0
  82. package/dist/checkout-hooks/index.d.ts.map +1 -0
  83. package/dist/checkout-hooks/index.js +4 -0
  84. package/dist/checkout-hooks/use-checkout-payment-link-config.d.ts +20 -0
  85. package/dist/checkout-hooks/use-checkout-payment-link-config.d.ts.map +1 -0
  86. package/dist/checkout-hooks/use-checkout-payment-link-config.js +26 -0
  87. package/dist/checkout-hooks/use-collect-payment.d.ts +227 -0
  88. package/dist/checkout-hooks/use-collect-payment.d.ts.map +1 -0
  89. package/dist/checkout-hooks/use-collect-payment.js +80 -0
  90. package/dist/checkout-hooks/use-initiate-checkout-collection.d.ts +308 -0
  91. package/dist/checkout-hooks/use-initiate-checkout-collection.d.ts.map +1 -0
  92. package/dist/checkout-hooks/use-initiate-checkout-collection.js +35 -0
  93. package/dist/checkout-hooks/use-preview-checkout-collection.d.ts +65 -0
  94. package/dist/checkout-hooks/use-preview-checkout-collection.d.ts.map +1 -0
  95. package/dist/checkout-hooks/use-preview-checkout-collection.js +27 -0
  96. package/dist/checkout-i18n/en.d.ts +3 -0
  97. package/dist/checkout-i18n/en.d.ts.map +1 -0
  98. package/dist/checkout-i18n/en.js +127 -0
  99. package/dist/checkout-i18n/index.d.ts +5 -0
  100. package/dist/checkout-i18n/index.d.ts.map +1 -0
  101. package/dist/checkout-i18n/index.js +3 -0
  102. package/dist/checkout-i18n/messages.d.ts +121 -0
  103. package/dist/checkout-i18n/messages.d.ts.map +1 -0
  104. package/dist/checkout-i18n/messages.js +1 -0
  105. package/dist/checkout-i18n/provider.d.ts +26 -0
  106. package/dist/checkout-i18n/provider.d.ts.map +1 -0
  107. package/dist/checkout-i18n/provider.js +41 -0
  108. package/dist/checkout-i18n/ro.d.ts +3 -0
  109. package/dist/checkout-i18n/ro.d.ts.map +1 -0
  110. package/dist/checkout-i18n/ro.js +127 -0
  111. package/dist/checkout-types.d.ts +53 -0
  112. package/dist/checkout-types.d.ts.map +1 -0
  113. package/dist/checkout-types.js +1 -0
  114. package/dist/checkout-ui.d.ts +7 -0
  115. package/dist/checkout-ui.d.ts.map +1 -0
  116. package/dist/checkout-ui.js +4 -0
  117. package/dist/checkout.d.ts +5 -0
  118. package/dist/checkout.d.ts.map +1 -0
  119. package/dist/checkout.js +3 -0
  120. package/dist/client.d.ts +16 -0
  121. package/dist/client.d.ts.map +1 -0
  122. package/dist/client.js +79 -0
  123. package/dist/components/accountant-portal/body.d.ts +8 -0
  124. package/dist/components/accountant-portal/body.d.ts.map +1 -0
  125. package/dist/components/accountant-portal/body.js +114 -0
  126. package/dist/components/accountant-portal/widgets.d.ts +13 -0
  127. package/dist/components/accountant-portal/widgets.d.ts.map +1 -0
  128. package/dist/components/accountant-portal/widgets.js +27 -0
  129. package/dist/components/accountant-portal.d.ts +10 -0
  130. package/dist/components/accountant-portal.d.ts.map +1 -0
  131. package/dist/components/accountant-portal.js +22 -0
  132. package/dist/components/accountant-share-dialog.d.ts +6 -0
  133. package/dist/components/accountant-share-dialog.d.ts.map +1 -0
  134. package/dist/components/accountant-share-dialog.js +53 -0
  135. package/dist/components/async-combobox.d.ts +33 -0
  136. package/dist/components/async-combobox.d.ts.map +1 -0
  137. package/dist/components/async-combobox.js +100 -0
  138. package/dist/components/booking-invoice-dialog.d.ts +63 -0
  139. package/dist/components/booking-invoice-dialog.d.ts.map +1 -0
  140. package/dist/components/booking-invoice-dialog.js +383 -0
  141. package/dist/components/cost-categories-page.d.ts +5 -0
  142. package/dist/components/cost-categories-page.d.ts.map +1 -0
  143. package/dist/components/cost-categories-page.js +30 -0
  144. package/dist/components/invoice-action-ledger-card.d.ts +15 -0
  145. package/dist/components/invoice-action-ledger-card.d.ts.map +1 -0
  146. package/dist/components/invoice-action-ledger-card.js +76 -0
  147. package/dist/components/invoice-bulk-actions.d.ts +10 -0
  148. package/dist/components/invoice-bulk-actions.d.ts.map +1 -0
  149. package/dist/components/invoice-bulk-actions.js +19 -0
  150. package/dist/components/invoice-detail-page/cards.d.ts +44 -0
  151. package/dist/components/invoice-detail-page/cards.d.ts.map +1 -0
  152. package/dist/components/invoice-detail-page/cards.js +43 -0
  153. package/dist/components/invoice-detail-page/header.d.ts +15 -0
  154. package/dist/components/invoice-detail-page/header.d.ts.map +1 -0
  155. package/dist/components/invoice-detail-page/header.js +30 -0
  156. package/dist/components/invoice-detail-page/notes-dialogs.d.ts +28 -0
  157. package/dist/components/invoice-detail-page/notes-dialogs.d.ts.map +1 -0
  158. package/dist/components/invoice-detail-page/notes-dialogs.js +104 -0
  159. package/dist/components/invoice-detail-page/primitives.d.ts +47 -0
  160. package/dist/components/invoice-detail-page/primitives.d.ts.map +1 -0
  161. package/dist/components/invoice-detail-page/primitives.js +76 -0
  162. package/dist/components/invoice-detail-page-with-action-ledger.d.ts +7 -0
  163. package/dist/components/invoice-detail-page-with-action-ledger.d.ts.map +1 -0
  164. package/dist/components/invoice-detail-page-with-action-ledger.js +11 -0
  165. package/dist/components/invoice-detail-page.d.ts +46 -0
  166. package/dist/components/invoice-detail-page.d.ts.map +1 -0
  167. package/dist/components/invoice-detail-page.js +134 -0
  168. package/dist/components/invoice-dialog.d.ts +9 -0
  169. package/dist/components/invoice-dialog.d.ts.map +1 -0
  170. package/dist/components/invoice-dialog.js +145 -0
  171. package/dist/components/invoice-number-series-dialog.d.ts +9 -0
  172. package/dist/components/invoice-number-series-dialog.d.ts.map +1 -0
  173. package/dist/components/invoice-number-series-dialog.js +134 -0
  174. package/dist/components/invoice-number-series-format.d.ts +3 -0
  175. package/dist/components/invoice-number-series-format.d.ts.map +1 -0
  176. package/dist/components/invoice-number-series-format.js +4 -0
  177. package/dist/components/invoice-number-series-page.d.ts +5 -0
  178. package/dist/components/invoice-number-series-page.d.ts.map +1 -0
  179. package/dist/components/invoice-number-series-page.js +55 -0
  180. package/dist/components/invoice-table-parts.d.ts +25 -0
  181. package/dist/components/invoice-table-parts.d.ts.map +1 -0
  182. package/dist/components/invoice-table-parts.js +32 -0
  183. package/dist/components/invoices-page-skeleton.d.ts +5 -0
  184. package/dist/components/invoices-page-skeleton.d.ts.map +1 -0
  185. package/dist/components/invoices-page-skeleton.js +13 -0
  186. package/dist/components/invoices-page.d.ts +6 -0
  187. package/dist/components/invoices-page.d.ts.map +1 -0
  188. package/dist/components/invoices-page.js +145 -0
  189. package/dist/components/payment-detail-page.d.ts +47 -0
  190. package/dist/components/payment-detail-page.d.ts.map +1 -0
  191. package/dist/components/payment-detail-page.js +90 -0
  192. package/dist/components/payment-policy-form.d.ts +49 -0
  193. package/dist/components/payment-policy-form.d.ts.map +1 -0
  194. package/dist/components/payment-policy-form.js +82 -0
  195. package/dist/components/payments-page/controls.d.ts +23 -0
  196. package/dist/components/payments-page/controls.d.ts.map +1 -0
  197. package/dist/components/payments-page/controls.js +20 -0
  198. package/dist/components/payments-page-skeleton.d.ts +5 -0
  199. package/dist/components/payments-page-skeleton.d.ts.map +1 -0
  200. package/dist/components/payments-page-skeleton.js +13 -0
  201. package/dist/components/payments-page.d.ts +20 -0
  202. package/dist/components/payments-page.d.ts.map +1 -0
  203. package/dist/components/payments-page.js +143 -0
  204. package/dist/components/profitability-page/sections.d.ts +24 -0
  205. package/dist/components/profitability-page/sections.d.ts.map +1 -0
  206. package/dist/components/profitability-page/sections.js +43 -0
  207. package/dist/components/profitability-page.d.ts +13 -0
  208. package/dist/components/profitability-page.d.ts.map +1 -0
  209. package/dist/components/profitability-page.js +175 -0
  210. package/dist/components/record-booking-payment-dialog/shared.d.ts +54 -0
  211. package/dist/components/record-booking-payment-dialog/shared.d.ts.map +1 -0
  212. package/dist/components/record-booking-payment-dialog/shared.js +47 -0
  213. package/dist/components/record-booking-payment-dialog.d.ts +4 -0
  214. package/dist/components/record-booking-payment-dialog.d.ts.map +1 -0
  215. package/dist/components/record-booking-payment-dialog.js +256 -0
  216. package/dist/components/supplier-invoice-detail-page/dialogs.d.ts +34 -0
  217. package/dist/components/supplier-invoice-detail-page/dialogs.d.ts.map +1 -0
  218. package/dist/components/supplier-invoice-detail-page/dialogs.js +119 -0
  219. package/dist/components/supplier-invoice-detail-page/shared.d.ts +64 -0
  220. package/dist/components/supplier-invoice-detail-page/shared.d.ts.map +1 -0
  221. package/dist/components/supplier-invoice-detail-page/shared.js +70 -0
  222. package/dist/components/supplier-invoice-detail-page.d.ts +4 -0
  223. package/dist/components/supplier-invoice-detail-page.d.ts.map +1 -0
  224. package/dist/components/supplier-invoice-detail-page.js +101 -0
  225. package/dist/components/supplier-invoice-form-dialog.d.ts +45 -0
  226. package/dist/components/supplier-invoice-form-dialog.d.ts.map +1 -0
  227. package/dist/components/supplier-invoice-form-dialog.js +102 -0
  228. package/dist/components/supplier-invoices-page.d.ts +14 -0
  229. package/dist/components/supplier-invoices-page.d.ts.map +1 -0
  230. package/dist/components/supplier-invoices-page.js +69 -0
  231. package/dist/components/supplier-payment-dialog.d.ts +7 -0
  232. package/dist/components/supplier-payment-dialog.d.ts.map +1 -0
  233. package/dist/components/supplier-payment-dialog.js +103 -0
  234. package/dist/components/taxes-page/policy-profile-sheet.d.ts +8 -0
  235. package/dist/components/taxes-page/policy-profile-sheet.d.ts.map +1 -0
  236. package/dist/components/taxes-page/policy-profile-sheet.js +52 -0
  237. package/dist/components/taxes-page/policy-rule-sheet.d.ts +10 -0
  238. package/dist/components/taxes-page/policy-rule-sheet.d.ts.map +1 -0
  239. package/dist/components/taxes-page/policy-rule-sheet.js +137 -0
  240. package/dist/components/taxes-page/shared.d.ts +128 -0
  241. package/dist/components/taxes-page/shared.d.ts.map +1 -0
  242. package/dist/components/taxes-page/shared.js +288 -0
  243. package/dist/components/taxes-page/sheets.d.ts +4 -0
  244. package/dist/components/taxes-page/sheets.d.ts.map +1 -0
  245. package/dist/components/taxes-page/sheets.js +3 -0
  246. package/dist/components/taxes-page/tax-sheet.d.ts +9 -0
  247. package/dist/components/taxes-page/tax-sheet.d.ts.map +1 -0
  248. package/dist/components/taxes-page/tax-sheet.js +108 -0
  249. package/dist/components/taxes-page.d.ts +4 -0
  250. package/dist/components/taxes-page.d.ts.map +1 -0
  251. package/dist/components/taxes-page.js +165 -0
  252. package/dist/hooks/index.d.ts +53 -0
  253. package/dist/hooks/index.d.ts.map +1 -0
  254. package/dist/hooks/index.js +52 -0
  255. package/dist/hooks/use-accountant-share-mutation.d.ts +20 -0
  256. package/dist/hooks/use-accountant-share-mutation.d.ts.map +1 -0
  257. package/dist/hooks/use-accountant-share-mutation.js +27 -0
  258. package/dist/hooks/use-accountant-shares.d.ts +13 -0
  259. package/dist/hooks/use-accountant-shares.d.ts.map +1 -0
  260. package/dist/hooks/use-accountant-shares.js +8 -0
  261. package/dist/hooks/use-admin-booking-payments.d.ts +30 -0
  262. package/dist/hooks/use-admin-booking-payments.d.ts.map +1 -0
  263. package/dist/hooks/use-admin-booking-payments.js +18 -0
  264. package/dist/hooks/use-all-payments.d.ts +35 -0
  265. package/dist/hooks/use-all-payments.d.ts.map +1 -0
  266. package/dist/hooks/use-all-payments.js +12 -0
  267. package/dist/hooks/use-booking-guarantees.d.ts +82 -0
  268. package/dist/hooks/use-booking-guarantees.d.ts.map +1 -0
  269. package/dist/hooks/use-booking-guarantees.js +46 -0
  270. package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.d.ts +44 -0
  271. package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.d.ts.map +1 -0
  272. package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.js +27 -0
  273. package/dist/hooks/use-booking-payment-schedules.d.ts +63 -0
  274. package/dist/hooks/use-booking-payment-schedules.d.ts.map +1 -0
  275. package/dist/hooks/use-booking-payment-schedules.js +47 -0
  276. package/dist/hooks/use-cost-categories.d.ts +14 -0
  277. package/dist/hooks/use-cost-categories.d.ts.map +1 -0
  278. package/dist/hooks/use-cost-categories.js +9 -0
  279. package/dist/hooks/use-cost-category-mutation.d.ts +31 -0
  280. package/dist/hooks/use-cost-category-mutation.d.ts.map +1 -0
  281. package/dist/hooks/use-cost-category-mutation.js +27 -0
  282. package/dist/hooks/use-departure-profitability.d.ts +56 -0
  283. package/dist/hooks/use-departure-profitability.d.ts.map +1 -0
  284. package/dist/hooks/use-departure-profitability.js +12 -0
  285. package/dist/hooks/use-finance-action-ledger.d.ts +94 -0
  286. package/dist/hooks/use-finance-action-ledger.d.ts.map +1 -0
  287. package/dist/hooks/use-finance-action-ledger.js +20 -0
  288. package/dist/hooks/use-invoice-attachment-mutation.d.ts +43 -0
  289. package/dist/hooks/use-invoice-attachment-mutation.d.ts.map +1 -0
  290. package/dist/hooks/use-invoice-attachment-mutation.js +39 -0
  291. package/dist/hooks/use-invoice-attachments.d.ts +18 -0
  292. package/dist/hooks/use-invoice-attachments.d.ts.map +1 -0
  293. package/dist/hooks/use-invoice-attachments.js +12 -0
  294. package/dist/hooks/use-invoice-bulk-status-mutation.d.ts +51 -0
  295. package/dist/hooks/use-invoice-bulk-status-mutation.d.ts.map +1 -0
  296. package/dist/hooks/use-invoice-bulk-status-mutation.js +66 -0
  297. package/dist/hooks/use-invoice-credit-note-mutation.d.ts +38 -0
  298. package/dist/hooks/use-invoice-credit-note-mutation.d.ts.map +1 -0
  299. package/dist/hooks/use-invoice-credit-note-mutation.js +35 -0
  300. package/dist/hooks/use-invoice-credit-notes.d.ts +17 -0
  301. package/dist/hooks/use-invoice-credit-notes.d.ts.map +1 -0
  302. package/dist/hooks/use-invoice-credit-notes.js +12 -0
  303. package/dist/hooks/use-invoice-fx-rate.d.ts +19 -0
  304. package/dist/hooks/use-invoice-fx-rate.d.ts.map +1 -0
  305. package/dist/hooks/use-invoice-fx-rate.js +13 -0
  306. package/dist/hooks/use-invoice-line-item-mutation.d.ts +40 -0
  307. package/dist/hooks/use-invoice-line-item-mutation.d.ts.map +1 -0
  308. package/dist/hooks/use-invoice-line-item-mutation.js +42 -0
  309. package/dist/hooks/use-invoice-line-items.d.ts +17 -0
  310. package/dist/hooks/use-invoice-line-items.d.ts.map +1 -0
  311. package/dist/hooks/use-invoice-line-items.js +12 -0
  312. package/dist/hooks/use-invoice-mutation.d.ts +225 -0
  313. package/dist/hooks/use-invoice-mutation.d.ts.map +1 -0
  314. package/dist/hooks/use-invoice-mutation.js +121 -0
  315. package/dist/hooks/use-invoice-note-mutation.d.ts +11 -0
  316. package/dist/hooks/use-invoice-note-mutation.d.ts.map +1 -0
  317. package/dist/hooks/use-invoice-note-mutation.js +23 -0
  318. package/dist/hooks/use-invoice-notes.d.ts +13 -0
  319. package/dist/hooks/use-invoice-notes.d.ts.map +1 -0
  320. package/dist/hooks/use-invoice-notes.js +12 -0
  321. package/dist/hooks/use-invoice-number-series-mutation.d.ts +62 -0
  322. package/dist/hooks/use-invoice-number-series-mutation.d.ts.map +1 -0
  323. package/dist/hooks/use-invoice-number-series-mutation.js +39 -0
  324. package/dist/hooks/use-invoice-number-series.d.ts +28 -0
  325. package/dist/hooks/use-invoice-number-series.d.ts.map +1 -0
  326. package/dist/hooks/use-invoice-number-series.js +12 -0
  327. package/dist/hooks/use-invoice-payment-mutation.d.ts +29 -0
  328. package/dist/hooks/use-invoice-payment-mutation.d.ts.map +1 -0
  329. package/dist/hooks/use-invoice-payment-mutation.js +35 -0
  330. package/dist/hooks/use-invoice-payments.d.ts +21 -0
  331. package/dist/hooks/use-invoice-payments.d.ts.map +1 -0
  332. package/dist/hooks/use-invoice-payments.js +12 -0
  333. package/dist/hooks/use-invoice.d.ts +32 -0
  334. package/dist/hooks/use-invoice.d.ts.map +1 -0
  335. package/dist/hooks/use-invoice.js +12 -0
  336. package/dist/hooks/use-invoices.d.ts +36 -0
  337. package/dist/hooks/use-invoices.d.ts.map +1 -0
  338. package/dist/hooks/use-invoices.js +12 -0
  339. package/dist/hooks/use-payment-mutation.d.ts +57 -0
  340. package/dist/hooks/use-payment-mutation.d.ts.map +1 -0
  341. package/dist/hooks/use-payment-mutation.js +59 -0
  342. package/dist/hooks/use-payment-session-mutation.d.ts +205 -0
  343. package/dist/hooks/use-payment-session-mutation.d.ts.map +1 -0
  344. package/dist/hooks/use-payment-session-mutation.js +38 -0
  345. package/dist/hooks/use-payment-sessions.d.ts +97 -0
  346. package/dist/hooks/use-payment-sessions.d.ts.map +1 -0
  347. package/dist/hooks/use-payment-sessions.js +17 -0
  348. package/dist/hooks/use-payment.d.ts +31 -0
  349. package/dist/hooks/use-payment.d.ts.map +1 -0
  350. package/dist/hooks/use-payment.js +12 -0
  351. package/dist/hooks/use-product-profitability.d.ts +52 -0
  352. package/dist/hooks/use-product-profitability.d.ts.map +1 -0
  353. package/dist/hooks/use-product-profitability.js +12 -0
  354. package/dist/hooks/use-public-booking-documents.d.ts +29 -0
  355. package/dist/hooks/use-public-booking-documents.d.ts.map +1 -0
  356. package/dist/hooks/use-public-booking-documents.js +12 -0
  357. package/dist/hooks/use-public-booking-payment-options.d.ts +47 -0
  358. package/dist/hooks/use-public-booking-payment-options.d.ts.map +1 -0
  359. package/dist/hooks/use-public-booking-payment-options.js +12 -0
  360. package/dist/hooks/use-public-booking-payments.d.ts +24 -0
  361. package/dist/hooks/use-public-booking-payments.d.ts.map +1 -0
  362. package/dist/hooks/use-public-booking-payments.js +12 -0
  363. package/dist/hooks/use-public-finance-document-by-reference.d.ts +27 -0
  364. package/dist/hooks/use-public-finance-document-by-reference.d.ts.map +1 -0
  365. package/dist/hooks/use-public-finance-document-by-reference.js +12 -0
  366. package/dist/hooks/use-public-payment-session-mutation.d.ts +82 -0
  367. package/dist/hooks/use-public-payment-session-mutation.d.ts.map +1 -0
  368. package/dist/hooks/use-public-payment-session-mutation.js +33 -0
  369. package/dist/hooks/use-public-payment-session.d.ts +73 -0
  370. package/dist/hooks/use-public-payment-session.d.ts.map +1 -0
  371. package/dist/hooks/use-public-payment-session.js +12 -0
  372. package/dist/hooks/use-public-voucher-validation-mutation.d.ts +23 -0
  373. package/dist/hooks/use-public-voucher-validation-mutation.d.ts.map +1 -0
  374. package/dist/hooks/use-public-voucher-validation-mutation.js +17 -0
  375. package/dist/hooks/use-supplier-invoice-attachments.d.ts +17 -0
  376. package/dist/hooks/use-supplier-invoice-attachments.d.ts.map +1 -0
  377. package/dist/hooks/use-supplier-invoice-attachments.js +12 -0
  378. package/dist/hooks/use-supplier-invoice-mutation.d.ts +353 -0
  379. package/dist/hooks/use-supplier-invoice-mutation.d.ts.map +1 -0
  380. package/dist/hooks/use-supplier-invoice-mutation.js +81 -0
  381. package/dist/hooks/use-supplier-invoice-payments.d.ts +26 -0
  382. package/dist/hooks/use-supplier-invoice-payments.d.ts.map +1 -0
  383. package/dist/hooks/use-supplier-invoice-payments.js +12 -0
  384. package/dist/hooks/use-supplier-invoice.d.ts +65 -0
  385. package/dist/hooks/use-supplier-invoice.d.ts.map +1 -0
  386. package/dist/hooks/use-supplier-invoice.js +12 -0
  387. package/dist/hooks/use-supplier-invoices.d.ts +36 -0
  388. package/dist/hooks/use-supplier-invoices.d.ts.map +1 -0
  389. package/dist/hooks/use-supplier-invoices.js +12 -0
  390. package/dist/hooks/use-supplier-payment-mutation.d.ts +55 -0
  391. package/dist/hooks/use-supplier-payment-mutation.d.ts.map +1 -0
  392. package/dist/hooks/use-supplier-payment-mutation.js +35 -0
  393. package/dist/hooks/use-supplier-payments.d.ts +27 -0
  394. package/dist/hooks/use-supplier-payments.d.ts.map +1 -0
  395. package/dist/hooks/use-supplier-payments.js +12 -0
  396. package/dist/hooks/use-traveler-profitability.d.ts +24 -0
  397. package/dist/hooks/use-traveler-profitability.d.ts.map +1 -0
  398. package/dist/hooks/use-traveler-profitability.js +11 -0
  399. package/dist/hooks/use-voucher-mutation.d.ts +105 -0
  400. package/dist/hooks/use-voucher-mutation.d.ts.map +1 -0
  401. package/dist/hooks/use-voucher-mutation.js +50 -0
  402. package/dist/hooks/use-voucher.d.ts +38 -0
  403. package/dist/hooks/use-voucher.d.ts.map +1 -0
  404. package/dist/hooks/use-voucher.js +17 -0
  405. package/dist/hooks/use-vouchers.d.ts +34 -0
  406. package/dist/hooks/use-vouchers.d.ts.map +1 -0
  407. package/dist/hooks/use-vouchers.js +18 -0
  408. package/dist/i18n/en/invoices.d.ts +278 -0
  409. package/dist/i18n/en/invoices.d.ts.map +1 -0
  410. package/dist/i18n/en/invoices.js +277 -0
  411. package/dist/i18n/en/numberingAndPayments.d.ts +387 -0
  412. package/dist/i18n/en/numberingAndPayments.d.ts.map +1 -0
  413. package/dist/i18n/en/numberingAndPayments.js +386 -0
  414. package/dist/i18n/en/profitability.d.ts +147 -0
  415. package/dist/i18n/en/profitability.d.ts.map +1 -0
  416. package/dist/i18n/en/profitability.js +146 -0
  417. package/dist/i18n/en/suppliers.d.ts +187 -0
  418. package/dist/i18n/en/suppliers.d.ts.map +1 -0
  419. package/dist/i18n/en/suppliers.js +186 -0
  420. package/dist/i18n/en.d.ts +998 -0
  421. package/dist/i18n/en.d.ts.map +1 -0
  422. package/dist/i18n/en.js +22 -0
  423. package/dist/i18n/index.d.ts +5 -0
  424. package/dist/i18n/index.d.ts.map +1 -0
  425. package/dist/i18n/index.js +3 -0
  426. package/dist/i18n/messages/core.d.ts +18 -0
  427. package/dist/i18n/messages/core.d.ts.map +1 -0
  428. package/dist/i18n/messages/core.js +30 -0
  429. package/dist/i18n/messages/invoices.d.ts +252 -0
  430. package/dist/i18n/messages/invoices.d.ts.map +1 -0
  431. package/dist/i18n/messages/invoices.js +1 -0
  432. package/dist/i18n/messages/numberingAndPayments.d.ts +277 -0
  433. package/dist/i18n/messages/numberingAndPayments.d.ts.map +1 -0
  434. package/dist/i18n/messages/numberingAndPayments.js +1 -0
  435. package/dist/i18n/messages/profitability.d.ts +151 -0
  436. package/dist/i18n/messages/profitability.d.ts.map +1 -0
  437. package/dist/i18n/messages/profitability.js +1 -0
  438. package/dist/i18n/messages/suppliers.d.ts +167 -0
  439. package/dist/i18n/messages/suppliers.d.ts.map +1 -0
  440. package/dist/i18n/messages/suppliers.js +1 -0
  441. package/dist/i18n/messages.d.ts +29 -0
  442. package/dist/i18n/messages.d.ts.map +1 -0
  443. package/dist/i18n/messages.js +1 -0
  444. package/dist/i18n/provider.d.ts +2018 -0
  445. package/dist/i18n/provider.d.ts.map +1 -0
  446. package/dist/i18n/provider.js +44 -0
  447. package/dist/i18n/ro/invoices.d.ts +278 -0
  448. package/dist/i18n/ro/invoices.d.ts.map +1 -0
  449. package/dist/i18n/ro/invoices.js +277 -0
  450. package/dist/i18n/ro/numberingAndPayments.d.ts +387 -0
  451. package/dist/i18n/ro/numberingAndPayments.d.ts.map +1 -0
  452. package/dist/i18n/ro/numberingAndPayments.js +386 -0
  453. package/dist/i18n/ro/profitability.d.ts +147 -0
  454. package/dist/i18n/ro/profitability.d.ts.map +1 -0
  455. package/dist/i18n/ro/profitability.js +146 -0
  456. package/dist/i18n/ro/suppliers.d.ts +187 -0
  457. package/dist/i18n/ro/suppliers.d.ts.map +1 -0
  458. package/dist/i18n/ro/suppliers.js +186 -0
  459. package/dist/i18n/ro.d.ts +998 -0
  460. package/dist/i18n/ro.d.ts.map +1 -0
  461. package/dist/i18n/ro.js +22 -0
  462. package/dist/index.d.ts +11 -0
  463. package/dist/index.d.ts.map +1 -0
  464. package/dist/index.js +9 -0
  465. package/dist/operations.d.ts +484 -0
  466. package/dist/operations.d.ts.map +1 -0
  467. package/dist/operations.js +52 -0
  468. package/dist/provider.d.ts +2 -0
  469. package/dist/provider.d.ts.map +1 -0
  470. package/dist/provider.js +1 -0
  471. package/dist/query-keys.d.ts +195 -0
  472. package/dist/query-keys.d.ts.map +1 -0
  473. package/dist/query-keys.js +49 -0
  474. package/dist/query-options/public-reporting.d.ts +2129 -0
  475. package/dist/query-options/public-reporting.d.ts.map +1 -0
  476. package/dist/query-options/public-reporting.js +193 -0
  477. package/dist/query-options-action-ledger.d.ts +382 -0
  478. package/dist/query-options-action-ledger.d.ts.map +1 -0
  479. package/dist/query-options-action-ledger.js +36 -0
  480. package/dist/query-options.d.ts +2057 -0
  481. package/dist/query-options.d.ts.map +1 -0
  482. package/dist/query-options.js +328 -0
  483. package/dist/schemas/accountant.d.ts +168 -0
  484. package/dist/schemas/accountant.d.ts.map +1 -0
  485. package/dist/schemas/accountant.js +53 -0
  486. package/dist/schemas/action-ledger.d.ts +206 -0
  487. package/dist/schemas/action-ledger.d.ts.map +1 -0
  488. package/dist/schemas/action-ledger.js +83 -0
  489. package/dist/schemas/common.d.ts +17 -0
  490. package/dist/schemas/common.d.ts.map +1 -0
  491. package/dist/schemas/common.js +10 -0
  492. package/dist/schemas/invoice.d.ts +1451 -0
  493. package/dist/schemas/invoice.d.ts.map +1 -0
  494. package/dist/schemas/invoice.js +438 -0
  495. package/dist/schemas/profitability.d.ts +333 -0
  496. package/dist/schemas/profitability.d.ts.map +1 -0
  497. package/dist/schemas/profitability.js +84 -0
  498. package/dist/schemas/public.d.ts +481 -0
  499. package/dist/schemas/public.d.ts.map +1 -0
  500. package/dist/schemas/public.js +9 -0
  501. package/dist/schemas/responses.d.ts +632 -0
  502. package/dist/schemas/responses.d.ts.map +1 -0
  503. package/dist/schemas/responses.js +27 -0
  504. package/dist/schemas/supplier.d.ts +226 -0
  505. package/dist/schemas/supplier.d.ts.map +1 -0
  506. package/dist/schemas/supplier.js +103 -0
  507. package/dist/schemas/vouchers.d.ts +283 -0
  508. package/dist/schemas/vouchers.d.ts.map +1 -0
  509. package/dist/schemas/vouchers.js +49 -0
  510. package/dist/schemas.d.ts +10 -0
  511. package/dist/schemas.d.ts.map +1 -0
  512. package/dist/schemas.js +9 -0
  513. package/dist/ui.d.ts +27 -0
  514. package/dist/ui.d.ts.map +1 -0
  515. package/dist/ui.js +26 -0
  516. package/package.json +181 -0
  517. package/src/styles.css +12 -0
@@ -0,0 +1,286 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { adminRoutePageModule, defineAdminExtension, } from "@voyant-travel/admin";
3
+ // Importing the slot id also binds the bookings-ui `AdminDestinations`
4
+ // augmentation (`booking.detail`, `person.detail`, `organization.detail`,
5
+ // `invoice.detail`, `payment.detail`, ...) into this program — the finance
6
+ // pages navigate through those shared keys, and this package already
7
+ // peer-depends on `@voyant-travel/bookings-react/ui`, so re-declaring them here would
8
+ // just duplicate the contract.
9
+ import { bookingDetailFinanceEndSlot, bookingDetailFinanceStartSlot, bookingDetailInvoicesTabSlot, } from "@voyant-travel/bookings-react/admin";
10
+ // Importing the slot id also binds the suppliers-ui `AdminDestinations`
11
+ // augmentation (`supplier.list`, `supplier.detail`) — this package already
12
+ // peer-depends on `@voyant-travel/distribution-react/suppliers/ui`.
13
+ import { supplierDetailPaymentPolicySlot } from "@voyant-travel/distribution-react/suppliers/admin";
14
+ import { defaultFetcher } from "@voyant-travel/react";
15
+ import * as React from "react";
16
+ // Skeletons are deliberately the ONLY page-adjacent statics this factory
17
+ // touches: they ship from their own light modules, so attaching them as
18
+ // `pendingComponent` doesn't pull the heavy page chunks into the factory.
19
+ // Query options resolve via dynamic import inside the loaders, and the
20
+ // widgets mount through Suspense-wrapped `React.lazy` loaders — both keep
21
+ // the finance data layer (client + response schemas + the payment-policy
22
+ // engine) out of the workspace-chrome chunk that evaluates this factory.
23
+ import { InvoicesPageSkeleton } from "../components/invoices-page-skeleton.js";
24
+ import { PaymentsPageSkeleton } from "../components/payments-page-skeleton.js";
25
+ import { InvoiceDetailSkeleton } from "./invoice-detail-skeleton.js";
26
+ import { PaymentDetailSkeleton } from "./payment-detail-skeleton.js";
27
+ /** The host runtime as the package's query-option client (`fetchWithValidation`). */
28
+ function runtimeClient(runtime) {
29
+ return { baseUrl: runtime.baseUrl, fetcher: runtime.fetcher ?? defaultFetcher };
30
+ }
31
+ /**
32
+ * Suspense-wrapped lazy widget mount: the widget registry takes a sync
33
+ * component, but the finance cards (and the payment-policy/schedule stack
34
+ * behind them) must not load with workspace chrome — each widget chunk
35
+ * fetches when its slot actually renders on a detail page.
36
+ */
37
+ function lazyWidget(load) {
38
+ const Lazy = React.lazy(load);
39
+ return function LazyFinanceAdminWidget(props) {
40
+ return (_jsx(React.Suspense, { fallback: null, children: _jsx(Lazy, { ...props }) }));
41
+ };
42
+ }
43
+ const LazyBookingInvoicesWidget = lazyWidget(() => import("./booking-invoices-widget.js").then((module) => ({
44
+ default: module.BookingInvoicesWidget,
45
+ })));
46
+ const LazyBookingPendingPaymentSessionsWidget = lazyWidget(() => import("./booking-pending-payment-sessions-widget.js").then((module) => ({
47
+ default: module.BookingPendingPaymentSessionsWidget,
48
+ })));
49
+ const LazyBookingPaymentPolicyWidget = lazyWidget(() => import("./booking-payment-policy-widget.js").then((module) => ({
50
+ default: module.BookingPaymentPolicyWidget,
51
+ })));
52
+ const LazySupplierPaymentPolicyWidget = lazyWidget(() => import("./supplier-payment-policy-widget.js").then((module) => ({
53
+ default: module.SupplierPaymentPolicyWidget,
54
+ })));
55
+ export { InvoiceDetailSkeleton } from "./invoice-detail-skeleton.js";
56
+ export { PaymentDetailSkeleton } from "./payment-detail-skeleton.js";
57
+ /**
58
+ * The finance admin contribution (packaged-admin RFC Phase 3,
59
+ * `@voyant-travel/<domain>-ui/admin` convention).
60
+ *
61
+ * NAVIGATION: deliberately none. The Finance nav group (invoices, number
62
+ * series, payments, supplier invoices, profitability) is part of the BASE
63
+ * operator navigation — see `createOperatorAdminNavigation` in
64
+ * `@voyant-travel/admin` — so contributing nav entries here would duplicate them.
65
+ * If the base nav ever drops the finance group, this extension is where the
66
+ * entries move.
67
+ *
68
+ * ROUTES: all eight contributions carry the FULL route implementation
69
+ * (packaged-admin RFC §4.8 endgame) — a lazy `page` module loader, a data
70
+ * loader fed by the host runtime (`baseUrl` + cookie-forwarding fetcher),
71
+ * `ssr: "data-only"`, and the pending skeleton where the operator route had
72
+ * one — so the host needs no per-route files for them. Pages stay
73
+ * code-split: this factory never references a page component statically;
74
+ * each `page:` dynamically imports its specific module (never a barrel), and
75
+ * param-taking pages read the matched `$id` off `AdminRoutePageProps` and
76
+ * bind it onto {@link InvoiceDetailHost} / {@link PaymentDetailHost}.
77
+ * Cross-route links resolve through the semantic destinations declared
78
+ * above. The supplier-invoices pages carry their previously app-owned wiring
79
+ * package-side now: attachment uploads post to the starter-level
80
+ * `/v1/uploads` route through the shared finance provider context (the
81
+ * `BookingInvoicesWidget` precedent), inline supplier creation rides the
82
+ * suppliers package's `useSupplierMutation`, and the allocation dialog's
83
+ * cross-domain target search composes the bookings / products /
84
+ * availability packages' query options through the same context client.
85
+ *
86
+ * WIDGETS: the cycle-resolution piece (RFC §4.7). The booking detail page
87
+ * needs the finance-owned invoices card, but this package peer-depends on
88
+ * `@voyant-travel/bookings-react/ui`, so the bookings host cannot import it. Instead
89
+ * this extension contributes {@link BookingInvoicesWidget} on the
90
+ * `booking.details.invoices-tab` slot the bookings host exposes; the host
91
+ * mounts its Invoices tab whenever a contribution targets that slot and
92
+ * hands the widget its typed slot context as props. The Finance tab's
93
+ * payment-links card ({@link BookingPendingPaymentSessionsWidget}) and
94
+ * payment-policy override card ({@link BookingPaymentPolicyWidget}) travel
95
+ * the same way on `booking.details.finance-start` / `…finance-end`. The
96
+ * same pattern resolves the finance-ui ↔ suppliers-ui cycle: the supplier detail page's
97
+ * customer-payment-policy card ships as {@link SupplierPaymentPolicyWidget}
98
+ * on the `supplier.details.payment-policy` slot the supplier host exposes.
99
+ */
100
+ export function createFinanceAdminExtension(options = {}) {
101
+ const { basePath = "/finance", labels = {} } = options;
102
+ const { invoices = "Invoices", invoiceNumberSeries = "Number Series", payments = "Payments", supplierInvoices = "Supplier invoices", profitability = "Profitability", } = labels;
103
+ return defineAdminExtension({
104
+ id: "finance",
105
+ routes: [
106
+ {
107
+ // Index redirect (formerly the host's `finance/index.tsx` file
108
+ // route): `/finance` lands on the invoices page.
109
+ id: "finance-index",
110
+ path: basePath,
111
+ title: invoices,
112
+ redirectTo: `${basePath}/invoices`,
113
+ },
114
+ {
115
+ id: "finance-invoices-index",
116
+ path: `${basePath}/invoices`,
117
+ title: invoices,
118
+ // Route-backed destination (RFC §4.7 endgame): the key resolves by
119
+ // pure path interpolation of this route, so the host's resolver is
120
+ // generated (`voyant admin generate --destinations`).
121
+ destination: "invoice.list",
122
+ ssr: "data-only",
123
+ page: () => import("./pages/invoices-index.js"),
124
+ // Dynamic import on purpose: the query options pull the finance
125
+ // data layer (client + response schemas), and a static import here
126
+ // would pin it into the workspace-chrome chunk that evaluates this
127
+ // factory.
128
+ loader: async ({ queryClient, runtime }) => {
129
+ const { getInvoicesQueryOptions } = await import("../query-options.js");
130
+ return queryClient.ensureQueryData(getInvoicesQueryOptions(runtimeClient(runtime)));
131
+ },
132
+ pendingComponent: InvoicesPageSkeleton,
133
+ },
134
+ {
135
+ id: "finance-invoices-detail",
136
+ path: `${basePath}/invoices/$id`,
137
+ title: invoices,
138
+ // Key declared by @voyant-travel/bookings-react/admin (bound above).
139
+ destination: "invoice.detail",
140
+ destinationParams: { id: "invoiceId" },
141
+ ssr: "data-only",
142
+ page: () => import("./pages/invoice-detail.js"),
143
+ loader: async ({ queryClient, runtime, params }) => {
144
+ const id = params.id;
145
+ if (!id)
146
+ return;
147
+ // Dynamic import on purpose — see the invoices index loader above.
148
+ const { getInvoiceCreditNotesQueryOptions, getInvoiceLineItemsQueryOptions, getInvoiceNotesQueryOptions, getInvoicePaymentsQueryOptions, getInvoiceQueryOptions, } = await import("../query-options.js");
149
+ const client = runtimeClient(runtime);
150
+ await queryClient.ensureQueryData(getInvoiceQueryOptions(client, id));
151
+ void queryClient.prefetchQuery(getInvoiceLineItemsQueryOptions(client, id));
152
+ void queryClient.prefetchQuery(getInvoicePaymentsQueryOptions(client, id));
153
+ void queryClient.prefetchQuery(getInvoiceCreditNotesQueryOptions(client, id));
154
+ void queryClient.prefetchQuery(getInvoiceNotesQueryOptions(client, id));
155
+ },
156
+ pendingComponent: InvoiceDetailSkeleton,
157
+ },
158
+ {
159
+ id: "finance-invoice-number-series",
160
+ path: `${basePath}/invoice-number-series`,
161
+ title: invoiceNumberSeries,
162
+ ssr: "data-only",
163
+ // `InvoiceNumberSeriesPage` takes an all-optional props bag, which
164
+ // TypeScript's weak-type rule rejects as a route page component
165
+ // despite being safe to mount — hence `adminRoutePageModule`.
166
+ page: () => import("../components/invoice-number-series-page.js").then((module) => adminRoutePageModule(module.InvoiceNumberSeriesPage)),
167
+ // Dynamic import on purpose — see the invoices index loader above.
168
+ loader: async ({ queryClient, runtime }) => {
169
+ const { getInvoiceNumberSeriesQueryOptions } = await import("../query-options.js");
170
+ return queryClient.ensureQueryData(getInvoiceNumberSeriesQueryOptions(runtimeClient(runtime), {
171
+ limit: 100,
172
+ offset: 0,
173
+ }));
174
+ },
175
+ },
176
+ {
177
+ id: "finance-payments-index",
178
+ path: `${basePath}/payments`,
179
+ title: payments,
180
+ destination: "payment.list",
181
+ ssr: "data-only",
182
+ page: () => import("./pages/payments-index.js"),
183
+ // Dynamic import on purpose — see the invoices index loader above.
184
+ loader: async ({ queryClient, runtime }) => {
185
+ const { getAllPaymentsQueryOptions } = await import("../query-options.js");
186
+ return queryClient.ensureQueryData(getAllPaymentsQueryOptions(runtimeClient(runtime)));
187
+ },
188
+ pendingComponent: PaymentsPageSkeleton,
189
+ },
190
+ {
191
+ id: "finance-payments-detail",
192
+ path: `${basePath}/payments/$id`,
193
+ title: payments,
194
+ // Key declared by @voyant-travel/bookings-react/admin (bound above).
195
+ destination: "payment.detail",
196
+ destinationParams: { id: "paymentId" },
197
+ ssr: "data-only",
198
+ page: () => import("./pages/payment-detail.js"),
199
+ loader: async ({ queryClient, runtime, params }) => {
200
+ const id = params.id;
201
+ if (!id)
202
+ return;
203
+ // Dynamic import on purpose — see the invoices index loader above.
204
+ const { getPaymentQueryOptions } = await import("../query-options.js");
205
+ return queryClient.ensureQueryData(getPaymentQueryOptions(runtimeClient(runtime), id));
206
+ },
207
+ pendingComponent: PaymentDetailSkeleton,
208
+ },
209
+ {
210
+ id: "finance-supplier-invoices-index",
211
+ path: `${basePath}/supplier-invoices`,
212
+ title: supplierInvoices,
213
+ destination: "supplierInvoice.list",
214
+ ssr: "data-only",
215
+ page: () => import("./pages/supplier-invoices-index.js"),
216
+ // Dynamic import on purpose — see the invoices index loader above.
217
+ loader: async ({ queryClient, runtime }) => {
218
+ const { getSupplierInvoicesQueryOptions } = await import("../query-options.js");
219
+ return queryClient.ensureQueryData(getSupplierInvoicesQueryOptions(runtimeClient(runtime)));
220
+ },
221
+ },
222
+ {
223
+ id: "finance-supplier-invoices-detail",
224
+ path: `${basePath}/supplier-invoices/$id`,
225
+ title: supplierInvoices,
226
+ destination: "supplierInvoice.detail",
227
+ destinationParams: { id: "supplierInvoiceId" },
228
+ ssr: "data-only",
229
+ page: () => import("./pages/supplier-invoice-detail.js"),
230
+ loader: async ({ queryClient, runtime, params }) => {
231
+ const id = params.id;
232
+ if (!id)
233
+ return;
234
+ // Dynamic import on purpose — see the invoices index loader above.
235
+ const { getSupplierInvoiceQueryOptions } = await import("../query-options.js");
236
+ return queryClient.ensureQueryData(getSupplierInvoiceQueryOptions(runtimeClient(runtime), id));
237
+ },
238
+ },
239
+ {
240
+ id: "finance-profitability",
241
+ path: `${basePath}/profitability`,
242
+ title: profitability,
243
+ ssr: "data-only",
244
+ page: () => import("./pages/profitability.js"),
245
+ // Dynamic import on purpose — see the invoices index loader above.
246
+ loader: async ({ queryClient, runtime }) => {
247
+ const { getDepartureProfitabilityQueryOptions } = await import("../query-options.js");
248
+ return queryClient.ensureQueryData(getDepartureProfitabilityQueryOptions(runtimeClient(runtime)));
249
+ },
250
+ },
251
+ ],
252
+ widgets: [
253
+ {
254
+ id: "finance-booking-invoices",
255
+ slot: bookingDetailInvoicesTabSlot,
256
+ // The widget registry is untyped (`Record<string, unknown>` props);
257
+ // the typed contract is `BookingDetailHostSlotContext`, which the
258
+ // bookings host passes verbatim to this slot's widgets.
259
+ component: LazyBookingInvoicesWidget,
260
+ },
261
+ {
262
+ id: "finance-booking-pending-payment-sessions",
263
+ slot: bookingDetailFinanceStartSlot,
264
+ // Same untyped-registry cast; the typed contract is
265
+ // `BookingDetailHostSlotContext`, which the bookings host passes
266
+ // verbatim to this slot's widgets.
267
+ component: LazyBookingPendingPaymentSessionsWidget,
268
+ },
269
+ {
270
+ id: "finance-booking-payment-policy",
271
+ slot: bookingDetailFinanceEndSlot,
272
+ // Same untyped-registry cast; the typed contract is
273
+ // `BookingDetailHostSlotContext`.
274
+ component: LazyBookingPaymentPolicyWidget,
275
+ },
276
+ {
277
+ id: "finance-supplier-payment-policy",
278
+ slot: supplierDetailPaymentPolicySlot,
279
+ // Same untyped-registry cast; the typed contract is
280
+ // `SupplierDetailHostSlotContext`, which the supplier detail host
281
+ // passes verbatim to this slot's widgets.
282
+ component: LazySupplierPaymentPolicyWidget,
283
+ },
284
+ ],
285
+ });
286
+ }
@@ -0,0 +1,19 @@
1
+ export interface InvoiceDetailHostProps {
2
+ id: string;
3
+ }
4
+ /**
5
+ * Packaged admin host for the operator-grade invoice detail page
6
+ * (packaged-admin RFC Phase 3). Owns everything package-clean:
7
+ *
8
+ * - Data access through `@voyant-travel/finance-react` hooks (shared finance
9
+ * provider context — no app RPC client).
10
+ * - Cross-route links resolve through semantic destinations (RFC §4.7):
11
+ * `invoice.list` (back/after delete), `invoice.detail` (after a proforma
12
+ * converts), `booking.detail` — no host route tree import.
13
+ * - Admin widget extension points: the `invoice.details.header` and
14
+ * `invoice.details.after-summary` slots render through the shared
15
+ * `AdminWidgetSlotRenderer`, which reads the workspace shell's
16
+ * `AdminExtensionsProvider` context.
17
+ */
18
+ export declare function InvoiceDetailHost({ id }: InvoiceDetailHostProps): import("react/jsx-runtime").JSX.Element;
19
+ //# sourceMappingURL=invoice-detail-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-detail-host.d.ts","sourceRoot":"","sources":["../../src/admin/invoice-detail-host.tsx"],"names":[],"mappings":"AAqEA,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;CACX;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,sBAAsB,2CAmS/D"}
@@ -0,0 +1,147 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { AdminWidgetSlotRenderer, useAdminNavigate, useOperatorAdminMessages, } from "@voyant-travel/admin";
4
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Badge, Button, Textarea, } from "@voyant-travel/ui/components";
5
+ import { ArrowLeft, ArrowRightLeft, Ban, Loader2, Pencil, Trash2 } from "lucide-react";
6
+ import { useState } from "react";
7
+ import { InvoiceActionLedgerCard } from "../components/invoice-action-ledger-card.js";
8
+ import { InvoiceDialog } from "../components/invoice-dialog.js";
9
+ import { useInvoice, useInvoiceCreditNotes, useInvoiceLineItemMutation, useInvoiceLineItems, useInvoiceMutation, useInvoiceNoteMutation, useInvoiceNotes, useInvoicePayments, } from "../index.js";
10
+ import { CreditNoteDialog } from "./credit-note-dialog.js";
11
+ import { invoiceStatusVariant } from "./finance-shared.js";
12
+ import { InvoiceAttachmentsCard, InvoiceCreditNotesCard, InvoiceInfoCards, InvoiceLineItemsCard, InvoiceNotesCard, InvoicePaymentsCard, } from "./invoice-detail-sections.js";
13
+ import { InvoiceDetailSkeleton } from "./invoice-detail-skeleton.js";
14
+ import { LineItemDialog } from "./line-item-dialog.js";
15
+ import { PaymentDialog } from "./payment-dialog.js";
16
+ function getInvoiceStatusLabel(messages, status) {
17
+ switch (status) {
18
+ case "draft":
19
+ return messages.finance.invoiceStatusDraft;
20
+ case "issued":
21
+ return messages.finance.invoiceStatusIssued;
22
+ case "partially_paid":
23
+ return messages.finance.invoiceStatusPartiallyPaid;
24
+ case "paid":
25
+ return messages.finance.invoiceStatusPaid;
26
+ case "overdue":
27
+ return messages.finance.invoiceStatusOverdue;
28
+ case "void":
29
+ return messages.finance.invoiceStatusVoid;
30
+ default:
31
+ return status.replace(/_/g, " ");
32
+ }
33
+ }
34
+ /**
35
+ * Packaged admin host for the operator-grade invoice detail page
36
+ * (packaged-admin RFC Phase 3). Owns everything package-clean:
37
+ *
38
+ * - Data access through `@voyant-travel/finance-react` hooks (shared finance
39
+ * provider context — no app RPC client).
40
+ * - Cross-route links resolve through semantic destinations (RFC §4.7):
41
+ * `invoice.list` (back/after delete), `invoice.detail` (after a proforma
42
+ * converts), `booking.detail` — no host route tree import.
43
+ * - Admin widget extension points: the `invoice.details.header` and
44
+ * `invoice.details.after-summary` slots render through the shared
45
+ * `AdminWidgetSlotRenderer`, which reads the workspace shell's
46
+ * `AdminExtensionsProvider` context.
47
+ */
48
+ export function InvoiceDetailHost({ id }) {
49
+ const messages = useOperatorAdminMessages();
50
+ const navigateTo = useAdminNavigate();
51
+ const [editOpen, setEditOpen] = useState(false);
52
+ const [lineItemDialogOpen, setLineItemDialogOpen] = useState(false);
53
+ const [editingLineItem, setEditingLineItem] = useState();
54
+ const [paymentDialogOpen, setPaymentDialogOpen] = useState(false);
55
+ const [creditNoteDialogOpen, setCreditNoteDialogOpen] = useState(false);
56
+ const [noteContent, setNoteContent] = useState("");
57
+ const [actionError, setActionError] = useState(null);
58
+ const [voidDialogOpen, setVoidDialogOpen] = useState(false);
59
+ const [voidReason, setVoidReason] = useState("");
60
+ const { data: invoiceData, isPending } = useInvoice(id);
61
+ const { data: lineItemsData } = useInvoiceLineItems(id);
62
+ const { data: paymentsData } = useInvoicePayments(id);
63
+ const { data: creditNotesData } = useInvoiceCreditNotes(id);
64
+ const { data: notesData } = useInvoiceNotes(id);
65
+ const { convertToInvoice, remove: deleteInvoice, voidInvoice } = useInvoiceMutation();
66
+ const { remove: deleteLineItem } = useInvoiceLineItemMutation(id);
67
+ const addNoteMutation = useInvoiceNoteMutation(id);
68
+ if (isPending) {
69
+ return _jsx(InvoiceDetailSkeleton, {});
70
+ }
71
+ const invoice = invoiceData?.data;
72
+ if (!invoice) {
73
+ return (_jsxs("div", { className: "flex flex-col items-center justify-center gap-4 py-12", children: [_jsx("p", { className: "text-muted-foreground", children: messages.finance.detailPage.notFound }), _jsx(Button, { variant: "outline", onClick: () => navigateTo("invoice.list", {}), children: messages.finance.detailPage.backToFinance })] }));
74
+ }
75
+ const lineItems = lineItemsData?.data ?? [];
76
+ const payments = paymentsData?.data ?? [];
77
+ const creditNotes = creditNotesData?.data ?? [];
78
+ const notes = notesData?.data ?? [];
79
+ const canVoidInvoice = ["pending_external_allocation", "issued", "overdue"].includes(invoice.status);
80
+ const canConvertProforma = invoice.invoiceType === "proforma" && invoice.status !== "void";
81
+ const getMutationErrorMessage = (fallback) => (error) => error instanceof Error ? error.message : fallback;
82
+ return (_jsxs("div", { className: "flex flex-col gap-6 p-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx(Button, { variant: "ghost", size: "icon", onClick: () => navigateTo("invoice.list", {}), children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsxs("div", { className: "flex-1", children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight", children: invoice.invoiceNumber }), _jsx("div", { className: "mt-1 flex items-center gap-2", children: _jsx(Badge, { variant: invoiceStatusVariant[invoice.status] ?? "secondary", className: "capitalize", children: getInvoiceStatusLabel(messages, invoice.status) }) })] }), _jsxs("div", { className: "flex items-center gap-2", children: [canConvertProforma ? (_jsxs(Button, { variant: "outline", disabled: convertToInvoice.isPending, onClick: () => {
83
+ if (!confirm(messages.finance.convertConfirm))
84
+ return;
85
+ setActionError(null);
86
+ convertToInvoice.mutate({ id }, {
87
+ onSuccess: (converted) => {
88
+ navigateTo("invoice.detail", { invoiceId: converted.id });
89
+ },
90
+ onError: (error) => {
91
+ setActionError(getMutationErrorMessage(messages.finance.detailPage.convertFailed)(error));
92
+ },
93
+ });
94
+ }, children: [convertToInvoice.isPending ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": "true" })) : (_jsx(ArrowRightLeft, { className: "mr-2 h-4 w-4" })), messages.finance.convertToInvoice] })) : null, _jsxs(Button, { variant: "outline", onClick: () => setEditOpen(true), children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), messages.finance.detailPage.edit] }), _jsxs(AlertDialog, { open: voidDialogOpen, onOpenChange: (open) => {
95
+ setVoidDialogOpen(open);
96
+ if (!open)
97
+ setVoidReason("");
98
+ }, children: [_jsxs(AlertDialogTrigger, { disabled: !canVoidInvoice || voidInvoice.isPending, render: _jsx(Button, { type: "button", variant: "outline" }), children: [_jsx(Ban, { className: "mr-2 h-4 w-4" }), messages.finance.detailPage.void] }), _jsxs(AlertDialogContent, { size: "sm", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: messages.finance.detailPage.voidConfirm }), _jsx(AlertDialogDescription, { children: messages.finance.detailPage.voidDescription })] }), _jsx(Textarea, { value: voidReason, onChange: (event) => setVoidReason(event.target.value), placeholder: messages.finance.detailPage.voidReasonPlaceholder, className: "min-h-24" }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: voidInvoice.isPending, children: messages.finance.detailPage.cancel }), _jsxs(AlertDialogAction, { variant: "destructive", disabled: voidInvoice.isPending, onClick: () => {
99
+ setActionError(null);
100
+ voidInvoice.mutate({ id, input: { reason: voidReason.trim() || null } }, {
101
+ onSuccess: () => {
102
+ setVoidDialogOpen(false);
103
+ setVoidReason("");
104
+ },
105
+ onError: (error) => {
106
+ setActionError(getMutationErrorMessage(messages.finance.detailPage.voidFailed)(error));
107
+ },
108
+ });
109
+ }, children: [voidInvoice.isPending ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": "true" })) : null, messages.finance.detailPage.void] })] })] })] }), _jsxs(Button, { variant: "destructive", onClick: () => {
110
+ if (invoice.status !== "draft") {
111
+ alert(messages.finance.detailPage.deleteOnlyDraftAlert);
112
+ return;
113
+ }
114
+ if (confirm(messages.finance.detailPage.deleteConfirm)) {
115
+ setActionError(null);
116
+ deleteInvoice.mutate(id, {
117
+ onSuccess: () => {
118
+ navigateTo("invoice.list", {});
119
+ },
120
+ onError: (error) => {
121
+ setActionError(getMutationErrorMessage(messages.finance.detailPage.deleteOnlyDraftAlert)(error));
122
+ },
123
+ });
124
+ }
125
+ }, disabled: deleteInvoice.isPending, children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), messages.finance.detailPage.delete] })] })] }), actionError ? (_jsx("div", { className: "rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-destructive text-sm", children: actionError })) : null, _jsx(AdminWidgetSlotRenderer, { slot: "invoice.details.header", props: { invoice } }), _jsx(InvoiceInfoCards, { invoice: invoice, onOpenBooking: () => navigateTo("booking.detail", { bookingId: invoice.bookingId }) }), _jsx(AdminWidgetSlotRenderer, { slot: "invoice.details.after-summary", props: { invoice, lineItems, payments, creditNotes, notes } }), _jsx(InvoiceLineItemsCard, { lineItems: lineItems, onCreate: () => {
126
+ setEditingLineItem(undefined);
127
+ setLineItemDialogOpen(true);
128
+ }, onEdit: (lineItem) => {
129
+ setEditingLineItem(lineItem);
130
+ setLineItemDialogOpen(true);
131
+ }, onDelete: (lineId) => {
132
+ if (confirm(messages.finance.detailPage.deleteLineItemConfirm)) {
133
+ setActionError(null);
134
+ deleteLineItem.mutate(lineId, {
135
+ onError: (error) => {
136
+ setActionError(getMutationErrorMessage(messages.finance.detailPage.deleteLineItemFailed)(error));
137
+ },
138
+ });
139
+ }
140
+ } }), _jsx(InvoiceAttachmentsCard, { invoiceId: id }), _jsx(InvoicePaymentsCard, { payments: payments, onCreate: () => setPaymentDialogOpen(true), canCreate: invoice.status !== "void" }), _jsx(InvoiceCreditNotesCard, { creditNotes: creditNotes, onCreate: () => setCreditNoteDialogOpen(true) }), _jsx(InvoiceNotesCard, { noteContent: noteContent, isAdding: addNoteMutation.isPending, notes: notes, onNoteChange: setNoteContent, onAddNote: () => addNoteMutation.mutate({ content: noteContent.trim() }, {
141
+ onSuccess: () => {
142
+ setNoteContent("");
143
+ },
144
+ }) }), _jsx(InvoiceActionLedgerCard, { invoiceId: invoice.id }), _jsx(InvoiceDialog, { open: editOpen, onOpenChange: setEditOpen, invoice: invoice }), _jsx(LineItemDialog, { open: lineItemDialogOpen, onOpenChange: setLineItemDialogOpen, invoiceId: id, lineItem: editingLineItem, onSuccess: () => {
145
+ setEditingLineItem(undefined);
146
+ } }), _jsx(PaymentDialog, { open: paymentDialogOpen, onOpenChange: setPaymentDialogOpen, invoiceId: id, invoiceCurrency: invoice.currency }), _jsx(CreditNoteDialog, { open: creditNoteDialogOpen, onOpenChange: setCreditNoteDialogOpen, invoiceId: id, invoiceCurrency: invoice.currency })] }));
147
+ }
@@ -0,0 +1,31 @@
1
+ import { type CreditNoteRow, type FinanceNote, type InvoiceDetail, type LineItem, type PaymentRow } from "./finance-shared.js";
2
+ export declare function InvoiceInfoCards({ invoice, onOpenBooking, }: {
3
+ invoice: InvoiceDetail;
4
+ onOpenBooking: () => void;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ export declare function InvoiceLineItemsCard({ lineItems, onCreate, onEdit, onDelete, }: {
7
+ lineItems: LineItem[];
8
+ onCreate: () => void;
9
+ onEdit: (lineItem: LineItem) => void;
10
+ onDelete: (lineId: string) => void;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ export declare function InvoicePaymentsCard({ payments, onCreate, canCreate, }: {
13
+ payments: PaymentRow[];
14
+ onCreate: () => void;
15
+ canCreate?: boolean;
16
+ }): import("react/jsx-runtime").JSX.Element;
17
+ export declare function InvoiceCreditNotesCard({ creditNotes, onCreate, }: {
18
+ creditNotes: CreditNoteRow[];
19
+ onCreate: () => void;
20
+ }): import("react/jsx-runtime").JSX.Element;
21
+ export declare function InvoiceAttachmentsCard({ invoiceId }: {
22
+ invoiceId: string;
23
+ }): import("react/jsx-runtime").JSX.Element;
24
+ export declare function InvoiceNotesCard({ notes, noteContent, isAdding, onNoteChange, onAddNote, }: {
25
+ notes: FinanceNote[];
26
+ noteContent: string;
27
+ isAdding: boolean;
28
+ onNoteChange: (value: string) => void;
29
+ onAddNote: () => void;
30
+ }): import("react/jsx-runtime").JSX.Element;
31
+ //# sourceMappingURL=invoice-detail-sections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-detail-sections.d.ts","sourceRoot":"","sources":["../../src/admin/invoice-detail-sections.tsx"],"names":[],"mappings":"AAoBA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,WAAW,EAGhB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,UAAU,EAEhB,MAAM,qBAAqB,CAAA;AA+C5B,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,aAAa,GACd,EAAE;IACD,OAAO,EAAE,aAAa,CAAA;IACtB,aAAa,EAAE,MAAM,IAAI,CAAA;CAC1B,2CA2HA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,QAAQ,EACR,MAAM,EACN,QAAQ,GACT,EAAE;IACD,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;IACpC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,2CAkFA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,QAAQ,EACR,SAAgB,GACjB,EAAE;IACD,QAAQ,EAAE,UAAU,EAAE,CAAA;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,2CAmEA;AAED,wBAAgB,sBAAsB,CAAC,EACrC,WAAW,EACX,QAAQ,GACT,EAAE;IACD,WAAW,EAAE,aAAa,EAAE,CAAA;IAC5B,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB,2CAyDA;AAED,wBAAgB,sBAAsB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,2CAsD1E;AAyBD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAS,GACV,EAAE;IACD,KAAK,EAAE,WAAW,EAAE,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,2CAyCA"}
@@ -0,0 +1,109 @@
1
+ // agent-quality: file-size exception -- owner: finance-react; existing UI surface stays co-located until a dedicated split preserves behavior and tests.
2
+ "use client";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { useLocale, useOperatorAdminMessages, } from "@voyant-travel/admin";
5
+ import { Badge, Button, Card, CardContent, CardHeader, CardTitle, Textarea, } from "@voyant-travel/ui/components";
6
+ import { Download, FileText, Pencil, Plus, Trash2 } from "lucide-react";
7
+ import { useInvoiceAttachments, useVoyantFinanceContext } from "../index.js";
8
+ import { creditNoteStatusVariant, formatAmount, formatMethod, paymentStatusVariant, } from "./finance-shared.js";
9
+ function getPaymentStatusLabel(messages, status) {
10
+ switch (status) {
11
+ case "pending":
12
+ return messages.finance.paymentStatusPending;
13
+ case "completed":
14
+ return messages.finance.paymentStatusCompleted;
15
+ case "failed":
16
+ return messages.finance.paymentStatusFailed;
17
+ case "refunded":
18
+ return messages.finance.paymentStatusRefunded;
19
+ default:
20
+ return status.replace(/_/g, " ");
21
+ }
22
+ }
23
+ function getPaymentMethodLabel(messages, method) {
24
+ switch (method) {
25
+ case "bank_transfer":
26
+ return messages.finance.paymentMethodBankTransfer;
27
+ case "credit_card":
28
+ return messages.finance.paymentMethodCreditCard;
29
+ case "cash":
30
+ return messages.finance.paymentMethodCash;
31
+ case "cheque":
32
+ return messages.finance.paymentMethodCheque;
33
+ case "other":
34
+ return messages.finance.paymentMethodOther;
35
+ default:
36
+ return formatMethod(method);
37
+ }
38
+ }
39
+ function getCreditNoteStatusLabel(messages, status) {
40
+ switch (status) {
41
+ case "draft":
42
+ return messages.finance.creditNoteStatusDraft;
43
+ case "issued":
44
+ return messages.finance.creditNoteStatusIssued;
45
+ case "applied":
46
+ return messages.finance.creditNoteStatusApplied;
47
+ default:
48
+ return status.replace(/_/g, " ");
49
+ }
50
+ }
51
+ export function InvoiceInfoCards({ invoice, onOpenBooking, }) {
52
+ const messages = useOperatorAdminMessages();
53
+ const { resolvedLocale } = useLocale();
54
+ return (_jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.finance.detailSections.invoiceDetailsTitle }) }), _jsxs(CardContent, { className: "grid gap-3 text-sm", children: [_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.currencyLabel, ":"] }), " ", _jsx("span", { children: invoice.currency })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.subtotalLabel, ":"] }), " ", _jsx("span", { className: "font-mono", children: formatAmount(invoice.subtotalCents, invoice.currency) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.taxLabel, ":"] }), " ", _jsx("span", { className: "font-mono", children: formatAmount(invoice.taxCents, invoice.currency) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.totalLabel, ":"] }), " ", _jsx("span", { className: "font-mono font-semibold", children: formatAmount(invoice.totalCents, invoice.currency) })] }), _jsxs("div", { className: "mt-2 border-t pt-3", children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.paidLabel, ":"] }), " ", _jsx("span", { className: "font-mono", children: formatAmount(invoice.paidCents, invoice.currency) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.balanceDueLabel, ":"] }), " ", _jsx("span", { className: "font-mono font-semibold", children: formatAmount(invoice.balanceDueCents, invoice.currency) })] })] })] }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.finance.detailSections.datesLinksTitle }) }), _jsxs(CardContent, { className: "grid gap-3 text-sm", children: [_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.issueDateLabel, ":"] }), " ", _jsx("span", { children: invoice.issueDate })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.dueDateLabel, ":"] }), " ", _jsx("span", { children: invoice.dueDate })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.bookingLabel, ":"] }), " ", _jsx("button", { type: "button", className: "text-primary underline", onClick: onOpenBooking, children: messages.finance.detailSections.viewBooking })] }), invoice.personId ? (_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.personLabel, ":"] }), " ", _jsx("span", { className: "font-mono text-xs", children: invoice.personId })] })) : null, invoice.organizationId ? (_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.organizationLabel, ":"] }), " ", _jsx("span", { className: "font-mono text-xs", children: invoice.organizationId })] })) : null, invoice.notes ? (_jsxs("div", { className: "mt-2 border-t pt-3", children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.notesLabel, ":"] }), _jsx("p", { className: "mt-1 whitespace-pre-wrap", children: invoice.notes })] })) : null, _jsxs("div", { className: "mt-2 border-t pt-3", children: [_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.createdLabel, ":"] }), " ", _jsx("span", { children: new Date(invoice.createdAt).toLocaleDateString(resolvedLocale) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.finance.detailSections.updatedLabel, ":"] }), " ", _jsx("span", { children: new Date(invoice.updatedAt).toLocaleDateString(resolvedLocale) })] })] })] })] })] }));
55
+ }
56
+ export function InvoiceLineItemsCard({ lineItems, onCreate, onEdit, onDelete, }) {
57
+ const messages = useOperatorAdminMessages();
58
+ const noValue = messages.finance.detailSections.noValue;
59
+ return (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { children: messages.finance.detailSections.lineItemsTitle }), _jsxs(Button, { size: "sm", onClick: onCreate, children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), messages.finance.detailSections.addLineItem] })] }), _jsx(CardContent, { children: lineItems.length === 0 ? (_jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: messages.finance.detailSections.noLineItems })) : (_jsx("div", { className: "rounded border bg-background", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b text-muted-foreground", children: [_jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.detailSections.descriptionColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.detailSections.quantityColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.detailSections.unitPriceColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.totalColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.detailSections.taxRateColumn }), _jsx("th", { className: "w-20 p-2" })] }) }), _jsx("tbody", { children: lineItems.map((lineItem) => (_jsxs("tr", { className: "border-b last:border-b-0", children: [_jsx("td", { className: "p-2", children: lineItem.description }), _jsx("td", { className: "p-2 text-right", children: lineItem.quantity }), _jsx("td", { className: "p-2 text-right font-mono", children: (lineItem.unitPriceCents / 100).toFixed(2) }), _jsx("td", { className: "p-2 text-right font-mono", children: (lineItem.totalCents / 100).toFixed(2) }), _jsx("td", { className: "p-2 text-right", children: lineItem.taxRate != null
60
+ ? `${(lineItem.taxRate / 100).toFixed(2)}%`
61
+ : noValue }), _jsx("td", { className: "p-2", children: _jsxs("div", { className: "flex items-center justify-end gap-1", children: [_jsx("button", { type: "button", onClick: () => onEdit(lineItem), className: "text-muted-foreground hover:text-foreground", children: _jsx(Pencil, { className: "h-3.5 w-3.5" }) }), _jsx("button", { type: "button", onClick: () => onDelete(lineItem.id), className: "text-muted-foreground hover:text-destructive", children: _jsx(Trash2, { className: "h-3.5 w-3.5" }) })] }) })] }, lineItem.id))) })] }) })) })] }));
62
+ }
63
+ export function InvoicePaymentsCard({ payments, onCreate, canCreate = true, }) {
64
+ const messages = useOperatorAdminMessages();
65
+ const noValue = messages.finance.detailSections.noValue;
66
+ return (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { children: messages.finance.detailSections.paymentsTitle }), canCreate ? (_jsxs(Button, { size: "sm", onClick: onCreate, children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), messages.finance.detailSections.recordPayment] })) : null] }), _jsx(CardContent, { children: payments.length === 0 ? (_jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: messages.finance.detailSections.noPayments })) : (_jsx("div", { className: "rounded border bg-background", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b text-muted-foreground", children: [_jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.dateColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.detailSections.methodColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.amountColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.statusColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.referenceColumn })] }) }), _jsx("tbody", { children: payments.map((payment) => (_jsxs("tr", { className: "border-b last:border-b-0", children: [_jsx("td", { className: "p-2", children: payment.paymentDate }), _jsx("td", { className: "p-2 capitalize", children: getPaymentMethodLabel(messages, payment.paymentMethod) }), _jsxs("td", { className: "p-2 text-right font-mono", children: [_jsx("div", { children: formatAmount(payment.amountCents, payment.currency) }), payment.baseAmountCents !== null && payment.baseCurrency ? (_jsx("div", { className: "text-muted-foreground text-xs", children: formatAmount(payment.baseAmountCents, payment.baseCurrency) })) : null] }), _jsx("td", { className: "p-2", children: _jsx(Badge, { variant: paymentStatusVariant[payment.status] ?? "secondary", className: "text-xs capitalize", children: getPaymentStatusLabel(messages, payment.status) }) }), _jsx("td", { className: "p-2", children: payment.referenceNumber ?? noValue })] }, payment.id))) })] }) })) })] }));
67
+ }
68
+ export function InvoiceCreditNotesCard({ creditNotes, onCreate, }) {
69
+ const messages = useOperatorAdminMessages();
70
+ return (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { children: messages.finance.detailSections.creditNotesTitle }), _jsxs(Button, { size: "sm", onClick: onCreate, children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), messages.finance.detailSections.addCreditNote] })] }), _jsx(CardContent, { children: creditNotes.length === 0 ? (_jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: messages.finance.detailSections.noCreditNotes })) : (_jsx("div", { className: "rounded border bg-background", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b text-muted-foreground", children: [_jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.detailSections.creditNoteNumberColumn }), _jsx("th", { className: "p-2 text-right font-medium", children: messages.finance.amountColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.detailSections.reasonColumn }), _jsx("th", { className: "p-2 text-left font-medium", children: messages.finance.statusColumn })] }) }), _jsx("tbody", { children: creditNotes.map((creditNote) => (_jsxs("tr", { className: "border-b last:border-b-0", children: [_jsx("td", { className: "p-2", children: creditNote.creditNoteNumber }), _jsx("td", { className: "p-2 text-right font-mono", children: formatAmount(creditNote.amountCents, creditNote.currency) }), _jsx("td", { className: "p-2", children: creditNote.reason }), _jsx("td", { className: "p-2", children: _jsx(Badge, { variant: creditNoteStatusVariant[creditNote.status] ?? "secondary", className: "text-xs capitalize", children: getCreditNoteStatusLabel(messages, creditNote.status) }) })] }, creditNote.id))) })] }) })) })] }));
71
+ }
72
+ export function InvoiceAttachmentsCard({ invoiceId }) {
73
+ const messages = useOperatorAdminMessages().finance.detailSections;
74
+ const { resolvedLocale } = useLocale();
75
+ const { data } = useInvoiceAttachments(invoiceId);
76
+ const attachments = data?.data ?? [];
77
+ // Download links hit the admin API directly — base URL from the shared
78
+ // finance provider context, not a host-app env helper.
79
+ const { baseUrl } = useVoyantFinanceContext();
80
+ return (_jsxs(Card, { children: [_jsx(CardHeader, { className: "pb-3", children: _jsxs(CardTitle, { className: "flex items-center gap-2 text-base", children: [_jsx(FileText, { className: "h-4 w-4 text-muted-foreground" }), messages.attachmentsTitle, attachments.length > 0 ? (_jsx(Badge, { variant: "outline", className: "text-[10px]", children: attachments.length })) : null] }) }), _jsx(CardContent, { className: "p-0", children: attachments.length === 0 ? (_jsx("p", { className: "px-6 py-6 text-center text-muted-foreground text-sm", children: messages.noAttachments })) : (_jsx("ul", { className: "divide-y", children: attachments.map((attachment) => (_jsxs("li", { className: "flex items-center justify-between gap-3 px-6 py-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "truncate text-sm font-medium", children: attachment.name }), _jsx("p", { className: "text-muted-foreground text-xs", children: formatAttachmentMeta(attachment, resolvedLocale) })] }), _jsxs("a", { href: `${baseUrl}/v1/admin/finance/invoice-attachments/${attachment.id}/download`, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-1.5 rounded px-2 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": messages.downloadAttachment, children: [_jsx(Download, { className: "h-3.5 w-3.5" }), messages.downloadAttachment] })] }, attachment.id))) })) })] }));
81
+ }
82
+ function formatAttachmentMeta(attachment, locale) {
83
+ const parts = [];
84
+ if (attachment.mimeType)
85
+ parts.push(attachment.mimeType);
86
+ if (typeof attachment.fileSize === "number")
87
+ parts.push(formatBytes(attachment.fileSize));
88
+ if (attachment.createdAt) {
89
+ try {
90
+ parts.push(new Date(attachment.createdAt).toLocaleDateString(locale));
91
+ }
92
+ catch {
93
+ // ignore — locale parse failures fall through silently
94
+ }
95
+ }
96
+ return parts.join(" · ");
97
+ }
98
+ function formatBytes(bytes) {
99
+ if (bytes < 1024)
100
+ return `${bytes} B`;
101
+ if (bytes < 1024 * 1024)
102
+ return `${Math.round(bytes / 1024)} KB`;
103
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
104
+ }
105
+ export function InvoiceNotesCard({ notes, noteContent, isAdding, onNoteChange, onAddNote, }) {
106
+ const messages = useOperatorAdminMessages();
107
+ const { resolvedLocale } = useLocale();
108
+ return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.finance.detailSections.notesTitle }) }), _jsxs(CardContent, { className: "space-y-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Textarea, { value: noteContent, onChange: (event) => onNoteChange(event.target.value), placeholder: messages.finance.detailSections.addInternalNotePlaceholder }), _jsx("div", { className: "flex justify-end", children: _jsx(Button, { disabled: isAdding || !noteContent.trim(), onClick: onAddNote, children: messages.finance.detailSections.addNote }) })] }), notes.length === 0 ? (_jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: messages.finance.detailSections.noNotes })) : (_jsx("div", { className: "space-y-3", children: notes.map((note) => (_jsxs("div", { className: "rounded border p-3", children: [_jsx("p", { className: "whitespace-pre-wrap text-sm", children: note.content }), _jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: new Date(note.createdAt).toLocaleString(resolvedLocale) })] }, note.id))) }))] })] }));
109
+ }