@dainamite/billing 0.17.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 (248) hide show
  1. package/CHANGELOG.md +658 -0
  2. package/LICENSE +21 -0
  3. package/README.md +77 -0
  4. package/dist/modules/billing/acl.js +20 -0
  5. package/dist/modules/billing/acl.js.map +7 -0
  6. package/dist/modules/billing/api/accounts/route.js +182 -0
  7. package/dist/modules/billing/api/accounts/route.js.map +7 -0
  8. package/dist/modules/billing/api/export/account/[id]/route.js +170 -0
  9. package/dist/modules/billing/api/export/account/[id]/route.js.map +7 -0
  10. package/dist/modules/billing/api/invoices/[id]/route.js +85 -0
  11. package/dist/modules/billing/api/invoices/[id]/route.js.map +7 -0
  12. package/dist/modules/billing/api/invoices/add-line/route.js +69 -0
  13. package/dist/modules/billing/api/invoices/add-line/route.js.map +7 -0
  14. package/dist/modules/billing/api/invoices/edit-line/route.js +78 -0
  15. package/dist/modules/billing/api/invoices/edit-line/route.js.map +7 -0
  16. package/dist/modules/billing/api/invoices/post/route.js +74 -0
  17. package/dist/modules/billing/api/invoices/post/route.js.map +7 -0
  18. package/dist/modules/billing/api/invoices/remove-line/route.js +69 -0
  19. package/dist/modules/billing/api/invoices/remove-line/route.js.map +7 -0
  20. package/dist/modules/billing/api/invoices/route.js +109 -0
  21. package/dist/modules/billing/api/invoices/route.js.map +7 -0
  22. package/dist/modules/billing/api/items/bulk/route.js +74 -0
  23. package/dist/modules/billing/api/items/bulk/route.js.map +7 -0
  24. package/dist/modules/billing/api/items/route.js +224 -0
  25. package/dist/modules/billing/api/items/route.js.map +7 -0
  26. package/dist/modules/billing/api/openapi.js +25 -0
  27. package/dist/modules/billing/api/openapi.js.map +7 -0
  28. package/dist/modules/billing/api/run-outcomes/route.js +122 -0
  29. package/dist/modules/billing/api/run-outcomes/route.js.map +7 -0
  30. package/dist/modules/billing/api/runs/retry-failed/route.js +70 -0
  31. package/dist/modules/billing/api/runs/retry-failed/route.js.map +7 -0
  32. package/dist/modules/billing/api/runs/route.js +143 -0
  33. package/dist/modules/billing/api/runs/route.js.map +7 -0
  34. package/dist/modules/billing/api/test-invoices/wipe/route.js +65 -0
  35. package/dist/modules/billing/api/test-invoices/wipe/route.js.map +7 -0
  36. package/dist/modules/billing/api/usage/route.js +138 -0
  37. package/dist/modules/billing/api/usage/route.js.map +7 -0
  38. package/dist/modules/billing/backend/billing/accounts/[id]/page.js +402 -0
  39. package/dist/modules/billing/backend/billing/accounts/[id]/page.js.map +7 -0
  40. package/dist/modules/billing/backend/billing/accounts/[id]/page.meta.js +25 -0
  41. package/dist/modules/billing/backend/billing/accounts/[id]/page.meta.js.map +7 -0
  42. package/dist/modules/billing/backend/billing/accounts/create/page.js +82 -0
  43. package/dist/modules/billing/backend/billing/accounts/create/page.js.map +7 -0
  44. package/dist/modules/billing/backend/billing/accounts/create/page.meta.js +25 -0
  45. package/dist/modules/billing/backend/billing/accounts/create/page.meta.js.map +7 -0
  46. package/dist/modules/billing/backend/billing/accounts/page.js +173 -0
  47. package/dist/modules/billing/backend/billing/accounts/page.js.map +7 -0
  48. package/dist/modules/billing/backend/billing/accounts/page.meta.js +18 -0
  49. package/dist/modules/billing/backend/billing/accounts/page.meta.js.map +7 -0
  50. package/dist/modules/billing/backend/billing/invoices/[id]/page.js +500 -0
  51. package/dist/modules/billing/backend/billing/invoices/[id]/page.js.map +7 -0
  52. package/dist/modules/billing/backend/billing/invoices/[id]/page.meta.js +25 -0
  53. package/dist/modules/billing/backend/billing/invoices/[id]/page.meta.js.map +7 -0
  54. package/dist/modules/billing/backend/billing/invoices/page.js +187 -0
  55. package/dist/modules/billing/backend/billing/invoices/page.js.map +7 -0
  56. package/dist/modules/billing/backend/billing/invoices/page.meta.js +18 -0
  57. package/dist/modules/billing/backend/billing/invoices/page.meta.js.map +7 -0
  58. package/dist/modules/billing/backend/billing/items/[id]/page.js +265 -0
  59. package/dist/modules/billing/backend/billing/items/[id]/page.js.map +7 -0
  60. package/dist/modules/billing/backend/billing/items/[id]/page.meta.js +25 -0
  61. package/dist/modules/billing/backend/billing/items/[id]/page.meta.js.map +7 -0
  62. package/dist/modules/billing/backend/billing/items/create/page.js +90 -0
  63. package/dist/modules/billing/backend/billing/items/create/page.js.map +7 -0
  64. package/dist/modules/billing/backend/billing/items/create/page.meta.js +25 -0
  65. package/dist/modules/billing/backend/billing/items/create/page.meta.js.map +7 -0
  66. package/dist/modules/billing/backend/billing/items/page.js +208 -0
  67. package/dist/modules/billing/backend/billing/items/page.js.map +7 -0
  68. package/dist/modules/billing/backend/billing/items/page.meta.js +18 -0
  69. package/dist/modules/billing/backend/billing/items/page.meta.js.map +7 -0
  70. package/dist/modules/billing/backend/billing/runs/[id]/page.js +293 -0
  71. package/dist/modules/billing/backend/billing/runs/[id]/page.js.map +7 -0
  72. package/dist/modules/billing/backend/billing/runs/[id]/page.meta.js +21 -0
  73. package/dist/modules/billing/backend/billing/runs/[id]/page.meta.js.map +7 -0
  74. package/dist/modules/billing/backend/billing/runs/page.js +341 -0
  75. package/dist/modules/billing/backend/billing/runs/page.js.map +7 -0
  76. package/dist/modules/billing/backend/billing/runs/page.meta.js +18 -0
  77. package/dist/modules/billing/backend/billing/runs/page.meta.js.map +7 -0
  78. package/dist/modules/billing/backend/billing/usage/create/page.js +100 -0
  79. package/dist/modules/billing/backend/billing/usage/create/page.js.map +7 -0
  80. package/dist/modules/billing/backend/billing/usage/create/page.meta.js +25 -0
  81. package/dist/modules/billing/backend/billing/usage/create/page.meta.js.map +7 -0
  82. package/dist/modules/billing/ce.js +56 -0
  83. package/dist/modules/billing/ce.js.map +7 -0
  84. package/dist/modules/billing/cli.js +67 -0
  85. package/dist/modules/billing/cli.js.map +7 -0
  86. package/dist/modules/billing/commands/accounts.js +157 -0
  87. package/dist/modules/billing/commands/accounts.js.map +7 -0
  88. package/dist/modules/billing/commands/index.js +6 -0
  89. package/dist/modules/billing/commands/index.js.map +7 -0
  90. package/dist/modules/billing/commands/invoices.js +401 -0
  91. package/dist/modules/billing/commands/invoices.js.map +7 -0
  92. package/dist/modules/billing/commands/items.js +317 -0
  93. package/dist/modules/billing/commands/items.js.map +7 -0
  94. package/dist/modules/billing/commands/runs.js +123 -0
  95. package/dist/modules/billing/commands/runs.js.map +7 -0
  96. package/dist/modules/billing/commands/usage.js +88 -0
  97. package/dist/modules/billing/commands/usage.js.map +7 -0
  98. package/dist/modules/billing/components/AccountForm.js +420 -0
  99. package/dist/modules/billing/components/AccountForm.js.map +7 -0
  100. package/dist/modules/billing/components/DetailFields.js +37 -0
  101. package/dist/modules/billing/components/DetailFields.js.map +7 -0
  102. package/dist/modules/billing/components/ItemForm.js +440 -0
  103. package/dist/modules/billing/components/ItemForm.js.map +7 -0
  104. package/dist/modules/billing/components/LineFormDialog.js +195 -0
  105. package/dist/modules/billing/components/LineFormDialog.js.map +7 -0
  106. package/dist/modules/billing/components/UsageForm.js +262 -0
  107. package/dist/modules/billing/components/UsageForm.js.map +7 -0
  108. package/dist/modules/billing/data/entities.js +433 -0
  109. package/dist/modules/billing/data/entities.js.map +7 -0
  110. package/dist/modules/billing/data/entityIds.js +12 -0
  111. package/dist/modules/billing/data/entityIds.js.map +7 -0
  112. package/dist/modules/billing/data/validators.js +396 -0
  113. package/dist/modules/billing/data/validators.js.map +7 -0
  114. package/dist/modules/billing/di.js +6 -0
  115. package/dist/modules/billing/di.js.map +7 -0
  116. package/dist/modules/billing/events.js +35 -0
  117. package/dist/modules/billing/events.js.map +7 -0
  118. package/dist/modules/billing/i18n/en.json +336 -0
  119. package/dist/modules/billing/i18n/pl.json +336 -0
  120. package/dist/modules/billing/index.js +17 -0
  121. package/dist/modules/billing/index.js.map +7 -0
  122. package/dist/modules/billing/lib/billPeriod.js +101 -0
  123. package/dist/modules/billing/lib/billPeriod.js.map +7 -0
  124. package/dist/modules/billing/lib/billRunEngine.js +256 -0
  125. package/dist/modules/billing/lib/billRunEngine.js.map +7 -0
  126. package/dist/modules/billing/lib/billRunLabel.js +8 -0
  127. package/dist/modules/billing/lib/billRunLabel.js.map +7 -0
  128. package/dist/modules/billing/lib/idempotency.js +13 -0
  129. package/dist/modules/billing/lib/idempotency.js.map +7 -0
  130. package/dist/modules/billing/lib/invoiceStatus.js +38 -0
  131. package/dist/modules/billing/lib/invoiceStatus.js.map +7 -0
  132. package/dist/modules/billing/lib/invoiceWriter.js +153 -0
  133. package/dist/modules/billing/lib/invoiceWriter.js.map +7 -0
  134. package/dist/modules/billing/lib/itemSelector.js +77 -0
  135. package/dist/modules/billing/lib/itemSelector.js.map +7 -0
  136. package/dist/modules/billing/lib/seeds/demo.js +130 -0
  137. package/dist/modules/billing/lib/seeds/demo.js.map +7 -0
  138. package/dist/modules/billing/lib/tenantLock.js +32 -0
  139. package/dist/modules/billing/lib/tenantLock.js.map +7 -0
  140. package/dist/modules/billing/lib/usageRater.js +150 -0
  141. package/dist/modules/billing/lib/usageRater.js.map +7 -0
  142. package/dist/modules/billing/lib/usageRunner.js +82 -0
  143. package/dist/modules/billing/lib/usageRunner.js.map +7 -0
  144. package/dist/modules/billing/migrations/Migration20260519000000_billing.js +144 -0
  145. package/dist/modules/billing/migrations/Migration20260519000000_billing.js.map +7 -0
  146. package/dist/modules/billing/setup.js +190 -0
  147. package/dist/modules/billing/setup.js.map +7 -0
  148. package/dist/modules/billing/subscribers/payment-captured-to-paid.js +47 -0
  149. package/dist/modules/billing/subscribers/payment-captured-to-paid.js.map +7 -0
  150. package/dist/modules/billing/translations.js +5 -0
  151. package/dist/modules/billing/translations.js.map +7 -0
  152. package/dist/modules/billing/workers/reap-stale-bill-runs.js +31 -0
  153. package/dist/modules/billing/workers/reap-stale-bill-runs.js.map +7 -0
  154. package/package.json +148 -0
  155. package/src/modules/billing/__integration__/TC-BILL-001.spec.ts +116 -0
  156. package/src/modules/billing/__integration__/TC-BILL-002.spec.ts +169 -0
  157. package/src/modules/billing/__integration__/TC-BILL-003.spec.ts +28 -0
  158. package/src/modules/billing/__integration__/meta.ts +4 -0
  159. package/src/modules/billing/__tests__/commands/invoices.test.ts +464 -0
  160. package/src/modules/billing/__tests__/commands/itemsBulk.test.ts +284 -0
  161. package/src/modules/billing/__tests__/lib/billPeriod.test.ts +131 -0
  162. package/src/modules/billing/__tests__/lib/billRunEngine.test.ts +561 -0
  163. package/src/modules/billing/__tests__/lib/idempotency.test.ts +81 -0
  164. package/src/modules/billing/__tests__/lib/invoiceStatus.test.ts +97 -0
  165. package/src/modules/billing/__tests__/lib/invoiceWriter.test.ts +119 -0
  166. package/src/modules/billing/__tests__/lib/itemSelector.test.ts +192 -0
  167. package/src/modules/billing/__tests__/lib/seedsDemo.test.ts +86 -0
  168. package/src/modules/billing/__tests__/lib/tenantLock.test.ts +126 -0
  169. package/src/modules/billing/__tests__/lib/usageRater.test.ts +190 -0
  170. package/src/modules/billing/__tests__/package-isolation.test.ts +223 -0
  171. package/src/modules/billing/__tests__/setup.test.ts +107 -0
  172. package/src/modules/billing/__tests__/validators.test.ts +594 -0
  173. package/src/modules/billing/acl.ts +16 -0
  174. package/src/modules/billing/api/accounts/route.ts +198 -0
  175. package/src/modules/billing/api/export/account/[id]/route.ts +233 -0
  176. package/src/modules/billing/api/invoices/[id]/route.ts +143 -0
  177. package/src/modules/billing/api/invoices/add-line/route.ts +74 -0
  178. package/src/modules/billing/api/invoices/edit-line/route.ts +97 -0
  179. package/src/modules/billing/api/invoices/post/route.ts +97 -0
  180. package/src/modules/billing/api/invoices/remove-line/route.ts +75 -0
  181. package/src/modules/billing/api/invoices/route.ts +167 -0
  182. package/src/modules/billing/api/items/bulk/route.ts +92 -0
  183. package/src/modules/billing/api/items/route.ts +255 -0
  184. package/src/modules/billing/api/openapi.ts +33 -0
  185. package/src/modules/billing/api/run-outcomes/route.ts +149 -0
  186. package/src/modules/billing/api/runs/retry-failed/route.ts +88 -0
  187. package/src/modules/billing/api/runs/route.ts +170 -0
  188. package/src/modules/billing/api/test-invoices/wipe/route.ts +87 -0
  189. package/src/modules/billing/api/usage/route.ts +148 -0
  190. package/src/modules/billing/backend/billing/accounts/[id]/page.meta.ts +23 -0
  191. package/src/modules/billing/backend/billing/accounts/[id]/page.tsx +574 -0
  192. package/src/modules/billing/backend/billing/accounts/create/page.meta.ts +23 -0
  193. package/src/modules/billing/backend/billing/accounts/create/page.tsx +101 -0
  194. package/src/modules/billing/backend/billing/accounts/page.meta.ts +16 -0
  195. package/src/modules/billing/backend/billing/accounts/page.tsx +222 -0
  196. package/src/modules/billing/backend/billing/invoices/[id]/page.meta.ts +23 -0
  197. package/src/modules/billing/backend/billing/invoices/[id]/page.tsx +613 -0
  198. package/src/modules/billing/backend/billing/invoices/page.meta.ts +16 -0
  199. package/src/modules/billing/backend/billing/invoices/page.tsx +245 -0
  200. package/src/modules/billing/backend/billing/items/[id]/page.meta.ts +23 -0
  201. package/src/modules/billing/backend/billing/items/[id]/page.tsx +366 -0
  202. package/src/modules/billing/backend/billing/items/create/page.meta.ts +23 -0
  203. package/src/modules/billing/backend/billing/items/create/page.tsx +110 -0
  204. package/src/modules/billing/backend/billing/items/page.meta.ts +16 -0
  205. package/src/modules/billing/backend/billing/items/page.tsx +272 -0
  206. package/src/modules/billing/backend/billing/runs/[id]/page.meta.ts +19 -0
  207. package/src/modules/billing/backend/billing/runs/[id]/page.tsx +404 -0
  208. package/src/modules/billing/backend/billing/runs/page.meta.ts +16 -0
  209. package/src/modules/billing/backend/billing/runs/page.tsx +426 -0
  210. package/src/modules/billing/backend/billing/usage/create/page.meta.ts +23 -0
  211. package/src/modules/billing/backend/billing/usage/create/page.tsx +120 -0
  212. package/src/modules/billing/ce.ts +74 -0
  213. package/src/modules/billing/cli.ts +89 -0
  214. package/src/modules/billing/commands/accounts.ts +205 -0
  215. package/src/modules/billing/commands/index.ts +13 -0
  216. package/src/modules/billing/commands/invoices.ts +542 -0
  217. package/src/modules/billing/commands/items.ts +438 -0
  218. package/src/modules/billing/commands/runs.ts +166 -0
  219. package/src/modules/billing/commands/usage.ts +118 -0
  220. package/src/modules/billing/components/AccountForm.tsx +517 -0
  221. package/src/modules/billing/components/DetailFields.tsx +60 -0
  222. package/src/modules/billing/components/ItemForm.tsx +558 -0
  223. package/src/modules/billing/components/LineFormDialog.tsx +253 -0
  224. package/src/modules/billing/components/UsageForm.tsx +326 -0
  225. package/src/modules/billing/data/entities.ts +533 -0
  226. package/src/modules/billing/data/entityIds.ts +25 -0
  227. package/src/modules/billing/data/validators.ts +562 -0
  228. package/src/modules/billing/di.ts +14 -0
  229. package/src/modules/billing/events.ts +47 -0
  230. package/src/modules/billing/i18n/en.json +336 -0
  231. package/src/modules/billing/i18n/pl.json +336 -0
  232. package/src/modules/billing/index.ts +22 -0
  233. package/src/modules/billing/lib/billPeriod.ts +181 -0
  234. package/src/modules/billing/lib/billRunEngine.ts +416 -0
  235. package/src/modules/billing/lib/billRunLabel.ts +14 -0
  236. package/src/modules/billing/lib/idempotency.ts +46 -0
  237. package/src/modules/billing/lib/invoiceStatus.ts +61 -0
  238. package/src/modules/billing/lib/invoiceWriter.ts +260 -0
  239. package/src/modules/billing/lib/itemSelector.ts +154 -0
  240. package/src/modules/billing/lib/seeds/demo.ts +199 -0
  241. package/src/modules/billing/lib/tenantLock.ts +87 -0
  242. package/src/modules/billing/lib/usageRater.ts +250 -0
  243. package/src/modules/billing/lib/usageRunner.ts +189 -0
  244. package/src/modules/billing/migrations/Migration20260519000000_billing.ts +175 -0
  245. package/src/modules/billing/setup.ts +252 -0
  246. package/src/modules/billing/subscribers/payment-captured-to-paid.ts +89 -0
  247. package/src/modules/billing/translations.ts +9 -0
  248. package/src/modules/billing/workers/reap-stale-bill-runs.ts +57 -0
