@hub-kit/core 0.3.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 (499) hide show
  1. package/README.md +125 -0
  2. package/cli/hub-kit.mjs +112 -0
  3. package/dist/adapters/bank-reconciliation.d.ts +100 -0
  4. package/dist/adapters/bank-reconciliation.js +1 -0
  5. package/dist/adapters/bank-sync-log.d.ts +46 -0
  6. package/dist/adapters/bank-sync-log.js +1 -0
  7. package/dist/adapters/category-rules.d.ts +94 -0
  8. package/dist/adapters/category-rules.js +1 -0
  9. package/dist/adapters/companies.d.ts +85 -0
  10. package/dist/adapters/companies.js +3 -0
  11. package/dist/adapters/customers.d.ts +71 -0
  12. package/dist/adapters/customers.js +1 -0
  13. package/dist/adapters/exclusion-rules.d.ts +34 -0
  14. package/dist/adapters/exclusion-rules.js +15 -0
  15. package/dist/adapters/file-naming.d.ts +36 -0
  16. package/dist/adapters/file-naming.js +1 -0
  17. package/dist/adapters/index.d.ts +24 -0
  18. package/dist/adapters/index.js +1 -0
  19. package/dist/adapters/invoice-detail.d.ts +126 -0
  20. package/dist/adapters/invoice-detail.js +1 -0
  21. package/dist/adapters/invoice-list.d.ts +63 -0
  22. package/dist/adapters/invoice-list.js +1 -0
  23. package/dist/adapters/invoice-upload.d.ts +26 -0
  24. package/dist/adapters/invoice-upload.js +1 -0
  25. package/dist/adapters/manual-bookings.d.ts +56 -0
  26. package/dist/adapters/manual-bookings.js +1 -0
  27. package/dist/adapters/notifications.d.ts +31 -0
  28. package/dist/adapters/notifications.js +1 -0
  29. package/dist/adapters/open-items.d.ts +42 -0
  30. package/dist/adapters/open-items.js +1 -0
  31. package/dist/adapters/opos-whitelist.d.ts +38 -0
  32. package/dist/adapters/opos-whitelist.js +1 -0
  33. package/dist/adapters/outgoing-invoices.d.ts +32 -0
  34. package/dist/adapters/outgoing-invoices.js +1 -0
  35. package/dist/adapters/overview.d.ts +68 -0
  36. package/dist/adapters/overview.js +1 -0
  37. package/dist/adapters/processing-log.d.ts +48 -0
  38. package/dist/adapters/processing-log.js +1 -0
  39. package/dist/adapters/properties.d.ts +87 -0
  40. package/dist/adapters/properties.js +1 -0
  41. package/dist/adapters/supplier-detail.d.ts +64 -0
  42. package/dist/adapters/supplier-detail.js +1 -0
  43. package/dist/adapters/supplier-list.d.ts +21 -0
  44. package/dist/adapters/supplier-list.js +1 -0
  45. package/dist/adapters/team.d.ts +79 -0
  46. package/dist/adapters/team.js +1 -0
  47. package/dist/adapters/trash.d.ts +26 -0
  48. package/dist/adapters/trash.js +1 -0
  49. package/dist/adapters/vat-rules.d.ts +83 -0
  50. package/dist/adapters/vat-rules.js +1 -0
  51. package/dist/components/access/index.d.ts +3 -0
  52. package/dist/components/access/index.js +3 -0
  53. package/dist/components/access/permission-checklist.d.ts +13 -0
  54. package/dist/components/access/permission-checklist.js +19 -0
  55. package/dist/components/access/permission-matrix.d.ts +12 -0
  56. package/dist/components/access/permission-matrix.js +18 -0
  57. package/dist/components/access/types.d.ts +15 -0
  58. package/dist/components/access/types.js +1 -0
  59. package/dist/components/dashboard/date-range-calendar.d.ts +19 -0
  60. package/dist/components/dashboard/date-range-calendar.js +97 -0
  61. package/dist/components/dashboard/index.d.ts +23 -0
  62. package/dist/components/dashboard/index.js +14 -0
  63. package/dist/components/dashboard/kpi-card.d.ts +13 -0
  64. package/dist/components/dashboard/kpi-card.js +7 -0
  65. package/dist/components/dashboard/money-cards-row.d.ts +29 -0
  66. package/dist/components/dashboard/money-cards-row.js +28 -0
  67. package/dist/components/dashboard/money-trend-chart.d.ts +13 -0
  68. package/dist/components/dashboard/money-trend-chart.js +16 -0
  69. package/dist/components/dashboard/panel.d.ts +9 -0
  70. package/dist/components/dashboard/panel.js +5 -0
  71. package/dist/components/dashboard/period-picker.d.ts +25 -0
  72. package/dist/components/dashboard/period-picker.js +82 -0
  73. package/dist/components/dashboard/periods.d.ts +13 -0
  74. package/dist/components/dashboard/periods.js +63 -0
  75. package/dist/components/dashboard/pipeline-stages-panel.d.ts +14 -0
  76. package/dist/components/dashboard/pipeline-stages-panel.js +12 -0
  77. package/dist/components/dashboard/processing-summary-panel.d.ts +34 -0
  78. package/dist/components/dashboard/processing-summary-panel.js +11 -0
  79. package/dist/components/dashboard/ranked-bars.d.ts +15 -0
  80. package/dist/components/dashboard/ranked-bars.js +16 -0
  81. package/dist/components/dashboard/ranked-list-panel.d.ts +14 -0
  82. package/dist/components/dashboard/ranked-list-panel.js +9 -0
  83. package/dist/components/dashboard/stage-tiles.d.ts +15 -0
  84. package/dist/components/dashboard/stage-tiles.js +6 -0
  85. package/dist/components/dashboard/stat-rows-panel.d.ts +25 -0
  86. package/dist/components/dashboard/stat-rows-panel.js +7 -0
  87. package/dist/components/dashboard/stat-tile.d.ts +20 -0
  88. package/dist/components/dashboard/stat-tile.js +9 -0
  89. package/dist/components/feedback/index.d.ts +4 -0
  90. package/dist/components/feedback/index.js +2 -0
  91. package/dist/components/feedback/query-states.d.ts +27 -0
  92. package/dist/components/feedback/query-states.js +38 -0
  93. package/dist/components/feedback/table-pagination.d.ts +20 -0
  94. package/dist/components/feedback/table-pagination.js +15 -0
  95. package/dist/components/invoice-queue/index.d.ts +5 -0
  96. package/dist/components/invoice-queue/index.js +3 -0
  97. package/dist/components/invoice-queue/next-action-cell.d.ts +5 -0
  98. package/dist/components/invoice-queue/next-action-cell.js +9 -0
  99. package/dist/components/invoice-queue/queue-kpi-card.d.ts +19 -0
  100. package/dist/components/invoice-queue/queue-kpi-card.js +31 -0
  101. package/dist/components/invoice-queue/queue-kpi-row.d.ts +22 -0
  102. package/dist/components/invoice-queue/queue-kpi-row.js +12 -0
  103. package/dist/components/notifications/alerts.d.ts +25 -0
  104. package/dist/components/notifications/alerts.js +66 -0
  105. package/dist/components/notifications/bell.d.ts +14 -0
  106. package/dist/components/notifications/bell.js +17 -0
  107. package/dist/components/notifications/highlight.d.ts +4 -0
  108. package/dist/components/notifications/highlight.js +7 -0
  109. package/dist/components/notifications/index.d.ts +7 -0
  110. package/dist/components/notifications/index.js +6 -0
  111. package/dist/components/notifications/reminder-dialog.d.ts +24 -0
  112. package/dist/components/notifications/reminder-dialog.js +54 -0
  113. package/dist/components/notifications/types.d.ts +27 -0
  114. package/dist/components/notifications/types.js +1 -0
  115. package/dist/components/notifications/use-notification-acks.d.ts +7 -0
  116. package/dist/components/notifications/use-notification-acks.js +37 -0
  117. package/dist/components/shell/breadcrumbs.d.ts +7 -0
  118. package/dist/components/shell/breadcrumbs.js +38 -0
  119. package/dist/components/shell/index.d.ts +3 -0
  120. package/dist/components/shell/index.js +3 -0
  121. package/dist/components/shell/shell.d.ts +30 -0
  122. package/dist/components/shell/shell.js +110 -0
  123. package/dist/components/shell/types.d.ts +23 -0
  124. package/dist/components/shell/types.js +3 -0
  125. package/dist/components/tour/find-target.d.ts +1 -0
  126. package/dist/components/tour/find-target.js +3 -0
  127. package/dist/components/tour/index.d.ts +14 -0
  128. package/dist/components/tour/index.js +8 -0
  129. package/dist/components/tour/labels.d.ts +10 -0
  130. package/dist/components/tour/labels.js +9 -0
  131. package/dist/components/tour/seen-store.d.ts +3 -0
  132. package/dist/components/tour/seen-store.js +34 -0
  133. package/dist/components/tour/tour-blocks.d.ts +4 -0
  134. package/dist/components/tour/tour-blocks.js +27 -0
  135. package/dist/components/tour/tour-button.d.ts +4 -0
  136. package/dist/components/tour/tour-button.js +12 -0
  137. package/dist/components/tour/tour-card.d.ts +11 -0
  138. package/dist/components/tour/tour-card.js +7 -0
  139. package/dist/components/tour/tour-context.d.ts +16 -0
  140. package/dist/components/tour/tour-context.js +2 -0
  141. package/dist/components/tour/tour-overlay.d.ts +1 -0
  142. package/dist/components/tour/tour-overlay.js +165 -0
  143. package/dist/components/tour/tour-provider.d.ts +9 -0
  144. package/dist/components/tour/tour-provider.js +80 -0
  145. package/dist/components/tour/types.d.ts +44 -0
  146. package/dist/components/tour/types.js +1 -0
  147. package/dist/components/tour/use-tour.d.ts +3 -0
  148. package/dist/components/tour/use-tour.js +9 -0
  149. package/dist/hooks/use-mobile.d.ts +1 -0
  150. package/dist/hooks/use-mobile.js +15 -0
  151. package/dist/i18n/index.d.ts +15 -0
  152. package/dist/i18n/index.js +15 -0
  153. package/dist/lib/bank-import/classify.d.ts +8 -0
  154. package/dist/lib/bank-import/classify.js +89 -0
  155. package/dist/lib/bank-import/column-guess.d.ts +2 -0
  156. package/dist/lib/bank-import/column-guess.js +40 -0
  157. package/dist/lib/bank-import/csv.d.ts +3 -0
  158. package/dist/lib/bank-import/csv.js +20 -0
  159. package/dist/lib/bank-import/duplicates.d.ts +2 -0
  160. package/dist/lib/bank-import/duplicates.js +21 -0
  161. package/dist/lib/bank-import/index.d.ts +12 -0
  162. package/dist/lib/bank-import/index.js +9 -0
  163. package/dist/lib/bank-import/mapping-storage.d.ts +3 -0
  164. package/dist/lib/bank-import/mapping-storage.js +29 -0
  165. package/dist/lib/bank-import/normalize.d.ts +4 -0
  166. package/dist/lib/bank-import/normalize.js +82 -0
  167. package/dist/lib/bank-import/parse-file.d.ts +7 -0
  168. package/dist/lib/bank-import/parse-file.js +23 -0
  169. package/dist/lib/bank-import/types.d.ts +31 -0
  170. package/dist/lib/bank-import/types.js +1 -0
  171. package/dist/lib/bank-import/xlsx.d.ts +2 -0
  172. package/dist/lib/bank-import/xlsx.js +25 -0
  173. package/dist/lib/class-names.d.ts +2 -0
  174. package/dist/lib/class-names.js +5 -0
  175. package/dist/lib/download.d.ts +2 -0
  176. package/dist/lib/download.js +14 -0
  177. package/dist/lib/formatters.d.ts +6 -0
  178. package/dist/lib/formatters.js +24 -0
  179. package/dist/lib/index.d.ts +9 -0
  180. package/dist/lib/index.js +6 -0
  181. package/dist/lib/opos-whitelist/index.d.ts +2 -0
  182. package/dist/lib/opos-whitelist/index.js +1 -0
  183. package/dist/lib/opos-whitelist/opos.d.ts +14 -0
  184. package/dist/lib/opos-whitelist/opos.js +49 -0
  185. package/dist/lib/query-result.d.ts +12 -0
  186. package/dist/lib/query-result.js +1 -0
  187. package/dist/lib/tour-placeholders/index.d.ts +2 -0
  188. package/dist/lib/tour-placeholders/index.js +1 -0
  189. package/dist/lib/tour-placeholders/overview.d.ts +12 -0
  190. package/dist/lib/tour-placeholders/overview.js +139 -0
  191. package/dist/pages/bank-accounts/BankAccountsPage.d.ts +7 -0
  192. package/dist/pages/bank-accounts/BankAccountsPage.js +21 -0
  193. package/dist/pages/bank-accounts/index.d.ts +4 -0
  194. package/dist/pages/bank-accounts/index.js +2 -0
  195. package/dist/pages/bank-accounts/labels.d.ts +15 -0
  196. package/dist/pages/bank-accounts/labels.js +14 -0
  197. package/dist/pages/bank-import/BankImportWizard.d.ts +9 -0
  198. package/dist/pages/bank-import/BankImportWizard.js +158 -0
  199. package/dist/pages/bank-import/index.d.ts +4 -0
  200. package/dist/pages/bank-import/index.js +2 -0
  201. package/dist/pages/bank-import/labels.d.ts +44 -0
  202. package/dist/pages/bank-import/labels.js +43 -0
  203. package/dist/pages/bank-sync-log/BankSyncLogPage.d.ts +7 -0
  204. package/dist/pages/bank-sync-log/BankSyncLogPage.js +77 -0
  205. package/dist/pages/bank-sync-log/index.d.ts +4 -0
  206. package/dist/pages/bank-sync-log/index.js +2 -0
  207. package/dist/pages/bank-sync-log/labels.d.ts +21 -0
  208. package/dist/pages/bank-sync-log/labels.js +20 -0
  209. package/dist/pages/bank-transactions/BankMatchPanel.d.ts +8 -0
  210. package/dist/pages/bank-transactions/BankMatchPanel.js +75 -0
  211. package/dist/pages/bank-transactions/BankTransactionsPage.d.ts +7 -0
  212. package/dist/pages/bank-transactions/BankTransactionsPage.js +59 -0
  213. package/dist/pages/bank-transactions/badges.d.ts +8 -0
  214. package/dist/pages/bank-transactions/badges.js +24 -0
  215. package/dist/pages/bank-transactions/index.d.ts +6 -0
  216. package/dist/pages/bank-transactions/index.js +4 -0
  217. package/dist/pages/bank-transactions/labels.d.ts +41 -0
  218. package/dist/pages/bank-transactions/labels.js +40 -0
  219. package/dist/pages/bank-transactions/sort-control.d.ts +17 -0
  220. package/dist/pages/bank-transactions/sort-control.js +8 -0
  221. package/dist/pages/bank-transactions/use-table-view.d.ts +23 -0
  222. package/dist/pages/bank-transactions/use-table-view.js +54 -0
  223. package/dist/pages/category-rules/CategoryRulesPage.d.ts +7 -0
  224. package/dist/pages/category-rules/CategoryRulesPage.js +160 -0
  225. package/dist/pages/category-rules/index.d.ts +4 -0
  226. package/dist/pages/category-rules/index.js +2 -0
  227. package/dist/pages/category-rules/labels.d.ts +66 -0
  228. package/dist/pages/category-rules/labels.js +72 -0
  229. package/dist/pages/companies/company-detail-page.d.ts +10 -0
  230. package/dist/pages/companies/company-detail-page.js +184 -0
  231. package/dist/pages/companies/company-form.d.ts +20 -0
  232. package/dist/pages/companies/company-form.js +23 -0
  233. package/dist/pages/companies/company-list-page.d.ts +9 -0
  234. package/dist/pages/companies/company-list-page.js +109 -0
  235. package/dist/pages/companies/known-spellings-card.d.ts +8 -0
  236. package/dist/pages/companies/known-spellings-card.js +65 -0
  237. package/dist/pages/companies/labels.d.ts +105 -0
  238. package/dist/pages/companies/labels.js +104 -0
  239. package/dist/pages/companies/sort-control.d.ts +17 -0
  240. package/dist/pages/companies/sort-control.js +8 -0
  241. package/dist/pages/companies/use-infinite-rows.d.ts +6 -0
  242. package/dist/pages/companies/use-infinite-rows.js +24 -0
  243. package/dist/pages/companies/use-table-view.d.ts +23 -0
  244. package/dist/pages/companies/use-table-view.js +56 -0
  245. package/dist/pages/customers/company-chip.d.ts +6 -0
  246. package/dist/pages/customers/company-chip.js +9 -0
  247. package/dist/pages/customers/copy-button.d.ts +6 -0
  248. package/dist/pages/customers/copy-button.js +31 -0
  249. package/dist/pages/customers/customer-detail-page.d.ts +10 -0
  250. package/dist/pages/customers/customer-detail-page.js +83 -0
  251. package/dist/pages/customers/customer-list-page.d.ts +9 -0
  252. package/dist/pages/customers/customer-list-page.js +65 -0
  253. package/dist/pages/customers/edit-customer-dialog.d.ts +9 -0
  254. package/dist/pages/customers/edit-customer-dialog.js +72 -0
  255. package/dist/pages/customers/form-hints.d.ts +6 -0
  256. package/dist/pages/customers/form-hints.js +9 -0
  257. package/dist/pages/customers/invoice-status-badge.d.ts +10 -0
  258. package/dist/pages/customers/invoice-status-badge.js +22 -0
  259. package/dist/pages/customers/labels.d.ts +116 -0
  260. package/dist/pages/customers/labels.js +117 -0
  261. package/dist/pages/customers/new-customer-dialog.d.ts +6 -0
  262. package/dist/pages/customers/new-customer-dialog.js +93 -0
  263. package/dist/pages/customers/sort-control.d.ts +14 -0
  264. package/dist/pages/customers/sort-control.js +9 -0
  265. package/dist/pages/customers/use-table-view.d.ts +23 -0
  266. package/dist/pages/customers/use-table-view.js +56 -0
  267. package/dist/pages/exclusion-rules/exclusion-rules-page.d.ts +7 -0
  268. package/dist/pages/exclusion-rules/exclusion-rules-page.js +114 -0
  269. package/dist/pages/exclusion-rules/labels.d.ts +53 -0
  270. package/dist/pages/exclusion-rules/labels.js +61 -0
  271. package/dist/pages/file-naming/build-filename.d.ts +3 -0
  272. package/dist/pages/file-naming/build-filename.js +82 -0
  273. package/dist/pages/file-naming/file-naming-page.d.ts +10 -0
  274. package/dist/pages/file-naming/file-naming-page.js +120 -0
  275. package/dist/pages/file-naming/labels.d.ts +44 -0
  276. package/dist/pages/file-naming/labels.js +44 -0
  277. package/dist/pages/index.d.ts +63 -0
  278. package/dist/pages/index.js +48 -0
  279. package/dist/pages/invoice-detail/InvoiceDetailPage.d.ts +11 -0
  280. package/dist/pages/invoice-detail/InvoiceDetailPage.js +292 -0
  281. package/dist/pages/invoice-detail/OutgoingInvoiceFlag.d.ts +26 -0
  282. package/dist/pages/invoice-detail/OutgoingInvoiceFlag.js +16 -0
  283. package/dist/pages/invoice-detail/ReviewBadge.d.ts +15 -0
  284. package/dist/pages/invoice-detail/ReviewBadge.js +23 -0
  285. package/dist/pages/invoice-detail/ReviewCard.d.ts +17 -0
  286. package/dist/pages/invoice-detail/ReviewCard.js +12 -0
  287. package/dist/pages/invoice-detail/SideBySide.d.ts +5 -0
  288. package/dist/pages/invoice-detail/SideBySide.js +5 -0
  289. package/dist/pages/invoice-detail/WorkflowHistoryList.d.ts +23 -0
  290. package/dist/pages/invoice-detail/WorkflowHistoryList.js +32 -0
  291. package/dist/pages/invoice-detail/WorkflowLadder.d.ts +20 -0
  292. package/dist/pages/invoice-detail/WorkflowLadder.js +16 -0
  293. package/dist/pages/invoice-detail/history.d.ts +23 -0
  294. package/dist/pages/invoice-detail/history.js +76 -0
  295. package/dist/pages/invoice-detail/index.d.ts +21 -0
  296. package/dist/pages/invoice-detail/index.js +11 -0
  297. package/dist/pages/invoice-detail/labels.d.ts +79 -0
  298. package/dist/pages/invoice-detail/labels.js +139 -0
  299. package/dist/pages/invoice-detail/pipeline-types.d.ts +58 -0
  300. package/dist/pages/invoice-detail/pipeline-types.js +1 -0
  301. package/dist/pages/invoice-detail/review-recheck.d.ts +8 -0
  302. package/dist/pages/invoice-detail/review-recheck.js +103 -0
  303. package/dist/pages/invoice-detail/review.d.ts +91 -0
  304. package/dist/pages/invoice-detail/review.js +310 -0
  305. package/dist/pages/invoice-list/badges.d.ts +23 -0
  306. package/dist/pages/invoice-list/badges.js +26 -0
  307. package/dist/pages/invoice-list/index.d.ts +5 -0
  308. package/dist/pages/invoice-list/index.js +3 -0
  309. package/dist/pages/invoice-list/invoice-list-page.d.ts +13 -0
  310. package/dist/pages/invoice-list/invoice-list-page.js +114 -0
  311. package/dist/pages/invoice-list/labels.d.ts +36 -0
  312. package/dist/pages/invoice-list/labels.js +29 -0
  313. package/dist/pages/invoice-list/sort-control.d.ts +17 -0
  314. package/dist/pages/invoice-list/sort-control.js +8 -0
  315. package/dist/pages/invoice-list/use-table-view.d.ts +23 -0
  316. package/dist/pages/invoice-list/use-table-view.js +54 -0
  317. package/dist/pages/invoice-upload/InvoiceUploadPage.d.ts +7 -0
  318. package/dist/pages/invoice-upload/InvoiceUploadPage.js +115 -0
  319. package/dist/pages/invoice-upload/index.d.ts +4 -0
  320. package/dist/pages/invoice-upload/index.js +2 -0
  321. package/dist/pages/invoice-upload/labels.d.ts +29 -0
  322. package/dist/pages/invoice-upload/labels.js +28 -0
  323. package/dist/pages/manual-bookings/ManualBookingsPage.d.ts +7 -0
  324. package/dist/pages/manual-bookings/ManualBookingsPage.js +161 -0
  325. package/dist/pages/manual-bookings/index.d.ts +4 -0
  326. package/dist/pages/manual-bookings/index.js +2 -0
  327. package/dist/pages/manual-bookings/labels.d.ts +53 -0
  328. package/dist/pages/manual-bookings/labels.js +52 -0
  329. package/dist/pages/notifications/labels.d.ts +22 -0
  330. package/dist/pages/notifications/labels.js +21 -0
  331. package/dist/pages/notifications/notifications-page.d.ts +14 -0
  332. package/dist/pages/notifications/notifications-page.js +81 -0
  333. package/dist/pages/open-items/OpenItemsPage.d.ts +11 -0
  334. package/dist/pages/open-items/OpenItemsPage.js +110 -0
  335. package/dist/pages/open-items/index.d.ts +6 -0
  336. package/dist/pages/open-items/index.js +3 -0
  337. package/dist/pages/open-items/labels.d.ts +37 -0
  338. package/dist/pages/open-items/labels.js +36 -0
  339. package/dist/pages/open-items/urgency.d.ts +8 -0
  340. package/dist/pages/open-items/urgency.js +27 -0
  341. package/dist/pages/opos-whitelist/OposWhitelistPage.d.ts +7 -0
  342. package/dist/pages/opos-whitelist/OposWhitelistPage.js +165 -0
  343. package/dist/pages/opos-whitelist/index.d.ts +4 -0
  344. package/dist/pages/opos-whitelist/index.js +2 -0
  345. package/dist/pages/opos-whitelist/labels.d.ts +56 -0
  346. package/dist/pages/opos-whitelist/labels.js +70 -0
  347. package/dist/pages/outgoing-invoices/OutgoingInvoicesPage.d.ts +7 -0
  348. package/dist/pages/outgoing-invoices/OutgoingInvoicesPage.js +169 -0
  349. package/dist/pages/outgoing-invoices/index.d.ts +4 -0
  350. package/dist/pages/outgoing-invoices/index.js +2 -0
  351. package/dist/pages/outgoing-invoices/labels.d.ts +43 -0
  352. package/dist/pages/outgoing-invoices/labels.js +42 -0
  353. package/dist/pages/outgoing-invoices/sort-control.d.ts +17 -0
  354. package/dist/pages/outgoing-invoices/sort-control.js +8 -0
  355. package/dist/pages/outgoing-invoices/use-table-view.d.ts +23 -0
  356. package/dist/pages/outgoing-invoices/use-table-view.js +54 -0
  357. package/dist/pages/overview/labels.d.ts +35 -0
  358. package/dist/pages/overview/labels.js +34 -0
  359. package/dist/pages/overview/overview-page.d.ts +22 -0
  360. package/dist/pages/overview/overview-page.js +127 -0
  361. package/dist/pages/processing-log/labels.d.ts +54 -0
  362. package/dist/pages/processing-log/labels.js +53 -0
  363. package/dist/pages/processing-log/mail-parsing.d.ts +21 -0
  364. package/dist/pages/processing-log/mail-parsing.js +52 -0
  365. package/dist/pages/processing-log/processing-log-page.d.ts +9 -0
  366. package/dist/pages/processing-log/processing-log-page.js +206 -0
  367. package/dist/pages/properties/badges.d.ts +20 -0
  368. package/dist/pages/properties/badges.js +45 -0
  369. package/dist/pages/properties/company-assignment-field.d.ts +11 -0
  370. package/dist/pages/properties/company-assignment-field.js +13 -0
  371. package/dist/pages/properties/form-field.d.ts +6 -0
  372. package/dist/pages/properties/form-field.js +9 -0
  373. package/dist/pages/properties/labels.d.ts +124 -0
  374. package/dist/pages/properties/labels.js +128 -0
  375. package/dist/pages/properties/name-variants-card.d.ts +7 -0
  376. package/dist/pages/properties/name-variants-card.js +60 -0
  377. package/dist/pages/properties/property-detail-page.d.ts +10 -0
  378. package/dist/pages/properties/property-detail-page.js +150 -0
  379. package/dist/pages/properties/property-list-page.d.ts +13 -0
  380. package/dist/pages/properties/property-list-page.js +201 -0
  381. package/dist/pages/properties/sort-control.d.ts +14 -0
  382. package/dist/pages/properties/sort-control.js +9 -0
  383. package/dist/pages/properties/use-infinite-rows.d.ts +6 -0
  384. package/dist/pages/properties/use-infinite-rows.js +26 -0
  385. package/dist/pages/properties/use-table-view.d.ts +23 -0
  386. package/dist/pages/properties/use-table-view.js +56 -0
  387. package/dist/pages/supplier-detail/SupplierDetailPage.d.ts +10 -0
  388. package/dist/pages/supplier-detail/SupplierDetailPage.js +157 -0
  389. package/dist/pages/supplier-detail/index.d.ts +4 -0
  390. package/dist/pages/supplier-detail/index.js +2 -0
  391. package/dist/pages/supplier-detail/labels.d.ts +46 -0
  392. package/dist/pages/supplier-detail/labels.js +45 -0
  393. package/dist/pages/supplier-list/SupplierListPage.d.ts +9 -0
  394. package/dist/pages/supplier-list/SupplierListPage.js +102 -0
  395. package/dist/pages/supplier-list/index.d.ts +4 -0
  396. package/dist/pages/supplier-list/index.js +2 -0
  397. package/dist/pages/supplier-list/labels.d.ts +33 -0
  398. package/dist/pages/supplier-list/labels.js +32 -0
  399. package/dist/pages/supplier-list/sort-control.d.ts +17 -0
  400. package/dist/pages/supplier-list/sort-control.js +8 -0
  401. package/dist/pages/supplier-list/use-table-view.d.ts +23 -0
  402. package/dist/pages/supplier-list/use-table-view.js +54 -0
  403. package/dist/pages/team/account-dialogs.d.ts +12 -0
  404. package/dist/pages/team/account-dialogs.js +49 -0
  405. package/dist/pages/team/employee-editor.d.ts +19 -0
  406. package/dist/pages/team/employee-editor.js +124 -0
  407. package/dist/pages/team/labels.d.ts +99 -0
  408. package/dist/pages/team/labels.js +98 -0
  409. package/dist/pages/team/new-employee.d.ts +8 -0
  410. package/dist/pages/team/new-employee.js +103 -0
  411. package/dist/pages/team/roles-tab.d.ts +6 -0
  412. package/dist/pages/team/roles-tab.js +46 -0
  413. package/dist/pages/team/team-page.d.ts +7 -0
  414. package/dist/pages/team/team-page.js +81 -0
  415. package/dist/pages/team/temp-password-dialog.d.ts +11 -0
  416. package/dist/pages/team/temp-password-dialog.js +23 -0
  417. package/dist/pages/trash/labels.d.ts +68 -0
  418. package/dist/pages/trash/labels.js +69 -0
  419. package/dist/pages/trash/trash-page.d.ts +9 -0
  420. package/dist/pages/trash/trash-page.js +259 -0
  421. package/dist/pages/vat-rules/labels.d.ts +110 -0
  422. package/dist/pages/vat-rules/labels.js +109 -0
  423. package/dist/pages/vat-rules/new-rule-dialog.d.ts +7 -0
  424. package/dist/pages/vat-rules/new-rule-dialog.js +134 -0
  425. package/dist/pages/vat-rules/rule-row.d.ts +20 -0
  426. package/dist/pages/vat-rules/rule-row.js +120 -0
  427. package/dist/pages/vat-rules/vat-rules-page.d.ts +9 -0
  428. package/dist/pages/vat-rules/vat-rules-page.js +61 -0
  429. package/dist/ui/alert-dialog.d.ts +20 -0
  430. package/dist/ui/alert-dialog.js +41 -0
  431. package/dist/ui/badge.d.ts +9 -0
  432. package/dist/ui/badge.js +20 -0
  433. package/dist/ui/breadcrumb.d.ts +19 -0
  434. package/dist/ui/breadcrumb.js +23 -0
  435. package/dist/ui/button.d.ts +11 -0
  436. package/dist/ui/button.js +33 -0
  437. package/dist/ui/calendar.d.ts +8 -0
  438. package/dist/ui/calendar.js +75 -0
  439. package/dist/ui/card.d.ts +8 -0
  440. package/dist/ui/card.js +16 -0
  441. package/dist/ui/chart.d.ts +62 -0
  442. package/dist/ui/chart.js +118 -0
  443. package/dist/ui/checkbox.d.ts +4 -0
  444. package/dist/ui/checkbox.js +11 -0
  445. package/dist/ui/collapsible.d.ts +5 -0
  446. package/dist/ui/collapsible.js +5 -0
  447. package/dist/ui/combobox.d.ts +24 -0
  448. package/dist/ui/combobox.js +55 -0
  449. package/dist/ui/command.d.ts +80 -0
  450. package/dist/ui/command.js +29 -0
  451. package/dist/ui/dialog.d.ts +19 -0
  452. package/dist/ui/dialog.js +58 -0
  453. package/dist/ui/dropdown-menu.d.ts +27 -0
  454. package/dist/ui/dropdown-menu.js +33 -0
  455. package/dist/ui/field-context.d.ts +4 -0
  456. package/dist/ui/field-context.js +6 -0
  457. package/dist/ui/field.d.ts +3 -0
  458. package/dist/ui/field.js +8 -0
  459. package/dist/ui/icon-action.d.ts +3 -0
  460. package/dist/ui/icon-action.js +8 -0
  461. package/dist/ui/index.d.ts +32 -0
  462. package/dist/ui/index.js +32 -0
  463. package/dist/ui/input.d.ts +3 -0
  464. package/dist/ui/input.js +11 -0
  465. package/dist/ui/label.d.ts +5 -0
  466. package/dist/ui/label.js +15 -0
  467. package/dist/ui/multi-combobox.d.ts +18 -0
  468. package/dist/ui/multi-combobox.js +40 -0
  469. package/dist/ui/popover.d.ts +9 -0
  470. package/dist/ui/popover.js +12 -0
  471. package/dist/ui/scroll-area.d.ts +5 -0
  472. package/dist/ui/scroll-area.js +9 -0
  473. package/dist/ui/scroll-shadow.d.ts +8 -0
  474. package/dist/ui/scroll-shadow.js +57 -0
  475. package/dist/ui/select.d.ts +13 -0
  476. package/dist/ui/select.js +31 -0
  477. package/dist/ui/separator.d.ts +4 -0
  478. package/dist/ui/separator.js +7 -0
  479. package/dist/ui/sheet.d.ts +25 -0
  480. package/dist/ui/sheet.js +40 -0
  481. package/dist/ui/sidebar.d.ts +65 -0
  482. package/dist/ui/sidebar.js +207 -0
  483. package/dist/ui/skeleton.d.ts +2 -0
  484. package/dist/ui/skeleton.js +6 -0
  485. package/dist/ui/sonner.d.ts +5 -0
  486. package/dist/ui/sonner.js +13 -0
  487. package/dist/ui/switch.d.ts +4 -0
  488. package/dist/ui/switch.js +7 -0
  489. package/dist/ui/table.d.ts +12 -0
  490. package/dist/ui/table.js +24 -0
  491. package/dist/ui/tabs.d.ts +7 -0
  492. package/dist/ui/tabs.js +12 -0
  493. package/dist/ui/textarea.d.ts +3 -0
  494. package/dist/ui/textarea.js +11 -0
  495. package/dist/ui/tooltip.d.ts +7 -0
  496. package/dist/ui/tooltip.js +11 -0
  497. package/package.json +80 -0
  498. package/themes/TOKENS.md +57 -0
  499. package/themes/default.css +60 -0
