@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.
- package/dist/billing/modules/dashboard/pages/OverviewPage.js +165 -162
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
- package/dist/billing/shared/components/PushPermissionNudge.js +73 -0
- package/dist/billing/shared/components/PushPermissionNudge.js.map +1 -0
- package/dist/billing/shared/components/index.js +1 -0
- package/dist/generated/global-types.js.map +1 -1
- package/package.json +2 -2
|
@@ -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 {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
11
|
-
import { useDashboardMutations as
|
|
12
|
-
import { useBillingOverviewData as
|
|
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
|
|
15
|
-
import { PaymentMethodsSection as
|
|
16
|
-
import { ActiveSubscriptionCard as
|
|
17
|
-
import { RecommendedAddonsSection as
|
|
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
|
|
20
|
+
import { AddPaymentMethodModal as pe } from "../components/AddPaymentMethodModal.js";
|
|
20
21
|
import "../components/index.js";
|
|
21
|
-
import { useAddonCartStore as
|
|
22
|
-
import { FloatingCartDrawer as
|
|
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
|
|
26
|
-
import { Fragment as
|
|
27
|
-
import { AuroraBackground as _, Button as
|
|
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:
|
|
31
|
-
|
|
32
|
-
}, [S]), { addToCart:
|
|
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
|
-
|
|
35
|
-
}, [
|
|
36
|
-
T &&
|
|
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
|
-
|
|
40
|
+
R,
|
|
39
41
|
T,
|
|
40
|
-
|
|
42
|
+
q
|
|
41
43
|
]), s(() => {
|
|
42
|
-
!T &&
|
|
44
|
+
!T && R.length > 0 && q((R.find((e) => e.isDefault) ?? R[0]).id);
|
|
43
45
|
}, [
|
|
44
|
-
|
|
46
|
+
R,
|
|
45
47
|
T,
|
|
46
|
-
|
|
48
|
+
q
|
|
47
49
|
]);
|
|
48
|
-
let Z =
|
|
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]),
|
|
52
|
-
|
|
53
|
+
}, [b, x]), Ue = o(async (e, t) => {
|
|
54
|
+
k(null);
|
|
53
55
|
try {
|
|
54
|
-
let n = await
|
|
55
|
-
t && n.id && await
|
|
56
|
+
let n = await Re(e);
|
|
57
|
+
t && n.id && await ze({
|
|
56
58
|
billingAccountId: n.id,
|
|
57
59
|
...t
|
|
58
|
-
}),
|
|
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
|
|
64
|
+
}), await G(), ke() && A(!0);
|
|
63
65
|
} catch (e) {
|
|
64
|
-
|
|
66
|
+
k(e instanceof Error ? e.message : "Failed to create billing account");
|
|
65
67
|
}
|
|
66
68
|
}, [
|
|
67
|
-
|
|
69
|
+
Re,
|
|
68
70
|
w,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
]),
|
|
73
|
-
|
|
71
|
+
G,
|
|
72
|
+
ze,
|
|
73
|
+
q
|
|
74
|
+
]), We = o(() => {
|
|
75
|
+
N(!0);
|
|
74
76
|
}, []), $ = o(async () => {
|
|
75
|
-
await
|
|
76
|
-
}, [
|
|
77
|
+
await G();
|
|
78
|
+
}, [G]), Ge = o(async () => {
|
|
77
79
|
w("billing.payment_method.added", {
|
|
78
80
|
route: "/billing/overview",
|
|
79
|
-
entityId:
|
|
81
|
+
entityId: K,
|
|
80
82
|
source: "overview"
|
|
81
83
|
}), await $();
|
|
82
84
|
}, [
|
|
83
|
-
|
|
85
|
+
K,
|
|
84
86
|
w,
|
|
85
87
|
$
|
|
86
|
-
]),
|
|
87
|
-
|
|
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
|
-
|
|
95
|
+
K,
|
|
94
96
|
w,
|
|
95
|
-
|
|
97
|
+
Be,
|
|
96
98
|
$
|
|
97
|
-
]),
|
|
98
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
+
K,
|
|
107
|
+
Ve,
|
|
106
108
|
w,
|
|
107
109
|
$
|
|
108
|
-
]),
|
|
109
|
-
|
|
110
|
-
}, [
|
|
111
|
-
await
|
|
112
|
-
}, [
|
|
113
|
-
|
|
114
|
-
}, [
|
|
115
|
-
t <= 0 ?
|
|
116
|
-
}, [
|
|
117
|
-
|
|
118
|
-
}, [
|
|
119
|
-
return C.canViewBillingAccount ?
|
|
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:
|
|
126
|
+
onRetry: Ye,
|
|
125
127
|
showRetry: !0
|
|
126
128
|
})
|
|
127
|
-
}) :
|
|
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(
|
|
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
|
-
}) : !
|
|
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(
|
|
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: () =>
|
|
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(
|
|
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:
|
|
167
|
+
isOpen: E,
|
|
166
168
|
onClose: () => {
|
|
167
|
-
|
|
169
|
+
D(!1), k(null);
|
|
168
170
|
},
|
|
169
|
-
onSubmit:
|
|
170
|
-
isSubmitting:
|
|
171
|
-
error:
|
|
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(
|
|
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(
|
|
196
|
-
primary: C.canManageBillingAccount &&
|
|
197
|
+
/* @__PURE__ */ h(Te, {
|
|
198
|
+
primary: C.canManageBillingAccount && R.length > 0 ? {
|
|
197
199
|
label: y("billing.overview.newAccount", "New Account"),
|
|
198
|
-
onSelect: () =>
|
|
199
|
-
icon: /* @__PURE__ */ h(
|
|
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
|
-
|
|
206
|
+
Ye();
|
|
205
207
|
},
|
|
206
|
-
icon: /* @__PURE__ */ h(
|
|
208
|
+
icon: /* @__PURE__ */ h(p, { className: `size-4 ${U ? "animate-spin" : ""}` })
|
|
207
209
|
}]
|
|
208
210
|
})
|
|
209
211
|
]
|
|
210
212
|
}),
|
|
211
|
-
|
|
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: () =>
|
|
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:
|
|
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:
|
|
232
|
+
children: z?.email
|
|
231
233
|
})]
|
|
232
234
|
})]
|
|
233
|
-
}), /* @__PURE__ */ h(
|
|
234
|
-
}),
|
|
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: () =>
|
|
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:
|
|
241
|
+
children: R.map((e) => /* @__PURE__ */ g("button", {
|
|
240
242
|
type: "button",
|
|
241
|
-
onClick: () =>
|
|
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
|
-
}),
|
|
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
|
-
|
|
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: `${(
|
|
270
|
-
icon: /* @__PURE__ */ h(
|
|
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:
|
|
276
|
-
icon: /* @__PURE__ */ h(
|
|
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:
|
|
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:
|
|
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
|
-
|
|
299
|
+
z && /* @__PURE__ */ h(le, {
|
|
298
300
|
dataTour: "billing-overview-billing-account-card",
|
|
299
|
-
account:
|
|
300
|
-
isDefault:
|
|
301
|
-
onEdit: () =>
|
|
302
|
-
onViewTransactions: () => Q(`/transactions/${
|
|
303
|
-
onViewCreditTransactions: () => Q(`/creditTransactions/${
|
|
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: [
|
|
309
|
+
children: [V.length > 1 && /* @__PURE__ */ g("div", {
|
|
308
310
|
className: "relative",
|
|
309
311
|
children: [/* @__PURE__ */ g("button", {
|
|
310
312
|
type: "button",
|
|
311
|
-
onClick: () =>
|
|
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(
|
|
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
|
-
|
|
335
|
+
V.length,
|
|
334
336
|
" ",
|
|
335
337
|
y("billing.overview.activeSubscriptions", "active subscriptions")
|
|
336
338
|
]
|
|
337
339
|
})]
|
|
338
340
|
})]
|
|
339
|
-
}), /* @__PURE__ */ h(
|
|
340
|
-
}),
|
|
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: () =>
|
|
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:
|
|
347
|
+
children: V.map((e, t) => /* @__PURE__ */ g("button", {
|
|
346
348
|
type: "button",
|
|
347
349
|
onClick: () => {
|
|
348
|
-
|
|
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(
|
|
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
|
-
}),
|
|
375
|
+
}), P === t && /* @__PURE__ */ h(u, { className: "size-4 text-text-link flex-shrink-0" })]
|
|
374
376
|
}, e.id))
|
|
375
377
|
})] })]
|
|
376
|
-
}), /* @__PURE__ */ h(
|
|
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 ??
|
|
380
|
-
onUpgrade: () => Z && Q(a(`/subscriptions/${Z.id}/upgrade`, Z.billingAccountId ??
|
|
381
|
-
onManage: () =>
|
|
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
|
-
|
|
387
|
+
z && /* @__PURE__ */ h(ue, {
|
|
386
388
|
dataTour: "billing-overview-payment-methods-section",
|
|
387
|
-
paymentMethods:
|
|
388
|
-
billingAccountId:
|
|
389
|
-
onAddPaymentMethod:
|
|
390
|
-
onSetDefault:
|
|
391
|
-
onDelete:
|
|
392
|
-
isLoading:
|
|
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: () =>
|
|
409
|
-
disabled: !
|
|
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: () =>
|
|
419
|
-
disabled: !
|
|
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(
|
|
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: () =>
|
|
438
|
-
disabled: !
|
|
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(
|
|
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
|
-
}), !
|
|
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(
|
|
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(
|
|
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(
|
|
474
|
+
/* @__PURE__ */ h(fe, {
|
|
473
475
|
dataTour: "billing-overview-recommended-addons",
|
|
474
|
-
addons:
|
|
475
|
-
hasSubscription:
|
|
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:
|
|
480
|
-
isInCart:
|
|
481
|
-
getCartQuantity:
|
|
482
|
-
onUpdateQuantity:
|
|
483
|
-
onRemoveFromCart:
|
|
481
|
+
onAddToCart: Xe,
|
|
482
|
+
isInCart: Ze,
|
|
483
|
+
getCartQuantity: Qe,
|
|
484
|
+
onUpdateQuantity: $e,
|
|
485
|
+
onRemoveFromCart: et,
|
|
484
486
|
maxAddons: 3,
|
|
485
|
-
isLoading:
|
|
487
|
+
isLoading: Fe
|
|
486
488
|
}),
|
|
487
|
-
/* @__PURE__ */ h(
|
|
489
|
+
/* @__PURE__ */ h(he, {}),
|
|
490
|
+
Me && /* @__PURE__ */ h(te, { onDismiss: () => A(!1) }),
|
|
488
491
|
/* @__PURE__ */ h(i, {
|
|
489
|
-
isOpen:
|
|
492
|
+
isOpen: E,
|
|
490
493
|
onClose: () => {
|
|
491
|
-
|
|
494
|
+
D(!1), k(null);
|
|
492
495
|
},
|
|
493
|
-
onSubmit:
|
|
494
|
-
isSubmitting:
|
|
495
|
-
error:
|
|
496
|
+
onSubmit: Ue,
|
|
497
|
+
isSubmitting: He,
|
|
498
|
+
error: O
|
|
496
499
|
}),
|
|
497
|
-
|
|
498
|
-
isOpen:
|
|
499
|
-
onClose: () =>
|
|
500
|
-
billingAccountId:
|
|
501
|
-
currency:
|
|
502
|
-
country:
|
|
503
|
-
onSuccess:
|
|
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." });
|