@burdenoff/microfe-billing 2026.1112.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.
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +182 -150
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +153 -126
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +110 -109
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +220 -181
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,38 +2,39 @@ import { useBillingNavigate as e } from "../../../hooks/useBillingNavigate.js";
|
|
|
2
2
|
import { useCreditTransactions as t } from "../hooks/useCredits.js";
|
|
3
3
|
import "../../subscriptions/hooks/index.js";
|
|
4
4
|
import { useBillingPermissions as n } from "../../../hooks/useBillingPermissions.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { useIsFluidgridsVariant as r } from "../../../hooks/useBillingVariant.js";
|
|
6
|
+
import { formatCreditTransactionType as i, formatDate as a, formatRelativeTime as o } from "../../../shared/utils/format.js";
|
|
7
|
+
import { getCreditTransactionStatusColor as s, getStatusBadgeClasses as c } from "../../../shared/utils/status.js";
|
|
8
|
+
import { useDefaultBillingAccount as l } from "../../subscriptions/hooks/useSubscriptions.js";
|
|
9
|
+
import { statusTokens as u } from "../../../shared/utils/tokens.js";
|
|
10
|
+
import { useState as d } from "react";
|
|
11
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
12
|
+
import { useI18n as m } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
13
|
+
import { EmphasisPanel as h, IllustratedEmptyState as g, PagePurpose as _ } from "@burdenoff/fe-libs/ui";
|
|
13
14
|
// src/billing/modules/credits/pages/CreditsPage.tsx
|
|
14
|
-
var
|
|
15
|
-
let { t:
|
|
16
|
-
let n =
|
|
15
|
+
var v = () => {
|
|
16
|
+
let { t: a } = m(), o = (e, t) => {
|
|
17
|
+
let n = a(e);
|
|
17
18
|
return n === e ? t : n;
|
|
18
|
-
},
|
|
19
|
-
billingAccountId:
|
|
20
|
-
days:
|
|
21
|
-
page:
|
|
19
|
+
}, s = e(), c = n(), u = !r(), { billingAccount: v, isLoading: b } = l(), [x, S] = d(30), [C, w] = d("all"), [T, E] = d(1), { transactions: D, pagination: O, isLoading: k, error: A, refetch: j } = t({
|
|
20
|
+
billingAccountId: v?.id || "",
|
|
21
|
+
days: x,
|
|
22
|
+
page: T,
|
|
22
23
|
pageSize: 20
|
|
23
24
|
});
|
|
24
|
-
if (!
|
|
25
|
+
if (!c.canViewCredits) return /* @__PURE__ */ f("div", {
|
|
25
26
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
26
|
-
children: /* @__PURE__ */
|
|
27
|
+
children: /* @__PURE__ */ p("div", {
|
|
27
28
|
className: "text-center space-y-2",
|
|
28
29
|
children: [
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */ f("div", {
|
|
30
31
|
className: "size-12 mx-auto rounded-full bg-bg-sunken flex items-center justify-center",
|
|
31
|
-
children: /* @__PURE__ */
|
|
32
|
+
children: /* @__PURE__ */ f("svg", {
|
|
32
33
|
className: "size-6 text-text-secondary",
|
|
33
34
|
fill: "none",
|
|
34
35
|
viewBox: "0 0 24 24",
|
|
35
36
|
stroke: "currentColor",
|
|
36
|
-
children: /* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ f("path", {
|
|
37
38
|
strokeLinecap: "round",
|
|
38
39
|
strokeLinejoin: "round",
|
|
39
40
|
strokeWidth: 2,
|
|
@@ -41,41 +42,41 @@ var _ = () => {
|
|
|
41
42
|
})
|
|
42
43
|
})
|
|
43
44
|
}),
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ f("h2", {
|
|
45
46
|
className: "text-lg font-semibold text-text-primary",
|
|
46
47
|
children: "Access Denied"
|
|
47
48
|
}),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ f("p", {
|
|
49
50
|
className: "text-sm text-text-secondary max-w-sm",
|
|
50
51
|
children: "You don't have permission to view credits."
|
|
51
52
|
})
|
|
52
53
|
]
|
|
53
54
|
})
|
|
54
55
|
});
|
|
55
|
-
let
|
|
56
|
-
if (
|
|
56
|
+
let M = b || k, N = D.filter((e) => C === "all" || e.type === C);
|
|
57
|
+
if (M && !v) return /* @__PURE__ */ p("div", {
|
|
57
58
|
className: "space-y-6 px-6 lg:px-8 py-6",
|
|
58
|
-
children: [/* @__PURE__ */
|
|
59
|
+
children: [/* @__PURE__ */ f("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ f("div", {
|
|
59
60
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
|
|
60
|
-
children: /* @__PURE__ */
|
|
61
|
+
children: /* @__PURE__ */ p("div", {
|
|
61
62
|
className: "border border-border-subtle rounded-lg p-6",
|
|
62
|
-
children: [/* @__PURE__ */
|
|
63
|
+
children: [/* @__PURE__ */ f("div", { className: "h-6 w-24 bg-bg-sunken animate-pulse rounded mb-2" }), /* @__PURE__ */ f("div", { className: "h-10 w-32 bg-bg-sunken animate-pulse rounded" })]
|
|
63
64
|
})
|
|
64
65
|
})]
|
|
65
66
|
});
|
|
66
|
-
if (
|
|
67
|
+
if (A) return /* @__PURE__ */ f("div", {
|
|
67
68
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
68
|
-
children: /* @__PURE__ */
|
|
69
|
+
children: /* @__PURE__ */ p("div", {
|
|
69
70
|
className: "text-center space-y-4",
|
|
70
71
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ f("div", {
|
|
72
73
|
className: "size-12 mx-auto rounded-full bg-status-error-bg-subtle flex items-center justify-center",
|
|
73
|
-
children: /* @__PURE__ */
|
|
74
|
+
children: /* @__PURE__ */ f("svg", {
|
|
74
75
|
className: "size-6 text-status-error-text",
|
|
75
76
|
fill: "none",
|
|
76
77
|
viewBox: "0 0 24 24",
|
|
77
78
|
stroke: "currentColor",
|
|
78
|
-
children: /* @__PURE__ */
|
|
79
|
+
children: /* @__PURE__ */ f("path", {
|
|
79
80
|
strokeLinecap: "round",
|
|
80
81
|
strokeLinejoin: "round",
|
|
81
82
|
strokeWidth: 2,
|
|
@@ -83,70 +84,70 @@ var _ = () => {
|
|
|
83
84
|
})
|
|
84
85
|
})
|
|
85
86
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ f("h2", {
|
|
87
88
|
className: "text-lg font-semibold text-text-primary",
|
|
88
89
|
children: "Failed to load credits"
|
|
89
90
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ f("p", {
|
|
91
92
|
className: "text-sm text-text-secondary",
|
|
92
|
-
children:
|
|
93
|
+
children: A.message
|
|
93
94
|
}),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ f("button", {
|
|
95
96
|
type: "button",
|
|
96
|
-
onClick: () =>
|
|
97
|
+
onClick: () => j(),
|
|
97
98
|
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",
|
|
98
99
|
children: "Try Again"
|
|
99
100
|
})
|
|
100
101
|
]
|
|
101
102
|
})
|
|
102
103
|
});
|
|
103
|
-
let
|
|
104
|
-
return /* @__PURE__ */
|
|
104
|
+
let P = v?.creditAmount || 0;
|
|
105
|
+
return /* @__PURE__ */ p("div", {
|
|
105
106
|
className: "space-y-6 px-6 lg:px-8 py-6",
|
|
106
107
|
children: [
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ p("div", {
|
|
108
109
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
109
|
-
children: [/* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */
|
|
110
|
+
children: [/* @__PURE__ */ p("div", { children: [
|
|
111
|
+
/* @__PURE__ */ f("h1", {
|
|
111
112
|
className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
|
|
112
|
-
children:
|
|
113
|
+
children: o("billing.credits.title", "Credits")
|
|
113
114
|
}),
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ f("p", {
|
|
115
116
|
className: "text-sm text-text-secondary mt-1",
|
|
116
117
|
children: "Manage your credit balance and view transaction history"
|
|
117
118
|
}),
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ f(_, {
|
|
119
120
|
className: "mt-3",
|
|
120
|
-
children:
|
|
121
|
+
children: o("billing.credits.purpose", "Credits are prepaid balance you can spend on usage and purchases instead of paying per invoice. See your available balance, top it up, withdraw unused credits, and review every credit purchase, grant and deduction over time.")
|
|
121
122
|
})
|
|
122
|
-
] }), /* @__PURE__ */
|
|
123
|
+
] }), /* @__PURE__ */ p("div", {
|
|
123
124
|
className: "flex items-center gap-2",
|
|
124
|
-
children: [/* @__PURE__ */
|
|
125
|
+
children: [u && /* @__PURE__ */ p("button", {
|
|
125
126
|
type: "button",
|
|
126
|
-
onClick: () =>
|
|
127
|
+
onClick: () => s("/credits/withdraw"),
|
|
127
128
|
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
|
|
128
|
-
children: [/* @__PURE__ */
|
|
129
|
+
children: [/* @__PURE__ */ f("svg", {
|
|
129
130
|
className: "size-4",
|
|
130
131
|
fill: "none",
|
|
131
132
|
viewBox: "0 0 24 24",
|
|
132
133
|
stroke: "currentColor",
|
|
133
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ f("path", {
|
|
134
135
|
strokeLinecap: "round",
|
|
135
136
|
strokeLinejoin: "round",
|
|
136
137
|
strokeWidth: 2,
|
|
137
138
|
d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"
|
|
138
139
|
})
|
|
139
140
|
}), "Withdraw"]
|
|
140
|
-
}), /* @__PURE__ */
|
|
141
|
+
}), /* @__PURE__ */ p("button", {
|
|
141
142
|
type: "button",
|
|
142
|
-
onClick: () =>
|
|
143
|
+
onClick: () => s("/checkout/credits"),
|
|
143
144
|
className: "inline-flex items-center gap-2 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",
|
|
144
|
-
children: [/* @__PURE__ */
|
|
145
|
+
children: [/* @__PURE__ */ f("svg", {
|
|
145
146
|
className: "size-4",
|
|
146
147
|
fill: "none",
|
|
147
148
|
viewBox: "0 0 24 24",
|
|
148
149
|
stroke: "currentColor",
|
|
149
|
-
children: /* @__PURE__ */
|
|
150
|
+
children: /* @__PURE__ */ f("path", {
|
|
150
151
|
strokeLinecap: "round",
|
|
151
152
|
strokeLinejoin: "round",
|
|
152
153
|
strokeWidth: 2,
|
|
@@ -156,61 +157,61 @@ var _ = () => {
|
|
|
156
157
|
})]
|
|
157
158
|
})]
|
|
158
159
|
}),
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ p("div", {
|
|
160
161
|
className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",
|
|
161
|
-
children: [/* @__PURE__ */
|
|
162
|
+
children: [/* @__PURE__ */ p(h, {
|
|
162
163
|
className: "p-6",
|
|
163
164
|
children: [
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ f("p", {
|
|
165
166
|
className: "text-sm text-text-secondary",
|
|
166
167
|
children: "Available Balance"
|
|
167
168
|
}),
|
|
168
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ p("p", {
|
|
169
170
|
className: "text-3xl font-bold tabular-nums text-text-primary mt-2",
|
|
170
|
-
children: [
|
|
171
|
+
children: [P.toLocaleString(), " Credits"]
|
|
171
172
|
}),
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ f("p", {
|
|
173
174
|
className: "text-sm text-text-secondary mt-2",
|
|
174
|
-
children:
|
|
175
|
+
children: v?.name
|
|
175
176
|
})
|
|
176
177
|
]
|
|
177
|
-
}), /* @__PURE__ */
|
|
178
|
+
}), /* @__PURE__ */ p("div", {
|
|
178
179
|
className: "border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 p-5",
|
|
179
180
|
children: [
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ p("p", {
|
|
181
182
|
className: "text-sm text-text-secondary",
|
|
182
183
|
children: [
|
|
183
184
|
"Transactions (",
|
|
184
|
-
|
|
185
|
+
x,
|
|
185
186
|
"d)"
|
|
186
187
|
]
|
|
187
188
|
}),
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ f("p", {
|
|
189
190
|
className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary mt-2",
|
|
190
|
-
children:
|
|
191
|
+
children: O.totalCount
|
|
191
192
|
}),
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ f("p", {
|
|
193
194
|
className: "text-sm text-text-secondary mt-2",
|
|
194
195
|
children: "Total transactions"
|
|
195
196
|
})
|
|
196
197
|
]
|
|
197
198
|
})]
|
|
198
199
|
}),
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ p("div", {
|
|
200
201
|
className: "flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle",
|
|
201
|
-
children: [/* @__PURE__ */
|
|
202
|
+
children: [/* @__PURE__ */ f("div", {
|
|
202
203
|
className: "inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken",
|
|
203
204
|
children: [
|
|
204
205
|
7,
|
|
205
206
|
30,
|
|
206
207
|
90
|
|
207
|
-
].map((e) => /* @__PURE__ */
|
|
208
|
+
].map((e) => /* @__PURE__ */ p("button", {
|
|
208
209
|
type: "button",
|
|
209
|
-
onClick: () =>
|
|
210
|
-
className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${
|
|
210
|
+
onClick: () => S(e),
|
|
211
|
+
className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${x === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
|
|
211
212
|
children: [e, "d"]
|
|
212
213
|
}, e))
|
|
213
|
-
}), /* @__PURE__ */
|
|
214
|
+
}), /* @__PURE__ */ f("div", {
|
|
214
215
|
className: "inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken",
|
|
215
216
|
children: [
|
|
216
217
|
"all",
|
|
@@ -218,25 +219,25 @@ var _ = () => {
|
|
|
218
219
|
"usage",
|
|
219
220
|
"adjustment",
|
|
220
221
|
"granted"
|
|
221
|
-
].map((e) => /* @__PURE__ */
|
|
222
|
+
].map((e) => /* @__PURE__ */ f("button", {
|
|
222
223
|
type: "button",
|
|
223
|
-
onClick: () =>
|
|
224
|
-
className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors capitalize ${
|
|
225
|
-
children: e === "all" ? "All" :
|
|
224
|
+
onClick: () => w(e),
|
|
225
|
+
className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors capitalize ${C === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
|
|
226
|
+
children: e === "all" ? "All" : i(e)
|
|
226
227
|
}, e))
|
|
227
228
|
})]
|
|
228
229
|
}),
|
|
229
|
-
|
|
230
|
-
illustration:
|
|
230
|
+
N.length === 0 ? /* @__PURE__ */ f(g, {
|
|
231
|
+
illustration: C === "all" ? "empty-data" : "empty-search",
|
|
231
232
|
title: "No transactions found",
|
|
232
|
-
description:
|
|
233
|
-
}) : /* @__PURE__ */
|
|
233
|
+
description: C === "all" ? "No credit transactions in this period." : "No transactions match your filter."
|
|
234
|
+
}) : /* @__PURE__ */ p("div", {
|
|
234
235
|
className: "space-y-3",
|
|
235
|
-
children: [
|
|
236
|
+
children: [N.map((e) => /* @__PURE__ */ f(y, { transaction: e }, e.id)), O.hasMore && /* @__PURE__ */ f("div", {
|
|
236
237
|
className: "flex justify-center pt-4",
|
|
237
|
-
children: /* @__PURE__ */
|
|
238
|
+
children: /* @__PURE__ */ f("button", {
|
|
238
239
|
type: "button",
|
|
239
|
-
onClick: () =>
|
|
240
|
+
onClick: () => E((e) => e + 1),
|
|
240
241
|
className: "px-4 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
|
|
241
242
|
children: "Load More"
|
|
242
243
|
})
|
|
@@ -244,30 +245,30 @@ var _ = () => {
|
|
|
244
245
|
})
|
|
245
246
|
]
|
|
246
247
|
});
|
|
247
|
-
},
|
|
248
|
-
let t =
|
|
249
|
-
return /* @__PURE__ */
|
|
248
|
+
}, y = ({ transaction: e }) => {
|
|
249
|
+
let t = s(e.status), n = e.type === "purchase" || e.type === "adjustment" || e.type === "granted";
|
|
250
|
+
return /* @__PURE__ */ p("div", {
|
|
250
251
|
className: "flex items-center gap-4 p-4 border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 hover:shadow-sm transition-shadow",
|
|
251
252
|
children: [
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
className: `size-10 rounded-full flex items-center justify-center ${n ?
|
|
254
|
-
children: n ? /* @__PURE__ */
|
|
255
|
-
className: `size-5 ${
|
|
253
|
+
/* @__PURE__ */ f("div", {
|
|
254
|
+
className: `size-10 rounded-full flex items-center justify-center ${n ? u.success.bg : u.warning.bg}`,
|
|
255
|
+
children: n ? /* @__PURE__ */ f("svg", {
|
|
256
|
+
className: `size-5 ${u.success.icon}`,
|
|
256
257
|
fill: "none",
|
|
257
258
|
viewBox: "0 0 24 24",
|
|
258
259
|
stroke: "currentColor",
|
|
259
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ f("path", {
|
|
260
261
|
strokeLinecap: "round",
|
|
261
262
|
strokeLinejoin: "round",
|
|
262
263
|
strokeWidth: 2,
|
|
263
264
|
d: "M12 4v16m8-8H4"
|
|
264
265
|
})
|
|
265
|
-
}) : /* @__PURE__ */
|
|
266
|
-
className: `size-5 ${
|
|
266
|
+
}) : /* @__PURE__ */ f("svg", {
|
|
267
|
+
className: `size-5 ${u.warning.icon}`,
|
|
267
268
|
fill: "none",
|
|
268
269
|
viewBox: "0 0 24 24",
|
|
269
270
|
stroke: "currentColor",
|
|
270
|
-
children: /* @__PURE__ */
|
|
271
|
+
children: /* @__PURE__ */ f("path", {
|
|
271
272
|
strokeLinecap: "round",
|
|
272
273
|
strokeLinejoin: "round",
|
|
273
274
|
strokeWidth: 2,
|
|
@@ -275,30 +276,30 @@ var _ = () => {
|
|
|
275
276
|
})
|
|
276
277
|
})
|
|
277
278
|
}),
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
+
/* @__PURE__ */ p("div", {
|
|
279
280
|
className: "flex-1 min-w-0",
|
|
280
|
-
children: [/* @__PURE__ */
|
|
281
|
+
children: [/* @__PURE__ */ p("div", {
|
|
281
282
|
className: "flex items-center gap-2",
|
|
282
|
-
children: [/* @__PURE__ */
|
|
283
|
+
children: [/* @__PURE__ */ f("p", {
|
|
283
284
|
className: "font-medium text-text-primary capitalize",
|
|
284
|
-
children:
|
|
285
|
-
}), /* @__PURE__ */
|
|
286
|
-
className: `px-2 py-0.5 text-xs font-medium rounded ${
|
|
285
|
+
children: i(e.type)
|
|
286
|
+
}), /* @__PURE__ */ f("span", {
|
|
287
|
+
className: `px-2 py-0.5 text-xs font-medium rounded ${c(t)}`,
|
|
287
288
|
children: e.status
|
|
288
289
|
})]
|
|
289
|
-
}), /* @__PURE__ */
|
|
290
|
+
}), /* @__PURE__ */ p("p", {
|
|
290
291
|
className: "text-sm text-text-secondary mt-0.5",
|
|
291
292
|
children: [
|
|
292
|
-
|
|
293
|
+
o(e.createdAt),
|
|
293
294
|
" • ",
|
|
294
|
-
|
|
295
|
+
a(e.createdAt, "short")
|
|
295
296
|
]
|
|
296
297
|
})]
|
|
297
298
|
}),
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ f("div", {
|
|
299
300
|
className: "text-right",
|
|
300
|
-
children: /* @__PURE__ */
|
|
301
|
-
className: `font-semibold ${n ?
|
|
301
|
+
children: /* @__PURE__ */ p("p", {
|
|
302
|
+
className: `font-semibold ${n ? u.success.text : "text-text-primary"}`,
|
|
302
303
|
children: [
|
|
303
304
|
n ? "+" : "-",
|
|
304
305
|
e.amount.toLocaleString(),
|
|
@@ -309,6 +310,6 @@ var _ = () => {
|
|
|
309
310
|
]
|
|
310
311
|
});
|
|
311
312
|
};
|
|
312
|
-
export {
|
|
313
|
+
export { v as CreditsPage };
|
|
313
314
|
|
|
314
315
|
//# sourceMappingURL=CreditsPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreditsPage.js","names":["CreditsPage","useI18n","tr","translated","t","key","fallback","navigateTo","useBillingNavigate","permissions","useBillingPermissions","isLoadingAccount","useDefaultBillingAccount","days","setDays","useState","filterType","setFilterType","page","setPage","isLoadingTransactions","useCreditTransactions","billingAccount","isLoading","filteredTransactions","transactions","tx","error","refetch","creditBalance","PagePurpose","EmphasisPanel","pagination","d","type","formatCreditTransactionType","IllustratedEmptyState","TransactionRow","p","statusColor","getCreditTransactionStatusColor","transaction","isCredit","statusTokens","getStatusBadgeClasses","formatRelativeTime","formatDate"],"sources":["../../../../../src/billing/modules/credits/pages/CreditsPage.tsx"],"sourcesContent":["/**\n * Credits Module - Credits Page\n * Displays credit balance and transaction history\n */\n\nimport { useState, type FC } from 'react';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useCreditTransactions } from '../hooks/useCredits';\nimport { useDefaultBillingAccount } from '../../subscriptions/hooks';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport {\n formatDate,\n formatRelativeTime,\n formatCreditTransactionType,\n} from '../../../shared/utils/format';\nimport {\n getCreditTransactionStatusColor,\n getStatusBadgeClasses,\n} from '../../../shared/utils/status';\nimport { statusTokens } from '../../../shared/utils/tokens';\nimport type { CreditTransaction, CreditTransactionType } from '../../../shared/types';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { EmphasisPanel, PagePurpose, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\n\ntype FilterType = 'all' | CreditTransactionType;\n\nexport const CreditsPage: FC = () => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n const navigateTo = useBillingNavigate();\n const permissions = useBillingPermissions();\n const { billingAccount, isLoading: isLoadingAccount } = useDefaultBillingAccount();\n\n const [days, setDays] = useState(30);\n const [filterType, setFilterType] = useState<FilterType>('all');\n const [page, setPage] = useState(1);\n\n const {\n transactions,\n pagination,\n isLoading: isLoadingTransactions,\n error,\n refetch,\n } = useCreditTransactions({\n billingAccountId: billingAccount?.id || '',\n days,\n page,\n pageSize: 20,\n });\n\n // Permission check\n if (!permissions.canViewCredits) {\n return (\n <div className=\"flex items-center justify-center h-full min-h-[400px]\">\n <div className=\"text-center space-y-2\">\n <div className=\"size-12 mx-auto rounded-full bg-bg-sunken flex items-center justify-center\">\n <svg\n className=\"size-6 text-text-secondary\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z\"\n />\n </svg>\n </div>\n <h2 className=\"text-lg font-semibold text-text-primary\">Access Denied</h2>\n <p className=\"text-sm text-text-secondary max-w-sm\">\n You don't have permission to view credits.\n </p>\n </div>\n </div>\n );\n }\n\n const isLoading = isLoadingAccount || isLoadingTransactions;\n\n // Filter transactions\n const filteredTransactions = transactions.filter((tx) => {\n if (filterType === 'all') return true;\n return tx.type === filterType;\n });\n\n // Loading state\n if (isLoading && !billingAccount) {\n return (\n <div className=\"space-y-6 px-6 lg:px-8 py-6\">\n <div className=\"h-8 w-48 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <div className=\"border border-border-subtle rounded-lg p-6\">\n <div className=\"h-6 w-24 bg-bg-sunken animate-pulse rounded mb-2\" />\n <div className=\"h-10 w-32 bg-bg-sunken animate-pulse rounded\" />\n </div>\n </div>\n </div>\n );\n }\n\n // Error state\n if (error) {\n return (\n <div className=\"flex items-center justify-center h-full min-h-[400px]\">\n <div className=\"text-center space-y-4\">\n <div className=\"size-12 mx-auto rounded-full bg-status-error-bg-subtle flex items-center justify-center\">\n <svg\n className=\"size-6 text-status-error-text\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n 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\"\n />\n </svg>\n </div>\n <h2 className=\"text-lg font-semibold text-text-primary\">Failed to load credits</h2>\n <p className=\"text-sm text-text-secondary\">{error.message}</p>\n <button\n type=\"button\"\n onClick={() => refetch()}\n 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\"\n >\n Try Again\n </button>\n </div>\n </div>\n );\n }\n\n const creditBalance = billingAccount?.creditAmount || 0;\n\n return (\n <div className=\"space-y-6 px-6 lg:px-8 py-6\">\n {/* Header */}\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h1 className=\"text-2xl md:text-3xl font-semibold tracking-tight text-text-primary\">\n {tr('billing.credits.title', 'Credits')}\n </h1>\n <p className=\"text-sm text-text-secondary mt-1\">\n Manage your credit balance and view transaction history\n </p>\n <PagePurpose className=\"mt-3\">\n {tr(\n 'billing.credits.purpose',\n 'Credits are prepaid balance you can spend on usage and purchases instead of paying per invoice. See your available balance, top it up, withdraw unused credits, and review every credit purchase, grant and deduction over time.'\n )}\n </PagePurpose>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => navigateTo('/credits/withdraw')}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z\"\n />\n </svg>\n Withdraw\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo('/checkout/credits')}\n className=\"inline-flex items-center gap-2 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\"\n >\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M12 4v16m8-8H4\"\n />\n </svg>\n Purchase Credits\n </button>\n </div>\n </div>\n\n {/* Balance Card */}\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4\">\n <EmphasisPanel className=\"p-6\">\n <p className=\"text-sm text-text-secondary\">Available Balance</p>\n <p className=\"text-3xl font-bold tabular-nums text-text-primary mt-2\">\n {creditBalance.toLocaleString()} Credits\n </p>\n <p className=\"text-sm text-text-secondary mt-2\">{billingAccount?.name}</p>\n </EmphasisPanel>\n\n <div className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 p-5\">\n <p className=\"text-sm text-text-secondary\">Transactions ({days}d)</p>\n <p className=\"text-2xl md:text-3xl font-semibold tracking-tight text-text-primary mt-2\">\n {pagination.totalCount}\n </p>\n <p className=\"text-sm text-text-secondary mt-2\">Total transactions</p>\n </div>\n </div>\n\n {/* Filters */}\n <div className=\"flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle\">\n {/* Time Range */}\n <div className=\"inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken\">\n {[7, 30, 90].map((d) => (\n <button\n type=\"button\"\n key={d}\n onClick={() => setDays(d)}\n className={`px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${\n days === d\n ? 'bg-bg-surface text-text-primary shadow-sm'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n >\n {d}d\n </button>\n ))}\n </div>\n\n {/* Transaction Type Filter */}\n <div className=\"inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken\">\n {(['all', 'purchase', 'usage', 'adjustment', 'granted'] as FilterType[]).map((type) => (\n <button\n type=\"button\"\n key={type}\n onClick={() => setFilterType(type)}\n className={`px-3 py-1.5 text-sm font-medium rounded-button transition-colors capitalize ${\n filterType === type\n ? 'bg-bg-surface text-text-primary shadow-sm'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n >\n {type === 'all' ? 'All' : formatCreditTransactionType(type as CreditTransactionType)}\n </button>\n ))}\n </div>\n </div>\n\n {/* Transactions List */}\n {filteredTransactions.length === 0 ? (\n <IllustratedEmptyState\n illustration={filterType !== 'all' ? 'empty-search' : 'empty-data'}\n title=\"No transactions found\"\n description={\n filterType !== 'all'\n ? 'No transactions match your filter.'\n : 'No credit transactions in this period.'\n }\n />\n ) : (\n <div className=\"space-y-3\">\n {filteredTransactions.map((tx) => (\n <TransactionRow key={tx.id} transaction={tx} />\n ))}\n\n {/* Pagination */}\n {pagination.hasMore && (\n <div className=\"flex justify-center pt-4\">\n <button\n type=\"button\"\n onClick={() => setPage((p) => p + 1)}\n className=\"px-4 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n Load More\n </button>\n </div>\n )}\n </div>\n )}\n </div>\n );\n};\n\n// ============================================================================\n// Transaction Row Component\n// ============================================================================\n\ninterface TransactionRowProps {\n transaction: CreditTransaction;\n}\n\nconst TransactionRow: FC<TransactionRowProps> = ({ transaction }) => {\n const statusColor = getCreditTransactionStatusColor(transaction.status);\n const isCredit =\n transaction.type === 'purchase' ||\n transaction.type === 'adjustment' ||\n transaction.type === 'granted';\n\n return (\n <div className=\"flex items-center gap-4 p-4 border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 hover:shadow-sm transition-shadow\">\n {/* Icon */}\n <div\n className={`size-10 rounded-full flex items-center justify-center ${\n isCredit ? statusTokens.success.bg : statusTokens.warning.bg\n }`}\n >\n {isCredit ? (\n <svg\n className={`size-5 ${statusTokens.success.icon}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M12 4v16m8-8H4\" />\n </svg>\n ) : (\n <svg\n className={`size-5 ${statusTokens.warning.icon}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M20 12H4\" />\n </svg>\n )}\n </div>\n\n {/* Info */}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <p className=\"font-medium text-text-primary capitalize\">\n {formatCreditTransactionType(transaction.type)}\n </p>\n <span\n className={`px-2 py-0.5 text-xs font-medium rounded ${getStatusBadgeClasses(statusColor)}`}\n >\n {transaction.status}\n </span>\n </div>\n <p className=\"text-sm text-text-secondary mt-0.5\">\n {formatRelativeTime(transaction.createdAt)} • {formatDate(transaction.createdAt, 'short')}\n </p>\n </div>\n\n {/* Amount */}\n <div className=\"text-right\">\n <p\n className={`font-semibold ${isCredit ? statusTokens.success.text : 'text-text-primary'}`}\n >\n {isCredit ? '+' : '-'}\n {transaction.amount.toLocaleString()} credits\n </p>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AA0BA,IAAaA,UAAwB;CACnC,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAAOF,MAAeE,IAAMC,IAAWH;CACzC,GACMI,IAAaC,EAAmB,GAChCC,IAAcC,EAAsB,GACpC,EAAE,mBAAgB,WAAWC,MAAqBC,EAAyB,GAE3E,CAACC,GAAMC,KAAWC,EAAS,EAAE,GAC7B,CAACC,GAAYC,KAAiBF,EAAqB,KAAK,GACxD,CAACG,GAAMC,KAAWJ,EAAS,CAAC,GAE5B,EACJ,iBACA,eACA,WAAWK,GACX,UACA,eACEC,EAAsB;EACxB,kBAAkBC,GAAgB,MAAM;EACxC;EACA;EACA,UAAU;CACZ,CAAC;CAGD,IAAI,CAACb,EAAY,gBACf,OACE,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACE,kBAAC,OAAD;KAAK,WAAU;KACb,UAAA,kBAAC,OAAD;MACE,WAAU;MACV,MAAK;MACL,SAAQ;MACR,QAAO;MAEP,UAAA,kBAAC,QAAD;OACE,eAAc;OACd,gBAAe;OACf,aAAa;OACb,GAAE;MACH,CAAA;KACE,CAAA;IACF,CAAA;IACL,kBAAC,MAAD;KAAI,WAAU;KAA0C,UAAA;IAAiB,CAAA;IACz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CAEvB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GAEE,kBAAC,OAAD;IACE,WAAW,yDACTC,IAAWC,EAAa,QAAQ,KAAKA,EAAa,QAAQ;IAG3D,UAAAD,IACC,kBAAC,OAAD;KACE,WAAW,UAAUC,EAAa,QAAQ;KAC1C,MAAK;KACL,SAAQ;KACR,QAAO;KAEP,UAAA,kBAAC,QAAD;MAAM,eAAc;MAAQ,gBAAe;MAAQ,aAAa;MAAG,GAAE;KAAkB,CAAA;IACpF,CAAA,IAEL,kBAAC,OAAD;KACE,WAAW,UAAUA,EAAa,QAAQ;KAC1C,MAAK;KACL,SAAQ;KACR,QAAO;KAEP,UAAA,kBAAC,QAAD;MAAM,eAAc;MAAQ,gBAAe;MAAQ,aAAa;MAAG,GAAE;KAAY,CAAA;IAC9E,CAAA;GAEJ,CAAA;GAGL,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,KAAD;MAAG,WAAU;MACV,UAAAR,EAA4BM,EAAY,IAAI;KAC5C,CAAA,GACH,kBAAC,QAAD;MACE,WAAW,2CAA2CG,EAAsBL,CAAW;MAEtF,UAAAE,EAAY;KACT,CAAA,CACH;IACL,CAAA,GAAA,kBAAC,KAAD;KAAG,WAAU;KAAb,UAAA;MACGI,EAAmBJ,EAAY,SAAS;MAAE;MAAIK,EAAWL,EAAY,WAAW,OAAO;KACvF;IACA,CAAA,CAAA;;GAGL,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAAC,KAAD;KACE,WAAW,iBAAiBC,IAAWC,EAAa,QAAQ,OAAO;KADrE,UAAA;MAGGD,IAAW,MAAM;MACjBD,EAAY,OAAO,eAAe;MAAE;KACpC;;GACA,CAAA;EACF;;AAET"}
|
|
1
|
+
{"version":3,"file":"CreditsPage.js","names":["CreditsPage","useI18n","tr","translated","t","key","fallback","navigateTo","useBillingNavigate","permissions","useBillingPermissions","showWithdraw","useIsFluidgridsVariant","isLoadingAccount","useDefaultBillingAccount","days","setDays","useState","filterType","setFilterType","page","setPage","isLoadingTransactions","useCreditTransactions","billingAccount","isLoading","filteredTransactions","transactions","tx","error","refetch","creditBalance","PagePurpose","EmphasisPanel","pagination","d","type","formatCreditTransactionType","IllustratedEmptyState","TransactionRow","p","statusColor","getCreditTransactionStatusColor","transaction","isCredit","statusTokens","getStatusBadgeClasses","formatRelativeTime","formatDate"],"sources":["../../../../../src/billing/modules/credits/pages/CreditsPage.tsx"],"sourcesContent":["/**\n * Credits Module - Credits Page\n * Displays credit balance and transaction history\n */\n\nimport { useState, type FC } from 'react';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useCreditTransactions } from '../hooks/useCredits';\nimport { useDefaultBillingAccount } from '../../subscriptions/hooks';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport {\n formatDate,\n formatRelativeTime,\n formatCreditTransactionType,\n} from '../../../shared/utils/format';\nimport {\n getCreditTransactionStatusColor,\n getStatusBadgeClasses,\n} from '../../../shared/utils/status';\nimport { statusTokens } from '../../../shared/utils/tokens';\nimport type { CreditTransaction, CreditTransactionType } from '../../../shared/types';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { EmphasisPanel, PagePurpose, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\n\ntype FilterType = 'all' | CreditTransactionType;\n\nexport const CreditsPage: FC = () => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n const navigateTo = useBillingNavigate();\n const permissions = useBillingPermissions();\n // FluidGrids: Withdraw lives only in the Seller area (BOFF-11861).\n const showWithdraw = !useIsFluidgridsVariant();\n const { billingAccount, isLoading: isLoadingAccount } = useDefaultBillingAccount();\n\n const [days, setDays] = useState(30);\n const [filterType, setFilterType] = useState<FilterType>('all');\n const [page, setPage] = useState(1);\n\n const {\n transactions,\n pagination,\n isLoading: isLoadingTransactions,\n error,\n refetch,\n } = useCreditTransactions({\n billingAccountId: billingAccount?.id || '',\n days,\n page,\n pageSize: 20,\n });\n\n // Permission check\n if (!permissions.canViewCredits) {\n return (\n <div className=\"flex items-center justify-center h-full min-h-[400px]\">\n <div className=\"text-center space-y-2\">\n <div className=\"size-12 mx-auto rounded-full bg-bg-sunken flex items-center justify-center\">\n <svg\n className=\"size-6 text-text-secondary\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z\"\n />\n </svg>\n </div>\n <h2 className=\"text-lg font-semibold text-text-primary\">Access Denied</h2>\n <p className=\"text-sm text-text-secondary max-w-sm\">\n You don't have permission to view credits.\n </p>\n </div>\n </div>\n );\n }\n\n const isLoading = isLoadingAccount || isLoadingTransactions;\n\n // Filter transactions\n const filteredTransactions = transactions.filter((tx) => {\n if (filterType === 'all') return true;\n return tx.type === filterType;\n });\n\n // Loading state\n if (isLoading && !billingAccount) {\n return (\n <div className=\"space-y-6 px-6 lg:px-8 py-6\">\n <div className=\"h-8 w-48 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <div className=\"border border-border-subtle rounded-lg p-6\">\n <div className=\"h-6 w-24 bg-bg-sunken animate-pulse rounded mb-2\" />\n <div className=\"h-10 w-32 bg-bg-sunken animate-pulse rounded\" />\n </div>\n </div>\n </div>\n );\n }\n\n // Error state\n if (error) {\n return (\n <div className=\"flex items-center justify-center h-full min-h-[400px]\">\n <div className=\"text-center space-y-4\">\n <div className=\"size-12 mx-auto rounded-full bg-status-error-bg-subtle flex items-center justify-center\">\n <svg\n className=\"size-6 text-status-error-text\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n 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\"\n />\n </svg>\n </div>\n <h2 className=\"text-lg font-semibold text-text-primary\">Failed to load credits</h2>\n <p className=\"text-sm text-text-secondary\">{error.message}</p>\n <button\n type=\"button\"\n onClick={() => refetch()}\n 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\"\n >\n Try Again\n </button>\n </div>\n </div>\n );\n }\n\n const creditBalance = billingAccount?.creditAmount || 0;\n\n return (\n <div className=\"space-y-6 px-6 lg:px-8 py-6\">\n {/* Header */}\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h1 className=\"text-2xl md:text-3xl font-semibold tracking-tight text-text-primary\">\n {tr('billing.credits.title', 'Credits')}\n </h1>\n <p className=\"text-sm text-text-secondary mt-1\">\n Manage your credit balance and view transaction history\n </p>\n <PagePurpose className=\"mt-3\">\n {tr(\n 'billing.credits.purpose',\n 'Credits are prepaid balance you can spend on usage and purchases instead of paying per invoice. See your available balance, top it up, withdraw unused credits, and review every credit purchase, grant and deduction over time.'\n )}\n </PagePurpose>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {showWithdraw && (\n <button\n type=\"button\"\n onClick={() => navigateTo('/credits/withdraw')}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z\"\n />\n </svg>\n Withdraw\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => navigateTo('/checkout/credits')}\n className=\"inline-flex items-center gap-2 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\"\n >\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M12 4v16m8-8H4\"\n />\n </svg>\n Purchase Credits\n </button>\n </div>\n </div>\n\n {/* Balance Card */}\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4\">\n <EmphasisPanel className=\"p-6\">\n <p className=\"text-sm text-text-secondary\">Available Balance</p>\n <p className=\"text-3xl font-bold tabular-nums text-text-primary mt-2\">\n {creditBalance.toLocaleString()} Credits\n </p>\n <p className=\"text-sm text-text-secondary mt-2\">{billingAccount?.name}</p>\n </EmphasisPanel>\n\n <div className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 p-5\">\n <p className=\"text-sm text-text-secondary\">Transactions ({days}d)</p>\n <p className=\"text-2xl md:text-3xl font-semibold tracking-tight text-text-primary mt-2\">\n {pagination.totalCount}\n </p>\n <p className=\"text-sm text-text-secondary mt-2\">Total transactions</p>\n </div>\n </div>\n\n {/* Filters */}\n <div className=\"flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle\">\n {/* Time Range */}\n <div className=\"inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken\">\n {[7, 30, 90].map((d) => (\n <button\n type=\"button\"\n key={d}\n onClick={() => setDays(d)}\n className={`px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${\n days === d\n ? 'bg-bg-surface text-text-primary shadow-sm'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n >\n {d}d\n </button>\n ))}\n </div>\n\n {/* Transaction Type Filter */}\n <div className=\"inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken\">\n {(['all', 'purchase', 'usage', 'adjustment', 'granted'] as FilterType[]).map((type) => (\n <button\n type=\"button\"\n key={type}\n onClick={() => setFilterType(type)}\n className={`px-3 py-1.5 text-sm font-medium rounded-button transition-colors capitalize ${\n filterType === type\n ? 'bg-bg-surface text-text-primary shadow-sm'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n >\n {type === 'all' ? 'All' : formatCreditTransactionType(type as CreditTransactionType)}\n </button>\n ))}\n </div>\n </div>\n\n {/* Transactions List */}\n {filteredTransactions.length === 0 ? (\n <IllustratedEmptyState\n illustration={filterType !== 'all' ? 'empty-search' : 'empty-data'}\n title=\"No transactions found\"\n description={\n filterType !== 'all'\n ? 'No transactions match your filter.'\n : 'No credit transactions in this period.'\n }\n />\n ) : (\n <div className=\"space-y-3\">\n {filteredTransactions.map((tx) => (\n <TransactionRow key={tx.id} transaction={tx} />\n ))}\n\n {/* Pagination */}\n {pagination.hasMore && (\n <div className=\"flex justify-center pt-4\">\n <button\n type=\"button\"\n onClick={() => setPage((p) => p + 1)}\n className=\"px-4 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n Load More\n </button>\n </div>\n )}\n </div>\n )}\n </div>\n );\n};\n\n// ============================================================================\n// Transaction Row Component\n// ============================================================================\n\ninterface TransactionRowProps {\n transaction: CreditTransaction;\n}\n\nconst TransactionRow: FC<TransactionRowProps> = ({ transaction }) => {\n const statusColor = getCreditTransactionStatusColor(transaction.status);\n const isCredit =\n transaction.type === 'purchase' ||\n transaction.type === 'adjustment' ||\n transaction.type === 'granted';\n\n return (\n <div className=\"flex items-center gap-4 p-4 border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 hover:shadow-sm transition-shadow\">\n {/* Icon */}\n <div\n className={`size-10 rounded-full flex items-center justify-center ${\n isCredit ? statusTokens.success.bg : statusTokens.warning.bg\n }`}\n >\n {isCredit ? (\n <svg\n className={`size-5 ${statusTokens.success.icon}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M12 4v16m8-8H4\" />\n </svg>\n ) : (\n <svg\n className={`size-5 ${statusTokens.warning.icon}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M20 12H4\" />\n </svg>\n )}\n </div>\n\n {/* Info */}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <p className=\"font-medium text-text-primary capitalize\">\n {formatCreditTransactionType(transaction.type)}\n </p>\n <span\n className={`px-2 py-0.5 text-xs font-medium rounded ${getStatusBadgeClasses(statusColor)}`}\n >\n {transaction.status}\n </span>\n </div>\n <p className=\"text-sm text-text-secondary mt-0.5\">\n {formatRelativeTime(transaction.createdAt)} • {formatDate(transaction.createdAt, 'short')}\n </p>\n </div>\n\n {/* Amount */}\n <div className=\"text-right\">\n <p\n className={`font-semibold ${isCredit ? statusTokens.success.text : 'text-text-primary'}`}\n >\n {isCredit ? '+' : '-'}\n {transaction.amount.toLocaleString()} credits\n </p>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AA2BA,IAAaA,UAAwB;CACnC,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAAOF,MAAeE,IAAMC,IAAWH;CACzC,GACMI,IAAaC,EAAmB,GAChCC,IAAcC,EAAsB,GAEpCC,IAAe,CAACC,EAAuB,GACvC,EAAE,mBAAgB,WAAWC,MAAqBC,EAAyB,GAE3E,CAACC,GAAMC,KAAWC,EAAS,EAAE,GAC7B,CAACC,GAAYC,KAAiBF,EAAqB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