@burdenoff/microfe-billing 2026.830.1 → 2026.830.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.
@@ -1,6 +1,7 @@
1
1
  import { useBilling as e } from "../../../providers/BillingProvider.js";
2
- import { AccessDenied as t } from "../../../shared/components/AccessDenied.js";
3
- import { StatCard as n } from "../../../shared/components/StatCard.js";
2
+ import { useTr as t } from "../../../shared/hooks/useTr.js";
3
+ import { AccessDenied as n } from "../../../shared/components/AccessDenied.js";
4
+ import { StatCard as r } from "../../../shared/components/StatCard.js";
4
5
  import { ServerError as ee } from "../../../shared/components/ServerError.js";
5
6
  import { useBillingEventEmitter as te } from "../../../hooks/useBillingEventEmitter.js";
6
7
  import { getStoredBillingAccountId as ne, setStoredBillingAccountId as re } from "../../../hooks/useBillingAccountSelection.js";
@@ -14,311 +15,307 @@ import { BillingAccountCard as ce } from "../components/BillingAccountCard.js";
14
15
  import { PaymentMethodsSection as le } from "../components/PaymentMethodsSection.js";
15
16
  import { ActiveSubscriptionCard as ue } from "../components/ActiveSubscriptionCard.js";
16
17
  import { RecommendedAddonsSection as de } from "../components/RecommendedAddonsSection.js";
17
- import { CreateBillingAccountModal as r } from "../components/CreateBillingAccountModal.js";
18
+ import { CreateBillingAccountModal as i } from "../components/CreateBillingAccountModal.js";
18
19
  import { AddPaymentMethodModal as fe } from "../components/AddPaymentMethodModal.js";
19
20
  import "../components/index.js";
20
21
  import { useAddonCartStore as pe } from "../../addons/store/addonCartStore.js";
21
22
  import { FloatingCartDrawer as me } from "../../addons/components/FloatingCartDrawer.js";
22
- import { withBillingAccountId as i } from "../../../shared/utils/navigation.js";
23
- import { useCallback as a, useEffect as o, useState as s } from "react";
24
- import { Activity as he, ArrowRight as ge, Building2 as c, Check as l, ChevronDown as _e, Coins as ve, Crown as ye, Loader2 as be, Plus as u, Receipt as xe, RefreshCw as Se, Sparkles as Ce, Wallet as d } from "lucide-react";
25
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
26
- import { useI18n as we } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
27
- import { AuroraBackground as h, Button as Te, CTAOverflowMenu as Ee, GlassCard as De, GradientText as g, IllustratedEmptyState as Oe, PagePurpose as ke } from "@burdenoff/fe-libs/ui";
23
+ import { withBillingAccountId as a } from "../../../shared/utils/navigation.js";
24
+ import { useCallback as o, useEffect as s, useState as c } from "react";
25
+ import { Activity as he, ArrowRight as ge, Building2 as l, Check as u, ChevronDown as _e, Coins as ve, Crown as ye, Loader2 as be, Plus as d, Receipt as xe, RefreshCw as f, Sparkles as Se, Wallet as p } from "lucide-react";
26
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
27
+ import { AuroraBackground as _, Button as Ce, CTAOverflowMenu as we, GlassCard as Te, GradientText as v, IllustratedEmptyState as Ee, PagePurpose as De } from "@burdenoff/fe-libs/ui";
28
28
  //#region src/billing/modules/dashboard/pages/OverviewPage.tsx