@@ -0,0 +1,109 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useMemo, useState } from "react";
3
+ import { Plus, Search } from "lucide-react";
4
+ import { toast } from "sonner";
5
+ import { Button } from "../../ui/button.js";
6
+ import { Input } from "../../ui/input.js";
7
+ import { Label } from "../../ui/label.js";
8
+ import { Skeleton } from "../../ui/skeleton.js";
9
+ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "../../ui/dialog.js";
10
+ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "../../ui/table.js";
11
+ import { ErrorState, TableSkeleton, readableErrorMessage } from "../../components/feedback/query-states.js";
12
+ import { TablePagination } from "../../components/feedback/table-pagination.js";
13
+ import { cn } from "../../lib/class-names.js";
14
+ import { englishFormatters } from "../../lib/formatters.js";
15
+ import { FieldErrorText, RequiredMark, validateCompanyForm } from "./company-form.js";
16
+ import { SortControl } from "./sort-control.js";
17
+ import { useTableView } from "./use-table-view.js";
18
+ import { englishCompaniesLabels } from "./labels.js";
19
+ const EMPTY_TOTALS = { totalAmount: 0, invoiceCount: 0 };
20
+ export function CompanyListPage({ adapter, labels = englishCompaniesLabels, formatters = englishFormatters, }) {
21
+ const [search, setSearch] = useState("");
22
+ const [showArchived, setShowArchived] = useState(false);
23
+ const companiesQuery = adapter.useCompanies({ includeArchived: showArchived });
24
+ const totalsQuery = adapter.useCompanyInvoiceTotals();
25
+ const companies = useMemo(() => companiesQuery.data ?? [], [companiesQuery.data]);
26
+ // Totals load separately from the list, so a row can render before its numbers are known.
27
+ const totalsReady = totalsQuery.data !== undefined;
28
+ const totals = totalsQuery.data ?? new Map();
29
+ const filteredCompanies = useMemo(() => {
30
+ const term = search.trim().toLowerCase();
31
+ return companies.filter((company) => !term || `${company.code} ${company.name}`.toLowerCase().includes(term));
32
+ }, [companies, search]);
33
+ const view = useTableView(filteredCompanies, {
34
+ initialSort: "updatedAt",
35
+ initialDirection: "desc",
36
+ resetKey: `${search}|${showArchived}`,
37
+ sortValue: (company, key) => {
38
+ const companyTotals = totals.get(company.id) ?? EMPTY_TOTALS;
39
+ switch (key) {
40
+ case "name":
41
+ return company.name ?? "";
42
+ case "bookedTotal":
43
+ return companyTotals.totalAmount;
44
+ case "createdAt":
45
+ return company.createdAt ?? "";
46
+ case "updatedAt":
47
+ return company.updatedAt ?? company.createdAt ?? "";
48
+ default:
49
+ return company.code ?? "";
50
+ }
51
+ },
52
+ });
53
+ const sortColumns = [
54
+ { value: "code", label: labels.list.columnCode },
55
+ { value: "name", label: labels.list.columnName },
56
+ { value: "bookedTotal", label: labels.list.columnBookedTotal },
57
+ { value: "createdAt", label: labels.list.columnCreatedAt },
58
+ { value: "updatedAt", label: labels.list.columnUpdatedAt },
59
+ ];
60
+ return (_jsxs("div", { children: [_jsxs("div", { className: "flex flex-wrap items-end justify-between gap-4", children: [_jsxs("div", { children: [_jsx("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: labels.list.title }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: labels.list.subtitle })] }), _jsx(NewCompanyDialog, { adapter: adapter, labels: labels })] }), _jsxs("div", { className: "mt-6 flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "relative w-full max-w-sm", children: [_jsx(Search, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { value: search, onChange: (event) => setSearch(event.target.value), placeholder: labels.list.searchPlaceholder, className: "pl-9" })] }), _jsxs("label", { className: "flex cursor-pointer items-center gap-2 text-sm text-muted-foreground", children: [_jsx("input", { type: "checkbox", checked: showArchived, onChange: (event) => setShowArchived(event.target.checked), className: "size-4" }), labels.list.showArchived] }), _jsx(SortControl, { columns: sortColumns, sort: view.sort, direction: view.direction, onSort: view.setSort, onDirection: view.setDirection, labels: labels })] }), companiesQuery.isError ? (_jsx("div", { className: "mt-4", children: _jsx(ErrorState, { error: companiesQuery.error, onRetry: () => companiesQuery.refetch() }) })) : companiesQuery.isLoading ? (_jsx("div", { className: "mt-4", children: _jsx(TableSkeleton, { rows: 6, columns: 3 }) })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "mt-4 hidden overflow-hidden rounded-xl border border-border bg-card sm:block", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { className: "bg-muted/40", children: [_jsx(TableHead, { children: labels.list.columnCode }), _jsx(TableHead, { children: labels.list.columnName }), _jsx(TableHead, { className: "text-right", children: labels.list.columnBookedTotal }), _jsx(TableHead, { children: labels.list.columnCreatedAt }), _jsx(TableHead, { children: labels.list.columnUpdatedAt })] }) }), _jsxs(TableBody, { children: [view.pageRows.map((company) => {
61
+ const companyTotals = totals.get(company.id) ?? EMPTY_TOTALS;
62
+ return (_jsxs(TableRow, { className: cn("cursor-pointer", company.archivedAt && "opacity-60"), onClick: () => adapter.openCompany(company.id), children: [_jsx(TableCell, { className: "font-mono font-medium text-foreground", children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [company.code, company.archivedAt && (_jsx("span", { className: "inline-flex items-center rounded-md bg-muted px-1.5 py-0.5 font-sans text-xs font-medium text-muted-foreground", children: labels.list.archivedBadge }))] }) }), _jsx(TableCell, { className: "text-foreground", children: company.name }), _jsx(TableCell, { className: "text-right tabular-nums", children: totalsReady ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "font-medium text-foreground", children: formatters.formatMoney(companyTotals.totalAmount) }), _jsx("div", { className: "text-xs text-muted-foreground", children: labels.list.invoiceCount(companyTotals.invoiceCount) })] })) : (_jsxs(_Fragment, { children: [_jsx(Skeleton, { className: "ml-auto h-4 w-24" }), _jsx(Skeleton, { className: "ml-auto mt-1.5 h-3 w-16" })] })) }), _jsx(TableCell, { className: "whitespace-nowrap text-sm text-muted-foreground", children: formatters.formatDate(company.createdAt) }), _jsx(TableCell, { className: "whitespace-nowrap text-sm text-muted-foreground", children: formatters.formatDate(company.updatedAt ?? company.createdAt) })] }, company.id));
63
+ }), view.total === 0 && (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 5, className: "py-12 text-center text-muted-foreground", children: labels.list.empty }) }))] })] }) }), _jsx("div", { className: "mt-4 space-y-3 sm:hidden", children: view.total === 0 ? (_jsx("p", { className: "rounded-xl border border-border bg-card px-4 py-12 text-center text-sm text-muted-foreground", children: labels.list.empty })) : (view.pageRows.map((company) => {
64
+ const companyTotals = totals.get(company.id) ?? EMPTY_TOTALS;
65
+ return (_jsxs("div", { className: "cursor-pointer rounded-xl border border-border bg-card p-4", onClick: () => adapter.openCompany(company.id), children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "font-mono font-medium text-foreground", children: company.code }), _jsx("div", { className: "mt-0.5 text-sm text-muted-foreground", children: company.name })] }), _jsx("div", { className: "shrink-0 text-right", children: totalsReady ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "font-medium tabular-nums text-foreground", children: formatters.formatMoney(companyTotals.totalAmount) }), _jsx("div", { className: "text-xs text-muted-foreground", children: labels.list.invoiceCount(companyTotals.invoiceCount) })] })) : (_jsxs(_Fragment, { children: [_jsx(Skeleton, { className: "ml-auto h-4 w-24" }), _jsx(Skeleton, { className: "ml-auto mt-1.5 h-3 w-16" })] })) })] }), _jsxs("div", { className: "mt-3 flex items-center justify-between border-t border-border pt-2 text-xs text-muted-foreground", children: [_jsxs("span", { children: [labels.list.columnCreatedAt, ": ", formatters.formatDate(company.createdAt)] }), _jsxs("span", { children: [labels.list.columnUpdatedAt, ":", " ", formatters.formatDate(company.updatedAt ?? company.createdAt)] })] })] }, company.id));
66
+ })) })] })), !companiesQuery.isError && !companiesQuery.isLoading && view.total > 0 && (_jsx(TablePagination, { page: view.page, totalPages: view.totalPages, pageSize: view.pageSize, total: view.total, from: view.from, to: view.to, onPage: view.setPage, onPageSize: view.setPageSize }))] }));
67
+ }
68
+ function NewCompanyDialog({ adapter, labels, }) {
69
+ const [open, setOpen] = useState(false);
70
+ const [code, setCode] = useState("");
71
+ const [name, setName] = useState("");
72
+ const [errors, setErrors] = useState({});
73
+ const [isCreating, setIsCreating] = useState(false);
74
+ // Clear a field's error as soon as it is touched, not only on the next submit.
75
+ const clearError = (field) => setErrors((previous) => (previous[field] ? { ...previous, [field]: "" } : previous));
76
+ async function create() {
77
+ const validated = validateCompanyForm({ code, name }, labels.validation);
78
+ if (Object.keys(validated.errors).length > 0) {
79
+ setErrors(validated.errors);
80
+ return;
81
+ }
82
+ setErrors({});
83
+ setIsCreating(true);
84
+ try {
85
+ await adapter.createCompany({ code: validated.code, name: validated.name });
86
+ toast.success(labels.list.createdToast);
87
+ setCode("");
88
+ setName("");
89
+ setOpen(false);
90
+ }
91
+ catch (error) {
92
+ toast.error(labels.list.createFailedToast(readableErrorMessage(error, "")));
93
+ }
94
+ finally {
95
+ setIsCreating(false);
96
+ }
97
+ }
98
+ return (_jsxs(Dialog, { open: open, onOpenChange: (next) => {
99
+ setOpen(next);
100
+ if (next)
101
+ setErrors({});
102
+ }, children: [_jsx(DialogTrigger, { asChild: true, children: _jsxs(Button, { className: "gap-2", children: [_jsx(Plus, { className: "size-4" }), " ", labels.list.newCompanyButton] }) }), _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: labels.list.newCompanyTitle }), _jsx(DialogDescription, { children: labels.list.newCompanyDescription })] }), _jsxs("div", { className: "grid gap-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs(Label, { className: "text-xs text-muted-foreground", children: [labels.list.codeFieldLabel, " ", _jsx(RequiredMark, { title: labels.requiredFieldTitle })] }), _jsx(Input, { value: code, onChange: (event) => {
103
+ setCode(event.target.value);
104
+ clearError("code");
105
+ }, placeholder: labels.list.codeFieldPlaceholder, "aria-invalid": !!errors.code }), _jsx(FieldErrorText, { text: errors.code })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs(Label, { className: "text-xs text-muted-foreground", children: [labels.list.nameFieldLabel, " ", _jsx(RequiredMark, { title: labels.requiredFieldTitle })] }), _jsx(Input, { value: name, onChange: (event) => {
106
+ setName(event.target.value);
107
+ clearError("name");
108
+ }, placeholder: labels.list.nameFieldPlaceholder, "aria-invalid": !!errors.name }), _jsx(FieldErrorText, { text: errors.name })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(false), children: labels.list.cancel }), _jsx(Button, { onClick: create, disabled: isCreating, children: isCreating ? labels.list.creating : labels.list.create })] })] })] }));
109
+ }
@@ -0,0 +1,8 @@
1
+ import { type CompaniesAdapter } from "../../adapters/companies";
2
+ import type { CompaniesLabels } from "./labels";
3
+ export declare function KnownSpellingsCard({ adapter, companyCode, labels, className, }: {
4
+ adapter: CompaniesAdapter;
5
+ companyCode: string;
6
+ labels: CompaniesLabels["aliases"];
7
+ className?: string;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from "react";
3
+ import { Plus, X } from "lucide-react";
4
+ import { toast } from "sonner";
5
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "../../ui/alert-dialog.js";
6
+ import { Button } from "../../ui/button.js";
7
+ import { Input } from "../../ui/input.js";
8
+ import { readableErrorMessage } from "../../components/feedback/query-states.js";
9
+ import { aliasAlreadyExistsError, aliasClaimedByAnotherEntityError, } from "../../adapters/companies.js";
10
+ // The same fold the backend's uniqueness check uses, so both agree on what a duplicate is.
11
+ function foldedSpelling(value) {
12
+ return value.trim().toLowerCase().replace(/\s+/g, " ");
13
+ }
14
+ export function KnownSpellingsCard({ adapter, companyCode, labels, className, }) {
15
+ const aliasesQuery = adapter.useCompanyAliases(companyCode);
16
+ const [newAlias, setNewAlias] = useState("");
17
+ const [isAdding, setIsAdding] = useState(false);
18
+ const [removingAliasId, setRemovingAliasId] = useState(null);
19
+ const activeAliases = useMemo(() => (aliasesQuery.data ?? []).filter((alias) => alias.isActive), [aliasesQuery.data]);
20
+ async function addAlias() {
21
+ const value = newAlias.trim();
22
+ if (activeAliases.some((alias) => foldedSpelling(alias.alias) === foldedSpelling(value))) {
23
+ toast.error(labels.alreadyExistsToast);
24
+ return;
25
+ }
26
+ setIsAdding(true);
27
+ try {
28
+ await adapter.addCompanyAlias({ companyCode, alias: value });
29
+ setNewAlias("");
30
+ toast.success(labels.addedToast(value));
31
+ }
32
+ catch (error) {
33
+ const reason = readableErrorMessage(error, "");
34
+ if (reason === aliasClaimedByAnotherEntityError) {
35
+ toast.error(labels.claimedByOtherToast(value));
36
+ }
37
+ else if (reason === aliasAlreadyExistsError) {
38
+ toast.error(labels.alreadyExistsToast);
39
+ }
40
+ else {
41
+ toast.error(labels.addFailedToast(reason));
42
+ }
43
+ }
44
+ finally {
45
+ setIsAdding(false);
46
+ }
47
+ }
48
+ async function removeAlias(alias) {
49
+ setRemovingAliasId(alias.id);
50
+ try {
51
+ await adapter.removeCompanyAlias({ aliasId: alias.id });
52
+ toast.success(labels.removedToast(alias.alias));
53
+ }
54
+ catch (error) {
55
+ toast.error(labels.addFailedToast(readableErrorMessage(error, "")));
56
+ }
57
+ finally {
58
+ setRemovingAliasId(null);
59
+ }
60
+ }
61
+ return (_jsxs("section", { className: `rounded-xl border border-border bg-card p-5 ${className ?? ""}`, children: [_jsxs("div", { className: "mb-1 flex items-center justify-between gap-2", children: [_jsx("h2", { className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground", children: labels.title }), activeAliases.length > 0 && (_jsx("span", { className: "text-xs tabular-nums text-muted-foreground", children: labels.count(activeAliases.length) }))] }), _jsx("p", { className: "mb-4 text-xs text-muted-foreground", children: labels.hint }), _jsxs("div", { className: "mb-3 flex items-center gap-2", children: [_jsx(Input, { value: newAlias, onChange: (event) => setNewAlias(event.target.value), placeholder: labels.placeholder, className: "text-sm", onKeyDown: (event) => {
62
+ if (event.key === "Enter" && newAlias.trim())
63
+ event.currentTarget.blur();
64
+ } }), _jsxs(Button, { size: "sm", variant: "outline", className: "shrink-0 gap-1.5", disabled: !newAlias.trim() || isAdding, onClick: addAlias, children: [_jsx(Plus, { className: "size-3.5" }), " ", labels.add] })] }), _jsxs("ul", { className: "max-h-[18rem] space-y-1.5 overflow-y-auto pr-1", children: [activeAliases.map((alias) => (_jsxs("li", { className: "flex items-center justify-between gap-2 rounded-md bg-muted/40 px-3 py-2 text-xs", children: [_jsx("span", { className: "min-w-0 truncate text-foreground", children: alias.alias }), _jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: _jsx("button", { className: "flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-destructive", "aria-label": labels.remove, children: _jsx(X, { className: "size-3.5" }) }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: labels.confirmTitle }), _jsx(AlertDialogDescription, { children: labels.confirmDescription(alias.alias) })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: labels.confirmCancel }), _jsx(AlertDialogAction, { disabled: removingAliasId === alias.id, onClick: () => removeAlias(alias), className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", children: labels.confirmRemove })] })] })] })] }, alias.id))), activeAliases.length === 0 && (_jsx("li", { className: "rounded-md border border-dashed border-border py-6 text-center text-xs text-muted-foreground", children: labels.empty }))] })] }));
65
+ }
@@ -0,0 +1,105 @@
1
+ export interface CompaniesLabels {
2
+ requiredFieldTitle: string;
3
+ sortLabel: string;
4
+ sortAscending: string;
5
+ sortDescending: string;
6
+ validation: {
7
+ codeRequired: string;
8
+ codeTooLong: string;
9
+ codeInvalidCharacters: string;
10
+ nameRequired: string;
11
+ };
12
+ list: {
13
+ title: string;
14
+ subtitle: string;
15
+ searchPlaceholder: string;
16
+ showArchived: string;
17
+ archivedBadge: string;
18
+ columnCode: string;
19
+ columnName: string;
20
+ columnBookedTotal: string;
21
+ columnCreatedAt: string;
22
+ columnUpdatedAt: string;
23
+ invoiceCount: (count: number) => string;
24
+ empty: string;
25
+ newCompanyButton: string;
26
+ newCompanyTitle: string;
27
+ newCompanyDescription: string;
28
+ codeFieldLabel: string;
29
+ codeFieldPlaceholder: string;
30
+ nameFieldLabel: string;
31
+ nameFieldPlaceholder: string;
32
+ cancel: string;
33
+ create: string;
34
+ creating: string;
35
+ createdToast: string;
36
+ createFailedToast: (error: string) => string;
37
+ };
38
+ detail: {
39
+ backToList: string;
40
+ notFoundTitle: string;
41
+ goToList: string;
42
+ edit: string;
43
+ restore: string;
44
+ archive: string;
45
+ archiveDialogTitle: string;
46
+ archiveDialogDescription: string;
47
+ archiveDialogInvoiceNote: (count: number) => string;
48
+ archiveReasonPlaceholder: string;
49
+ archiveCancel: string;
50
+ archiveConfirm: string;
51
+ archivedToast: string;
52
+ archiveFailedToast: (error: string) => string;
53
+ restoredToast: string;
54
+ restoreFailedToast: (error: string) => string;
55
+ archivedBanner: (date: string, reason: string) => string;
56
+ archivedWithoutReason: string;
57
+ masterDataSection: string;
58
+ bookedSection: string;
59
+ codeField: string;
60
+ nameField: string;
61
+ areaField: string;
62
+ areaNone: string;
63
+ areaLabel: (area: string) => string;
64
+ propertiesHeading: string;
65
+ invoiceTotalCaption: (count: number) => string;
66
+ foreignPropertiesWarning: (count: number, totalAmount: string) => string;
67
+ foreignPropertyHint: (propertyCode: string, companyCodes: string) => string;
68
+ columnInvoice: string;
69
+ columnProperty: string;
70
+ columnDate: string;
71
+ columnAmount: string;
72
+ columnStatus: string;
73
+ withoutInvoiceNumber: string;
74
+ invoicesEmpty: string;
75
+ loadMoreRemaining: (count: number) => string;
76
+ invoiceStatusLabel: (status: string) => string;
77
+ editDialogTitle: string;
78
+ editDialogDescription: string;
79
+ cancel: string;
80
+ save: string;
81
+ saving: string;
82
+ savedToast: string;
83
+ noChangesToast: string;
84
+ saveFailedToast: (error: string) => string;
85
+ };
86
+ aliases: {
87
+ title: string;
88
+ count: (count: number) => string;
89
+ hint: string;
90
+ placeholder: string;
91
+ add: string;
92
+ addedToast: (alias: string) => string;
93
+ alreadyExistsToast: string;
94
+ claimedByOtherToast: (alias: string) => string;
95
+ addFailedToast: (error: string) => string;
96
+ removedToast: (alias: string) => string;
97
+ remove: string;
98
+ confirmTitle: string;
99
+ confirmDescription: (alias: string) => string;
100
+ confirmCancel: string;
101
+ confirmRemove: string;
102
+ empty: string;
103
+ };
104
+ }
105
+ export declare const englishCompaniesLabels: CompaniesLabels;
@@ -0,0 +1,104 @@
1
+ export const englishCompaniesLabels = {
2
+ requiredFieldTitle: "Required field",
3
+ sortLabel: "Sort by",
4
+ sortAscending: "Ascending",
5
+ sortDescending: "Descending",
6
+ validation: {
7
+ codeRequired: "Please enter a code.",
8
+ codeTooLong: "The code may be at most 16 characters long.",
9
+ codeInvalidCharacters: "The code may only contain letters and digits.",
10
+ nameRequired: "Please enter a name.",
11
+ },
12
+ list: {
13
+ title: "Companies",
14
+ subtitle: "All companies invoices are booked against.",
15
+ searchPlaceholder: "Search code or name …",
16
+ showArchived: "Show archived",
17
+ archivedBadge: "Archived",
18
+ columnCode: "Code",
19
+ columnName: "Name",
20
+ columnBookedTotal: "Booked",
21
+ columnCreatedAt: "Created",
22
+ columnUpdatedAt: "Updated",
23
+ invoiceCount: (count) => `${count} ${count === 1 ? "invoice" : "invoices"}`,
24
+ empty: "No companies found.",
25
+ newCompanyButton: "New company",
26
+ newCompanyTitle: "Create company",
27
+ newCompanyDescription: "Code and name of the new company.",
28
+ codeFieldLabel: "Code",
29
+ codeFieldPlaceholder: "e.g. ACME",
30
+ nameFieldLabel: "Name",
31
+ nameFieldPlaceholder: "e.g. Acme GmbH",
32
+ cancel: "Cancel",
33
+ create: "Create",
34
+ creating: "Creating …",
35
+ createdToast: "Company created.",
36
+ createFailedToast: (error) => `Creating the company failed: ${error}`,
37
+ },
38
+ detail: {
39
+ backToList: "Back to companies",
40
+ notFoundTitle: "Company not found.",
41
+ goToList: "Go to the company list",
42
+ edit: "Edit",
43
+ restore: "Restore",
44
+ archive: "Archive",
45
+ archiveDialogTitle: "Archive this company?",
46
+ archiveDialogDescription: "The company is hidden from the list but nothing is deleted. It can be restored at any time.",
47
+ archiveDialogInvoiceNote: (count) => `${count} ${count === 1 ? "invoice is" : "invoices are"} booked against it.`,
48
+ archiveReasonPlaceholder: "Reason for archiving …",
49
+ archiveCancel: "Cancel",
50
+ archiveConfirm: "Archive",
51
+ archivedToast: "Company archived.",
52
+ archiveFailedToast: (error) => `Archiving failed: ${error}`,
53
+ restoredToast: "Company restored.",
54
+ restoreFailedToast: (error) => `Restoring failed: ${error}`,
55
+ archivedBanner: (date, reason) => `Archived on ${date} — ${reason}`,
56
+ archivedWithoutReason: "no reason given",
57
+ masterDataSection: "Master data",
58
+ bookedSection: "Booked invoices",
59
+ codeField: "Code",
60
+ nameField: "Name",
61
+ areaField: "Area of responsibility",
62
+ areaNone: "None",
63
+ areaLabel: (area) => area,
64
+ propertiesHeading: "Properties",
65
+ invoiceTotalCaption: (count) => `Total (${count} ${count === 1 ? "invoice" : "invoices"})`,
66
+ foreignPropertiesWarning: (count, totalAmount) => `${count} ${count === 1 ? "invoice is" : "invoices are"} booked against properties that belong to a different company (${totalAmount}).`,
67
+ foreignPropertyHint: (propertyCode, companyCodes) => `Property ${propertyCode} belongs to: ${companyCodes}`,
68
+ columnInvoice: "Invoice",
69
+ columnProperty: "Property",
70
+ columnDate: "Date",
71
+ columnAmount: "Amount",
72
+ columnStatus: "Status",
73
+ withoutInvoiceNumber: "No number",
74
+ invoicesEmpty: "No invoices yet.",
75
+ loadMoreRemaining: (count) => `${count} more — keep scrolling to load`,
76
+ invoiceStatusLabel: (status) => status,
77
+ editDialogTitle: "Edit company",
78
+ editDialogDescription: "Change the code, name or area of this company.",
79
+ cancel: "Cancel",
80
+ save: "Save",
81
+ saving: "Saving …",
82
+ savedToast: "Changes saved.",
83
+ noChangesToast: "Nothing was changed.",
84
+ saveFailedToast: (error) => `Saving failed: ${error}`,
85
+ },
86
+ aliases: {
87
+ title: "Known spellings",
88
+ count: (count) => `${count} ${count === 1 ? "entry" : "entries"}`,
89
+ hint: "Names on documents that should be recognized as this company.",
90
+ placeholder: "Add a spelling …",
91
+ add: "Add",
92
+ addedToast: (alias) => `"${alias}" added.`,
93
+ alreadyExistsToast: "This spelling already exists.",
94
+ claimedByOtherToast: (alias) => `"${alias}" is already used by another entry.`,
95
+ addFailedToast: (error) => `Adding the spelling failed: ${error}`,
96
+ removedToast: (alias) => `"${alias}" removed.`,
97
+ remove: "Remove spelling",
98
+ confirmTitle: "Remove this spelling?",
99
+ confirmDescription: (alias) => `"${alias}" will no longer be matched to this company.`,
100
+ confirmCancel: "Cancel",
101
+ confirmRemove: "Remove",
102
+ empty: "No spellings recorded yet.",
103
+ },
104
+ };
@@ -0,0 +1,17 @@
1
+ import type { SortDirection } from "./use-table-view";
2
+ export interface SortColumn {
3
+ value: string;
4
+ label: string;
5
+ }
6
+ export declare function SortControl({ columns, sort, direction, onSort, onDirection, labels, }: {
7
+ columns: SortColumn[];
8
+ sort: string;
9
+ direction: SortDirection;
10
+ onSort: (key: string) => void;
11
+ onDirection: (direction: SortDirection) => void;
12
+ labels: {
13
+ sortLabel: string;
14
+ sortAscending: string;
15
+ sortDescending: string;
16
+ };
17
+ }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Combobox } from "../../ui/combobox.js";
3
+ export function SortControl({ columns, sort, direction, onSort, onDirection, labels, }) {
4
+ return (_jsxs("div", { className: "flex w-full flex-wrap items-center gap-2 sm:w-auto", children: [_jsx("span", { className: "hidden shrink-0 text-sm text-muted-foreground sm:inline", children: labels.sortLabel }), _jsx(Combobox, { value: sort, onValueChange: onSort, className: "w-full sm:w-48", options: columns }), _jsx(Combobox, { value: direction, onValueChange: (value) => onDirection(value), className: "w-full sm:w-40", options: [
5
+ { value: "asc", label: labels.sortAscending },
6
+ { value: "desc", label: labels.sortDescending },
7
+ ] })] }));
8
+ }
@@ -0,0 +1,6 @@
1
+ export declare function useInfiniteRows<Row>(rows: Row[], pageSize?: number): {
2
+ visible: Row[];
3
+ hasMore: boolean;
4
+ sentinelRef: (node: HTMLElement | null) => void;
5
+ total: number;
6
+ };
@@ -0,0 +1,24 @@
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
+ // Reveals a long list one page at a time as the reader scrolls; windows rendering, not fetching.
3
+ export function useInfiniteRows(rows, pageSize = 25) {
4
+ const [visibleCount, setVisibleCount] = useState(pageSize);
5
+ const observerRef = useRef(null);
6
+ useEffect(() => {
7
+ setVisibleCount(pageSize);
8
+ }, [rows, pageSize]);
9
+ const hasMore = visibleCount < rows.length;
10
+ // Callback ref because the sentinel row mounts and unmounts as the list grows.
11
+ const sentinelRef = useCallback((node) => {
12
+ observerRef.current?.disconnect();
13
+ if (!node || !hasMore)
14
+ return;
15
+ observerRef.current = new IntersectionObserver((entries) => {
16
+ if (entries.some((entry) => entry.isIntersecting)) {
17
+ setVisibleCount((count) => Math.min(count + pageSize, rows.length));
18
+ }
19
+ }, { rootMargin: "120px" });
20
+ observerRef.current.observe(node);
21
+ }, [hasMore, pageSize, rows.length]);
22
+ useEffect(() => () => observerRef.current?.disconnect(), []);
23
+ return { visible: rows.slice(0, visibleCount), hasMore, sentinelRef, total: rows.length };
24
+ }
@@ -0,0 +1,23 @@
1
+ export type SortDirection = "asc" | "desc";
2
+ export interface TableView<Row> {
3
+ pageRows: Row[];
4
+ sort: string;
5
+ direction: SortDirection;
6
+ setSort: (key: string) => void;
7
+ setDirection: (direction: SortDirection) => void;
8
+ page: number;
9
+ setPage: (page: number) => void;
10
+ pageSize: number;
11
+ setPageSize: (size: number) => void;
12
+ total: number;
13
+ totalPages: number;
14
+ from: number;
15
+ to: number;
16
+ }
17
+ export declare function useTableView<Row>(rows: Row[], options: {
18
+ sortValue: (row: Row, key: string) => string | number;
19
+ initialSort: string;
20
+ initialDirection?: SortDirection;
21
+ initialPageSize?: number;
22
+ resetKey?: string;
23
+ }): TableView<Row>;
@@ -0,0 +1,56 @@
1
+ import { useMemo, useState } from "react";
2
+ // Client-side sort and pagination for small lists; resetKey returns to page 1 when it changes.
3
+ export function useTableView(rows, options) {
4
+ const { sortValue, initialSort, initialDirection = "asc", initialPageSize = 25, resetKey, } = options;
5
+ const [sort, setSortState] = useState(initialSort);
6
+ const [direction, setDirectionState] = useState(initialDirection);
7
+ const [page, setPage] = useState(1);
8
+ const [pageSize, setPageSize] = useState(initialPageSize);
9
+ // Adjust state during render so a filter change lands on page 1 without an extra paint.
10
+ const [seenResetKey, setSeenResetKey] = useState(resetKey);
11
+ if (resetKey !== seenResetKey) {
12
+ setSeenResetKey(resetKey);
13
+ setPage(1);
14
+ }
15
+ const sortedRows = useMemo(() => {
16
+ const copy = [...rows];
17
+ copy.sort((first, second) => {
18
+ const firstValue = sortValue(first, sort);
19
+ const secondValue = sortValue(second, sort);
20
+ const comparison = typeof firstValue === "number" && typeof secondValue === "number"
21
+ ? firstValue - secondValue
22
+ : String(firstValue).localeCompare(String(secondValue));
23
+ return direction === "asc" ? comparison : -comparison;
24
+ });
25
+ return copy;
26
+ }, [rows, sort, direction, sortValue]);
27
+ const total = sortedRows.length;
28
+ const totalPages = Math.max(1, Math.ceil(total / pageSize));
29
+ const safePage = Math.min(page, totalPages);
30
+ const from = total === 0 ? 0 : (safePage - 1) * pageSize + 1;
31
+ const to = Math.min(safePage * pageSize, total);
32
+ const pageRows = sortedRows.slice((safePage - 1) * pageSize, safePage * pageSize);
33
+ function setSort(key) {
34
+ setSortState(key);
35
+ setPage(1);
36
+ }
37
+ function setDirection(next) {
38
+ setDirectionState(next);
39
+ setPage(1);
40
+ }
41
+ return {
42
+ pageRows,
43
+ sort,
44
+ direction,
45
+ setSort,
46
+ setDirection,
47
+ page: safePage,
48
+ setPage,
49
+ pageSize,
50
+ setPageSize,
51
+ total,
52
+ totalPages,
53
+ from,
54
+ to,
55
+ };
56
+ }
@@ -0,0 +1,6 @@
1
+ import type { CustomersLabels } from "./labels";
2
+ export declare function CompanyChip({ code, labels, className, }: {
3
+ code: string | null | undefined;
4
+ labels: CustomersLabels["companyChip"];
5
+ className?: string;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/class-names.js";
3
+ // Company code chip; a missing company renders as a warning because invoices need one.
4
+ export function CompanyChip({ code, labels, className, }) {
5
+ if (!code) {
6
+ return (_jsx("span", { className: cn("inline-flex items-center whitespace-nowrap rounded-md bg-warning-soft px-2 py-0.5 text-xs font-medium text-warning", className), title: labels.missingTitle, children: labels.missing }));
7
+ }
8
+ return (_jsx("span", { className: cn("inline-flex items-center rounded-md bg-brand-tint px-2 py-0.5 font-mono text-xs font-medium text-brand-dark", className), children: code }));
9
+ }
@@ -0,0 +1,6 @@
1
+ import type { CustomersLabels } from "./labels";
2
+ export declare function CopyButton({ value, fieldLabel, labels, }: {
3
+ value: string;
4
+ fieldLabel: string;
5
+ labels: CustomersLabels["copy"];
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Check, Copy } from "lucide-react";
4
+ import { toast } from "sonner";
5
+ import { IconAction } from "../../ui/icon-action.js";
6
+ async function writeClipboard(text) {
7
+ try {
8
+ if (typeof navigator !== "undefined" && navigator.clipboard) {
9
+ await navigator.clipboard.writeText(text);
10
+ return true;
11
+ }
12
+ }
13
+ catch {
14
+ return false;
15
+ }
16
+ return false;
17
+ }
18
+ export function CopyButton({ value, fieldLabel, labels, }) {
19
+ const [copied, setCopied] = useState(false);
20
+ async function copyValue() {
21
+ if (await writeClipboard(value)) {
22
+ setCopied(true);
23
+ toast.success(labels.copied(fieldLabel));
24
+ window.setTimeout(() => setCopied(false), 1500);
25
+ }
26
+ else {
27
+ toast.error(labels.failed);
28
+ }
29
+ }
30
+ return (_jsx(IconAction, { label: labels.action(fieldLabel), className: "size-7 shrink-0", onClick: copyValue, children: copied ? _jsx(Check, { className: "size-3.5 text-brand" }) : _jsx(Copy, { className: "size-3.5" }) }));
31
+ }
@@ -0,0 +1,10 @@
1
+ import { type Formatters } from "../../lib/formatters";
2
+ import type { CustomersAdapter } from "../../adapters/customers";
3
+ import { type CustomersLabels } from "./labels";
4
+ export interface CustomerDetailPageProps {
5
+ adapter: CustomersAdapter;
6
+ customerId: string;
7
+ labels?: CustomersLabels;
8
+ formatters?: Formatters;
9
+ }
10
+ export declare function CustomerDetailPage({ adapter, customerId, labels, formatters, }: CustomerDetailPageProps): import("react").JSX.Element;