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