29
- var _ = () => {
30
- let { t: _ } = we(), v = (e, t) => {
31
- let n = _(e);
32
- return n === e ? t : n;
33
- }, { navigate: y, basePath: b, orgId: x, productId: Ae } = e(), S = ae(), { emit: C } = te(), [w, je] = s(() => ne(x)), [T, E] = s(!1), [D, O] = s(null), [k, A] = s(!1), [Me, j] = s(!1), [M, N] = s(0), [P, F] = s(!1), { billingAccounts: I, currentAccount: L, paymentMethods: R, activeSubscriptions: z, hasActiveSubscription: B, recommendedAddons: Ne, isLoading: V, error: H, refetchAll: U } = se(w, Ae), W = L?.id, Pe = V, G = a((e) => {
34
- je(e), re(x, e);
35
- }, [x]), { addToCart: K, isInCart: q, getCartItem: J, updateQuantity: Y, removeFromCart: X } = pe(), { createBillingAccount: Fe, setBillingAddress: Ie, setDefaultPaymentMethod: Le, deletePaymentMethod: Re, isCreatingAccount: ze } = oe();
36
- o(() => {
37
- N(0), F(!1);
38
- }, [W, z.length]), o(() => {
39
- w && I.length > 0 && (I.some((e) => e.id === w) || G(null));
29
+ var y = () => {
30
+ let y = t(), { navigate: b, basePath: x, orgId: S, productId: Oe } = e(), C = ae(), { emit: w } = te(), [T, ke] = c(() => ne(S)), [Ae, E] = c(!1), [D, O] = c(null), [k, A] = c(!1), [je, j] = c(!1), [Me, M] = c(0), [N, P] = c(!1), { billingAccounts: F, currentAccount: I, paymentMethods: L, activeSubscriptions: R, hasActiveSubscription: z, recommendedAddons: Ne, isLoading: B, error: V, refetchAll: H } = se(T, Oe), U = I?.id, Pe = B, W = o((e) => {
31
+ ke(e), re(S, e);
32
+ }, [S]), { addToCart: G, isInCart: K, getCartItem: q, updateQuantity: J, removeFromCart: Y } = pe(), { createBillingAccount: X, setBillingAddress: Fe, setDefaultPaymentMethod: Ie, deletePaymentMethod: Le, isCreatingAccount: Re } = oe();
33
+ s(() => {
34
+ M(0), P(!1);
35
+ }, [U, R.length]), s(() => {
36
+ T && F.length > 0 && (F.some((e) => e.id === T) || W(null));
40
37
  }, [
41
- I,
42
- w,
43
- G
44
- ]), o(() => {
45
- !w && I.length > 0 && G((I.find((e) => e.isDefault) ?? I[0]).id);
38
+ F,
39
+ T,
40
+ W
41
+ ]), s(() => {
42
+ !T && F.length > 0 && W((F.find((e) => e.isDefault) ?? F[0]).id);
46
43
  }, [
47
- I,
48
- w,
49
- G
44
+ F,
45
+ T,
46
+ W
50
47
  ]);
51
- let Z = z[M] || z[0] || null, Q = a((e) => {
48
+ let Z = R[Me] || R[0] || null, Q = o((e) => {
52
49
  let t = e;
53
- b && b !== "/" && (t = `${b.endsWith("/") ? b.slice(0, -1) : b}${e.startsWith("/") ? e : `/${e}`}`), y(t);
54
- }, [y, b]), Be = a(async (e, t) => {
50
+ x && x !== "/" && (t = `${x.endsWith("/") ? x.slice(0, -1) : x}${e.startsWith("/") ? e : `/${e}`}`), b(t);
51
+ }, [b, x]), ze = o(async (e, t) => {
55
52
  O(null);
56
53
  try {
57
- let n = await Fe(e);
58
- t && n.id && await Ie({
54
+ let n = await X(e);
55
+ t && n.id && await Fe({
59
56
  billingAccountId: n.id,
60
57
  ...t
61
- }), E(!1), G(n.id), C("billing.billing_account.created", {
58
+ }), E(!1), W(n.id), w("billing.billing_account.created", {
62
59
  route: "/billing/overview",
63
60
  entityId: n.id,
64
61
  source: "overview"
65
- }), await U();
62
+ }), await H();
66
63
  } catch (e) {
67
64
  O(e instanceof Error ? e.message : "Failed to create billing account");
68
65
  }
69
66
  }, [
67
+ X,
68
+ w,
69
+ H,
70
70
  Fe,
71
- C,
72
- U,
73
- Ie,
74
- G
75
- ]), Ve = a(() => {
71
+ W
72
+ ]), Be = o(() => {
76
73
  j(!0);
77
- }, []), $ = a(async () => {
78
- await U();
79
- }, [U]), He = a(async () => {
80
- C("billing.payment_method.added", {
74
+ }, []), $ = o(async () => {
75
+ await H();
76
+ }, [H]), Ve = o(async () => {
77
+ w("billing.payment_method.added", {
81
78
  route: "/billing/overview",
82
- entityId: W,
79
+ entityId: U,
83
80
  source: "overview"
84
81
  }), await $();
85
82
  }, [
86
- W,
87
- C,
83
+ U,
84
+ w,
88
85
  $
89
- ]), Ue = a(async (e) => {
90
- W && (await Le(e, W), C("billing.payment_method.default_set", {
86
+ ]), He = o(async (e) => {
87
+ U && (await Ie(e, U), w("billing.payment_method.default_set", {
91
88
  route: "/billing/overview",
92
89
  entityId: e,
93
90
  source: "overview"
94
91
  }), await $());
95
92
  }, [
96
- W,
97
- C,
98
- Le,
93
+ U,
94
+ w,
95
+ Ie,
99
96
  $
100
- ]), We = a(async (e) => {
101
- W && (await Re(e, W), C("billing.payment_method.deleted", {
97
+ ]), Ue = o(async (e) => {
98
+ U && (await Le(e, U), w("billing.payment_method.deleted", {
102
99
  route: "/billing/overview",
103
100
  entityId: e,
104
101
  source: "overview"
105
102
  }), await $());
106
103
  }, [
107
- W,
108
- Re,
109
- C,
104
+ U,
105
+ Le,
106
+ w,
110
107
  $
111
- ]), Ge = a((e) => {
112
- G(e.id), A(!1);
113
- }, [G]), Ke = a(async () => {
114
- await U();
115
- }, [U]), qe = a((e) => {
116
- K(e);
117
- }, [K]), Je = a((e) => q(e), [q]), Ye = a((e) => J(e)?.quantity || 0, [J]), Xe = a((e, t) => {
118
- t <= 0 ? X(e) : Y(e, t);
119
- }, [Y, X]), Ze = a((e) => {
120
- X(e);
121
- }, [X]);
122
- return S.canViewBillingAccount ? H && ie(H) && !V ? /* @__PURE__ */ p("div", {
108
+ ]), We = o((e) => {
109
+ W(e.id), A(!1);
110
+ }, [W]), Ge = o(async () => {
111
+ await H();
112
+ }, [H]), Ke = o((e) => {
113
+ G(e);
114
+ }, [G]), qe = o((e) => K(e), [K]), Je = o((e) => q(e)?.quantity || 0, [q]), Ye = o((e, t) => {
115
+ t <= 0 ? Y(e) : J(e, t);
116
+ }, [J, Y]), Xe = o((e) => {
117
+ Y(e);
118
+ }, [Y]);
119
+ return C.canViewBillingAccount ? V && ie(V) && !B ? /* @__PURE__ */ h("div", {
123
120
  className: "p-6",
124
- children: /* @__PURE__ */ p(ee, {
125
- title: "Server Unavailable",
126
- message: "Unable to load billing overview. The server might be down or experiencing issues.",
127
- onRetry: Ke,
121
+ children: /* @__PURE__ */ h(ee, {
122
+ title: y("billing.serverError.title", "Server Unavailable"),
123
+ message: y("billing.overview.serverUnavailableMessage", "Unable to load billing overview. The server might be down or experiencing issues."),
124
+ onRetry: Ge,
128
125
  showRetry: !0
129
126
  })
130
- }) : V && !L ? /* @__PURE__ */ p("div", {
127
+ }) : B && !I ? /* @__PURE__ */ h("div", {
131
128
  className: "flex items-center justify-center min-h-[400px]",
132
- children: /* @__PURE__ */ m("div", {
129
+ children: /* @__PURE__ */ g("div", {
133
130
  className: "flex flex-col items-center gap-3",
134
- children: [/* @__PURE__ */ p(be, { className: "size-8 animate-spin text-text-link" }), /* @__PURE__ */ p("p", {
131
+ children: [/* @__PURE__ */ h(be, { className: "size-8 animate-spin text-text-link" }), /* @__PURE__ */ h("p", {
135
132
  className: "text-sm text-text-secondary",
136
- children: v("billing.overview.loadingInfo", "Loading billing information...")
133
+ children: y("billing.overview.loadingInfo", "Loading billing information...")
137
134
  })]
138
135
  })
139
- }) : !V && I.length === 0 && !L ? /* @__PURE__ */ m("div", {
136
+ }) : !B && F.length === 0 && !I ? /* @__PURE__ */ g("div", {
140
137
  className: "px-6 lg:px-8 py-6",
141
138
  children: [
142
- /* @__PURE__ */ m("header", {
139
+ /* @__PURE__ */ g("header", {
143
140
  className: "relative overflow-hidden mb-8 rounded-card",
144
141
  children: [
145
- /* @__PURE__ */ p(h, { intensity: "subtle" }),
146
- /* @__PURE__ */ p("h1", {
142
+ /* @__PURE__ */ h(_, { intensity: "subtle" }),
143
+ /* @__PURE__ */ h("h1", {
147
144
  className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
148
- children: /* @__PURE__ */ p(g, { children: v("billing.overview.title", "Billing Overview") })
145
+ children: /* @__PURE__ */ h(v, { children: y("billing.overview.title", "Billing Overview") })
149
146
  }),
150
- /* @__PURE__ */ p("p", {
147
+ /* @__PURE__ */ h("p", {
151
148
  className: "text-sm text-text-secondary mt-1",
152
- children: v("billing.overview.emptySetupDescription", "Set up billing to manage subscriptions, payments, and invoices")
149
+ children: y("billing.overview.emptySetupDescription", "Set up billing to manage subscriptions, payments, and invoices")
153
150
  })
154
151
  ]
155
152
  }),
156
- /* @__PURE__ */ p(Oe, {
153
+ /* @__PURE__ */ h(Ee, {
157
154
  illustration: "onboarding",
158
- title: v("billing.overview.emptyTitle", "No billing account"),
159
- description: v("billing.overview.emptyDescription", "Create a billing account to start managing your subscriptions and payments"),
160
- action: S.canManageBillingAccount ? /* @__PURE__ */ m("button", {
155
+ title: y("billing.overview.emptyTitle", "No billing account"),
156
+ description: y("billing.overview.emptyDescription", "Create a billing account to start managing your subscriptions and payments"),
157
+ action: C.canManageBillingAccount ? /* @__PURE__ */ g("button", {
161
158
  type: "button",
162
159
  onClick: () => E(!0),
163
160
  className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-action-primary-text bg-action-primary-bg rounded-button hover:bg-action-primary-bgHover transition-colors duration-200",
164
- children: [/* @__PURE__ */ p(u, { className: "size-4" }), v("billing.overview.createBillingAccount", "Create Billing Account")]
161
+ children: [/* @__PURE__ */ h(d, { className: "size-4" }), y("billing.overview.createBillingAccount", "Create Billing Account")]
165
162
  }) : void 0
166
163
  }),
167
- /* @__PURE__ */ p(r, {
168
- isOpen: T,
164
+ /* @__PURE__ */ h(i, {
165
+ isOpen: Ae,
169
166
  onClose: () => {
170
167
  E(!1), O(null);
171
168
  },
172
- onSubmit: Be,
173
- isSubmitting: ze,
169
+ onSubmit: ze,
170
+ isSubmitting: Re,
174
171
  error: D
175
172
  })
176
173
  ]
177
- }) : /* @__PURE__ */ m("div", {
174
+ }) : /* @__PURE__ */ g("div", {
178
175
  className: "px-6 lg:px-8 py-6 space-y-6 sm:space-y-8",
179
176
  children: [
180
- /* @__PURE__ */ m("header", {
177
+ /* @__PURE__ */ g("header", {
181
178
  className: "relative overflow-hidden rounded-card flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",
182
179
  children: [
183
- /* @__PURE__ */ p(h, { intensity: "subtle" }),
184
- /* @__PURE__ */ m("div", { children: [
185
- /* @__PURE__ */ p("h1", {
180
+ /* @__PURE__ */ h(_, { intensity: "subtle" }),
181
+ /* @__PURE__ */ g("div", { children: [
182
+ /* @__PURE__ */ h("h1", {
186
183
  className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
187
- children: /* @__PURE__ */ p(g, { children: v("billing.overview.title", "Billing Overview") })
184
+ children: /* @__PURE__ */ h(v, { children: y("billing.overview.title", "Billing Overview") })
188
185
  }),
189
- /* @__PURE__ */ p("p", {
186
+ /* @__PURE__ */ h("p", {
190
187
  className: "text-sm text-text-secondary mt-1",
191
- children: v("billing.overview.description", "Manage your billing accounts, subscriptions, and payment methods")
188
+ children: y("billing.overview.description", "Manage your billing accounts, subscriptions, and payment methods")
192
189
  }),
193
- /* @__PURE__ */ p(ke, {
190
+ /* @__PURE__ */ h(De, {
194
191
  className: "mt-3",
195
- children: v("billing.overview.purpose", "Your billing home base — see your current plan, credit balance and payment methods at a glance, and jump to transactions, usage, credits or new plans. Start here to understand what you are paying for and manage it.")
192
+ children: y("billing.overview.purpose", "Your billing home base — see your current plan, credit balance and payment methods at a glance, and jump to transactions, usage, credits or new plans. Start here to understand what you are paying for and manage it.")
196
193
  })
197
194
  ] }),
198
- /* @__PURE__ */ p(Ee, {
199
- primary: S.canManageBillingAccount && I.length > 0 ? {
200
- label: v("billing.overview.newAccount", "New Account"),
195
+ /* @__PURE__ */ h(we, {
196
+ primary: C.canManageBillingAccount && F.length > 0 ? {
197
+ label: y("billing.overview.newAccount", "New Account"),
201
198
  onSelect: () => E(!0),
202
- icon: /* @__PURE__ */ p(u, { className: "size-4" })
199
+ icon: /* @__PURE__ */ h(d, { className: "size-4" })
203
200
  } : void 0,
204
201
  actions: [{
205
- label: v("billing.overview.refresh", "Refresh"),
202
+ label: y("billing.overview.refresh", "Refresh"),
206
203
  onSelect: () => {
207
- Ke();
204
+ Ge();
208
205
  },
209
- icon: /* @__PURE__ */ p(Se, { className: `size-4 ${V ? "animate-spin" : ""}` })
206
+ icon: /* @__PURE__ */ h(f, { className: `size-4 ${B ? "animate-spin" : ""}` })
210
207
  }]
211
208
  })
212
209
  ]
213
210
  }),
214
- I.length > 1 && /* @__PURE__ */ m("div", {
211
+ F.length > 1 && /* @__PURE__ */ g("div", {
215
212
  className: "relative",
216
213
  "data-tour": "billing-overview-account-selector",
217
- children: [/* @__PURE__ */ m("button", {
214
+ children: [/* @__PURE__ */ g("button", {
218
215
  type: "button",
219
216
  onClick: () => A(!k),
220
217
  className: "w-full sm:w-auto flex items-center justify-between gap-3 px-4 py-3 border border-border-seam rounded-card bg-bg-surface hover:bg-bg-sunken hover:border-border-strong transition-all duration-200",
221
- children: [/* @__PURE__ */ m("div", {
218
+ children: [/* @__PURE__ */ g("div", {
222
219
  className: "flex items-center gap-3",
223
- children: [/* @__PURE__ */ p("div", {
220
+ children: [/* @__PURE__ */ h("div", {
224
221
  className: "size-9 rounded-lg bg-[var(--color-accent-soft)] flex items-center justify-center",
225
- children: /* @__PURE__ */ p(c, { className: "size-4 text-text-link" })
226
- }), /* @__PURE__ */ m("div", {
222
+ children: /* @__PURE__ */ h(l, { className: "size-4 text-text-link" })
223
+ }), /* @__PURE__ */ g("div", {
227
224
  className: "text-left",
228
- children: [/* @__PURE__ */ p("p", {
225
+ children: [/* @__PURE__ */ h("p", {
229
226
  className: "text-sm font-medium text-text-primary",
230
- children: L?.name || v("billing.overview.selectAccount", "Select Account")
231
- }), /* @__PURE__ */ p("p", {
227
+ children: I?.name || y("billing.overview.selectAccount", "Select Account")
228
+ }), /* @__PURE__ */ h("p", {
232
229
  className: "text-xs text-text-secondary",
233
- children: L?.email
230
+ children: I?.email
234
231
  })]
235
232
  })]
236
- }), /* @__PURE__ */ p(_e, { className: `size-4 text-text-muted transition-transform ${k ? "rotate-180" : ""}` })]
237
- }), k && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
233
+ }), /* @__PURE__ */ h(_e, { className: `size-4 text-text-muted transition-transform ${k ? "rotate-180" : ""}` })]
234
+ }), k && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
238
235
  className: "fixed inset-0 z-10",
239
236
  onClick: () => A(!1)
240
- }), /* @__PURE__ */ p("div", {
237
+ }), /* @__PURE__ */ h("div", {
241
238
  className: "absolute top-full left-0 right-0 sm:right-auto mt-1 w-full sm:w-80 bg-bg-elevated border border-border-seam rounded-card shadow-elevation-3 z-20 py-1 max-h-60 overflow-y-auto",
242
- children: I.map((e) => /* @__PURE__ */ m("button", {
239
+ children: F.map((e) => /* @__PURE__ */ g("button", {
243
240
  type: "button",
244
- onClick: () => Ge(e),
241
+ onClick: () => We(e),
245
242
  className: "w-full flex items-center justify-between gap-3 px-4 py-3 hover:bg-bg-sunken transition-colors",
246
- children: [/* @__PURE__ */ m("div", {
243
+ children: [/* @__PURE__ */ g("div", {
247
244
  className: "flex items-center gap-3 min-w-0",
248
- children: [/* @__PURE__ */ p("div", {
245
+ children: [/* @__PURE__ */ h("div", {
249
246
  className: "size-9 rounded-lg bg-bg-sunken flex items-center justify-center flex-shrink-0",
250
- children: /* @__PURE__ */ p(c, { className: "size-4 text-text-secondary" })
251
- }), /* @__PURE__ */ m("div", {
247
+ children: /* @__PURE__ */ h(l, { className: "size-4 text-text-secondary" })
248
+ }), /* @__PURE__ */ g("div", {
252
249
  className: "text-left min-w-0",
253
- children: [/* @__PURE__ */ p("p", {
250
+ children: [/* @__PURE__ */ h("p", {
254
251
  className: "text-sm font-medium text-text-primary truncate",
255
252
  children: e.name
256
- }), /* @__PURE__ */ p("p", {
253
+ }), /* @__PURE__ */ h("p", {
257
254
  className: "text-xs text-text-secondary truncate",
258
255
  children: e.email
259
256
  })]
260
257
  })]
261
- }), L?.id === e.id && /* @__PURE__ */ p(l, { className: "size-4 text-text-link flex-shrink-0" })]
258
+ }), I?.id === e.id && /* @__PURE__ */ h(u, { className: "size-4 text-text-link flex-shrink-0" })]
262
259
  }, e.id))
263
260
  })] })]
264
261
  }),
265
- L && /* @__PURE__ */ m("div", {
262
+ I && /* @__PURE__ */ g("div", {
266
263
  className: "grid grid-cols-1 xs:grid-cols-2 sm:grid-cols-4 gap-3 sm:gap-4",
267
264
  "data-tour": "billing-overview-stats-row",
268
265
  children: [
269
- /* @__PURE__ */ p(n, {
270
- label: v("billing.overview.stats.creditBalance", "Credit Balance"),
271
- value: `${(L.creditAmount || 0).toLocaleString()} Credits`,
272
- icon: /* @__PURE__ */ p(d, { className: "size-5" })
266
+ /* @__PURE__ */ h(r, {
267
+ label: y("billing.overview.stats.creditBalance", "Credit Balance"),
268
+ value: `${(I.creditAmount || 0).toLocaleString()} Credits`,
269
+ icon: /* @__PURE__ */ h(p, { className: "size-5" })
273
270
  }),
274
- /* @__PURE__ */ p(n, {
275
- label: v("billing.overview.stats.activePlans", "Active Plans"),
276
- value: z.length > 0 ? z.length === 1 ? z[0]?.plan?.name || "1 Plan" : `${z.length} ${v("billing.overview.stats.plansSuffix", "Plans")}` : v("billing.overview.stats.none", "None"),
277
- icon: /* @__PURE__ */ p(Se, { className: "size-5" })
271
+ /* @__PURE__ */ h(r, {
272
+ label: y("billing.overview.stats.activePlans", "Active Plans"),
273
+ value: R.length > 0 ? R.length === 1 ? R[0]?.plan?.name || "1 Plan" : `${R.length} ${y("billing.overview.stats.plansSuffix", "Plans")}` : y("billing.overview.stats.none", "None"),
274
+ icon: /* @__PURE__ */ h(f, { className: "size-5" })
278
275
  }),
279
- /* @__PURE__ */ p(n, {
280
- label: v("billing.overview.stats.paymentMethods", "Payment Methods"),
281
- value: R.length,
282
- icon: /* @__PURE__ */ p(c, { className: "size-5" })
276
+ /* @__PURE__ */ h(r, {
277
+ label: y("billing.overview.stats.paymentMethods", "Payment Methods"),
278
+ value: L.length,
279
+ icon: /* @__PURE__ */ h(l, { className: "size-5" })
283
280
  }),
284
- /* @__PURE__ */ p(n, {
285
- label: v("billing.overview.stats.paymentCurrency", "Payment Currency"),
286
- value: L.currency || "USD",
287
- icon: /* @__PURE__ */ p(c, { className: "size-5" })
281
+ /* @__PURE__ */ h(r, {
282
+ label: y("billing.overview.stats.paymentCurrency", "Payment Currency"),
283
+ value: I.currency || "USD",
284
+ icon: /* @__PURE__ */ h(l, { className: "size-5" })
288
285
  })
289
286
  ]
290
287
  }),
291
- /* @__PURE__ */ m("div", {
288
+ /* @__PURE__ */ g("div", {
292
289
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
293
- children: [/* @__PURE__ */ m("div", {
290
+ children: [/* @__PURE__ */ g("div", {
294
291
  className: "lg:col-span-2 space-y-6",
295
292
  children: [
296
- L && /* @__PURE__ */ p(ce, {
293
+ I && /* @__PURE__ */ h(ce, {
297
294
  dataTour: "billing-overview-billing-account-card",
298
- account: L,
299
- isDefault: L.isDefault ?? !1,
300
- onEdit: () => L && Q(`/settings?billingAccountId=${L.id}`),
301
- onViewTransactions: () => Q(`/transactions/${L.id}`),
302
- onViewCreditTransactions: () => Q(`/creditTransactions/${L.id}`)
295
+ account: I,
296
+ isDefault: I.isDefault ?? !1,
297
+ onEdit: () => I && Q(`/settings?billingAccountId=${I.id}`),
298
+ onViewTransactions: () => Q(`/transactions/${I.id}`),
299
+ onViewCreditTransactions: () => Q(`/creditTransactions/${I.id}`)
303
300
  }),
304
- /* @__PURE__ */ m("div", {
301
+ /* @__PURE__ */ g("div", {
305
302
  className: "space-y-3",
306
- children: [z.length > 1 && /* @__PURE__ */ m("div", {
303
+ children: [R.length > 1 && /* @__PURE__ */ g("div", {
307
304
  className: "relative",
308
- children: [/* @__PURE__ */ m("button", {
305
+ children: [/* @__PURE__ */ g("button", {
309
306
  type: "button",
310
- onClick: () => F(!P),
307
+ onClick: () => P(!N),
311
308
  className: "w-full sm:w-auto flex items-center justify-between gap-3 px-4 py-3 border border-border-seam rounded-card bg-bg-surface hover:bg-bg-sunken hover:border-border-strong transition-all duration-200",
312
- children: [/* @__PURE__ */ m("div", {
309
+ children: [/* @__PURE__ */ g("div", {
313
310
  className: "flex items-center gap-3",
314
- children: [/* @__PURE__ */ p("div", {
311
+ children: [/* @__PURE__ */ h("div", {
315
312
  className: "size-9 rounded-lg bg-[var(--color-accent-soft)] flex items-center justify-center",
316
- children: /* @__PURE__ */ p(ye, { className: "size-4 text-text-link" })
317
- }), /* @__PURE__ */ m("div", {
313
+ children: /* @__PURE__ */ h(ye, { className: "size-4 text-text-link" })
314
+ }), /* @__PURE__ */ g("div", {
318
315
  className: "text-left",
319
- children: [/* @__PURE__ */ m("p", {
316
+ children: [/* @__PURE__ */ g("p", {
320
317
  className: "text-sm font-medium text-text-primary",
321
- children: [Z?.plan?.name || v("billing.overview.selectSubscription", "Select Subscription"), Z?.plan?.product?.name && /* @__PURE__ */ m("span", {
318
+ children: [Z?.plan?.name || y("billing.overview.selectSubscription", "Select Subscription"), Z?.plan?.product?.name && /* @__PURE__ */ g("span", {
322
319
  className: "text-text-secondary font-normal",
323
320
  children: [
324
321
  " ",
@@ -326,185 +323,185 @@ var _ = () => {
326
323
  Z.plan.product.name
327
324
  ]
328
325
  })]
329
- }), /* @__PURE__ */ m("p", {
326
+ }), /* @__PURE__ */ g("p", {
330
327
  className: "text-xs text-text-secondary",
331
328
  children: [
332
- z.length,
329
+ R.length,
333
330
  " ",
334
- v("billing.overview.activeSubscriptions", "active subscriptions")
331
+ y("billing.overview.activeSubscriptions", "active subscriptions")
335
332
  ]
336
333
  })]
337
334
  })]
338
- }), /* @__PURE__ */ p(_e, { className: `size-4 text-text-muted transition-transform ${P ? "rotate-180" : ""}` })]
339
- }), P && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
335
+ }), /* @__PURE__ */ h(_e, { className: `size-4 text-text-muted transition-transform ${N ? "rotate-180" : ""}` })]
336
+ }), N && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
340
337
  className: "fixed inset-0 z-10",
341
- onClick: () => F(!1)
342
- }), /* @__PURE__ */ p("div", {
338
+ onClick: () => P(!1)
339
+ }), /* @__PURE__ */ h("div", {
343
340
  className: "absolute top-full left-0 right-0 sm:right-auto mt-1 w-full sm:w-80 bg-bg-elevated border border-border-seam rounded-card shadow-elevation-3 z-20 py-1 max-h-60 overflow-y-auto",
344
- children: z.map((e, t) => /* @__PURE__ */ m("button", {
341
+ children: R.map((e, t) => /* @__PURE__ */ g("button", {
345
342
  type: "button",
346
343
  onClick: () => {
347
- N(t), F(!1);
344
+ M(t), P(!1);
348
345
  },
349
346
  className: "w-full flex items-center justify-between gap-3 px-4 py-3 hover:bg-bg-sunken transition-colors",
350
- children: [/* @__PURE__ */ m("div", {
347
+ children: [/* @__PURE__ */ g("div", {
351
348
  className: "flex items-center gap-3 min-w-0",
352
- children: [/* @__PURE__ */ p("div", {
349
+ children: [/* @__PURE__ */ h("div", {
353
350
  className: "size-9 rounded-lg bg-bg-sunken flex items-center justify-center flex-shrink-0",
354
- children: /* @__PURE__ */ p(ye, { className: "size-4 text-text-secondary" })
355
- }), /* @__PURE__ */ m("div", {
351
+ children: /* @__PURE__ */ h(ye, { className: "size-4 text-text-secondary" })
352
+ }), /* @__PURE__ */ g("div", {
356
353
  className: "text-left min-w-0",
357
- children: [/* @__PURE__ */ p("p", {
354
+ children: [/* @__PURE__ */ h("p", {
358
355
  className: "text-sm font-medium text-text-primary truncate",
359
- children: e.plan?.name || v("billing.overview.subscription", "Subscription")
360
- }), /* @__PURE__ */ m("p", {
356
+ children: e.plan?.name || y("billing.overview.subscription", "Subscription")
357
+ }), /* @__PURE__ */ g("p", {
361
358
  className: "text-xs text-text-secondary truncate",
362
359
  children: [
363
- e.plan?.product?.name || v("billing.overview.unknownProduct", "Unknown Product"),
360
+ e.plan?.product?.name || y("billing.overview.unknownProduct", "Unknown Product"),
364
361
  " ",
365
362
  "· ",
366
- v("billing.overview.ends", "Ends"),
363
+ y("billing.overview.ends", "Ends"),
367
364
  " ",
368
365
  new Date(e.endDate).toLocaleDateString()
369
366
  ]
370
367
  })]
371
368
  })]
372
- }), M === t && /* @__PURE__ */ p(l, { className: "size-4 text-text-link flex-shrink-0" })]
369
+ }), Me === t && /* @__PURE__ */ h(u, { className: "size-4 text-text-link flex-shrink-0" })]
373
370
  }, e.id))
374
371
  })] })]
375
- }), /* @__PURE__ */ p(ue, {
372
+ }), /* @__PURE__ */ h(ue, {
376
373
  dataTour: "billing-overview-active-subscription-card",
377
374
  subscription: Z,
378
- onViewDetails: () => Z && Q(i(`/subscriptions/${Z.id}`, Z.billingAccountId ?? L?.id)),
379
- onUpgrade: () => Z && Q(i(`/subscriptions/${Z.id}/upgrade`, Z.billingAccountId ?? L?.id)),
380
- onManage: () => L && Q(`/subscriptions?billingAccountId=${L.id}`),
375
+ onViewDetails: () => Z && Q(a(`/subscriptions/${Z.id}`, Z.billingAccountId ?? I?.id)),
376
+ onUpgrade: () => Z && Q(a(`/subscriptions/${Z.id}/upgrade`, Z.billingAccountId ?? I?.id)),
377
+ onManage: () => I && Q(`/subscriptions?billingAccountId=${I.id}`),
381
378
  onPurchasePlan: () => Q("/plans")
382
379
  })]
383
380
  }),
384
- L && /* @__PURE__ */ p(le, {
381
+ I && /* @__PURE__ */ h(le, {
385
382
  dataTour: "billing-overview-payment-methods-section",
386
- paymentMethods: R,
387
- billingAccountId: L.id,
388
- onAddPaymentMethod: Ve,
389
- onSetDefault: Ue,
390
- onDelete: We,
391
- isLoading: V
383
+ paymentMethods: L,
384
+ billingAccountId: I.id,
385
+ onAddPaymentMethod: Be,
386
+ onSetDefault: He,
387
+ onDelete: Ue,
388
+ isLoading: B
392
389
  })
393
390
  ]
394
- }), /* @__PURE__ */ m("div", {
391
+ }), /* @__PURE__ */ g("div", {
395
392
  className: "space-y-6",
396
- children: [/* @__PURE__ */ m("section", {
393
+ children: [/* @__PURE__ */ g("section", {
397
394
  className: "border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 p-5",
398
395
  "data-tour": "billing-overview-quick-actions",
399
- children: [/* @__PURE__ */ p("h3", {
396
+ children: [/* @__PURE__ */ h("h3", {
400
397
  className: "font-semibold text-text-primary mb-4",
401
- children: "Quick Actions"
402
- }), /* @__PURE__ */ m("div", {
398
+ children: y("billing.overview.quickActions", "Quick Actions")
399
+ }), /* @__PURE__ */ g("div", {
403
400
  className: "space-y-1.5",
404
401
  children: [
405
- /* @__PURE__ */ m("button", {
402
+ /* @__PURE__ */ g("button", {
406
403
  type: "button",
407
- onClick: () => L && Q(`/transactions/${L.id}`),
408
- disabled: !L,
404
+ onClick: () => I && Q(`/transactions/${I.id}`),
405
+ disabled: !I,
409
406
  className: "w-full flex items-center gap-3 px-3 py-2.5 text-sm text-left text-text-primary hover:bg-bg-sunken rounded-button transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
410
- children: [/* @__PURE__ */ p("div", {
407
+ children: [/* @__PURE__ */ h("div", {
411
408
  className: "size-9 rounded-lg bg-status-info-bg-subtle flex items-center justify-center",
412
- children: /* @__PURE__ */ p(xe, { className: "size-4 text-status-info-text" })
413
- }), "View Transactions"]
409
+ children: /* @__PURE__ */ h(xe, { className: "size-4 text-status-info-text" })
410
+ }), y("billing.overview.viewTransactions", "View Transactions")]
414
411
  }),
415
- /* @__PURE__ */ m("button", {
412
+ /* @__PURE__ */ g("button", {
416
413
  type: "button",
417
- onClick: () => L && Q(`/creditTransactions/${L.id}`),
418
- disabled: !L,
414
+ onClick: () => I && Q(`/creditTransactions/${I.id}`),
415
+ disabled: !I,
419
416
  className: "w-full flex items-center gap-3 px-3 py-2.5 text-sm text-left text-text-primary hover:bg-bg-sunken rounded-button transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
420
- children: [/* @__PURE__ */ p("div", {
417
+ children: [/* @__PURE__ */ h("div", {
421
418
  className: "size-9 rounded-lg bg-status-warning-bg-subtle flex items-center justify-center",
422
- children: /* @__PURE__ */ p(d, { className: "size-4 text-status-warning-text" })
423
- }), "Credit History"]
419
+ children: /* @__PURE__ */ h(p, { className: "size-4 text-status-warning-text" })
420
+ }), y("billing.overview.creditHistory", "Credit History")]
424
421
  }),
425
- /* @__PURE__ */ m("button", {
422
+ /* @__PURE__ */ g("button", {
426
423
  type: "button",
427
424
  onClick: () => Q("/checkout/credits"),
428
425
  className: "w-full flex items-center gap-3 px-3 py-2.5 text-sm text-left text-text-primary hover:bg-bg-sunken rounded-button transition-colors",
429
- children: [/* @__PURE__ */ p("div", {
426
+ children: [/* @__PURE__ */ h("div", {
430
427
  className: "size-9 rounded-lg bg-status-success-bg-subtle flex items-center justify-center",
431
- children: /* @__PURE__ */ p(ve, { className: "size-4 text-status-success-text" })
432
- }), "Purchase Credits"]
428
+ children: /* @__PURE__ */ h(ve, { className: "size-4 text-status-success-text" })
429
+ }), y("billing.overview.purchaseCredits", "Purchase Credits")]
433
430
  }),
434
- /* @__PURE__ */ m("button", {
431
+ /* @__PURE__ */ g("button", {
435
432
  type: "button",
436
- onClick: () => L && Q(`/usage?billingAccountId=${L.id}`),
437
- disabled: !L,
433
+ onClick: () => I && Q(`/usage?billingAccountId=${I.id}`),
434
+ disabled: !I,
438
435
  className: "w-full flex items-center gap-3 px-3 py-2.5 text-sm text-left text-text-primary hover:bg-bg-sunken rounded-button transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
439
- children: [/* @__PURE__ */ p("div", {
436
+ children: [/* @__PURE__ */ h("div", {
440
437
  className: "size-9 rounded-lg bg-[var(--color-accent-soft)] flex items-center justify-center",
441
- children: /* @__PURE__ */ p(he, { className: "size-4 text-text-link" })
442
- }), "Usage Analytics"]
438
+ children: /* @__PURE__ */ h(he, { className: "size-4 text-text-link" })
439
+ }), y("billing.overview.usageAnalytics", "Usage Analytics")]
443
440
  })
444
441
  ]
445
442
  })]
446
- }), !B && /* @__PURE__ */ m(De, {
443
+ }), !z && /* @__PURE__ */ g(Te, {
447
444
  treatment: "glass",
448
445
  glow: !0,
449
446
  className: "p-5",
450
- children: [/* @__PURE__ */ m("div", {
447
+ children: [/* @__PURE__ */ g("div", {
451
448
  className: "flex items-start gap-3 mb-4",
452
- children: [/* @__PURE__ */ p("div", {
449
+ children: [/* @__PURE__ */ h("div", {
453
450
  className: "size-10 rounded-lg bg-bg-surface flex items-center justify-center flex-shrink-0 shadow-elevation-1",
454
- children: /* @__PURE__ */ p(Ce, { className: "size-5 text-text-link" })
455
- }), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h3", {
451
+ children: /* @__PURE__ */ h(Se, { className: "size-5 text-text-link" })
452
+ }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("h3", {
456
453
  className: "font-semibold text-text-primary",
457
- children: "Get Started"
458
- }), /* @__PURE__ */ p("p", {
454
+ children: y("billing.overview.getStarted", "Get Started")
455
+ }), /* @__PURE__ */ h("p", {
459
456
  className: "text-sm text-text-secondary mt-1",
460
- children: "Choose a plan that fits your needs to unlock all features"
457
+ children: y("billing.overview.getStartedDescription", "Choose a plan that fits your needs to unlock all features")
461
458
  })] })]
462
- }), /* @__PURE__ */ m(Te, {
459
+ }), /* @__PURE__ */ g(Ce, {
463
460
  type: "button",
464
461
  onClick: () => Q("/plans"),
465
462
  className: "w-full",
466
- children: ["Browse Plans", /* @__PURE__ */ p(ge, { className: "size-4" })]
463
+ children: [y("billing.overview.browsePlans", "Browse Plans"), /* @__PURE__ */ h(ge, { className: "size-4" })]
467
464
  })]
468
465
  })]
469
466
  })]
470
467
  }),
471
- /* @__PURE__ */ p(de, {
468
+ /* @__PURE__ */ h(de, {
472
469
  dataTour: "billing-overview-recommended-addons",
473
470
  addons: Ne,
474
- hasSubscription: B,
471
+ hasSubscription: z,
475
472
  onViewAddon: (e) => Q(`/addons/${e}`),
476
473
  onPurchaseAddon: (e) => Q(`/addons/${e}?action=purchase`),
477
474
  onViewAllAddons: () => Q("/addons"),
478
- onAddToCart: qe,
479
- isInCart: Je,
480
- getCartQuantity: Ye,
481
- onUpdateQuantity: Xe,
482
- onRemoveFromCart: Ze,
475
+ onAddToCart: Ke,
476
+ isInCart: qe,
477
+ getCartQuantity: Je,
478
+ onUpdateQuantity: Ye,
479
+ onRemoveFromCart: Xe,
483
480
  maxAddons: 3,
484
481
  isLoading: Pe
485
482
  }),
486
- /* @__PURE__ */ p(me, {}),
487
- /* @__PURE__ */ p(r, {
488
- isOpen: T,
483
+ /* @__PURE__ */ h(me, {}),
484
+ /* @__PURE__ */ h(i, {
485
+ isOpen: Ae,
489
486
  onClose: () => {
490
487
  E(!1), O(null);
491
488
  },
492
- onSubmit: Be,
493
- isSubmitting: ze,
489
+ onSubmit: ze,
490
+ isSubmitting: Re,
494
491
  error: D
495
492
  }),
496
- L && /* @__PURE__ */ p(fe, {
497
- isOpen: Me,
493
+ I && /* @__PURE__ */ h(fe, {
494
+ isOpen: je,
498
495
  onClose: () => j(!1),
499
- billingAccountId: L.id,
500
- currency: L.currency,
501
- country: L.billingAddresses?.[0]?.country,
502
- onSuccess: He
496
+ billingAccountId: I.id,
497
+ currency: I.currency,
498
+ country: I.billingAddresses?.[0]?.country,
499
+ onSuccess: Ve
503
500
  })
504
501
  ]
505
- }) : /* @__PURE__ */ p(t, { message: "You don't have permission to view billing information." });
502
+ }) : /* @__PURE__ */ h(n, { message: "You don't have permission to view billing information." });
506
503
  };
507
504
  //#endregion
508
- export { _ as OverviewPage };
505
+ export { y as OverviewPage };
509
506
 
510
507
  //# sourceMappingURL=OverviewPage.js.map