@burdenoff/microfe-billing 2026.1114.2 → 2026.1114.3

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