@burdenoff/microfe-billing 2026.1109.1 → 2026.1112.2

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 (33) hide show
  1. package/dist/billing/BillingUserRoutes.js +202 -188
  2. package/dist/billing/BillingUserRoutes.js.map +1 -1
  3. package/dist/billing/hooks/useBillingVariant.d.ts +6 -0
  4. package/dist/billing/hooks/useBillingVariant.js +8 -0
  5. package/dist/billing/hooks/useBillingVariant.js.map +1 -0
  6. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +182 -150
  7. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
  8. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +169 -140
  9. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
  10. package/dist/billing/modules/billing/pages/InvoicesListPage.js +191 -156
  11. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  12. package/dist/billing/modules/billing/pages/UserRefundsPage.js +160 -157
  13. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  14. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +153 -126
  15. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
  16. package/dist/billing/modules/credits/pages/CreditsPage.js +110 -109
  17. package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
  18. package/dist/billing/modules/earnings/pages/PayoutsPage.js +220 -181
  19. package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
  20. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +4 -1
  21. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
  22. package/dist/billing/providers/BillingProvider.js +16 -15
  23. package/dist/billing/providers/BillingProvider.js.map +1 -1
  24. package/dist/billing/shared/components/MoneyActionDialog.d.ts +27 -0
  25. package/dist/billing/shared/components/MoneyActionDialog.js +53 -0
  26. package/dist/billing/shared/components/MoneyActionDialog.js.map +1 -0
  27. package/dist/billing/shared/components/index.d.ts +1 -0
  28. package/dist/billing/shared/components/index.js +2 -1
  29. package/dist/billing/shared/utils/accessRules.d.ts +16 -0
  30. package/dist/billing/shared/utils/accessRules.js +10 -0
  31. package/dist/billing/shared/utils/accessRules.js.map +1 -0
  32. package/dist/billing/types/index.d.ts +6 -0
  33. package/package.json +1 -1
@@ -1,27 +1,30 @@
1
1
  import { useBillingNavigate as e } from "../../../hooks/useBillingNavigate.js";
2
2
  import { StatusPill as t } from "../../../shared/ui/StatusPill.js";
3
3
  import { useInvoiceMutations as n, usePaginatedInvoices as r } from "../hooks/useInvoices.js";
4
- import { useBillingPermissions as i } from "../../../hooks/useBillingPermissions.js";
5
- import { useGetBillingAccountsByOrgQuery as a } from "../../../../generated/global-operations.js";
6
- import { formatCurrency as o, formatDate as s, formatInvoiceNumber as c, formatInvoiceStatus as l } from "../../../shared/utils/format.js";
7
- import { withBillingAccountId as u } from "../../../shared/utils/navigation.js";
8
- import { getInvoiceStatusColor as d } from "../../../shared/utils/status.js";
4
+ import { MoneyActionDialog as i } from "../../../shared/components/MoneyActionDialog.js";
5
+ import { useBillingPermissions as a } from "../../../hooks/useBillingPermissions.js";
6
+ import { useGetBillingAccountsByOrgQuery as o } from "../../../../generated/global-operations.js";
7
+ import { formatCurrency as s, formatDate as c, formatInvoiceNumber as l, formatInvoiceStatus as u } from "../../../shared/utils/format.js";
8
+ import { withBillingAccountId as d } from "../../../shared/utils/navigation.js";
9
+ import { getInvoiceStatusColor as f } from "../../../shared/utils/status.js";
9
10
  import "../../../shared/ui/index.js";
10
- import { useTr as f } from "../../../shared/hooks/useTr.js";
11
- import { nativeConfirm as p, nativeImpact as m, nativeNotify as h } from "../../../../utils/nativeBridge.js";
12
- import { useCallback as g, useEffect as _, useMemo as v, useRef as y, useState as b } from "react";
13
- import { RotateCcw as x } from "lucide-react";
14
- import { useSearchParams as S } from "react-router";
15
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
16
- import { IllustratedEmptyState as E, PagePurpose as D } from "@burdenoff/fe-libs/ui";
11
+ import "../../../shared/components/index.js";
12
+ import { useIsFluidgridsVariant as p } from "../../../hooks/useBillingVariant.js";
13
+ import { useTr as m } from "../../../shared/hooks/useTr.js";
14
+ import { nativeConfirm as h, nativeImpact as g, nativeNotify as _ } from "../../../../utils/nativeBridge.js";
15
+ import { useCallback as v, useEffect as y, useMemo as b, useRef as x, useState as S } from "react";
16
+ import { RotateCcw as C } from "lucide-react";
17
+ import { useSearchParams as w } from "react-router";
18
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
19
+ import { IllustratedEmptyState as O, PagePurpose as k } from "@burdenoff/fe-libs/ui";
17
20
  // src/billing/modules/billing/pages/InvoicesListPage.tsx
