@burdenoff/microfe-billing 2026.907.2 → 2026.909.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.
@@ -8,274 +8,295 @@ import { getStatusBadgeClasses as o, getTransactionStatusColor as s } from "../.
8
8
  import { isServerError as c } from "../../../shared/utils/error.js";
9
9
  import "../../../shared/utils/index.js";
10
10
  import { useBillingPermissions as l } from "../../../hooks/useBillingPermissions.js";
11
- import { nativeImpact as u, nativeOpenUrl as d } from "../../../../utils/nativeBridge.js";
12
- import { useBillingNavigate as f } from "../../../hooks/useBillingNavigate.js";
13
- import { useTransactions as p } from "../hooks/useTransactions.js";
11
+ import { nativeImpact as u, nativeNotify as d, nativeOpenUrl as f } from "../../../../utils/nativeBridge.js";
12
+ import { useBillingNavigate as p } from "../../../hooks/useBillingNavigate.js";
13
+ import { useInvoiceMutations as m } from "../hooks/useInvoices.js";
14
+ import { useTransactions as h } from "../hooks/useTransactions.js";
14
15
  import "../hooks/index.js";
15
- import { useEffect as m, useRef as h, useState as g } from "react";
16
- import { ArrowLeft as _, Calendar as v, CheckCircle as y, ChevronLeft as b, ChevronRight as x, CreditCard as S, Eye as C, FileText as w, Mail as T, MoreHorizontal as E, Wallet as D, XCircle as O } from "lucide-react";
17
- import { useParams as k } from "react-router";
18
- import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
19
- import { useI18n as ee } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
20
- import { Dialog as N, DialogContent as P, DialogFooter as F, DialogHeader as I, DialogTitle as L, EmphasisPanel as R, IllustratedEmptyState as z, PagePurpose as B, ResponsiveTable as V } from "@burdenoff/fe-libs/ui";
16
+ import { useEffect as g, useRef as _, useState as v } from "react";
17
+ import { ArrowLeft as y, Calendar as b, CheckCircle as x, ChevronLeft as S, ChevronRight as C, CreditCard as w, Eye as T, FileText as E, Mail as D, MoreHorizontal as O, Wallet as k, XCircle as A } from "lucide-react";
18
+ import { useParams as j } from "react-router";
19
+ import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
20
+ import { useI18n as F } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
21
+ import { Dialog as I, DialogContent as L, DialogFooter as R, DialogHeader as z, DialogTitle as B, EmphasisPanel as V, IllustratedEmptyState as H, PagePurpose as U, ResponsiveTable as ee } from "@burdenoff/fe-libs/ui";
21
22
  //#region src/billing/modules/billing/pages/TransactionsPage.tsx
