@burdenoff/microfe-billing 2026.1113.4 → 2026.1114.1

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 (46) hide show
  1. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +293 -291
  2. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
  3. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +25 -24
  4. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
  5. package/dist/billing/modules/analytics/pages/AnalyticsPage.js +25 -24
  6. package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
  7. package/dist/billing/modules/billing/hooks/index.js +5 -5
  8. package/dist/billing/modules/billing/hooks/useInvoices.js +20 -39
  9. package/dist/billing/modules/billing/hooks/useInvoices.js.map +1 -1
  10. package/dist/billing/modules/billing/index.js +14 -14
  11. package/dist/billing/modules/billing/pages/InvoicesListPage.js +92 -89
  12. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  13. package/dist/billing/modules/billing/pages/TransactionsPage.js +2 -2
  14. package/dist/billing/modules/billing/pages/UserRefundsPage.js +140 -140
  15. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  16. package/dist/billing/modules/coupons/pages/CouponDetailPage.js +16 -15
  17. package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -1
  18. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +1 -1
  19. package/dist/billing/modules/credits/pages/CreditsPage.js +164 -137
  20. package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
  21. package/dist/billing/modules/dashboard/pages/OverviewPage.js +444 -594
  22. package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
  23. package/dist/billing/modules/earnings/pages/EarningsPage.js +20 -20
  24. package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
  25. package/dist/billing/modules/earnings/pages/PayoutsPage.js +1 -1
  26. package/dist/billing/modules/plans/pages/PlansBrowsePage.js +32 -32
  27. package/dist/billing/modules/settings/pages/SettingsPage.js +4 -4
  28. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +577 -640
  29. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
  30. package/dist/billing/shared/components/HeaderActions.d.ts +10 -0
  31. package/dist/billing/shared/components/HeaderActions.js +33 -0
  32. package/dist/billing/shared/components/HeaderActions.js.map +1 -0
  33. package/dist/billing/shared/components/index.d.ts +1 -0
  34. package/dist/billing/shared/components/index.js +2 -1
  35. package/dist/billing/shared/utils/format.js +4 -16
  36. package/dist/billing/shared/utils/format.js.map +1 -1
  37. package/dist/billing/shared/utils/index.js +8 -8
  38. package/dist/generated/global-operations.js +286 -294
  39. package/dist/generated/global-operations.js.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/billing/modules/dashboard/utils/overviewSummary.d.ts +0 -46
  42. package/dist/billing/modules/dashboard/utils/overviewSummary.js +0 -37
  43. package/dist/billing/modules/dashboard/utils/overviewSummary.js.map +0 -1
  44. package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.d.ts +0 -30
  45. package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.js +0 -20
  46. package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.js.map +0 -1
@@ -1,40 +1,45 @@
1
1
  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
- import { useBillingPermissions as n } from "../../../hooks/useBillingPermissions.js";
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 { EmphasisPanel as f, IllustratedEmptyState as p, PagePurpose as m } from "@burdenoff/fe-libs/ui";
12
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
13
- import { useI18n as _ } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
4
+ import { useGetBillingAccountsByOrgQuery as n } from "../../../../generated/global-operations.js";
5
+ import { useBillingPermissions as r } from "../../../hooks/useBillingPermissions.js";
6
+ import { useIsFluidgridsVariant as i } from "../../../hooks/useBillingVariant.js";
7
+ import { formatCreditTransactionType as a, formatDate as o, formatRelativeTime as s } from "../../../shared/utils/format.js";
8
+ import { getCreditTransactionStatusColor as c, getStatusBadgeClasses as l } from "../../../shared/utils/status.js";
9
+ import { useBillingAccount as u, useDefaultBillingAccount as d } from "../../subscriptions/hooks/useSubscriptions.js";
10
+ import { statusTokens as f } from "../../../shared/utils/tokens.js";
11
+ import { useMemo as p, useState as m } from "react";
12
+ import { EmphasisPanel as h, IllustratedEmptyState as g, PagePurpose as _ } from "@burdenoff/fe-libs/ui";
13
+ import { useSearchParams as v } from "react-router";
14
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
15
+ import { useI18n as x } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
14
16
  // src/billing/modules/credits/pages/CreditsPage.tsx