@@ -0,0 +1,293 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import Link from "next/link";
5
+ import { useParams } from "next/navigation";
6
+ import { useT } from "@open-mercato/shared/lib/i18n/context";
7
+ import { Page, PageBody, PageHeader } from "@open-mercato/ui/backend/Page";
8
+ import { FormHeader } from "@open-mercato/ui/backend/forms";
9
+ import { DataTable } from "@open-mercato/ui/backend/DataTable";
10
+ import { Tag } from "@open-mercato/ui/primitives/tag";
11
+ import { Button } from "@open-mercato/ui/primitives/button";
12
+ import { LoadingMessage, ErrorMessage } from "@open-mercato/ui/backend/detail";
13
+ import { flash } from "@open-mercato/ui/backend/FlashMessages";
14
+ import {
15
+ apiCallOrThrow,
16
+ readApiResultOrThrow
17
+ } from "@open-mercato/ui/backend/utils/apiCall";
18
+ import { normalizeCrudServerError } from "@open-mercato/ui/backend/utils/serverErrors";
19
+ import { billRunName } from "../../../../lib/billRunLabel.js";
20
+ import {
21
+ DetailCard,
22
+ DetailField,
23
+ Stat,
24
+ StatCard
25
+ } from "../../../../components/DetailFields.js";
26
+ function formatDate(value) {
27
+ if (!value) return "\u2014";
28
+ const parsed = new Date(value);
29
+ return Number.isNaN(parsed.getTime()) ? value : parsed.toLocaleString();
30
+ }
31
+ function runStatusVariant(status) {
32
+ switch (status) {
33
+ case "completed":
34
+ return "success";
35
+ case "partial_failure":
36
+ return "warning";
37
+ case "failed":
38
+ return "error";
39
+ default:
40
+ return "default";
41
+ }
42
+ }
43
+ function outcomeStatusVariant(status) {
44
+ switch (status) {
45
+ case "success":
46
+ return "success";
47
+ case "success_with_warnings":
48
+ return "warning";
49
+ case "failed":
50
+ return "error";
51
+ case "skipped_existing_draft":
52
+ default:
53
+ return "default";
54
+ }
55
+ }
56
+ function BillRunDetailPage(props) {
57
+ const t = useT();
58
+ const urlParams = useParams();
59
+ const runId = props.params?.id ?? urlParams?.id ?? "";
60
+ const [run, setRun] = React.useState(null);
61
+ const [runError, setRunError] = React.useState(null);
62
+ const [outcomes, setOutcomes] = React.useState([]);
63
+ const [outcomesPage, setOutcomesPage] = React.useState(1);
64
+ const [outcomesTotal, setOutcomesTotal] = React.useState(0);
65
+ const [outcomesTotalPages, setOutcomesTotalPages] = React.useState(1);
66
+ const [outcomesLoading, setOutcomesLoading] = React.useState(true);
67
+ const [retrying, setRetrying] = React.useState(false);
68
+ const loadRun = React.useCallback(async () => {
69
+ if (!runId) return;
70
+ setRunError(null);
71
+ try {
72
+ const result = await readApiResultOrThrow(
73
+ `/api/billing/runs?id=${runId}&pageSize=1`
74
+ );
75
+ const found = result.items?.[0];
76
+ if (!found) {
77
+ setRunError(t("billing.runs.detail.error.not_found", "Run not found"));
78
+ setRun(null);
79
+ return;
80
+ }
81
+ setRun(found);
82
+ } catch (err) {
83
+ const { message } = normalizeCrudServerError(err);
84
+ setRunError(message || t("billing.runs.detail.error.load", "Failed to load run"));
85
+ }
86
+ }, [runId, t]);
87
+ const loadOutcomes = React.useCallback(async () => {
88
+ if (!runId) return;
89
+ setOutcomesLoading(true);
90
+ try {
91
+ const params = new URLSearchParams({
92
+ billRunId: runId,
93
+ page: String(outcomesPage),
94
+ pageSize: "50"
95
+ });
96
+ const result = await readApiResultOrThrow(
97
+ `/api/billing/run-outcomes?${params.toString()}`
98
+ );
99
+ setOutcomes(result.items ?? []);
100
+ setOutcomesTotal(result.total ?? 0);
101
+ setOutcomesTotalPages(result.totalPages ?? 1);
102
+ } finally {
103
+ setOutcomesLoading(false);
104
+ }
105
+ }, [outcomesPage, runId]);
106
+ React.useEffect(() => {
107
+ void loadRun();
108
+ }, [loadRun]);
109
+ React.useEffect(() => {
110
+ void loadOutcomes();
111
+ }, [loadOutcomes]);
112
+ const failedCount = run?.summary?.accounts_failed ?? 0;
113
+ const handleRetryFailed = React.useCallback(async () => {
114
+ if (!run || failedCount === 0) return;
115
+ setRetrying(true);
116
+ try {
117
+ const call = await apiCallOrThrow(
118
+ "/api/billing/runs/retry-failed",
119
+ {
120
+ method: "POST",
121
+ headers: { "Content-Type": "application/json" },
122
+ body: JSON.stringify({ billRunId: run.id })
123
+ }
124
+ );
125
+ const outcomesCount = call.result?.outcomesCount ?? 0;
126
+ flash(
127
+ t("billing.runs.retry.success", "Retry run created") + ` (${outcomesCount} accounts)`,
128
+ "success"
129
+ );
130
+ void loadRun();
131
+ } catch (err) {
132
+ const { message } = normalizeCrudServerError(err);
133
+ flash(message || t("billing.runs.retry.error", "Retry failed"), "error");
134
+ } finally {
135
+ setRetrying(false);
136
+ }
137
+ }, [failedCount, loadRun, run, t]);
138
+ const outcomeColumns = React.useMemo(
139
+ () => [
140
+ {
141
+ accessorKey: "bill_account_id",
142
+ header: t("billing.runs.outcomes.columns.account", "Account"),
143
+ cell: ({ row }) => /* @__PURE__ */ jsx(
144
+ Link,
145
+ {
146
+ href: `/backend/billing/accounts/${row.original.bill_account_id}`,
147
+ className: "text-sm text-primary hover:underline",
148
+ children: row.original.bill_account_name ?? row.original.bill_account_id
149
+ }
150
+ )
151
+ },
152
+ {
153
+ accessorKey: "status",
154
+ header: t("billing.runs.outcomes.columns.status", "Status"),
155
+ cell: ({ row }) => /* @__PURE__ */ jsx(Tag, { variant: outcomeStatusVariant(row.original.status), children: row.original.status })
156
+ },
157
+ {
158
+ accessorKey: "draft_invoice_id",
159
+ header: t("billing.runs.outcomes.columns.invoice", "Invoice"),
160
+ cell: ({ row }) => row.original.draft_invoice_id ? /* @__PURE__ */ jsx(
161
+ Link,
162
+ {
163
+ href: `/backend/billing/invoices/${row.original.draft_invoice_id}`,
164
+ className: "text-sm text-primary hover:underline",
165
+ children: row.original.invoice_number ?? row.original.draft_invoice_id
166
+ }
167
+ ) : "\u2014"
168
+ },
169
+ {
170
+ accessorKey: "error_message",
171
+ header: t("billing.runs.outcomes.columns.error", "Error"),
172
+ cell: ({ row }) => row.original.error_message ?? "\u2014"
173
+ },
174
+ {
175
+ accessorKey: "warnings",
176
+ header: t("billing.runs.outcomes.columns.warnings", "Warnings"),
177
+ cell: ({ row }) => {
178
+ if (!row.original.warnings) return "\u2014";
179
+ return /* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: JSON.stringify(row.original.warnings) });
180
+ }
181
+ }
182
+ ],
183
+ [t]
184
+ );
185
+ if (runError) {
186
+ return /* @__PURE__ */ jsxs(Page, { children: [
187
+ /* @__PURE__ */ jsx(PageHeader, { title: t("billing.runs.detail.title", "Bill Run") }),
188
+ /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(ErrorMessage, { label: runError }) })
189
+ ] });
190
+ }
191
+ if (!run) {
192
+ return /* @__PURE__ */ jsxs(Page, { children: [
193
+ /* @__PURE__ */ jsx(PageHeader, { title: t("billing.runs.detail.title", "Bill Run") }),
194
+ /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(LoadingMessage, { label: t("billing.runs.detail.loading", "Loading run\u2026") }) })
195
+ ] });
196
+ }
197
+ return /* @__PURE__ */ jsxs(Page, { children: [
198
+ /* @__PURE__ */ jsx(
199
+ FormHeader,
200
+ {
201
+ mode: "detail",
202
+ backHref: "/backend/billing/runs",
203
+ entityTypeLabel: t("billing.runs.detail.title", "Bill Run"),
204
+ title: billRunName(run.as_of_date),
205
+ statusBadge: /* @__PURE__ */ jsx(Tag, { variant: runStatusVariant(run.status), children: run.status }),
206
+ actionsContent: failedCount > 0 ? /* @__PURE__ */ jsxs(Button, { disabled: retrying, onClick: handleRetryFailed, children: [
207
+ retrying ? t("billing.runs.retry.in_progress", "Retrying\u2026") : t("billing.runs.retry.action", "Retry failed accounts"),
208
+ ` (${failedCount})`
209
+ ] }) : null
210
+ }
211
+ ),
212
+ /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
213
+ /* @__PURE__ */ jsxs(DetailCard, { children: [
214
+ /* @__PURE__ */ jsx(DetailField, { label: t("billing.runs.detail.field.run_id", "Run ID"), children: /* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: run.id }) }),
215
+ /* @__PURE__ */ jsx(DetailField, { label: t("billing.runs.detail.field.triggered_by", "Trigger"), children: run.triggered_by }),
216
+ /* @__PURE__ */ jsx(DetailField, { label: t("billing.runs.detail.field.mode", "Mode"), children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
217
+ run.dry_run ? /* @__PURE__ */ jsx(Tag, { variant: "warning", children: t("billing.runs.mode.dry_run", "Dry-run") }) : run.test_mode ? /* @__PURE__ */ jsx(Tag, { variant: "warning", children: t("billing.runs.mode.test", "Test") }) : /* @__PURE__ */ jsx(Tag, { variant: "default", children: t("billing.runs.mode.real", "Real") }),
218
+ run.catch_up ? /* @__PURE__ */ jsx(Tag, { variant: "default", children: t("billing.runs.mode.catch_up", "Catch-up") }) : null
219
+ ] }) }),
220
+ /* @__PURE__ */ jsx(DetailField, { label: t("billing.runs.detail.field.as_of_date", "As-of date"), children: run.as_of_date?.slice(0, 10) ?? "\u2014" }),
221
+ /* @__PURE__ */ jsx(DetailField, { label: t("billing.runs.detail.field.started_at", "Started"), children: formatDate(run.started_at) }),
222
+ /* @__PURE__ */ jsx(DetailField, { label: t("billing.runs.detail.field.finished_at", "Finished"), children: formatDate(run.finished_at) }),
223
+ run.parent_run_id ? /* @__PURE__ */ jsx(DetailField, { label: t("billing.runs.detail.field.parent_run", "Parent run"), children: /* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: run.parent_run_id }) }) : null
224
+ ] }),
225
+ run.summary ? /* @__PURE__ */ jsxs(StatCard, { title: t("billing.runs.summary.title", "Summary"), children: [
226
+ /* @__PURE__ */ jsx(
227
+ Stat,
228
+ {
229
+ label: t("billing.runs.summary.accounts", "Accounts"),
230
+ value: run.summary.accounts_processed ?? 0
231
+ }
232
+ ),
233
+ /* @__PURE__ */ jsx(
234
+ Stat,
235
+ {
236
+ label: t("billing.runs.summary.drafts", "Drafts"),
237
+ value: run.summary.drafts_created ?? 0
238
+ }
239
+ ),
240
+ /* @__PURE__ */ jsx(
241
+ Stat,
242
+ {
243
+ label: t("billing.runs.summary.skipped", "Skipped"),
244
+ value: run.summary.drafts_skipped_existing ?? 0
245
+ }
246
+ ),
247
+ /* @__PURE__ */ jsx(
248
+ Stat,
249
+ {
250
+ label: t("billing.runs.summary.warnings", "Warnings"),
251
+ value: run.summary.accounts_with_warnings ?? 0
252
+ }
253
+ ),
254
+ /* @__PURE__ */ jsx(
255
+ Stat,
256
+ {
257
+ label: t("billing.runs.summary.failed", "Failed"),
258
+ value: run.summary.accounts_failed ?? 0
259
+ }
260
+ ),
261
+ /* @__PURE__ */ jsx(
262
+ Stat,
263
+ {
264
+ label: t("billing.runs.summary.usage", "Usage rated"),
265
+ value: run.summary.usage_records_rated ?? 0
266
+ }
267
+ )
268
+ ] }) : null,
269
+ /* @__PURE__ */ jsxs("div", { children: [
270
+ /* @__PURE__ */ jsx("h2", { className: "text-base font-semibold mb-2", children: t("billing.runs.outcomes.title", "Per-account outcomes") }),
271
+ /* @__PURE__ */ jsx(
272
+ DataTable,
273
+ {
274
+ columns: outcomeColumns,
275
+ data: outcomes,
276
+ isLoading: outcomesLoading,
277
+ pagination: {
278
+ page: outcomesPage,
279
+ pageSize: 50,
280
+ total: outcomesTotal,
281
+ totalPages: outcomesTotalPages,
282
+ onPageChange: setOutcomesPage
283
+ }
284
+ }
285
+ )
286
+ ] })
287
+ ] }) })
288
+ ] });
289
+ }
290
+ export {
291
+ BillRunDetailPage as default
292
+ };
293
+ //# sourceMappingURL=page.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/modules/billing/backend/billing/runs/%5Bid%5D/page.tsx"],
4
+ "sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { useParams } from 'next/navigation'\nimport type { ColumnDef } from '@tanstack/react-table'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Page, PageBody, PageHeader } from '@open-mercato/ui/backend/Page'\nimport { FormHeader } from '@open-mercato/ui/backend/forms'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport { Tag } from '@open-mercato/ui/primitives/tag'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport {\n apiCallOrThrow,\n readApiResultOrThrow,\n} from '@open-mercato/ui/backend/utils/apiCall'\nimport { normalizeCrudServerError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { billRunName } from '../../../../lib/billRunLabel'\nimport {\n DetailCard,\n DetailField,\n Stat,\n StatCard,\n} from '../../../../components/DetailFields'\n\n/**\n * Bill Run detail \u2014 header card + outcomes list.\n *\n * The \"Retry failed accounts\" button is enabled only when the run\n * has at least one failed outcome. It POSTs the\n * `billing.runs.retry_failed` endpoint, which creates a new run\n * scoped to those accounts (the new run shows up in the list at\n * `/backend/billing/runs`).\n */\n\n// API list rows are snake_case (see `api/runs/route.ts` +\n// `api/run-outcomes/route.ts` `fields`).\ntype BillRun = {\n id: string\n triggered_by: 'schedule' | 'manual'\n parent_run_id: string | null\n dry_run: boolean\n test_mode: boolean\n catch_up: boolean\n as_of_date: string\n started_at: string | null\n finished_at: string | null\n status: 'running' | 'completed' | 'partial_failure' | 'failed'\n summary: {\n accounts_processed?: number\n drafts_created?: number\n drafts_skipped_existing?: number\n accounts_failed?: number\n accounts_with_warnings?: number\n usage_records_rated?: number\n } | null\n organization_id: string\n tenant_id: string\n created_at: string\n updated_at: string\n}\n\ntype BillRunOutcome = {\n id: string\n bill_run_id: string\n bill_account_id: string\n bill_account_name: string | null\n status: 'success' | 'success_with_warnings' | 'skipped_existing_draft' | 'failed'\n error_message: string | null\n warnings: Record<string, unknown> | null\n draft_invoice_id: string | null\n invoice_number: string | null\n created_at: string\n}\n\ntype ListResponse<T> = {\n items: T[]\n total: number\n totalPages: number\n}\n\nfunction formatDate(value: string | null | undefined): string {\n if (!value) return '\u2014'\n const parsed = new Date(value)\n return Number.isNaN(parsed.getTime()) ? value : parsed.toLocaleString()\n}\n\nfunction runStatusVariant(\n status: BillRun['status'],\n): 'default' | 'success' | 'warning' | 'error' {\n switch (status) {\n case 'completed':\n return 'success'\n case 'partial_failure':\n return 'warning'\n case 'failed':\n return 'error'\n default:\n return 'default'\n }\n}\n\nfunction outcomeStatusVariant(\n status: BillRunOutcome['status'],\n): 'default' | 'success' | 'warning' | 'error' {\n switch (status) {\n case 'success':\n return 'success'\n case 'success_with_warnings':\n return 'warning'\n case 'failed':\n return 'error'\n case 'skipped_existing_draft':\n default:\n return 'default'\n }\n}\n\nexport default function BillRunDetailPage(props: { params?: { id?: string } }) {\n const t = useT()\n // OM serves backend pages through a catch-all route \u2014 the dynamic\n // `[id]` segment arrives as a page prop; `useParams()` is the fallback.\n const urlParams = useParams<{ id: string }>()\n const runId = (props.params?.id ?? urlParams?.id ?? '') as string\n\n const [run, setRun] = React.useState<BillRun | null>(null)\n const [runError, setRunError] = React.useState<string | null>(null)\n const [outcomes, setOutcomes] = React.useState<BillRunOutcome[]>([])\n const [outcomesPage, setOutcomesPage] = React.useState(1)\n const [outcomesTotal, setOutcomesTotal] = React.useState(0)\n const [outcomesTotalPages, setOutcomesTotalPages] = React.useState(1)\n const [outcomesLoading, setOutcomesLoading] = React.useState(true)\n const [retrying, setRetrying] = React.useState(false)\n\n const loadRun = React.useCallback(async () => {\n if (!runId) return\n setRunError(null)\n try {\n const result = await readApiResultOrThrow<ListResponse<BillRun>>(\n `/api/billing/runs?id=${runId}&pageSize=1`,\n )\n const found = result.items?.[0]\n if (!found) {\n setRunError(t('billing.runs.detail.error.not_found', 'Run not found'))\n setRun(null)\n return\n }\n setRun(found)\n } catch (err) {\n const { message } = normalizeCrudServerError(err)\n setRunError(message || t('billing.runs.detail.error.load', 'Failed to load run'))\n }\n }, [runId, t])\n\n const loadOutcomes = React.useCallback(async () => {\n if (!runId) return\n setOutcomesLoading(true)\n try {\n const params = new URLSearchParams({\n billRunId: runId,\n page: String(outcomesPage),\n pageSize: '50',\n })\n const result = await readApiResultOrThrow<ListResponse<BillRunOutcome>>(\n `/api/billing/run-outcomes?${params.toString()}`,\n )\n setOutcomes(result.items ?? [])\n setOutcomesTotal(result.total ?? 0)\n setOutcomesTotalPages(result.totalPages ?? 1)\n } finally {\n setOutcomesLoading(false)\n }\n }, [outcomesPage, runId])\n\n React.useEffect(() => {\n void loadRun()\n }, [loadRun])\n React.useEffect(() => {\n void loadOutcomes()\n }, [loadOutcomes])\n\n const failedCount = run?.summary?.accounts_failed ?? 0\n\n const handleRetryFailed = React.useCallback(async () => {\n if (!run || failedCount === 0) return\n setRetrying(true)\n try {\n const call = await apiCallOrThrow<{ billRunId: string; outcomesCount: number }>(\n '/api/billing/runs/retry-failed',\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ billRunId: run.id }),\n },\n )\n const outcomesCount = call.result?.outcomesCount ?? 0\n flash(\n t('billing.runs.retry.success', 'Retry run created') +\n ` (${outcomesCount} accounts)`,\n 'success',\n )\n // Refresh \u2014 the new run shows up in the list view; the current\n // run's outcomes are immutable so no reload of `loadOutcomes`\n // needed, but loadRun is cheap.\n void loadRun()\n } catch (err) {\n const { message } = normalizeCrudServerError(err)\n flash(message || t('billing.runs.retry.error', 'Retry failed'), 'error')\n } finally {\n setRetrying(false)\n }\n }, [failedCount, loadRun, run, t])\n\n const outcomeColumns = React.useMemo<ColumnDef<BillRunOutcome>[]>(\n () => [\n {\n accessorKey: 'bill_account_id',\n header: t('billing.runs.outcomes.columns.account', 'Account'),\n cell: ({ row }) => (\n <Link\n href={`/backend/billing/accounts/${row.original.bill_account_id}`}\n className=\"text-sm text-primary hover:underline\"\n >\n {row.original.bill_account_name ?? row.original.bill_account_id}\n </Link>\n ),\n },\n {\n accessorKey: 'status',\n header: t('billing.runs.outcomes.columns.status', 'Status'),\n cell: ({ row }) => (\n <Tag variant={outcomeStatusVariant(row.original.status)}>\n {row.original.status}\n </Tag>\n ),\n },\n {\n accessorKey: 'draft_invoice_id',\n header: t('billing.runs.outcomes.columns.invoice', 'Invoice'),\n cell: ({ row }) =>\n row.original.draft_invoice_id ? (\n <Link\n href={`/backend/billing/invoices/${row.original.draft_invoice_id}`}\n className=\"text-sm text-primary hover:underline\"\n >\n {row.original.invoice_number ?? row.original.draft_invoice_id}\n </Link>\n ) : (\n '\u2014'\n ),\n },\n {\n accessorKey: 'error_message',\n header: t('billing.runs.outcomes.columns.error', 'Error'),\n cell: ({ row }) => row.original.error_message ?? '\u2014',\n },\n {\n accessorKey: 'warnings',\n header: t('billing.runs.outcomes.columns.warnings', 'Warnings'),\n cell: ({ row }) => {\n if (!row.original.warnings) return '\u2014'\n return (\n <span className=\"font-mono text-xs\">{JSON.stringify(row.original.warnings)}</span>\n )\n },\n },\n ],\n [t],\n )\n\n if (runError) {\n return (\n <Page>\n <PageHeader title={t('billing.runs.detail.title', 'Bill Run')} />\n <PageBody>\n <ErrorMessage label={runError} />\n </PageBody>\n </Page>\n )\n }\n\n if (!run) {\n return (\n <Page>\n <PageHeader title={t('billing.runs.detail.title', 'Bill Run')} />\n <PageBody>\n <LoadingMessage label={t('billing.runs.detail.loading', 'Loading run\u2026')} />\n </PageBody>\n </Page>\n )\n }\n\n return (\n <Page>\n <FormHeader\n mode=\"detail\"\n backHref=\"/backend/billing/runs\"\n entityTypeLabel={t('billing.runs.detail.title', 'Bill Run')}\n title={billRunName(run.as_of_date)}\n statusBadge={\n <Tag variant={runStatusVariant(run.status)}>{run.status}</Tag>\n }\n actionsContent={\n failedCount > 0 ? (\n <Button disabled={retrying} onClick={handleRetryFailed}>\n {retrying\n ? t('billing.runs.retry.in_progress', 'Retrying\u2026')\n : t('billing.runs.retry.action', 'Retry failed accounts')}\n {` (${failedCount})`}\n </Button>\n ) : null\n }\n />\n <PageBody>\n <div className=\"space-y-6\">\n <DetailCard>\n <DetailField label={t('billing.runs.detail.field.run_id', 'Run ID')}>\n <span className=\"font-mono text-xs\">{run.id}</span>\n </DetailField>\n <DetailField label={t('billing.runs.detail.field.triggered_by', 'Trigger')}>\n {run.triggered_by}\n </DetailField>\n <DetailField label={t('billing.runs.detail.field.mode', 'Mode')}>\n <div className=\"flex flex-wrap gap-1\">\n {run.dry_run ? (\n <Tag variant=\"warning\">{t('billing.runs.mode.dry_run', 'Dry-run')}</Tag>\n ) : run.test_mode ? (\n <Tag variant=\"warning\">{t('billing.runs.mode.test', 'Test')}</Tag>\n ) : (\n <Tag variant=\"default\">{t('billing.runs.mode.real', 'Real')}</Tag>\n )}\n {run.catch_up ? (\n <Tag variant=\"default\">{t('billing.runs.mode.catch_up', 'Catch-up')}</Tag>\n ) : null}\n </div>\n </DetailField>\n <DetailField label={t('billing.runs.detail.field.as_of_date', 'As-of date')}>\n {run.as_of_date?.slice(0, 10) ?? '\u2014'}\n </DetailField>\n <DetailField label={t('billing.runs.detail.field.started_at', 'Started')}>\n {formatDate(run.started_at)}\n </DetailField>\n <DetailField label={t('billing.runs.detail.field.finished_at', 'Finished')}>\n {formatDate(run.finished_at)}\n </DetailField>\n {run.parent_run_id ? (\n <DetailField label={t('billing.runs.detail.field.parent_run', 'Parent run')}>\n <span className=\"font-mono text-xs\">{run.parent_run_id}</span>\n </DetailField>\n ) : null}\n </DetailCard>\n\n {run.summary ? (\n <StatCard title={t('billing.runs.summary.title', 'Summary')}>\n <Stat\n label={t('billing.runs.summary.accounts', 'Accounts')}\n value={run.summary.accounts_processed ?? 0}\n />\n <Stat\n label={t('billing.runs.summary.drafts', 'Drafts')}\n value={run.summary.drafts_created ?? 0}\n />\n <Stat\n label={t('billing.runs.summary.skipped', 'Skipped')}\n value={run.summary.drafts_skipped_existing ?? 0}\n />\n <Stat\n label={t('billing.runs.summary.warnings', 'Warnings')}\n value={run.summary.accounts_with_warnings ?? 0}\n />\n <Stat\n label={t('billing.runs.summary.failed', 'Failed')}\n value={run.summary.accounts_failed ?? 0}\n />\n <Stat\n label={t('billing.runs.summary.usage', 'Usage rated')}\n value={run.summary.usage_records_rated ?? 0}\n />\n </StatCard>\n ) : null}\n\n <div>\n <h2 className=\"text-base font-semibold mb-2\">\n {t('billing.runs.outcomes.title', 'Per-account outcomes')}\n </h2>\n <DataTable\n columns={outcomeColumns}\n data={outcomes}\n isLoading={outcomesLoading}\n pagination={{\n page: outcomesPage,\n pageSize: 50,\n total: outcomesTotal,\n totalPages: outcom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;AAAA,YACC,SAAS;AAAA,YACT,MAAM;AAAA,YACN,WAAW;AAAA,YACX,YAAY;AAAA,cACV,MAAM;AAAA,cACN,UAAU;AAAA,cACV,OAAO;AAAA,cACP,YAAY;AAAA,cACZ,cAAc;AAAA,YAChB;AAAA;AAAA,QACF;AAAA,SACF;AAAA,OACF,GACF;AAAA,KACF;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import { PlayCircle } from "lucide-react";
3
+ const runIcon = React.createElement(PlayCircle, { size: 16 });
4
+ const metadata = {
5
+ requireAuth: true,
6
+ requireFeatures: ["billing.run.view"],
7
+ pageTitle: "Bill Run",
8
+ pageTitleKey: "billing.runs.detail.title",
9
+ pageGroup: "Billing",
10
+ pageGroupKey: "billing.nav.group",
11
+ navHidden: true,
12
+ icon: runIcon,
13
+ breadcrumb: [
14
+ { label: "Bill Runs", labelKey: "billing.runs.title", href: "/backend/billing/runs" },
15
+ { label: "Run", labelKey: "billing.runs.detail.title" }
16
+ ]
17
+ };
18
+ export {
19
+ metadata
20
+ };
21
+ //# sourceMappingURL=page.meta.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/modules/billing/backend/billing/runs/%5Bid%5D/page.meta.ts"],
4
+ "sourcesContent": ["import React from 'react'\nimport { PlayCircle } from 'lucide-react'\n\nconst runIcon = React.createElement(PlayCircle, { size: 16 })\n\nexport const metadata = {\n requireAuth: true,\n requireFeatures: ['billing.run.view'],\n pageTitle: 'Bill Run',\n pageTitleKey: 'billing.runs.detail.title',\n pageGroup: 'Billing',\n pageGroupKey: 'billing.nav.group',\n navHidden: true,\n icon: runIcon,\n breadcrumb: [\n { label: 'Bill Runs', labelKey: 'billing.runs.title', href: '/backend/billing/runs' },\n { label: 'Run', labelKey: 'billing.runs.detail.title' },\n ],\n} as const\n"],
5
+ "mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,kBAAkB;AAE3B,MAAM,UAAU,MAAM,cAAc,YAAY,EAAE,MAAM,GAAG,CAAC;AAErD,MAAM,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,iBAAiB,CAAC,kBAAkB;AAAA,EACpC,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,MAAM;AAAA,EACN,YAAY;AAAA,IACV,EAAE,OAAO,aAAa,UAAU,sBAAsB,MAAM,wBAAwB;AAAA,IACpF,EAAE,OAAO,OAAO,UAAU,4BAA4B;AAAA,EACxD;AACF;",
6
+ "names": []
7
+ }