22
- var H = {
23
+ var W = {
23
24
  payment: "Payment",
24
25
  refund: "Refund",
25
26
  adjustment: "Adjustment"
26
- }, U = (e) => H[e.toLowerCase()] ?? e, W = ({ transaction: e, onViewDetails: t, onViewInvoice: n, hasInvoiceUrl: r }) => {
27
- let [i, a] = g(!1), o = h(null);
28
- return m(() => {
27
+ }, G = (e) => W[e.toLowerCase()] ?? e, te = ({ transaction: e, onViewDetails: t, onViewInvoice: n, hasInvoiceUrl: r }) => {
28
+ let [i, a] = v(!1), o = _(null);
29
+ return g(() => {
29
30
  let e = (e) => {
30
31
  o.current && !o.current.contains(e.target) && a(!1);
31
32
  };
32
33
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
33
- }, []), /* @__PURE__ */ M("div", {
34
+ }, []), /* @__PURE__ */ P("div", {
34
35
  className: "relative overflow-visible",
35
36
  ref: o,
36
- children: [/* @__PURE__ */ j("button", {
37
+ children: [/* @__PURE__ */ N("button", {
37
38
  type: "button",
38
39
  onClick: () => a(!i),
39
40
  className: "p-1.5 rounded-md hover:bg-bg-sunken/50 transition-colors",
40
41
  "aria-label": "Transaction actions",
41
- children: /* @__PURE__ */ j(E, { className: "size-4 text-text-secondary" })
42
- }), i && /* @__PURE__ */ M("div", {
42
+ children: /* @__PURE__ */ N(O, { className: "size-4 text-text-secondary" })
43
+ }), i && /* @__PURE__ */ P("div", {
43
44
  className: "absolute right-0 top-full mt-1 z-50 min-w-[160px] bg-popover border border-border-subtle rounded-md shadow-lg py-1",
44
- children: [/* @__PURE__ */ M("button", {
45
+ children: [/* @__PURE__ */ P("button", {
45
46
  type: "button",
46
47
  onClick: () => {
47
48
  t(), a(!1);
48
49
  },
49
50
  className: "w-full flex items-center gap-2 px-3 py-2 text-sm text-text-primary hover:bg-bg-sunken/50 transition-colors whitespace-nowrap",
50
- children: [/* @__PURE__ */ j(C, { className: "size-4" }), "View Details"]
51
- }), e.type === "payment" && r && /* @__PURE__ */ M("button", {
51
+ children: [/* @__PURE__ */ N(T, { className: "size-4" }), "View Details"]
52
+ }), e.type === "payment" && r && /* @__PURE__ */ P("button", {
52
53
  type: "button",
53
54
  onClick: () => {
54
55
  n(), a(!1);
55
56
  },
56
57
  className: "w-full flex items-center gap-2 px-3 py-2 text-sm text-text-primary hover:bg-bg-sunken/50 transition-colors whitespace-nowrap",
57
- children: [/* @__PURE__ */ j(w, { className: "size-4" }), "View Invoice"]
58
+ children: [/* @__PURE__ */ N(E, { className: "size-4" }), "View Invoice"]
58
59
  })]
59
60
  })]
60
61
  });
61
- }, G = ({ transaction: e, onClose: t, onViewInvoice: n, invoiceUrl: r, invoiceProvider: c }) => {
62
+ }, ne = ({ transaction: e, onClose: t, onViewInvoice: n, onRetryInvoice: r, isRetryingInvoice: c, retryInvoiceError: l, invoiceUrl: d, invoiceProvider: p }) => {
62
63
  if (!e) return null;
63
- let l = e.metadata, f = l?.subtotal, p = l?.taxAmount, m = l?.taxRate, h = l?.taxType, g = l?.total, _ = l?.invoiceNumber, v = l?.invoiceStatus, y = e.type === "refund", b = l?.refundRecordId, x = l?.originalTransactionId, S = l?.creditNoteId, C = l?.creditNoteNumber, T = l?.creditNotePdfUrl, E = l?.reason, D = l?.purchaseType, O = l?.purchaseDetail, k = g && p !== void 0 && p > 0;
64
- return /* @__PURE__ */ j(N, {
64
+ let m = e.metadata, h = m?.subtotal, g = m?.taxAmount, _ = m?.taxRate, v = m?.taxType, y = m?.total, b = m?.invoiceNumber, x = m?.invoiceStatus, S = m?.invoiceCreationError, C = !b && e.type === "payment" && e.status === "success", w = e.type === "refund", T = m?.refundRecordId, D = m?.originalTransactionId, O = m?.creditNoteId, k = m?.creditNoteNumber, A = m?.creditNotePdfUrl, j = m?.reason, F = m?.purchaseType, V = m?.purchaseDetail, H = y && g !== void 0 && g > 0;
65
+ return /* @__PURE__ */ N(I, {
65
66
  open: !!e,
66
67
  onOpenChange: (e) => !e && t(),
67
- children: /* @__PURE__ */ M(P, {
68
+ children: /* @__PURE__ */ P(L, {
68
69
  className: "max-w-md max-h-[90vh] overflow-auto p-0",
69
70
  children: [
70
- /* @__PURE__ */ j(I, {
71
+ /* @__PURE__ */ N(z, {
71
72
  className: "p-4 border-b border-border-subtle",
72
- children: /* @__PURE__ */ j(L, {
73
+ children: /* @__PURE__ */ N(B, {
73
74
  className: "text-lg font-semibold",
74
75
  children: "Transaction Details"
75
76
  })
76
77
  }),
77
- /* @__PURE__ */ M("div", {
78
+ /* @__PURE__ */ P("div", {
78
79
  className: "p-4 space-y-4",
79
80
  children: [
80
- /* @__PURE__ */ M("div", {
81
+ /* @__PURE__ */ P("div", {
81
82
  className: "grid grid-cols-2 gap-4",
82
- children: [/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
83
+ children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
83
84
  className: "text-xs text-text-secondary mb-1",
84
85
  children: "Transaction ID"
85
- }), /* @__PURE__ */ j("p", {
86
+ }), /* @__PURE__ */ N("p", {
86
87
  className: "text-sm font-mono break-all",
87
88
  children: e.id
88
- })] }), /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
89
+ })] }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
89
90
  className: "text-xs text-text-secondary mb-1",
90
91
  children: "Type"
91
- }), /* @__PURE__ */ j("p", {
92
+ }), /* @__PURE__ */ N("p", {
92
93
  className: "text-sm capitalize",
93
- children: U(e.type)
94
+ children: G(e.type)
94
95
  })] })]
95
96
  }),
96
- /* @__PURE__ */ j("div", {
97
+ /* @__PURE__ */ N("div", {
97
98
  className: "space-y-2",
98
- children: k ? /* @__PURE__ */ M(A, { children: [
99
- /* @__PURE__ */ M("div", {
99
+ children: H ? /* @__PURE__ */ P(M, { children: [
100
+ /* @__PURE__ */ P("div", {
100
101
  className: "flex justify-between text-sm",
101
- children: [/* @__PURE__ */ j("span", {
102
+ children: [/* @__PURE__ */ N("span", {
102
103
  className: "text-text-secondary",
103
104
  children: "Subtotal"
104
- }), /* @__PURE__ */ j("span", { children: i(f || e.amount, e.currency) })]
105
+ }), /* @__PURE__ */ N("span", { children: i(h || e.amount, e.currency) })]
105
106
  }),
106
- p > 0 && /* @__PURE__ */ M("div", {
107
+ g > 0 && /* @__PURE__ */ P("div", {
107
108
  className: "flex justify-between text-sm",
108
- children: [/* @__PURE__ */ M("span", {
109
+ children: [/* @__PURE__ */ P("span", {
109
110
  className: "text-text-secondary",
110
111
  children: [
111
- h || "Tax",
112
+ v || "Tax",
112
113
  " ",
113
- m ? `(${(m * 100).toFixed(0)}%)` : ""
114
+ _ ? `(${(_ * 100).toFixed(0)}%)` : ""
114
115
  ]
115
- }), /* @__PURE__ */ j("span", { children: i(p, e.currency) })]
116
+ }), /* @__PURE__ */ N("span", { children: i(g, e.currency) })]
116
117
  }),
117
- /* @__PURE__ */ M("div", {
118
+ /* @__PURE__ */ P("div", {
118
119
  className: "flex justify-between text-sm font-semibold border-t border-border-subtle pt-2",
119
- children: [/* @__PURE__ */ j("span", { children: "Total" }), /* @__PURE__ */ M("span", {
120
+ children: [/* @__PURE__ */ N("span", { children: "Total" }), /* @__PURE__ */ P("span", {
120
121
  className: e.type === "refund" ? "text-status-error-text" : "",
121
- children: [e.type === "refund" ? "-" : "", i(g, e.currency)]
122
+ children: [e.type === "refund" ? "-" : "", i(y, e.currency)]
122
123
  })]
123
124
  })
124
- ] }) : /* @__PURE__ */ M("div", {
125
+ ] }) : /* @__PURE__ */ P("div", {
125
126
  className: "grid grid-cols-2 gap-4",
126
- children: [/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
127
+ children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
127
128
  className: "text-xs text-text-secondary mb-1",
128
129
  children: "Amount"
129
- }), /* @__PURE__ */ M("p", {
130
+ }), /* @__PURE__ */ P("p", {
130
131
  className: `text-sm font-medium ${e.type === "refund" ? "text-status-error-text" : ""}`,
131
- children: [e.type === "refund" ? "-" : "", i(g || e.amount, e.currency)]
132
- })] }), /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
132
+ children: [e.type === "refund" ? "-" : "", i(y || e.amount, e.currency)]
133
+ })] }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
133
134
  className: "text-xs text-text-secondary mb-1",
134
135
  children: "Status"
135
- }), /* @__PURE__ */ j("span", {
136
+ }), /* @__PURE__ */ N("span", {
136
137
  className: `px-2 py-0.5 text-xs font-medium rounded ${o(s(e.status))}`,
137
138
  children: e.status
138
139
  })] })]
139
140
  })
140
141
  }),
141
- k && /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
142
+ H && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
142
143
  className: "text-xs text-text-secondary mb-1",
143
144
  children: "Status"
144
- }), /* @__PURE__ */ j("span", {
145
+ }), /* @__PURE__ */ N("span", {
145
146
  className: `px-2 py-0.5 text-xs font-medium rounded ${o(s(e.status))}`,
146
147
  children: e.status
147
148
  })] }),
148
- /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
149
+ /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
149
150
  className: "text-xs text-text-secondary mb-1",
150
151
  children: "Date & Time"
151
- }), /* @__PURE__ */ j("p", {
152
+ }), /* @__PURE__ */ N("p", {
152
153
  className: "text-sm",
153
154
  children: a(e.createdAt)
154
155
  })] }),
155
- e.description && /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
156
+ e.description && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
156
157
  className: "text-xs text-text-secondary mb-1",
157
158
  children: "Description"
158
- }), /* @__PURE__ */ j("p", {
159
+ }), /* @__PURE__ */ N("p", {
159
160
  className: "text-sm",
160
161
  children: e.description
161
162
  })] }),
