@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.
- package/dist/billing/BillingRoot.js +56 -59
- package/dist/billing/BillingRoot.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +163 -168
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/dashboard/pages/OverviewPage.js +251 -254
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansListPage.js +179 -185
- package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/SettingsPage.js +285 -289
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +191 -198
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
- package/dist/billing/shared/components/AccessDenied.js +12 -15
- package/dist/billing/shared/components/AccessDenied.js.map +1 -1
- package/dist/billing/shared/components/ActorIdentity.js +34 -33
- package/dist/billing/shared/components/ActorIdentity.js.map +1 -1
- package/dist/billing/shared/components/ServerError.js +27 -30
- package/dist/billing/shared/components/ServerError.js.map +1 -1
- package/dist/billing/shared/hooks/index.js +1 -0
- package/dist/billing/shared/hooks/useTr.js +14 -0
- package/dist/billing/shared/hooks/useTr.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useBilling as e } from "../../../providers/BillingProvider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
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
|
|
23
|
-
import { useCallback as
|
|
24
|
-
import { Activity as he, ArrowRight as ge, Building2 as
|
|
25
|
-
import { Fragment as
|
|
26
|
-
import {
|
|
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 {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, [
|
|
36
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
]),
|
|
45
|
-
!
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
F,
|
|
45
|
+
T,
|
|
46
|
+
W
|
|
50
47
|
]);
|
|
51
|
-
let Z =
|
|
48
|
+
let Z = R[Me] || R[0] || null, Q = o((e) => {
|
|
52
49
|
let t = e;
|
|
53
|
-
|
|
54
|
-
}, [
|
|
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
|
|
58
|
-
t && n.id && await
|
|
54
|
+
let n = await X(e);
|
|
55
|
+
t && n.id && await Fe({
|
|
59
56
|
billingAccountId: n.id,
|
|
60
57
|
...t
|
|
61
|
-
}), E(!1),
|
|
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
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
Ie,
|
|
74
|
-
G
|
|
75
|
-
]), Ve = a(() => {
|
|
71
|
+
W
|
|
72
|
+
]), Be = o(() => {
|
|
76
73
|
j(!0);
|
|
77
|
-
}, []), $ =
|
|
78
|
-
await
|
|
79
|
-
}, [
|
|
80
|
-
|
|
74
|
+
}, []), $ = o(async () => {
|
|
75
|
+
await H();
|
|
76
|
+
}, [H]), Ve = o(async () => {
|
|
77
|
+
w("billing.payment_method.added", {
|
|
81
78
|
route: "/billing/overview",
|
|
82
|
-
entityId:
|
|
79
|
+
entityId: U,
|
|
83
80
|
source: "overview"
|
|
84
81
|
}), await $();
|
|
85
82
|
}, [
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
U,
|
|
84
|
+
w,
|
|
88
85
|
$
|
|
89
|
-
]),
|
|
90
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
U,
|
|
94
|
+
w,
|
|
95
|
+
Ie,
|
|
99
96
|
$
|
|
100
|
-
]),
|
|
101
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
U,
|
|
105
|
+
Le,
|
|
106
|
+
w,
|
|
110
107
|
$
|
|
111
|
-
]),
|
|
112
|
-
|
|
113
|
-
}, [
|
|
114
|
-
await
|
|
115
|
-
}, [
|
|
116
|
-
|
|
117
|
-
}, [
|
|
118
|
-
t <= 0 ?
|
|
119
|
-
}, [
|
|
120
|
-
|
|
121
|
-
}, [
|
|
122
|
-
return
|
|
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__ */
|
|
125
|
-
title: "Server Unavailable",
|
|
126
|
-
message: "Unable to load billing overview. The server might be down or experiencing issues.",
|
|
127
|
-
onRetry:
|
|
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
|
-
}) :
|
|
127
|
+
}) : B && !I ? /* @__PURE__ */ h("div", {
|
|
131
128
|
className: "flex items-center justify-center min-h-[400px]",
|
|
132
|
-
children: /* @__PURE__ */
|
|
129
|
+
children: /* @__PURE__ */ g("div", {
|
|
133
130
|
className: "flex flex-col items-center gap-3",
|
|
134
|
-
children: [/* @__PURE__ */
|
|
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:
|
|
133
|
+
children: y("billing.overview.loadingInfo", "Loading billing information...")
|
|
137
134
|
})]
|
|
138
135
|
})
|
|
139
|
-
}) : !
|
|
136
|
+
}) : !B && F.length === 0 && !I ? /* @__PURE__ */ g("div", {
|
|
140
137
|
className: "px-6 lg:px-8 py-6",
|
|
141
138
|
children: [
|
|
142
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ g("header", {
|
|
143
140
|
className: "relative overflow-hidden mb-8 rounded-card",
|
|
144
141
|
children: [
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
/* @__PURE__ */
|
|
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__ */
|
|
145
|
+
children: /* @__PURE__ */ h(v, { children: y("billing.overview.title", "Billing Overview") })
|
|
149
146
|
}),
|
|
150
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ h("p", {
|
|
151
148
|
className: "text-sm text-text-secondary mt-1",
|
|
152
|
-
children:
|
|
149
|
+
children: y("billing.overview.emptySetupDescription", "Set up billing to manage subscriptions, payments, and invoices")
|
|
153
150
|
})
|
|
154
151
|
]
|
|
155
152
|
}),
|
|
156
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ h(Ee, {
|
|
157
154
|
illustration: "onboarding",
|
|
158
|
-
title:
|
|
159
|
-
description:
|
|
160
|
-
action:
|
|
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__ */
|
|
161
|
+
children: [/* @__PURE__ */ h(d, { className: "size-4" }), y("billing.overview.createBillingAccount", "Create Billing Account")]
|
|
165
162
|
}) : void 0
|
|
166
163
|
}),
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
isOpen:
|
|
164
|
+
/* @__PURE__ */ h(i, {
|
|
165
|
+
isOpen: Ae,
|
|
169
166
|
onClose: () => {
|
|
170
167
|
E(!1), O(null);
|
|
171
168
|
},
|
|
172
|
-
onSubmit:
|
|
173
|
-
isSubmitting:
|
|
169
|
+
onSubmit: ze,
|
|
170
|
+
isSubmitting: Re,
|
|
174
171
|
error: D
|
|
175
172
|
})
|
|
176
173
|
]
|
|
177
|
-
}) : /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
/* @__PURE__ */
|
|
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__ */
|
|
184
|
+
children: /* @__PURE__ */ h(v, { children: y("billing.overview.title", "Billing Overview") })
|
|
188
185
|
}),
|
|
189
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ h("p", {
|
|
190
187
|
className: "text-sm text-text-secondary mt-1",
|
|
191
|
-
children:
|
|
188
|
+
children: y("billing.overview.description", "Manage your billing accounts, subscriptions, and payment methods")
|
|
192
189
|
}),
|
|
193
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ h(De, {
|
|
194
191
|
className: "mt-3",
|
|
195
|
-
children:
|
|
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__ */
|
|
199
|
-
primary:
|
|
200
|
-
label:
|
|
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__ */
|
|
199
|
+
icon: /* @__PURE__ */ h(d, { className: "size-4" })
|
|
203
200
|
} : void 0,
|
|
204
201
|
actions: [{
|
|
205
|
-
label:
|
|
202
|
+
label: y("billing.overview.refresh", "Refresh"),
|
|
206
203
|
onSelect: () => {
|
|
207
|
-
|
|
204
|
+
Ge();
|
|
208
205
|
},
|
|
209
|
-
icon: /* @__PURE__ */
|
|
206
|
+
icon: /* @__PURE__ */ h(f, { className: `size-4 ${B ? "animate-spin" : ""}` })
|
|
210
207
|
}]
|
|
211
208
|
})
|
|
212
209
|
]
|
|
213
210
|
}),
|
|
214
|
-
|
|
211
|
+
F.length > 1 && /* @__PURE__ */ g("div", {
|
|
215
212
|
className: "relative",
|
|
216
213
|
"data-tour": "billing-overview-account-selector",
|
|
217
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
218
|
+
children: [/* @__PURE__ */ g("div", {
|
|
222
219
|
className: "flex items-center gap-3",
|
|
223
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
226
|
-
}), /* @__PURE__ */
|
|
222
|
+
children: /* @__PURE__ */ h(l, { className: "size-4 text-text-link" })
|
|
223
|
+
}), /* @__PURE__ */ g("div", {
|
|
227
224
|
className: "text-left",
|
|
228
|
-
children: [/* @__PURE__ */
|
|
225
|
+
children: [/* @__PURE__ */ h("p", {
|
|
229
226
|
className: "text-sm font-medium text-text-primary",
|
|
230
|
-
children:
|
|
231
|
-
}), /* @__PURE__ */
|
|
227
|
+
children: I?.name || y("billing.overview.selectAccount", "Select Account")
|
|
228
|
+
}), /* @__PURE__ */ h("p", {
|
|
232
229
|
className: "text-xs text-text-secondary",
|
|
233
|
-
children:
|
|
230
|
+
children: I?.email
|
|
234
231
|
})]
|
|
235
232
|
})]
|
|
236
|
-
}), /* @__PURE__ */
|
|
237
|
-
}), k && /* @__PURE__ */ m
|
|
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__ */
|
|
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:
|
|
239
|
+
children: F.map((e) => /* @__PURE__ */ g("button", {
|
|
243
240
|
type: "button",
|
|
244
|
-
onClick: () =>
|
|
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__ */
|
|
243
|
+
children: [/* @__PURE__ */ g("div", {
|
|
247
244
|
className: "flex items-center gap-3 min-w-0",
|
|
248
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
251
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
250
|
+
children: [/* @__PURE__ */ h("p", {
|
|
254
251
|
className: "text-sm font-medium text-text-primary truncate",
|
|
255
252
|
children: e.name
|
|
256
|
-
}), /* @__PURE__ */
|
|
253
|
+
}), /* @__PURE__ */ h("p", {
|
|
257
254
|
className: "text-xs text-text-secondary truncate",
|
|
258
255
|
children: e.email
|
|
259
256
|
})]
|
|
260
257
|
})]
|
|
261
|
-
}),
|
|
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
|
-
|
|
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__ */
|
|
270
|
-
label:
|
|
271
|
-
value: `${(
|
|
272
|
-
icon: /* @__PURE__ */ p
|
|
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__ */
|
|
275
|
-
label:
|
|
276
|
-
value:
|
|
277
|
-
icon: /* @__PURE__ */
|
|
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__ */
|
|
280
|
-
label:
|
|
281
|
-
value:
|
|
282
|
-
icon: /* @__PURE__ */
|
|
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__ */
|
|
285
|
-
label:
|
|
286
|
-
value:
|
|
287
|
-
icon: /* @__PURE__ */
|
|
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__ */
|
|
288
|
+
/* @__PURE__ */ g("div", {
|
|
292
289
|
className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
|
|
293
|
-
children: [/* @__PURE__ */
|
|
290
|
+
children: [/* @__PURE__ */ g("div", {
|
|
294
291
|
className: "lg:col-span-2 space-y-6",
|
|
295
292
|
children: [
|
|
296
|
-
|
|
293
|
+
I && /* @__PURE__ */ h(ce, {
|
|
297
294
|
dataTour: "billing-overview-billing-account-card",
|
|
298
|
-
account:
|
|
299
|
-
isDefault:
|
|
300
|
-
onEdit: () =>
|
|
301
|
-
onViewTransactions: () => Q(`/transactions/${
|
|
302
|
-
onViewCreditTransactions: () => Q(`/creditTransactions/${
|
|
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__ */
|
|
301
|
+
/* @__PURE__ */ g("div", {
|
|
305
302
|
className: "space-y-3",
|
|
306
|
-
children: [
|
|
303
|
+
children: [R.length > 1 && /* @__PURE__ */ g("div", {
|
|
307
304
|
className: "relative",
|
|
308
|
-
children: [/* @__PURE__ */
|
|
305
|
+
children: [/* @__PURE__ */ g("button", {
|
|
309
306
|
type: "button",
|
|
310
|
-
onClick: () =>
|
|
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__ */
|
|
309
|
+
children: [/* @__PURE__ */ g("div", {
|
|
313
310
|
className: "flex items-center gap-3",
|
|
314
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
317
|
-
}), /* @__PURE__ */
|
|
313
|
+
children: /* @__PURE__ */ h(ye, { className: "size-4 text-text-link" })
|
|
314
|
+
}), /* @__PURE__ */ g("div", {
|
|
318
315
|
className: "text-left",
|
|
319
|
-
children: [/* @__PURE__ */
|
|
316
|
+
children: [/* @__PURE__ */ g("p", {
|
|
320
317
|
className: "text-sm font-medium text-text-primary",
|
|
321
|
-
children: [Z?.plan?.name ||
|
|
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__ */
|
|
326
|
+
}), /* @__PURE__ */ g("p", {
|
|
330
327
|
className: "text-xs text-text-secondary",
|
|
331
328
|
children: [
|
|
332
|
-
|
|
329
|
+
R.length,
|
|
333
330
|
" ",
|
|
334
|
-
|
|
331
|
+
y("billing.overview.activeSubscriptions", "active subscriptions")
|
|
335
332
|
]
|
|
336
333
|
})]
|
|
337
334
|
})]
|
|
338
|
-
}), /* @__PURE__ */
|
|
339
|
-
}),
|
|
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: () =>
|
|
342
|
-
}), /* @__PURE__ */
|
|
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:
|
|
341
|
+
children: R.map((e, t) => /* @__PURE__ */ g("button", {
|
|
345
342
|
type: "button",
|
|
346
343
|
onClick: () => {
|
|
347
|
-
|
|
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__ */
|
|
347
|
+
children: [/* @__PURE__ */ g("div", {
|
|
351
348
|
className: "flex items-center gap-3 min-w-0",
|
|
352
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
355
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
354
|
+
children: [/* @__PURE__ */ h("p", {
|
|
358
355
|
className: "text-sm font-medium text-text-primary truncate",
|
|
359
|
-
children: e.plan?.name ||
|
|
360
|
-
}), /* @__PURE__ */
|
|
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 ||
|
|
360
|
+
e.plan?.product?.name || y("billing.overview.unknownProduct", "Unknown Product"),
|
|
364
361
|
" ",
|
|
365
362
|
"· ",
|
|
366
|
-
|
|
363
|
+
y("billing.overview.ends", "Ends"),
|
|
367
364
|
" ",
|
|
368
365
|
new Date(e.endDate).toLocaleDateString()
|
|
369
366
|
]
|
|
370
367
|
})]
|
|
371
368
|
})]
|
|
372
|
-
}),
|
|
369
|
+
}), Me === t && /* @__PURE__ */ h(u, { className: "size-4 text-text-link flex-shrink-0" })]
|
|
373
370
|
}, e.id))
|
|
374
371
|
})] })]
|
|
375
|
-
}), /* @__PURE__ */
|
|
372
|
+
}), /* @__PURE__ */ h(ue, {
|
|
376
373
|
dataTour: "billing-overview-active-subscription-card",
|
|
377
374
|
subscription: Z,
|
|
378
|
-
onViewDetails: () => Z && Q(
|
|
379
|
-
onUpgrade: () => Z && Q(
|
|
380
|
-
onManage: () =>
|
|
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
|
-
|
|
381
|
+
I && /* @__PURE__ */ h(le, {
|
|
385
382
|
dataTour: "billing-overview-payment-methods-section",
|
|
386
|
-
paymentMethods:
|
|
387
|
-
billingAccountId:
|
|
388
|
-
onAddPaymentMethod:
|
|
389
|
-
onSetDefault:
|
|
390
|
-
onDelete:
|
|
391
|
-
isLoading:
|
|
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__ */
|
|
391
|
+
}), /* @__PURE__ */ g("div", {
|
|
395
392
|
className: "space-y-6",
|
|
396
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
396
|
+
children: [/* @__PURE__ */ h("h3", {
|
|
400
397
|
className: "font-semibold text-text-primary mb-4",
|
|
401
|
-
children: "Quick Actions"
|
|
402
|
-
}), /* @__PURE__ */
|
|
398
|
+
children: y("billing.overview.quickActions", "Quick Actions")
|
|
399
|
+
}), /* @__PURE__ */ g("div", {
|
|
403
400
|
className: "space-y-1.5",
|
|
404
401
|
children: [
|
|
405
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ g("button", {
|
|
406
403
|
type: "button",
|
|
407
|
-
onClick: () =>
|
|
408
|
-
disabled: !
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
412
|
+
/* @__PURE__ */ g("button", {
|
|
416
413
|
type: "button",
|
|
417
|
-
onClick: () =>
|
|
418
|
-
disabled: !
|
|
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__ */
|
|
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
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
431
|
+
/* @__PURE__ */ g("button", {
|
|
435
432
|
type: "button",
|
|
436
|
-
onClick: () =>
|
|
437
|
-
disabled: !
|
|
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__ */
|
|
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__ */
|
|
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
|
-
}), !
|
|
443
|
+
}), !z && /* @__PURE__ */ g(Te, {
|
|
447
444
|
treatment: "glass",
|
|
448
445
|
glow: !0,
|
|
449
446
|
className: "p-5",
|
|
450
|
-
children: [/* @__PURE__ */
|
|
447
|
+
children: [/* @__PURE__ */ g("div", {
|
|
451
448
|
className: "flex items-start gap-3 mb-4",
|
|
452
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
455
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
459
|
+
}), /* @__PURE__ */ g(Ce, {
|
|
463
460
|
type: "button",
|
|
464
461
|
onClick: () => Q("/plans"),
|
|
465
462
|
className: "w-full",
|
|
466
|
-
children: ["Browse Plans", /* @__PURE__ */
|
|
463
|
+
children: [y("billing.overview.browsePlans", "Browse Plans"), /* @__PURE__ */ h(ge, { className: "size-4" })]
|
|
467
464
|
})]
|
|
468
465
|
})]
|
|
469
466
|
})]
|
|
470
467
|
}),
|
|
471
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ h(de, {
|
|
472
469
|
dataTour: "billing-overview-recommended-addons",
|
|
473
470
|
addons: Ne,
|
|
474
|
-
hasSubscription:
|
|
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:
|
|
479
|
-
isInCart:
|
|
480
|
-
getCartQuantity:
|
|
481
|
-
onUpdateQuantity:
|
|
482
|
-
onRemoveFromCart:
|
|
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__ */
|
|
487
|
-
/* @__PURE__ */
|
|
488
|
-
isOpen:
|
|
483
|
+
/* @__PURE__ */ h(me, {}),
|
|
484
|
+
/* @__PURE__ */ h(i, {
|
|
485
|
+
isOpen: Ae,
|
|
489
486
|
onClose: () => {
|
|
490
487
|
E(!1), O(null);
|
|
491
488
|
},
|
|
492
|
-
onSubmit:
|
|
493
|
-
isSubmitting:
|
|
489
|
+
onSubmit: ze,
|
|
490
|
+
isSubmitting: Re,
|
|
494
491
|
error: D
|
|
495
492
|
}),
|
|
496
|
-
|
|
497
|
-
isOpen:
|
|
493
|
+
I && /* @__PURE__ */ h(fe, {
|
|
494
|
+
isOpen: je,
|
|
498
495
|
onClose: () => j(!1),
|
|
499
|
-
billingAccountId:
|
|
500
|
-
currency:
|
|
501
|
-
country:
|
|
502
|
-
onSuccess:
|
|
496
|
+
billingAccountId: I.id,
|
|
497
|
+
currency: I.currency,
|
|
498
|
+
country: I.billingAddresses?.[0]?.country,
|
|
499
|
+
onSuccess: Ve
|
|
503
500
|
})
|
|
504
501
|
]
|
|
505
|
-
}) : /* @__PURE__ */
|
|
502
|
+
}) : /* @__PURE__ */ h(n, { message: "You don't have permission to view billing information." });
|
|
506
503
|
};
|
|
507
504
|
//#endregion
|
|
508
|
-
export {
|
|
505
|
+
export { y as OverviewPage };
|
|
509
506
|
|
|
510
507
|
//# sourceMappingURL=OverviewPage.js.map
|