15
- var v = () => {
16
- let { t: a } = _(), o = (e, t) => {
17
- let n = a(e);
17
+ var S = () => {
18
+ let { t: o } = x(), s = (e, t) => {
19
+ let n = o(e);
18
20
  return n === e ? t : n;
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,
21
+ }, c = e(), l = r(), f = i(), S = !f, { billingAccount: w, isLoading: T } = d(), [E] = v(), [D, O] = m(E.get("billingAccountId")), { data: k } = n({
22
+ fetchPolicy: "cache-first",
23
+ skip: !f
24
+ }), A = p(() => f ? k?.getBillingAccountsByOrg ?? [] : [], [f, k]), j = f && D !== null && D !== w?.id, { billingAccount: M, isLoading: N } = u(j ? D : void 0), P = j ? M : w, F = j ? N : T, I = j ? D : w?.id ?? "", [L, R] = m(30), [z, B] = m("all"), [V, H] = m(1), { transactions: U, pagination: W, isLoading: G, error: K, refetch: q } = t({
25
+ billingAccountId: P?.id || "",
26
+ days: L,
27
+ page: V,
23
28
  pageSize: 20
24
29
  });
25
- if (!c.canViewCredits) return /* @__PURE__ */ h("div", {
30
+ if (!l.canViewCredits) return /* @__PURE__ */ y("div", {
26
31
  className: "flex items-center justify-center h-full min-h-[400px]",
27
- children: /* @__PURE__ */ g("div", {
32
+ children: /* @__PURE__ */ b("div", {
28
33
  className: "text-center space-y-2",
29
34
  children: [
30
- /* @__PURE__ */ h("div", {
35
+ /* @__PURE__ */ y("div", {
31
36
  className: "size-12 mx-auto rounded-full bg-bg-sunken flex items-center justify-center",
32
- children: /* @__PURE__ */ h("svg", {
37
+ children: /* @__PURE__ */ y("svg", {
33
38
  className: "size-6 text-text-secondary",
34
39
  fill: "none",
35
40
  viewBox: "0 0 24 24",
36
41
  stroke: "currentColor",
37
- children: /* @__PURE__ */ h("path", {
42
+ children: /* @__PURE__ */ y("path", {
38
43
  strokeLinecap: "round",
39
44
  strokeLinejoin: "round",
40
45
  strokeWidth: 2,
@@ -42,41 +47,41 @@ var v = () => {
42
47
  })
43
48
  })
44
49
  }),
45
- /* @__PURE__ */ h("h2", {
50
+ /* @__PURE__ */ y("h2", {
46
51
  className: "text-lg font-semibold text-text-primary",
47
52
  children: "Access Denied"
48
53
  }),
49
- /* @__PURE__ */ h("p", {
54
+ /* @__PURE__ */ y("p", {
50
55
  className: "text-sm text-text-secondary max-w-sm",
51
56
  children: "You don't have permission to view credits."
52
57
  })
53
58
  ]
54
59
  })
55
60
  });
56
- let M = b || k, N = D.filter((e) => C === "all" || e.type === C);
57
- if (M && !v) return /* @__PURE__ */ g("div", {
61
+ let J = F || G, Y = U.filter((e) => z === "all" || e.type === z);
62
+ if (J && !P) return /* @__PURE__ */ b("div", {
58
63
  className: "space-y-6 px-6 lg:px-8 py-6",
59
- children: [/* @__PURE__ */ h("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ h("div", {
64
+ children: [/* @__PURE__ */ y("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ y("div", {
60
65
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
61
- children: /* @__PURE__ */ g("div", {
66
+ children: /* @__PURE__ */ b("div", {
62
67
  className: "border border-border-subtle rounded-lg p-6",
63
- children: [/* @__PURE__ */ h("div", { className: "h-6 w-24 bg-bg-sunken animate-pulse rounded mb-2" }), /* @__PURE__ */ h("div", { className: "h-10 w-32 bg-bg-sunken animate-pulse rounded" })]
68
+ children: [/* @__PURE__ */ y("div", { className: "h-6 w-24 bg-bg-sunken animate-pulse rounded mb-2" }), /* @__PURE__ */ y("div", { className: "h-10 w-32 bg-bg-sunken animate-pulse rounded" })]
64
69
  })
65
70
  })]
66
71
  });
67
- if (A) return /* @__PURE__ */ h("div", {
72
+ if (K) return /* @__PURE__ */ y("div", {
68
73
  className: "flex items-center justify-center h-full min-h-[400px]",
69
- children: /* @__PURE__ */ g("div", {
74
+ children: /* @__PURE__ */ b("div", {
70
75
  className: "text-center space-y-4",
71
76
  children: [
72
- /* @__PURE__ */ h("div", {
77
+ /* @__PURE__ */ y("div", {
73
78
  className: "size-12 mx-auto rounded-full bg-status-error-bg-subtle flex items-center justify-center",
74
- children: /* @__PURE__ */ h("svg", {
79
+ children: /* @__PURE__ */ y("svg", {
75
80
  className: "size-6 text-status-error-text",
76
81
  fill: "none",
77
82
  viewBox: "0 0 24 24",
78
83
  stroke: "currentColor",
79
- children: /* @__PURE__ */ h("path", {
84
+ children: /* @__PURE__ */ y("path", {
80
85
  strokeLinecap: "round",
81
86
  strokeLinejoin: "round",
82
87
  strokeWidth: 2,
@@ -84,134 +89,156 @@ var v = () => {
84
89
  })
85
90
  })
86
91
  }),
87
- /* @__PURE__ */ h("h2", {
92
+ /* @__PURE__ */ y("h2", {
88
93
  className: "text-lg font-semibold text-text-primary",
89
94
  children: "Failed to load credits"
90
95
  }),
91
- /* @__PURE__ */ h("p", {
96
+ /* @__PURE__ */ y("p", {
92
97
  className: "text-sm text-text-secondary",
93
- children: A.message
98
+ children: K.message
94
99
  }),
95
- /* @__PURE__ */ h("button", {
100
+ /* @__PURE__ */ y("button", {
96
101
  type: "button",
97
- onClick: () => j(),
102
+ onClick: () => q(),
98
103
  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",
99
104
  children: "Try Again"
100
105
  })
101
106
  ]
102
107
  })
103
108
  });
104
- let P = v?.creditAmount || 0;
105
- return /* @__PURE__ */ g("div", {
109
+ let X = P?.creditAmount || 0;
110
+ return /* @__PURE__ */ b("div", {
106
111
  className: "space-y-6 px-6 lg:px-8 py-6",
107
112
  children: [
108
- /* @__PURE__ */ g("div", {
113
+ /* @__PURE__ */ b("div", {
109
114
  className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
110
- children: [/* @__PURE__ */ g("div", { children: [
111
- /* @__PURE__ */ h("h1", {
115
+ children: [/* @__PURE__ */ b("div", { children: [
116
+ /* @__PURE__ */ y("h1", {
112
117
  className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
113
- children: o("billing.credits.title", "Credits")
118
+ children: s("billing.credits.title", "Credits")
114
119
  }),
115
- /* @__PURE__ */ h("p", {
120
+ /* @__PURE__ */ y("p", {
116
121
  className: "text-sm text-text-secondary mt-1",
117
122
  children: "Manage your credit balance and view transaction history"
118
123
  }),
119
- /* @__PURE__ */ h(m, {
124
+ /* @__PURE__ */ y(_, {
120
125
  className: "mt-3",
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.")
126
+ children: s("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.")
122
127
  })
123
- ] }), /* @__PURE__ */ g("div", {
124
- className: "flex items-center gap-2",
125
- children: [u && /* @__PURE__ */ g("button", {
126
- type: "button",
127
- onClick: () => s("/credits/withdraw"),
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",
129
- children: [/* @__PURE__ */ h("svg", {
130
- className: "size-4",
131
- fill: "none",
132
- viewBox: "0 0 24 24",
133
- stroke: "currentColor",
134
- children: /* @__PURE__ */ h("path", {
135
- strokeLinecap: "round",
136
- strokeLinejoin: "round",
137
- strokeWidth: 2,
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"
139
- })
140
- }), "Withdraw"]
141
- }), /* @__PURE__ */ g("button", {
142
- type: "button",
143
- onClick: () => s("/checkout/credits"),
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",
145
- children: [/* @__PURE__ */ h("svg", {
146
- className: "size-4",
147
- fill: "none",
148
- viewBox: "0 0 24 24",
149
- stroke: "currentColor",
150
- children: /* @__PURE__ */ h("path", {
151
- strokeLinecap: "round",
152
- strokeLinejoin: "round",
153
- strokeWidth: 2,
154
- d: "M12 4v16m8-8H4"
155
- })
156
- }), "Purchase Credits"]
157
- })]
128
+ ] }), /* @__PURE__ */ b("div", {
129
+ className: f ? "flex flex-wrap items-center gap-2 lg:shrink-0" : "flex items-center gap-2",
130
+ children: [
131
+ f && A.length > 1 && /* @__PURE__ */ b("div", {
132
+ className: "flex w-full min-w-0 items-center gap-2 sm:w-auto",
133
+ children: [/* @__PURE__ */ y("label", {
134
+ htmlFor: "credits-billing-account",
135
+ className: "text-sm text-text-secondary whitespace-nowrap",
136
+ children: s("billing.credits.billingAccountLabel", "Billing Account")
137
+ }), /* @__PURE__ */ y("select", {
138
+ id: "credits-billing-account",
139
+ value: I ?? "",
140
+ onChange: (e) => {
141
+ O(e.target.value || null), H(1);
142
+ },
143
+ className: "min-w-0 flex-1 truncate sm:max-w-xs sm:flex-none 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",
144
+ children: A.map((e) => /* @__PURE__ */ b("option", {
145
+ value: e.id ?? "",
146
+ children: [e.name ?? e.email ?? e.id, e.isDefault ? s("billing.invoices.defaultSuffix", " (Default)") : ""]
147
+ }, e.id ?? ""))
148
+ })]
149
+ }),
150
+ S && /* @__PURE__ */ b("button", {
151
+ type: "button",
152
+ onClick: () => c("/credits/withdraw"),
153
+ 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",
154
+ children: [/* @__PURE__ */ y("svg", {
155
+ className: "size-4",
156
+ fill: "none",
157
+ viewBox: "0 0 24 24",
158
+ stroke: "currentColor",
159
+ children: /* @__PURE__ */ y("path", {
160
+ strokeLinecap: "round",
161
+ strokeLinejoin: "round",
162
+ strokeWidth: 2,
163
+ 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"
164
+ })
165
+ }), "Withdraw"]
166
+ }),
167
+ /* @__PURE__ */ b("button", {
168
+ type: "button",
169
+ onClick: () => c("/checkout/credits"),
170
+ 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",
171
+ children: [/* @__PURE__ */ y("svg", {
172
+ className: "size-4",
173
+ fill: "none",
174
+ viewBox: "0 0 24 24",
175
+ stroke: "currentColor",
176
+ children: /* @__PURE__ */ y("path", {
177
+ strokeLinecap: "round",
178
+ strokeLinejoin: "round",
179
+ strokeWidth: 2,
180
+ d: "M12 4v16m8-8H4"
181
+ })
182
+ }), "Purchase Credits"]
183
+ })
184
+ ]
158
185
  })]
159
186
  }),
160
- /* @__PURE__ */ g("div", {
187
+ /* @__PURE__ */ b("div", {
161
188
  className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",
162
- children: [/* @__PURE__ */ g(f, {
189
+ children: [/* @__PURE__ */ b(h, {
163
190
  className: "p-6",
164
191
  children: [
165
- /* @__PURE__ */ h("p", {
192
+ /* @__PURE__ */ y("p", {
166
193
  className: "text-sm text-text-secondary",
167
194
  children: "Available Balance"
168
195
  }),
169
- /* @__PURE__ */ g("p", {
196
+ /* @__PURE__ */ b("p", {
170
197
  className: "text-3xl font-bold tabular-nums text-text-primary mt-2",
171
- children: [P.toLocaleString(), " Credits"]
198
+ children: [X.toLocaleString(), " Credits"]
172
199
  }),
173
- /* @__PURE__ */ h("p", {
200
+ /* @__PURE__ */ y("p", {
174
201
  className: "text-sm text-text-secondary mt-2",
175
- children: v?.name
202
+ children: P?.name
176
203
  })
177
204
  ]
178
- }), /* @__PURE__ */ g("div", {
205
+ }), /* @__PURE__ */ b("div", {
179
206
  className: "border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 p-5",
180
207
  children: [
181
- /* @__PURE__ */ g("p", {
208
+ /* @__PURE__ */ b("p", {
182
209
  className: "text-sm text-text-secondary",
183
210
  children: [
184
211
  "Transactions (",
185
- x,
212
+ L,
186
213
  "d)"
187
214
  ]
188
215
  }),
189
- /* @__PURE__ */ h("p", {
216
+ /* @__PURE__ */ y("p", {
190
217
  className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary mt-2",
191
- children: O.totalCount
218
+ children: W.totalCount
192
219
  }),
193
- /* @__PURE__ */ h("p", {
220
+ /* @__PURE__ */ y("p", {
194
221
  className: "text-sm text-text-secondary mt-2",
195
222
  children: "Total transactions"
196
223
  })
197
224
  ]
198
225
  })]
199
226
  }),
200
- /* @__PURE__ */ g("div", {
227
+ /* @__PURE__ */ b("div", {
201
228
  className: "flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle",
202
- children: [/* @__PURE__ */ h("div", {
229
+ children: [/* @__PURE__ */ y("div", {
203
230
  className: "inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken",
204
231
  children: [
205
232
  7,
206
233
  30,
207
234
  90
208
- ].map((e) => /* @__PURE__ */ g("button", {
235
+ ].map((e) => /* @__PURE__ */ b("button", {
209
236
  type: "button",
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"}`,
237
+ onClick: () => R(e),
238
+ className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${L === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
212
239
  children: [e, "d"]
213
240
  }, e))
214
- }), /* @__PURE__ */ h("div", {
241
+ }), /* @__PURE__ */ y("div", {
215
242
  className: "inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken",
216
243
  children: [
217
244
  "all",
@@ -219,25 +246,25 @@ var v = () => {
219
246
  "usage",
220
247
  "adjustment",
221
248
  "granted"
222
- ].map((e) => /* @__PURE__ */ h("button", {
249
+ ].map((e) => /* @__PURE__ */ y("button", {
223
250
  type: "button",
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)
251
+ onClick: () => B(e),
252
+ className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors capitalize ${z === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
253
+ children: e === "all" ? "All" : a(e)
227
254
  }, e))
228
255
  })]
229
256
  }),
230
- N.length === 0 ? /* @__PURE__ */ h(p, {
231
- illustration: C === "all" ? "empty-data" : "empty-search",
257
+ Y.length === 0 ? /* @__PURE__ */ y(g, {
258
+ illustration: z === "all" ? "empty-data" : "empty-search",
232
259
  title: "No transactions found",
233
- description: C === "all" ? "No credit transactions in this period." : "No transactions match your filter."
234
- }) : /* @__PURE__ */ g("div", {
260
+ description: z === "all" ? "No credit transactions in this period." : "No transactions match your filter."
261
+ }) : /* @__PURE__ */ b("div", {
235
262
  className: "space-y-3",
236
- children: [N.map((e) => /* @__PURE__ */ h(y, { transaction: e }, e.id)), O.hasMore && /* @__PURE__ */ h("div", {
263
+ children: [Y.map((e) => /* @__PURE__ */ y(C, { transaction: e }, e.id)), W.hasMore && /* @__PURE__ */ y("div", {
237
264
  className: "flex justify-center pt-4",
238
- children: /* @__PURE__ */ h("button", {
265
+ children: /* @__PURE__ */ y("button", {
239
266
  type: "button",
240
- onClick: () => E((e) => e + 1),
267
+ onClick: () => H((e) => e + 1),
241
268
  className: "px-4 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
242
269
  children: "Load More"
243
270
  })
@@ -245,30 +272,30 @@ var v = () => {
245
272
  })
246
273
  ]
247
274
  });
248
- }, y = ({ transaction: e }) => {
249
- let t = s(e.status), n = e.type === "purchase" || e.type === "adjustment" || e.type === "granted";
250
- return /* @__PURE__ */ g("div", {
275
+ }, C = ({ transaction: e }) => {
276
+ let t = c(e.status), n = e.type === "purchase" || e.type === "adjustment" || e.type === "granted";
277
+ return /* @__PURE__ */ b("div", {
251
278
  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",
252
279
  children: [
253
- /* @__PURE__ */ h("div", {
254
- className: `size-10 rounded-full flex items-center justify-center ${n ? u.success.bg : u.warning.bg}`,
255
- children: n ? /* @__PURE__ */ h("svg", {
256
- className: `size-5 ${u.success.icon}`,
280
+ /* @__PURE__ */ y("div", {
281
+ className: `size-10 rounded-full flex items-center justify-center ${n ? f.success.bg : f.warning.bg}`,
282
+ children: n ? /* @__PURE__ */ y("svg", {
283
+ className: `size-5 ${f.success.icon}`,
257
284
  fill: "none",
258
285
  viewBox: "0 0 24 24",
259
286
  stroke: "currentColor",
260
- children: /* @__PURE__ */ h("path", {
287
+ children: /* @__PURE__ */ y("path", {
261
288
  strokeLinecap: "round",
262
289
  strokeLinejoin: "round",
263
290
  strokeWidth: 2,
264
291
  d: "M12 4v16m8-8H4"
265
292
  })
266
- }) : /* @__PURE__ */ h("svg", {
267
- className: `size-5 ${u.warning.icon}`,
293
+ }) : /* @__PURE__ */ y("svg", {
294
+ className: `size-5 ${f.warning.icon}`,
268
295
  fill: "none",
269
296
  viewBox: "0 0 24 24",
270
297
  stroke: "currentColor",
271
- children: /* @__PURE__ */ h("path", {
298
+ children: /* @__PURE__ */ y("path", {
272
299
  strokeLinecap: "round",
273
300
  strokeLinejoin: "round",
274
301
  strokeWidth: 2,
@@ -276,30 +303,30 @@ var v = () => {
276
303
  })
277
304
  })
278
305
  }),
279
- /* @__PURE__ */ g("div", {
306
+ /* @__PURE__ */ b("div", {
280
307
  className: "flex-1 min-w-0",
281
- children: [/* @__PURE__ */ g("div", {
308
+ children: [/* @__PURE__ */ b("div", {
282
309
  className: "flex items-center gap-2",
283
- children: [/* @__PURE__ */ h("p", {
310
+ children: [/* @__PURE__ */ y("p", {
284
311
  className: "font-medium text-text-primary capitalize",
285
- children: i(e.type)
286
- }), /* @__PURE__ */ h("span", {
287
- className: `px-2 py-0.5 text-xs font-medium rounded ${c(t)}`,
312
+ children: a(e.type)
313
+ }), /* @__PURE__ */ y("span", {
314
+ className: `px-2 py-0.5 text-xs font-medium rounded ${l(t)}`,
288
315
  children: e.status
289
316
  })]
290
- }), /* @__PURE__ */ g("p", {
317
+ }), /* @__PURE__ */ b("p", {
291
318
  className: "text-sm text-text-secondary mt-0.5",
292
319
  children: [
293
- o(e.createdAt),
320
+ s(e.createdAt),
294
321
  " • ",
295
- a(e.createdAt, "short")
322
+ o(e.createdAt, "short")
296
323
  ]
297
324
  })]
298
325
  }),
299
- /* @__PURE__ */ h("div", {
326
+ /* @__PURE__ */ y("div", {
300
327
  className: "text-right",
301
- children: /* @__PURE__ */ g("p", {
302
- className: `font-semibold ${n ? u.success.text : "text-text-primary"}`,
328
+ children: /* @__PURE__ */ b("p", {
329
+ className: `font-semibold ${n ? f.success.text : "text-text-primary"}`,
303
330
  children: [
304
331
  n ? "+" : "-",
305
332
  e.amount.toLocaleString(),
@@ -310,6 +337,6 @@ var v = () => {
310
337
  ]
311
338
  });
312
339
  };
313
- export { v as CreditsPage };
340
+ export { S as CreditsPage };
314
341
 
315
342
  //# sourceMappingURL=CreditsPage.js.map
@@ -1 +1 @@
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&apos;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,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,CAACf,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;KAA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allback","navigateTo","useBillingNavigate","permissions","useBillingPermissions","isFluidgrids","useIsFluidgridsVariant","showWithdraw","defaultAccount","isLoadingDefault","useDefaultBillingAccount","searchParams","useSearchParams","chosenAccountId","setChosenAccountId","useState","accountsData","useGetBillingAccountsByOrgQuery","accountOptions","useMemo","viewingOther","otherAccount","isLoadingOther","useBillingAccount","billingAccount","isLoadingAccount","selectedAccountId","days","setDays","filterType","setFilterType","page","setPage","isLoadingTransactions","useCreditTransactions","isLoading","filteredTransactions","transactions","tx","error","refetch","creditBalance","PagePurpose","account","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 { useMemo, useState, type FC } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useCreditTransactions } from '../hooks/useCredits';\nimport { useBillingAccount, useDefaultBillingAccount } from '../../subscriptions/hooks';\nimport {\n useGetBillingAccountsByOrgQuery,\n type GetBillingAccountsByOrgQuery,\n} from '../../../../generated/global-operations';\n\ntype BillingAccountItem = GetBillingAccountsByOrgQuery['getBillingAccountsByOrg'][number];\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 isFluidgrids = useIsFluidgridsVariant();\n const showWithdraw = !isFluidgrids;\n const { billingAccount: defaultAccount, isLoading: isLoadingDefault } =\n useDefaultBillingAccount();\n\n // FluidGrids: pick which billing account's credits to see, like Invoices does.\n const [searchParams] = useSearchParams();\n const [chosenAccountId, setChosenAccountId] = useState<string | null>(\n searchParams.get('billingAccountId')\n );\n const { data: accountsData } = useGetBillingAccountsByOrgQuery({\n fetchPolicy: 'cache-first',\n skip: !isFluidgrids,\n });\n const accountOptions = useMemo(\n () => (isFluidgrids ? (accountsData?.getBillingAccountsByOrg ?? []) : []),\n [isFluidgrids, accountsData]\n );\n const viewingOther =\n isFluidgrids && chosenAccountId !== null && chosenAccountId !== defaultAccount?.id;\n const { billingAccount: otherAccount, isLoading: isLoadingOther } = useBillingAccount(\n viewingOther ? chosenAccountId : undefined\n );\n const billingAccount = viewingOther ? otherAccount : defaultAccount;\n const isLoadingAccount = viewingOther ? isLoadingOther : isLoadingDefault;\n const selectedAccountId = viewingOther ? chosenAccountId : (defaultAccount?.id ?? '');\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&apos;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\n className={\n isFluidgrids\n ? 'flex flex-wrap items-center gap-2 lg:shrink-0'\n : 'flex items-center gap-2'\n }\n >\n {isFluidgrids && accountOptions.length > 1 && (\n <div className=\"flex w-full min-w-0 items-center gap-2 sm:w-auto\">\n <label\n htmlFor=\"credits-billing-account\"\n className=\"text-sm text-text-secondary whitespace-nowrap\"\n >\n {tr('billing.credits.billingAccountLabel', 'Billing Account')}\n </label>\n <select\n id=\"credits-billing-account\"\n value={selectedAccountId ?? ''}\n onChange={(e) => {\n setChosenAccountId(e.target.value || null);\n setPage(1);\n }}\n className=\"min-w-0 flex-1 truncate sm:max-w-xs sm:flex-none 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\"\n >\n {accountOptions.map((account: BillingAccountItem) => (\n <option key={account.id ?? ''} value={account.id ?? ''}>\n {account.name ?? account.email ?? account.id}\n {account.isDefault ? tr('billing.invoices.defaultSuffix', ' (Default)') : ''}\n </option>\n ))}\n </select>\n </div>\n )}\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\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