162
- _ && /* @__PURE__ */ M("div", {
163
+ b && /* @__PURE__ */ P("div", {
163
164
  className: "p-3 bg-bg-sunken/50 rounded-lg space-y-2",
164
165
  children: [
165
- /* @__PURE__ */ M("div", {
166
+ /* @__PURE__ */ P("div", {
166
167
  className: "flex items-center justify-between",
167
- children: [/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
168
+ children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
168
169
  className: "text-xs text-text-secondary mb-1",
169
170
  children: "Invoice"
170
- }), /* @__PURE__ */ j("p", {
171
+ }), /* @__PURE__ */ N("p", {
171
172
  className: "text-sm font-mono",
172
- children: _
173
- })] }), v && /* @__PURE__ */ j("span", {
174
- className: `px-2 py-0.5 text-xs font-medium rounded ${v === "PAID" ? "bg-status-success-bg-subtle text-status-success-text" : "bg-status-warning-bg-subtle text-status-warning-text"}`,
175
- children: v
173
+ children: b
174
+ })] }), x && /* @__PURE__ */ N("span", {
175
+ className: `px-2 py-0.5 text-xs font-medium rounded ${x === "PAID" ? "bg-status-success-bg-subtle text-status-success-text" : "bg-status-warning-bg-subtle text-status-warning-text"}`,
176
+ children: x
176
177
  })]
177
178
  }),