18
- var O = () => {
19
- let t = f(), o = e(), s = i(), [c] = S(), d = c.get("billingAccountId") ?? void 0, { data: p } = a({ fetchPolicy: "cache-first" }), m = v(() => p?.getBillingAccountsByOrg ?? [], [p]), { payInvoice: O, voidInvoice: A } = n(), [j, M] = b(null), [N, P] = b(null), [F, I] = b(d);
20
- _(() => {
21
- I(d);
22
- }, [d]);
23
- let L = v(() => (m.find((e) => e.isDefault) ?? m[0])?.id ?? void 0, [m]), R = F === void 0 ? L ?? null : F, [z, B] = b("all"), [V, H] = b(""), [U, W] = b(""), [G, K] = b(1), q = y(null);
24
- _(() => (q.current && clearTimeout(q.current), q.current = setTimeout(() => {
21
+ var A = () => {
22
+ let t = m(), i = e(), s = a(), [c] = w(), l = c.get("billingAccountId") ?? void 0, { data: f } = o({ fetchPolicy: "cache-first" }), p = b(() => f?.getBillingAccountsByOrg ?? [], [f]), { payInvoice: h, voidInvoice: g } = n(), [A, M] = S(null), [N, P] = S(null), [F, I] = S(l);
23
+ y(() => {
24
+ I(l);
25
+ }, [l]);
26
+ let L = b(() => (p.find((e) => e.isDefault) ?? p[0])?.id ?? void 0, [p]), R = F === void 0 ? L ?? null : F, [z, B] = S("all"), [V, H] = S(""), [U, W] = S(""), [G, K] = S(1), q = x(null);
27
+ y(() => (q.current && clearTimeout(q.current), q.current = setTimeout(() => {
25
28
  W(V), K(1);
26
29
  }, 400), () => {
27
30
  q.current && clearTimeout(q.current);
@@ -32,8 +35,8 @@ var O = () => {
32
35
  search: U || void 0,
33
36
  page: G,
34
37
  pageSize: 20
35
- }), $ = g(async (e) => {
36
- let t = e.billingAccountId, n = t ? m.find((e) => e.id === t)?.defaultPaymentMethod : void 0;
38
+ }), $ = v(async (e) => {
39
+ let t = e.billingAccountId, n = t ? p.find((e) => e.id === t)?.defaultPaymentMethod : void 0;
37
40
  if (!t) M("No billing account context");
38
41
  else if (!n) M("Add and set a default payment method before paying this invoice.");
39
42
  else {
@@ -42,18 +45,18 @@ var O = () => {
42
45
  action: "pay"
43
46
  });
44
47
  try {
45
- await O(e.id, n, t), await Q(), h("success");
48
+ await h(e.id, n, t), await Q(), _("success");
46
49
  } catch (e) {
47
- M(e instanceof Error ? e.message : "Failed to pay invoice"), h("error");
50
+ M(e instanceof Error ? e.message : "Failed to pay invoice"), _("error");
48
51
  } finally {
49
52
  P(null);
50
53
  }
51
54
  }
52
55
  }, [
53
- m,
54
- O,
56
+ p,
57
+ h,
55
58
  Q
56
- ]), ee = g(async (e) => {
59
+ ]), ee = v(async (e) => {
57
60
  let t = e.billingAccountId;
58
61
  if (!t) M("No billing account context");
59
62
  else {
@@ -62,17 +65,17 @@ var O = () => {
62
65
  action: "void"
63
66
  });
64
67
  try {
65
- await A(e.id, t), await Q(), h("success");
68
+ await g(e.id, t), await Q(), _("success");
66
69
  } catch (e) {
67
- M(e instanceof Error ? e.message : "Failed to void invoice"), h("error");
70
+ M(e instanceof Error ? e.message : "Failed to void invoice"), _("error");
68
71
  } finally {
69
72
  P(null);
70
73
  }
71
74
  }
72
- }, [Q, A]);
73
- return s.canViewInvoices ? X && J.length === 0 ? /* @__PURE__ */ T("div", {
75
+ }, [Q, g]);
76
+ return s.canViewInvoices ? X && J.length === 0 ? /* @__PURE__ */ D("div", {
74
77
  className: "space-y-6 p-6",
75
- children: [/* @__PURE__ */ w("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ w("div", {
78
+ children: [/* @__PURE__ */ E("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ E("div", {
76
79
  className: "space-y-3",
77
80
  children: [
78
81
  1,
@@ -80,30 +83,30 @@ var O = () => {
80
83
  3,
81
84
  4,
82
85
  5
83
- ].map((e) => /* @__PURE__ */ w("div", {
86
+ ].map((e) => /* @__PURE__ */ E("div", {
84
87
  className: "border border-border-subtle rounded-lg p-4",
85
- children: /* @__PURE__ */ T("div", {
88
+ children: /* @__PURE__ */ D("div", {
86
89
  className: "flex items-center gap-4",
87
- children: [/* @__PURE__ */ w("div", { className: "size-10 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ T("div", {
90
+ children: [/* @__PURE__ */ E("div", { className: "size-10 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ D("div", {
88
91
  className: "flex-1 space-y-2",
89
- children: [/* @__PURE__ */ w("div", { className: "h-4 w-32 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ w("div", { className: "h-3 w-48 bg-bg-sunken animate-pulse rounded" })]
92
+ children: [/* @__PURE__ */ E("div", { className: "h-4 w-32 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ E("div", { className: "h-3 w-48 bg-bg-sunken animate-pulse rounded" })]
90
93
  })]
91
94
  })
92
95
  }, e))
93
96
  })]
94
- }) : Z ? /* @__PURE__ */ w("div", {
97
+ }) : Z ? /* @__PURE__ */ E("div", {
95
98
  className: "flex items-center justify-center h-full min-h-[400px]",
96
- children: /* @__PURE__ */ T("div", {
99
+ children: /* @__PURE__ */ D("div", {
97
100
  className: "text-center space-y-4",
98
101
  children: [
99
- /* @__PURE__ */ w("div", {
102
+ /* @__PURE__ */ E("div", {
100
103
  className: "size-12 mx-auto rounded-full bg-status-error-bg-subtle flex items-center justify-center",
101
- children: /* @__PURE__ */ w("svg", {
104
+ children: /* @__PURE__ */ E("svg", {
102
105
  className: "size-6 text-status-error-text",
103
106
  fill: "none",
104
107
  viewBox: "0 0 24 24",
105
108
  stroke: "currentColor",
106
- children: /* @__PURE__ */ w("path", {
109
+ children: /* @__PURE__ */ E("path", {
107
110
  strokeLinecap: "round",
108
111
  strokeLinejoin: "round",
109
112
  strokeWidth: 2,
@@ -111,15 +114,15 @@ var O = () => {
111
114
  })
112
115
  })
113
116
  }),
114
- /* @__PURE__ */ w("h2", {
117
+ /* @__PURE__ */ E("h2", {
115
118
  className: "text-lg font-semibold text-text-primary",
116
119
  children: t("billing.invoices.failedToLoad", "Failed to load invoices")
117
120
  }),
118
- /* @__PURE__ */ w("p", {
121
+ /* @__PURE__ */ E("p", {
119
122
  className: "text-sm text-text-secondary",
120
123
  children: Z.message
121
124
  }),
122
- /* @__PURE__ */ w("button", {
125
+ /* @__PURE__ */ E("button", {
123
126
  type: "button",
124
127
  onClick: () => Q(),
125
128
  className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
@@ -127,44 +130,44 @@ var O = () => {
127
130
  })
128
131
  ]
129
132
  })
130
- }) : /* @__PURE__ */ T("div", {
133
+ }) : /* @__PURE__ */ D("div", {
131
134
  className: "space-y-6 px-6 lg:px-8 py-6",
132
135
  children: [
133
- /* @__PURE__ */ T("div", {
136
+ /* @__PURE__ */ D("div", {
134
137
  className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
135
- children: [/* @__PURE__ */ T("div", { children: [
136
- /* @__PURE__ */ w("h1", {
138
+ children: [/* @__PURE__ */ D("div", { children: [
139
+ /* @__PURE__ */ E("h1", {
137
140
  className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
138
141
  children: t("billing.invoices.title", "Invoices")
139
142
  }),
140
- /* @__PURE__ */ w("p", {
143
+ /* @__PURE__ */ E("p", {
141
144
  className: "text-sm text-text-secondary mt-1",
142
145
  children: t("billing.invoices.subtitle", "View and manage your billing invoices")
143
146
  }),
144
- /* @__PURE__ */ w(D, {
147
+ /* @__PURE__ */ E(k, {
145
148
  className: "mt-3",
146
149
  children: t("billing.invoices.purpose", "A record of everything you have been billed for — subscriptions, add-ons and one-off charges. Open an invoice to see line items, download the PDF, pay an outstanding amount, or request a refund.")
147
150
  })
148
- ] }), /* @__PURE__ */ T("div", {
151
+ ] }), /* @__PURE__ */ D("div", {
149
152
  className: "flex items-center gap-3",
150
- children: [/* @__PURE__ */ T("button", {
153
+ children: [/* @__PURE__ */ D("button", {
151
154
  type: "button",
152
- onClick: () => o("/refunds"),
155
+ onClick: () => i("/refunds"),
153
156
  className: "inline-flex items-center gap-2 px-3 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken hover:border-border-strong transition-all duration-200",
154
- children: [/* @__PURE__ */ w(x, { className: "size-4" }), t("billing.invoices.myRefunds", "My Refunds")]
155
- }), m.length > 1 && /* @__PURE__ */ T("div", {
157
+ children: [/* @__PURE__ */ E(C, { className: "size-4" }), t("billing.invoices.myRefunds", "My Refunds")]
158
+ }), p.length > 1 && /* @__PURE__ */ D("div", {
156
159
  className: "flex items-center gap-2",
157
- children: [/* @__PURE__ */ w("label", {
160
+ children: [/* @__PURE__ */ E("label", {
158
161
  className: "text-sm text-text-secondary whitespace-nowrap",
159
162
  children: t("billing.invoices.billingAccountLabel", "Billing Account")
160
- }), /* @__PURE__ */ T("select", {
163
+ }), /* @__PURE__ */ D("select", {
161
164
  value: R ?? "",
162
165
  onChange: (e) => I(e.target.value || null),
163
166
  className: "text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary px-3 py-2 focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
164
- children: [/* @__PURE__ */ w("option", {
167
+ children: [/* @__PURE__ */ E("option", {
165
168
  value: "",
166
169
  children: t("billing.invoices.allAccounts", "All Accounts")
167
- }), m.map((e) => /* @__PURE__ */ T("option", {
170
+ }), p.map((e) => /* @__PURE__ */ D("option", {
168
171
  value: e.id ?? "",
169
172
  children: [e.name ?? e.email ?? e.id, e.isDefault ? t("billing.invoices.defaultSuffix", " (Default)") : ""]
170
173
  }, e.id ?? ""))]
@@ -172,9 +175,9 @@ var O = () => {
172
175
  })]
173
176
  })]
174
177
  }),
175
- /* @__PURE__ */ T("div", {
178
+ /* @__PURE__ */ D("div", {
176
179
  className: "flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle",
177
- children: [/* @__PURE__ */ w("div", {
180
+ children: [/* @__PURE__ */ E("div", {
178
181
  className: "inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken flex-wrap",
179
182
  children: [
180
183
  "all",
@@ -182,28 +185,28 @@ var O = () => {
182
185
  "PAID",
183
186
  "DRAFT",
184
187
  "VOID"
185
- ].map((e) => /* @__PURE__ */ w("button", {
188
+ ].map((e) => /* @__PURE__ */ E("button", {
186
189
  type: "button",
187
190
  onClick: () => {
188
191
  B(e), K(1);
189
192
  },
190
193
  className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${z === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
191
- children: e === "all" ? "All" : l(e)
194
+ children: e === "all" ? "All" : u(e)
192
195
  }, e))
193
- }), /* @__PURE__ */ T("div", {
196
+ }), /* @__PURE__ */ D("div", {
194
197
  className: "relative flex-1 min-w-0 w-full sm:max-w-md",
195
- children: [/* @__PURE__ */ w("svg", {
198
+ children: [/* @__PURE__ */ E("svg", {
196
199
  className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-text-secondary",
197
200
  fill: "none",
198
201
  viewBox: "0 0 24 24",
199
202
  stroke: "currentColor",
200
- children: /* @__PURE__ */ w("path", {
203
+ children: /* @__PURE__ */ E("path", {
201
204
  strokeLinecap: "round",
202
205
  strokeLinejoin: "round",
203
206
  strokeWidth: 2,
204
207
  d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
205
208
  })
206
- }), /* @__PURE__ */ w("input", {
209
+ }), /* @__PURE__ */ E("input", {
207
210
  type: "text",
208
211
  placeholder: t("billing.invoices.searchPlaceholder", "Search by invoice number..."),
209
212
  value: V,
@@ -212,86 +215,86 @@ var O = () => {
212
215
  })]
213
216
  })]
214
217
  }),
215
- j && /* @__PURE__ */ w("div", {
218
+ A && /* @__PURE__ */ E("div", {
216
219
  className: "rounded-button border border-status-error-border bg-status-error-bg-subtle p-3",
217
- children: /* @__PURE__ */ w("p", {
220
+ children: /* @__PURE__ */ E("p", {
218
221
  className: "text-sm text-status-error-text",
219
- children: j
222
+ children: A
220
223
  })
221
224
  }),
222
- !X && J.length === 0 ? /* @__PURE__ */ w(E, {
225
+ !X && J.length === 0 ? /* @__PURE__ */ E(O, {
223
226
  illustration: z !== "all" || U ? "empty-search" : "empty-files",
224
227
  title: t("billing.invoices.noInvoicesFound", "No invoices found"),
225
228
  description: z !== "all" || U ? t("billing.invoices.noInvoicesFiltered", "No invoices match your filters.") : t("billing.invoices.noInvoicesYet", "You don't have any invoices yet.")
226
- }) : /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("div", {
229
+ }) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("div", {
227
230
  className: "border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 overflow-hidden",
228
- children: /* @__PURE__ */ T("table", {
231
+ children: /* @__PURE__ */ D("table", {
229
232
  className: "w-full",
230
- children: [/* @__PURE__ */ w("thead", {
233
+ children: [/* @__PURE__ */ E("thead", {
231
234
  className: "bg-bg-sunken",
232
- children: /* @__PURE__ */ T("tr", { children: [
233
- /* @__PURE__ */ w("th", {
235
+ children: /* @__PURE__ */ D("tr", { children: [
236
+ /* @__PURE__ */ E("th", {
234
237
  className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted",
235
238
  children: t("billing.invoices.invoice", "Invoice")
236
239
  }),
237
- /* @__PURE__ */ w("th", {
240
+ /* @__PURE__ */ E("th", {
238
241
  className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted",
239
242
  children: t("billing.common.status", "Status")
240
243
  }),
241
- !R && m.length > 1 && /* @__PURE__ */ w("th", {
244
+ !R && p.length > 1 && /* @__PURE__ */ E("th", {
242
245
  className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden lg:table-cell",
243
246
  children: t("billing.common.account", "Account")
244
247
  }),
245
- /* @__PURE__ */ w("th", {
248
+ /* @__PURE__ */ E("th", {
246
249
  className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden sm:table-cell",
247
250
  children: t("billing.common.date", "Date")
248
251
  }),
249
- /* @__PURE__ */ w("th", {
252
+ /* @__PURE__ */ E("th", {
250
253
  className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden md:table-cell",
251
254
  children: t("billing.common.dueDate", "Due Date")
252
255
  }),
253
- /* @__PURE__ */ w("th", {
256
+ /* @__PURE__ */ E("th", {
254
257
  className: "text-right px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted",
255
258
  children: t("billing.common.amount", "Amount")
256
259
  }),
257
- /* @__PURE__ */ w("th", {
260
+ /* @__PURE__ */ E("th", {
258
261
  className: "text-right px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted",
259
262
  children: t("billing.common.actions", "Actions")
260
263
  })
261
264
  ] })
262
- }), /* @__PURE__ */ w("tbody", {
265
+ }), /* @__PURE__ */ E("tbody", {
263
266
  className: "divide-y divide-border-subtle",
264
- children: J.map((e) => /* @__PURE__ */ w(k, {
267
+ children: J.map((e) => /* @__PURE__ */ E(j, {
265
268
  invoice: e,
266
- onView: () => o(u(`/invoices/${e.id}`, e.billingAccountId)),
269
+ onView: () => i(d(`/invoices/${e.id}`, e.billingAccountId)),
267
270
  canPay: s.canPayInvoice,
268
271
  canVoid: s.canVoidInvoice,
269
272
  onPay: $,
270
273
  onVoid: ee,
271
274
  isProcessing: N?.invoiceId === e.id,
272
275
  processingAction: N?.invoiceId === e.id ? N.action : void 0,
273
- showAccount: !R && m.length > 1,
274
- accountName: m.find((t) => t.id === e.billingAccountId)?.name ?? null
276
+ showAccount: !R && p.length > 1,
277
+ accountName: p.find((t) => t.id === e.billingAccountId)?.name ?? null
275
278
  }, e.id))
276
279
  })]
277
280
  })
278
- }), Y > 1 && /* @__PURE__ */ T("div", {
281
+ }), Y > 1 && /* @__PURE__ */ D("div", {
279
282
  className: "flex items-center justify-between pt-2",
280
- children: [/* @__PURE__ */ w("p", {
283
+ children: [/* @__PURE__ */ E("p", {
281
284
  className: "text-sm text-text-secondary",
282
285
  children: t("billing.common.pageOf", "Page {{page}} of {{totalPages}}", {
283
286
  page: G,
284
287
  totalPages: Y
285
288
  })
286
- }), /* @__PURE__ */ T("div", {
289
+ }), /* @__PURE__ */ D("div", {
287
290
  className: "flex items-center gap-2",
288
- children: [/* @__PURE__ */ w("button", {
291
+ children: [/* @__PURE__ */ E("button", {
289
292
  type: "button",
290
293
  onClick: () => K((e) => Math.max(1, e - 1)),
291
294
  disabled: G <= 1,
292
295
  className: "px-3 py-1.5 text-sm font-medium border border-border-subtle rounded-button bg-bg-surface text-text-primary hover:bg-bg-sunken disabled:opacity-40 disabled:cursor-not-allowed transition-colors",
293
296
  children: t("billing.common.previous", "Previous")
294
- }), /* @__PURE__ */ w("button", {
297
+ }), /* @__PURE__ */ E("button", {
295
298
  type: "button",
296
299
  onClick: () => K((e) => Math.min(Y, e + 1)),
297
300
  disabled: G >= Y,
@@ -301,19 +304,19 @@ var O = () => {
301
304
  })]
302
305
  })] })
303
306
  ]
304
- }) : /* @__PURE__ */ w("div", {
307
+ }) : /* @__PURE__ */ E("div", {
305
308
  className: "flex items-center justify-center h-full min-h-[400px]",
306
- children: /* @__PURE__ */ T("div", {
309
+ children: /* @__PURE__ */ D("div", {
307
310
  className: "text-center space-y-2",
308
311
  children: [
309
- /* @__PURE__ */ w("div", {
312
+ /* @__PURE__ */ E("div", {
310
313
  className: "size-12 mx-auto rounded-full bg-bg-sunken flex items-center justify-center",
311
- children: /* @__PURE__ */ w("svg", {
314
+ children: /* @__PURE__ */ E("svg", {
312
315
  className: "size-6 text-text-secondary",
313
316
  fill: "none",
314
317
  viewBox: "0 0 24 24",
315
318
  stroke: "currentColor",
316
- children: /* @__PURE__ */ w("path", {
319
+ children: /* @__PURE__ */ E("path", {
317
320
  strokeLinecap: "round",
318
321
  strokeLinejoin: "round",
319
322
  strokeWidth: 2,
@@ -321,144 +324,176 @@ var O = () => {
321
324
  })
322
325
  })
323
326
  }),
324
- /* @__PURE__ */ w("h2", {
327
+ /* @__PURE__ */ E("h2", {
325
328
  className: "text-lg font-semibold text-text-primary",
326
329
  children: t("billing.accessDenied.title", "Access Denied")
327
330
  }),
328
- /* @__PURE__ */ w("p", {
331
+ /* @__PURE__ */ E("p", {
329
332
  className: "text-sm text-text-secondary max-w-sm",
330
333
  children: t("billing.invoices.noViewPermission", "You don't have permission to view invoices.")
331
334
  })
332
335
  ]
333
336
  })
334
337
  });
335
- }, k = ({ invoice: e, onView: n, onPay: r, onVoid: i, canPay: a, canVoid: u, isProcessing: h, processingAction: g, showAccount: _ = !1, accountName: v }) => {
336
- let y = f(), [x, S] = b(!1), C = d(e.status), E = e.status === "OPEN", D = e.status === "DRAFT", O = async () => {
337
- m("medium");
338
- let t = await p({
338
+ }, j = ({ invoice: e, onView: n, onPay: r, onVoid: a, canPay: o, canVoid: d, isProcessing: _, processingAction: v, showAccount: y = !1, accountName: b }) => {
339
+ let x = m(), C = p(), [w, T] = S(!1), [O, k] = S(!1), A = f(e.status), j = e.status === "OPEN", M = e.status === "DRAFT", N = async () => {
340
+ g("medium");
341
+ let t = await h({
339
342
  title: "Void invoice",
340
343
  message: "Are you sure you want to void this invoice?",
341
344
  okButtonTitle: "Void",
342
345
  cancelButtonTitle: "Cancel"
343
346
  });
344
- t === !0 ? await i(e) : t === null && S(!0);
345
- }, k = async () => {
346
- await i(e), S(!1);
347
- }, A = e.metadata?.invoicePdfBackupUrl;
348
- return /* @__PURE__ */ T("tr", {
347
+ t === !0 ? await a(e) : t === null && T(!0);
348
+ }, P = () => {
349
+ C ? k(!0) : r(e);
350
+ }, F = async () => {
351
+ await r(e), k(!1);
352
+ }, I = async () => {
353
+ await a(e), T(!1);
354
+ }, L = e.metadata?.invoicePdfBackupUrl;
355
+ return /* @__PURE__ */ D("tr", {
349
356
  className: "hover:bg-bg-sunken transition-colors",
350
357
  children: [
351
- /* @__PURE__ */ T("td", {
358
+ /* @__PURE__ */ D("td", {
352
359
  className: "p-4",
353
- children: [e.invoiceUrl ? /* @__PURE__ */ w("a", {
360
+ children: [e.invoiceUrl ? /* @__PURE__ */ E("a", {
354
361
  href: e.invoiceUrl,
355
362
  target: "_blank",
356
363
  rel: "noopener noreferrer",
357
364
  className: "font-medium text-text-primary hover:text-text-link transition-colors",
358
- children: c(e.invoiceNumber)
359
- }) : /* @__PURE__ */ w("button", {
365
+ children: l(e.invoiceNumber)
366
+ }) : /* @__PURE__ */ E("button", {
360
367
  type: "button",
361
368
  onClick: n,
362
369
  className: "font-medium text-text-primary hover:text-text-link transition-colors",
363
- children: c(e.invoiceNumber)
364
- }), (e.itemDescription ?? e.subscription?.plan?.name) && /* @__PURE__ */ w("p", {
370
+ children: l(e.invoiceNumber)
371
+ }), (e.itemDescription ?? e.subscription?.plan?.name) && /* @__PURE__ */ E("p", {
365
372
  className: "text-sm text-text-secondary mt-0.5",
366
373
  children: e.itemDescription ?? e.subscription?.plan?.name
367
374
  })]
368
375
  }),
369
- /* @__PURE__ */ w("td", {
376
+ /* @__PURE__ */ E("td", {
370
377
  className: "p-4",
371
- children: /* @__PURE__ */ w(t, {
372
- status: C,
378
+ children: /* @__PURE__ */ E(t, {
379
+ status: A,
373
380
  dot: !0,
374
- children: l(e.status)
381
+ children: u(e.status)
375
382
  })
376
383
  }),
377
- _ && /* @__PURE__ */ w("td", {
384
+ y && /* @__PURE__ */ E("td", {
378
385
  className: "p-4 hidden lg:table-cell",
379
- children: v ? /* @__PURE__ */ w("span", {
386
+ children: b ? /* @__PURE__ */ E("span", {
380
387
  className: "inline-flex items-center px-2 py-0.5 text-xs font-medium rounded-full bg-bg-sunken text-text-secondary border border-border-subtle",
381
- children: v
382
- }) : /* @__PURE__ */ w("span", {
388
+ children: b
389
+ }) : /* @__PURE__ */ E("span", {
383
390
  className: "text-sm text-text-secondary",
384
391
  children: ", "
385
392
  })
386
393
  }),
387
- /* @__PURE__ */ w("td", {
394
+ /* @__PURE__ */ E("td", {
388
395
  className: "p-4 text-sm text-text-secondary hidden sm:table-cell",
389
- children: s(e.createdAt, "short")
396
+ children: c(e.createdAt, "short")
390
397
  }),
391
- /* @__PURE__ */ w("td", {
398
+ /* @__PURE__ */ E("td", {
392
399
  className: "p-4 text-sm text-text-secondary hidden md:table-cell",
393
- children: e.dueDate ? s(e.dueDate, "short") : "—"
400
+ children: e.dueDate ? c(e.dueDate, "short") : "—"
394
401
  }),
395
- /* @__PURE__ */ w("td", {
402
+ /* @__PURE__ */ E("td", {
396
403
  className: "p-4 text-right font-medium text-text-primary",
397
- children: o(e.total, e.currency)
404
+ children: s(e.total, e.currency)
398
405
  }),
399
- /* @__PURE__ */ w("td", {
406
+ /* @__PURE__ */ E("td", {
400
407
  className: "p-4 text-right",
401
- children: /* @__PURE__ */ T("div", {
408
+ children: /* @__PURE__ */ D("div", {
402
409
  className: "relative flex items-center justify-end gap-2",
403
410
  children: [
404
- e.invoiceUrl ? /* @__PURE__ */ w("a", {
411
+ e.invoiceUrl ? /* @__PURE__ */ E("a", {
405
412
  href: e.invoiceUrl,
406
413
  target: "_blank",
407
414
  rel: "noopener noreferrer",
408
415
  className: "px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-sunken rounded-button transition-colors duration-200",
409
- children: y("billing.common.view", "View")
410
- }) : /* @__PURE__ */ w("button", {
416
+ children: x("billing.common.view", "View")
417
+ }) : /* @__PURE__ */ E("button", {
411
418
  type: "button",
412
419
  onClick: n,
413
420
  className: "px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-sunken rounded-button transition-colors duration-200",
414
- children: y("billing.common.view", "View")
421
+ children: x("billing.common.view", "View")
415
422
  }),
416
- e.pdfUrl && /* @__PURE__ */ w("a", {
423
+ e.pdfUrl && /* @__PURE__ */ E("a", {
417
424
  href: e.pdfUrl,
418
425
  target: "_blank",
419
426
  rel: "noopener noreferrer",
420
427
  className: "px-3 py-1.5 text-sm font-medium text-text-link hover:bg-[var(--color-accent-softHover)] rounded-button transition-colors duration-200",
421
- children: y("billing.common.pdf", "PDF")
428
+ children: x("billing.common.pdf", "PDF")
422
429
  }),
423
- A && /* @__PURE__ */ w("a", {
424
- href: A,
430
+ L && /* @__PURE__ */ E("a", {
431
+ href: L,
425
432
  target: "_blank",
426
433
  rel: "noopener noreferrer",
427
434
  className: "px-3 py-1.5 text-sm font-medium text-text-link hover:bg-[var(--color-accent-softHover)] rounded-button transition-colors duration-200",
428
- children: y("billing.common.pdfBackup", "PDF (backup)")
435
+ children: x("billing.common.pdfBackup", "PDF (backup)")
429
436
  }),
430
- E && a && /* @__PURE__ */ w("button", {
437
+ j && o && /* @__PURE__ */ E("button", {
431
438
  type: "button",
432
- onClick: () => void r(e),
433
- disabled: h,
439
+ onClick: P,
440
+ disabled: _,
434
441
  className: "px-3 py-1.5 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors duration-200 disabled:cursor-not-allowed disabled:opacity-50",
435
- children: h && g === "pay" ? y("billing.common.paying", "Paying…") : y("billing.common.pay", "Pay")
442
+ children: _ && v === "pay" ? x("billing.common.paying", "Paying…") : x("billing.common.pay", "Pay")
436
443
  }),
437
- (E || D) && u && /* @__PURE__ */ w("button", {
444
+ C && /* @__PURE__ */ E(i, {
445
+ open: O,
446
+ title: x("billing.invoices.payReview.title", "Review and pay"),
447
+ description: x("billing.invoices.payReview.description", "Your default card is charged as soon as you confirm."),
448
+ details: [
449
+ {
450
+ label: x("billing.invoices.payReview.invoice", "Invoice"),
451
+ value: l(e.invoiceNumber)
452
+ },
453
+ ...b ? [{
454
+ label: x("billing.invoices.payReview.account", "Billing account"),
455
+ value: b
456
+ }] : [],
457
+ {
458
+ label: x("billing.invoices.payReview.card", "Paid with"),
459
+ value: x("billing.invoices.payReview.defaultCard", "Your default card")
460
+ },
461
+ {
462
+ label: x("billing.invoices.payReview.amount", "Amount"),
463
+ value: s(e.total, e.currency)
464
+ }
465
+ ],
466
+ confirmLabel: x("billing.invoices.payReview.confirm", "Pay {{amount}}", { amount: s(e.total, e.currency) }),
467
+ busyLabel: x("billing.common.paying", "Paying…"),
468
+ isBusy: _ && v === "pay",
469
+ onConfirm: () => void F(),
470
+ onCancel: () => k(!1)
471
+ }),
472
+ (j || M) && d && /* @__PURE__ */ E("button", {
438
473
  type: "button",
439
- onClick: () => void O(),
440
- disabled: h,
474
+ onClick: () => void N(),
475
+ disabled: _,
441
476
  className: "px-3 py-1.5 text-sm font-medium text-status-error-text hover:bg-status-error-bg-subtle rounded-button transition-colors duration-200 disabled:cursor-not-allowed disabled:opacity-50",
442
- children: h && g === "void" ? y("billing.common.voiding", "Voiding…") : y("billing.common.void", "Void")
477
+ children: _ && v === "void" ? x("billing.common.voiding", "Voiding…") : x("billing.common.void", "Void")
443
478
  }),
444
- x && /* @__PURE__ */ T("div", {
479
+ w && /* @__PURE__ */ D("div", {
445
480
  className: "absolute right-4 mt-12 z-10 w-64 rounded-card border border-status-error-border bg-bg-elevated p-3 text-left shadow-elevation-2",
446
- children: [/* @__PURE__ */ w("p", {
481
+ children: [/* @__PURE__ */ E("p", {
447
482
  className: "text-sm font-medium text-text-primary",
448
483
  children: "Void this invoice?"
449
- }), /* @__PURE__ */ T("div", {
484
+ }), /* @__PURE__ */ D("div", {
450
485
  className: "mt-3 flex justify-end gap-2",
451
- children: [/* @__PURE__ */ w("button", {
486
+ children: [/* @__PURE__ */ E("button", {
452
487
  type: "button",
453
- onClick: () => S(!1),
488
+ onClick: () => T(!1),
454
489
  className: "rounded-button border border-border-subtle bg-bg-surface px-2.5 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken",
455
490
  children: "Cancel"
456
- }), /* @__PURE__ */ w("button", {
491
+ }), /* @__PURE__ */ E("button", {
457
492
  type: "button",
458
- onClick: () => void k(),
459
- disabled: h,
493
+ onClick: () => void I(),
494
+ disabled: _,
460
495
  className: "rounded-button bg-action-danger-bg px-2.5 py-1.5 text-xs font-medium text-action-primary-text hover:bg-action-danger-bgHover disabled:cursor-not-allowed disabled:opacity-50",
461
- children: h ? "Voiding…" : "Confirm"
496
+ children: _ ? "Voiding…" : "Confirm"
462
497
  })]
463
498
  })]
464
499
  })
@@ -468,6 +503,6 @@ var O = () => {
468
503
  ]
469
504
  });
470
505
  };
471
- export { O as InvoicesListPage };
506
+ export { A as InvoicesListPage };
472
507
 
473
508
  //# sourceMappingURL=InvoicesListPage.js.map