178
- c && /* @__PURE__ */ M("p", {
179
+ p && /* @__PURE__ */ P("p", {
179
180
  className: "text-xs text-text-secondary",
180
- children: ["Provider: ", c]
181
+ children: ["Provider: ", p]
181
182
  }),
182
- r && n && /* @__PURE__ */ M("button", {
183
+ d && n && /* @__PURE__ */ P("button", {
183
184
  type: "button",
184
185
  onClick: () => n(e),
185
186
  className: "flex items-center gap-2 text-sm text-primary hover:underline",
186
- children: [/* @__PURE__ */ j(w, { className: "size-4" }), "View Invoice"]
187
+ children: [/* @__PURE__ */ N(E, { className: "size-4" }), "View Invoice"]
187
188
  })
188
189
  ]
189
190
  }),
190
- !_ && r && n && /* @__PURE__ */ j("div", {
191
+ !b && d && n && /* @__PURE__ */ N("div", {
191
192
  className: "p-3 bg-bg-sunken/50 rounded-lg",
192
- children: /* @__PURE__ */ M("button", {
193
+ children: /* @__PURE__ */ P("button", {
193
194
  type: "button",
194
195
  onClick: () => n(e),
195
196
  className: "flex items-center gap-2 text-sm text-primary hover:underline",
196
197
  children: [
197
- /* @__PURE__ */ j(w, { className: "size-4" }),
198
+ /* @__PURE__ */ N(E, { className: "size-4" }),
198
199
  "View Invoice ",
199
- c && `(${c})`
200
+ p && `(${p})`
200
201
  ]
201
202
  })
202
203
  }),
203
- y && (S || E || D) && /* @__PURE__ */ M("div", {
204
+ C && !d && r && /* @__PURE__ */ P("div", {
205
+ className: "p-3 bg-status-warning-bg-subtle border border-status-warning-border rounded-lg space-y-2",
206
+ children: [
207
+ /* @__PURE__ */ N("p", {
208
+ className: "text-sm text-status-warning-text",
209
+ children: S ? "Invoice generation failed for this payment." : "This payment doesn't have an invoice yet."
210
+ }),
211
+ /* @__PURE__ */ P("button", {
212
+ type: "button",
213
+ onClick: () => r(e),
214
+ disabled: c,
215
+ className: "flex items-center gap-2 text-sm font-medium text-primary hover:underline disabled:cursor-not-allowed disabled:opacity-50",
216
+ children: [/* @__PURE__ */ N(E, { className: "size-4" }), c ? "Generating…" : "Generate Invoice"]
217
+ }),
218
+ l && /* @__PURE__ */ N("p", {
219
+ className: "text-sm text-status-error-text",
220
+ children: l
221
+ })
222
+ ]
223
+ }),
224
+ w && (O || j || F) && /* @__PURE__ */ P("div", {
204
225
  className: "p-3 bg-status-error-bg-subtle/20 border border-border-subtle rounded-lg space-y-3",
205
226
  children: [
206
- /* @__PURE__ */ M("div", {
227
+ /* @__PURE__ */ P("div", {
207
228
  className: "flex items-center gap-2",
208
- children: [/* @__PURE__ */ j("div", { className: "size-1.5 rounded-full bg-status-error-bg" }), /* @__PURE__ */ j("p", {
229
+ children: [/* @__PURE__ */ N("div", { className: "size-1.5 rounded-full bg-status-error-bg" }), /* @__PURE__ */ N("p", {
209
230
  className: "text-sm font-semibold text-status-error-text",
210
231
  children: "Refund Information"
211
232
  })]
212
233
  }),
213
- C && /* @__PURE__ */ M("div", {
234
+ k && /* @__PURE__ */ P("div", {
214
235
  className: "space-y-2",
215
- children: [/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
236
+ children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
216
237
  className: "text-xs text-status-error-text mb-1",
217
238
  children: "Credit Note"
218
- }), /* @__PURE__ */ j("p", {
239
+ }), /* @__PURE__ */ N("p", {
219
240
  className: "text-sm font-mono text-status-error-text",
220
- children: C
221
- })] }), T && /* @__PURE__ */ M("button", {
241
+ children: k
242
+ })] }), A && /* @__PURE__ */ P("button", {
222
243
  type: "button",
223
244
  onClick: () => {
224
- u("light"), d(T);
245
+ u("light"), f(A);
225
246
  },
226
247
  className: "flex items-center gap-2 text-sm text-status-error-text hover:underline",
227
- children: [/* @__PURE__ */ j(w, { className: "size-4" }), "Download Credit Note PDF"]
248
+ children: [/* @__PURE__ */ N(E, { className: "size-4" }), "Download Credit Note PDF"]
228
249
  })]
229
250
  }),
230
- D && /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
251
+ F && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
231
252
  className: "text-xs text-status-error-text mb-1",
232
253
  children: "Purchase Type"
233
- }), /* @__PURE__ */ M("p", {
254
+ }), /* @__PURE__ */ P("p", {
234
255
  className: "text-sm text-status-error-text",
235
- children: [D, O && ` - ${O}`]
256
+ children: [F, V && ` - ${V}`]
236
257
  })] }),
237
- E && /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
258
+ j && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
238
259
  className: "text-xs text-status-error-text mb-1",
239
260
  children: "Reason"
240
- }), /* @__PURE__ */ j("p", {
261
+ }), /* @__PURE__ */ N("p", {
241
262
  className: "text-sm text-status-error-text",
242
- children: E
263
+ children: j
243
264
  })] }),
244
- x && /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
265
+ D && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
245
266
  className: "text-xs text-status-error-text mb-1",
246
267
  children: "Original Transaction"
247
- }), /* @__PURE__ */ j("p", {
268
+ }), /* @__PURE__ */ N("p", {
248
269
  className: "text-sm font-mono text-status-error-text break-all",
249
- children: x
270
+ children: D
250
271
  })] }),
251
- b && /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
272
+ T && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
252
273
  className: "text-xs text-status-error-text mb-1",
253
274
  children: "Refund Record ID"
254
- }), /* @__PURE__ */ j("p", {
275
+ }), /* @__PURE__ */ N("p", {
255
276
  className: "text-sm font-mono text-status-error-text break-all",
256
- children: b
277
+ children: T
257
278
  })] })
258
279
  ]
259
280
  }),
260
- e.stripePaymentId && /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
281
+ e.stripePaymentId && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
261
282
  className: "text-xs text-text-secondary mb-1",
262
283
  children: "Stripe Payment ID"
263
- }), /* @__PURE__ */ j("p", {
284
+ }), /* @__PURE__ */ N("p", {
264
285
  className: "text-sm font-mono break-all",
265
286
  children: e.stripePaymentId
266
287
  })] }),
267
- e.razorpayPaymentId && /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
288
+ e.razorpayPaymentId && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
268
289
  className: "text-xs text-text-secondary mb-1",
269
290
  children: "Razorpay Payment ID"
270
- }), /* @__PURE__ */ j("p", {
291
+ }), /* @__PURE__ */ N("p", {
271
292
  className: "text-sm font-mono break-all",
272
293
  children: e.razorpayPaymentId
273
294
  })] })
274
295
  ]
275
296
  }),
276
- /* @__PURE__ */ j(F, {
297
+ /* @__PURE__ */ N(R, {
277
298
  className: "p-4 border-t border-border-subtle",
278
- children: /* @__PURE__ */ j("button", {
299
+ children: /* @__PURE__ */ N("button", {
279
300
  type: "button",
280
301
  onClick: t,
281
302
  className: "w-full py-2 px-4 bg-action-primary-bg text-action-primary-text rounded-md hover:bg-action-primary-bg/90 transition-colors",
@@ -286,55 +307,64 @@ var H = {
286
307
  })
287
308
  });
288
309
  }, K = () => {
289
- let { t: m } = ee(), h = (e, t) => {
290
- let n = m(e);
310
+ let { t: g } = F(), _ = (e, t) => {
311
+ let n = g(e);
291
312
  return n === e ? t : n;
292
- }, { billingAccountId: C } = k(), E = l(), A = f(), { billingAccount: N, transactions: P, pagination: F, isLoading: I, error: L, refetch: K, goToNextPage: q, goToPreviousPage: te } = p(C), [J, ne] = g("all"), [Y, X] = g(null), Z = (e) => {
313
+ }, { billingAccountId: T } = j(), O = l(), M = p(), { billingAccount: I, transactions: L, pagination: R, isLoading: z, error: B, refetch: K, goToNextPage: re, goToPreviousPage: ie } = h(T), [q, ae] = v("all"), [J, Y] = v(null), { retryInvoiceGeneration: oe, isRetrying: se } = m(), [ce, X] = v(null), le = async (e) => {
314
+ if (T) {
315
+ X(null);
316
+ try {
317
+ await oe(e.id, T), d("success");
318
+ } catch (e) {
319
+ X(e instanceof Error ? e.message : "Failed to generate invoice"), d("error");
320
+ }
321
+ }
322
+ }, Z = (e) => {
293
323
  let t = e.metadata;
294
324
  return t?.zohoBooksInvoiceUrl ? t.zohoBooksInvoiceUrl : t?.invoiceUrl ? t.invoiceUrl : t?.invoicePdf ? t.invoicePdf : null;
295
- }, re = (e) => {
325
+ }, ue = (e) => {
296
326
  let t = e.metadata;
297
327
  return t?.total && typeof t.total == "number" ? t.total : e.amount;
298
- }, ie = (e) => {
328
+ }, de = (e) => {
299
329
  let t = e.metadata;
300
330
  return t?.zohoBooksInvoiceUrl ? "Zoho Books" : t?.invoiceUrl || t?.invoicePdf ? "Stripe" : null;
301
331
  }, Q = (e) => {
302
332
  let t = Z(e);
303
- t && (u("light"), d(t));
333
+ t && (u("light"), f(t));
304
334
  };
305
- if (!E.canViewPayments) return /* @__PURE__ */ j(e, { message: h("billing.transactions.noPermission", "You don't have permission to view transaction history.") });
306
- if (!C) return /* @__PURE__ */ j("div", {
335
+ if (!O.canViewPayments) return /* @__PURE__ */ N(e, { message: _("billing.transactions.noPermission", "You don't have permission to view transaction history.") });
336
+ if (!T) return /* @__PURE__ */ N("div", {
307
337
  className: "p-6",
308
- children: /* @__PURE__ */ j(n, {
309
- icon: /* @__PURE__ */ j("svg", {
338
+ children: /* @__PURE__ */ N(n, {
339
+ icon: /* @__PURE__ */ N("svg", {
310
340
  className: "size-6 text-text-secondary",
311
341
  fill: "none",
312
342
  viewBox: "0 0 24 24",
313
343
  stroke: "currentColor",
314
- children: /* @__PURE__ */ j("path", {
344
+ children: /* @__PURE__ */ N("path", {
315
345
  strokeLinecap: "round",
316
346
  strokeLinejoin: "round",
317
347
  strokeWidth: 2,
318
348
  d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
319
349
  })
320
350
  }),
321
- title: h("billing.transactions.noAccountSelected", "No billing account selected"),
322
- description: h("billing.transactions.noAccountSelectedDesc", "Please select a billing account from the overview page to view transactions.")
351
+ title: _("billing.transactions.noAccountSelected", "No billing account selected"),
352
+ description: _("billing.transactions.noAccountSelectedDesc", "Please select a billing account from the overview page to view transactions.")
323
353
  })
324
354
  });
325
- if (L && c(L)) return /* @__PURE__ */ j("div", {
355
+ if (B && c(B)) return /* @__PURE__ */ N("div", {
326
356
  className: "p-6",
327
- children: /* @__PURE__ */ j(r, {
328
- title: h("billing.transactions.serverUnavailable", "Server Unavailable"),
329
- message: h("billing.transactions.serverUnavailableMessage", "Unable to load transactions. The server might be down or experiencing issues."),
357
+ children: /* @__PURE__ */ N(r, {
358
+ title: _("billing.transactions.serverUnavailable", "Server Unavailable"),
359
+ message: _("billing.transactions.serverUnavailableMessage", "Unable to load transactions. The server might be down or experiencing issues."),
330
360
  onRetry: () => K(),
331
361
  showRetry: !0
332
362
  })
333
363
  });
334
- let $ = J === "all" ? P : P.filter((e) => e.type === J);
335
- return I ? /* @__PURE__ */ M("div", {
364
+ let $ = q === "all" ? L : L.filter((e) => e.type === q);
365
+ return z ? /* @__PURE__ */ P("div", {
336
366
  className: "space-y-6 p-6",
337
- children: [/* @__PURE__ */ j("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ j("div", {
367
+ children: [/* @__PURE__ */ N("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ N("div", {
338
368
  className: "space-y-2",
339
369
  children: [
340
370
  1,
@@ -342,121 +372,121 @@ var H = {
342
372
  3,
343
373
  4,
344
374
  5
345
- ].map((e) => /* @__PURE__ */ j("div", { className: "h-16 bg-bg-sunken animate-pulse rounded" }, e))
375
+ ].map((e) => /* @__PURE__ */ N("div", { className: "h-16 bg-bg-sunken animate-pulse rounded" }, e))
346
376
  })]
347
- }) : /* @__PURE__ */ M("div", {
377
+ }) : /* @__PURE__ */ P("div", {
348
378
  className: "space-y-6 p-6",
349
379
  children: [
350
- /* @__PURE__ */ M("button", {
380
+ /* @__PURE__ */ P("button", {
351
381
  type: "button",
352
- onClick: () => A("/overview"),
382
+ onClick: () => M("/overview"),
353
383
  className: "inline-flex items-center gap-2 text-sm text-text-secondary hover:text-text-primary transition-colors",
354
- children: [/* @__PURE__ */ j(_, { className: "size-4" }), "Back to Overview"]
384
+ children: [/* @__PURE__ */ N(y, { className: "size-4" }), "Back to Overview"]
355
385
  }),
356
- /* @__PURE__ */ j(t, {
357
- title: h("billing.transactions.title", "Transaction History"),
358
- description: N ? `Transactions for ${N.name}` : "View all your billing transactions"
386
+ /* @__PURE__ */ N(t, {
387
+ title: _("billing.transactions.title", "Transaction History"),
388
+ description: I ? `Transactions for ${I.name}` : "View all your billing transactions"
359
389
  }),
360
- /* @__PURE__ */ j(B, { children: h("billing.transactions.purpose", "A complete, time-ordered ledger of money movements on this billing account — payments, refunds and adjustments. Use it to reconcile what you were charged, open the linked invoice or credit note, and see tax breakdowns for each transaction.") }),
361
- N && /* @__PURE__ */ j(R, {
390
+ /* @__PURE__ */ N(U, { children: _("billing.transactions.purpose", "A complete, time-ordered ledger of money movements on this billing account — payments, refunds and adjustments. Use it to reconcile what you were charged, open the linked invoice or credit note, and see tax breakdowns for each transaction.") }),
391
+ I && /* @__PURE__ */ N(V, {
362
392
  className: "p-4",
363
- children: /* @__PURE__ */ M("div", {
393
+ children: /* @__PURE__ */ P("div", {
364
394
  className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",
365
395
  children: [
366
- /* @__PURE__ */ M("div", {
396
+ /* @__PURE__ */ P("div", {
367
397
  className: "flex items-start gap-2",
368
- children: [/* @__PURE__ */ j(S, { className: "size-4 text-text-secondary mt-0.5" }), /* @__PURE__ */ M("div", { children: [
369
- /* @__PURE__ */ j("p", {
398
+ children: [/* @__PURE__ */ N(w, { className: "size-4 text-text-secondary mt-0.5" }), /* @__PURE__ */ P("div", { children: [
399
+ /* @__PURE__ */ N("p", {
370
400
  className: "text-xs text-text-secondary mb-0.5",
371
401
  children: "Account"
372
402
  }),
373
- /* @__PURE__ */ j("p", {
403
+ /* @__PURE__ */ N("p", {
374
404
  className: "text-sm font-medium",
375
- children: N.name
405
+ children: I.name
376
406
  }),
377
- N.isActive ? /* @__PURE__ */ M("span", {
407
+ I.isActive ? /* @__PURE__ */ P("span", {
378
408
  className: "inline-flex items-center gap-1 mt-1 px-1.5 py-0.5 text-xs font-medium rounded bg-status-success-bg-subtle text-status-success-text",
379
- children: [/* @__PURE__ */ j(y, { className: "size-3" }), "Active"]
380
- }) : /* @__PURE__ */ M("span", {
409
+ children: [/* @__PURE__ */ N(x, { className: "size-3" }), "Active"]
410
+ }) : /* @__PURE__ */ P("span", {
381
411
  className: "inline-flex items-center gap-1 mt-1 px-1.5 py-0.5 text-xs font-medium rounded bg-status-error-bg-subtle text-status-error-text",
382
- children: [/* @__PURE__ */ j(O, { className: "size-3" }), "Inactive"]
412
+ children: [/* @__PURE__ */ N(A, { className: "size-3" }), "Inactive"]
383
413
  })
384
414
  ] })]
385
415
  }),
386
- /* @__PURE__ */ M("div", {
416
+ /* @__PURE__ */ P("div", {
387
417
  className: "flex items-start gap-2",
388
- children: [/* @__PURE__ */ j(T, { className: "size-4 text-text-secondary mt-0.5" }), /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
418
+ children: [/* @__PURE__ */ N(D, { className: "size-4 text-text-secondary mt-0.5" }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
389
419
  className: "text-xs text-text-secondary mb-0.5",
390
420
  children: "Email"
391
- }), /* @__PURE__ */ j("p", {
421
+ }), /* @__PURE__ */ N("p", {
392
422
  className: "text-sm font-medium break-all",
393
- children: N.billingEmail || N.email
423
+ children: I.billingEmail || I.email
394
424
  })] })]
395
425
  }),
396
- /* @__PURE__ */ M("div", {
426
+ /* @__PURE__ */ P("div", {
397
427
  className: "flex items-start gap-2",
398
- children: [/* @__PURE__ */ j(D, { className: "size-4 text-text-secondary mt-0.5" }), /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
428
+ children: [/* @__PURE__ */ N(k, { className: "size-4 text-text-secondary mt-0.5" }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
399
429
  className: "text-xs text-text-secondary mb-0.5",
400
430
  children: "Credits Balance"
401
- }), /* @__PURE__ */ M("p", {
431
+ }), /* @__PURE__ */ P("p", {
402
432
  className: "text-sm font-semibold text-text-primary",
403
- children: [(N.creditAmount || 0).toLocaleString(), " Credits"]
433
+ children: [(I.creditAmount || 0).toLocaleString(), " Credits"]
404
434
  })] })]
405
435
  }),
406
- /* @__PURE__ */ M("div", {
436
+ /* @__PURE__ */ P("div", {
407
437
  className: "flex items-start gap-2",
408
- children: [/* @__PURE__ */ j(w, { className: "size-4 text-text-secondary mt-0.5" }), /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
438
+ children: [/* @__PURE__ */ N(E, { className: "size-4 text-text-secondary mt-0.5" }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
409
439
  className: "text-xs text-text-secondary mb-0.5",
410
440
  children: "Tax ID"
411
- }), /* @__PURE__ */ j("p", {
441
+ }), /* @__PURE__ */ N("p", {
412
442
  className: "text-sm font-medium",
413
- children: N.taxId || "-"
443
+ children: I.taxId || "-"
414
444
  })] })]
415
445
  }),
416
- /* @__PURE__ */ M("div", {
446
+ /* @__PURE__ */ P("div", {
417
447
  className: "flex items-start gap-2",
418
- children: [/* @__PURE__ */ j(v, { className: "size-4 text-text-secondary mt-0.5" }), /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("p", {
448
+ children: [/* @__PURE__ */ N(b, { className: "size-4 text-text-secondary mt-0.5" }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
419
449
  className: "text-xs text-text-secondary mb-0.5",
420
450
  children: "Member Since"
421
- }), /* @__PURE__ */ j("p", {
451
+ }), /* @__PURE__ */ N("p", {
422
452
  className: "text-sm font-medium",
423
- children: N.createdAt ? a(N.createdAt) : "-"
453
+ children: I.createdAt ? a(I.createdAt) : "-"
424
454
  })] })]
425
455
  })
426
456
  ]
427
457
  })
428
458
  }),
429
- /* @__PURE__ */ j("div", {
459
+ /* @__PURE__ */ N("div", {
430
460
  className: "flex items-center gap-4",
431
- children: /* @__PURE__ */ j("div", {
461
+ children: /* @__PURE__ */ N("div", {
432
462
  className: "inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken/50",
433
463
  children: [
434
464
  "all",
435
465
  "payment",
436
466
  "refund",
437
467
  "adjustment"
438
- ].map((e) => /* @__PURE__ */ j("button", {
468
+ ].map((e) => /* @__PURE__ */ N("button", {
439
469
  type: "button",
440
- onClick: () => ne(e),
441
- className: `px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${J === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
442
- children: e === "all" ? "All" : H[e]
470
+ onClick: () => ae(e),
471
+ className: `px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${q === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
472
+ children: e === "all" ? "All" : W[e]
443
473
  }, e))
444
474
  })
445
475
  }),
446
- $.length === 0 ? /* @__PURE__ */ j(z, {
447
- illustration: J === "all" ? "empty-data" : "empty-search",
448
- title: h("billing.transactions.noTransactionsFound", "No transactions found"),
449
- description: J === "all" ? h("billing.transactions.noTransactionsYet", "Your transaction history will appear here.") : h("billing.transactions.noTransactionsFiltered", "No transactions match your filter.")
450
- }) : /* @__PURE__ */ j("div", {
476
+ $.length === 0 ? /* @__PURE__ */ N(H, {
477
+ illustration: q === "all" ? "empty-data" : "empty-search",
478
+ title: _("billing.transactions.noTransactionsFound", "No transactions found"),
479
+ description: q === "all" ? _("billing.transactions.noTransactionsYet", "Your transaction history will appear here.") : _("billing.transactions.noTransactionsFiltered", "No transactions match your filter.")
480
+ }) : /* @__PURE__ */ N("div", {
451
481
  className: "border border-border-subtle rounded-lg overflow-visible",
452
- children: /* @__PURE__ */ j(V, {
482
+ children: /* @__PURE__ */ N(ee, {
453
483
  columns: [
454
484
  {
455
485
  key: "date",
456
486
  header: "Date",
457
487
  priority: "primary",
458
488
  cellClassName: "whitespace-nowrap",
459
- cell: (e) => /* @__PURE__ */ j("span", {
489
+ cell: (e) => /* @__PURE__ */ N("span", {
460
490
  className: "text-sm text-text-primary",
461
491
  children: a(e.createdAt)
462
492
  })
@@ -465,15 +495,15 @@ var H = {
465
495
  key: "type",
466
496
  header: "Type",
467
497
  cellClassName: "whitespace-nowrap",
468
- cell: (e) => /* @__PURE__ */ j("span", {
498
+ cell: (e) => /* @__PURE__ */ N("span", {
469
499
  className: "text-sm text-text-primary capitalize",
470
- children: U(e.type)
500
+ children: G(e.type)
471
501
  })
472
502
  },
473
503
  {
474
504
  key: "description",
475
505
  header: "Description",
476
- cell: (e) => /* @__PURE__ */ j("span", {
506
+ cell: (e) => /* @__PURE__ */ N("span", {
477
507
  className: "text-sm text-text-secondary",
478
508
  children: e.description ?? "-"
479
509
  })
@@ -483,9 +513,9 @@ var H = {
483
513
  header: "Amount",
484
514
  headerClassName: "text-right",
485
515
  cellClassName: "text-right whitespace-nowrap",
486
- cell: (e) => /* @__PURE__ */ M("span", {
516
+ cell: (e) => /* @__PURE__ */ P("span", {
487
517
  className: `text-sm font-medium tabular-nums ${e.type === "refund" ? "text-status-error-text" : "text-text-primary"}`,
488
- children: [e.type === "refund" ? "-" : "", i(re(e), e.currency)]
518
+ children: [e.type === "refund" ? "-" : "", i(ue(e), e.currency)]
489
519
  })
490
520
  },
491
521
  {
@@ -493,7 +523,7 @@ var H = {
493
523
  header: "Status",
494
524
  headerClassName: "text-center",
495
525
  cellClassName: "text-center whitespace-nowrap",
496
- cell: (e) => /* @__PURE__ */ j("span", {
526
+ cell: (e) => /* @__PURE__ */ N("span", {
497
527
  className: `px-1.5 py-0.5 text-xs font-medium rounded ${o(s(e.status))}`,
498
528
  children: e.status
499
529
  })
@@ -501,64 +531,69 @@ var H = {
501
531
  ],
502
532
  data: $,
503
533
  rowKey: (e) => e.id,
504
- rowActions: (e) => /* @__PURE__ */ j(W, {
534
+ rowActions: (e) => /* @__PURE__ */ N(te, {
505
535
  transaction: e,
506
- onViewDetails: () => X(e),
536
+ onViewDetails: () => Y(e),
507
537
  onViewInvoice: () => Q(e),
508
538
  hasInvoiceUrl: !!Z(e)
509
539
  })
510
540
  })
511
541
  }),
512
- F.totalCount > 0 && /* @__PURE__ */ M("div", {
542
+ R.totalCount > 0 && /* @__PURE__ */ P("div", {
513
543
  className: "flex items-center justify-between border-t border-border-subtle pt-4",
514
- children: [/* @__PURE__ */ M("p", {
544
+ children: [/* @__PURE__ */ P("p", {
515
545
  className: "text-sm text-text-secondary",
516
546
  children: [
517
547
  "Showing ",
518
- F.page * F.pageSize + 1,
548
+ R.page * R.pageSize + 1,
519
549
  " to",
520
550
  " ",
521
- Math.min((F.page + 1) * F.pageSize, F.totalCount),
551
+ Math.min((R.page + 1) * R.pageSize, R.totalCount),
522
552
  " of",
523
553
  " ",
524
- F.totalCount,
554
+ R.totalCount,
525
555
  " transactions"
526
556
  ]
527
- }), /* @__PURE__ */ M("div", {
557
+ }), /* @__PURE__ */ P("div", {
528
558
  className: "flex items-center gap-2",
529
559
  children: [
530
- /* @__PURE__ */ M("button", {
560
+ /* @__PURE__ */ P("button", {
531
561
  type: "button",
532
- onClick: te,
533
- disabled: !F.hasPrevious,
562
+ onClick: ie,
563
+ disabled: !R.hasPrevious,
534
564
  className: "inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-md border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
535
- children: [/* @__PURE__ */ j(b, { className: "size-4" }), "Previous"]
565
+ children: [/* @__PURE__ */ N(S, { className: "size-4" }), "Previous"]
536
566
  }),
537
- /* @__PURE__ */ M("span", {
567
+ /* @__PURE__ */ P("span", {
538
568
  className: "text-sm text-text-secondary px-2",
539
569
  children: [
540
570
  "Page ",
541
- F.page + 1,
571
+ R.page + 1,
542
572
  " of ",
543
- Math.ceil(F.totalCount / F.pageSize)
573
+ Math.ceil(R.totalCount / R.pageSize)
544
574
  ]
545
575
  }),
546
- /* @__PURE__ */ M("button", {
576
+ /* @__PURE__ */ P("button", {
547
577
  type: "button",
548
- onClick: q,
549
- disabled: !F.hasMore,
578
+ onClick: re,
579
+ disabled: !R.hasMore,
550
580
  className: "inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-md border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
551
- children: ["Next", /* @__PURE__ */ j(x, { className: "size-4" })]
581
+ children: ["Next", /* @__PURE__ */ N(C, { className: "size-4" })]
552
582
  })
553
583
  ]
554
584
  })]
555
585
  }),
556
- /* @__PURE__ */ j(G, {
557
- transaction: Y,
558
- onClose: () => X(null),
586
+ /* @__PURE__ */ N(ne, {
587
+ transaction: J,
588
+ onClose: () => {
589
+ Y(null), X(null);
590
+ },
559
591
  onViewInvoice: Q,
560
- invoiceUrl: Y ? Z(Y) : null,
561
- invoiceProvider: Y ? ie(Y) : null
592
+ onRetryInvoice: le,
593
+ isRetryingInvoice: se,
594
+ retryInvoiceError: ce,
595
+ invoiceUrl: J ? Z(J) : null,
596
+ invoiceProvider: J ? de(J) : null
562
597
  })
563
598
  ]
564
599
  });