@tangle-network/sandbox-ui 0.15.1 → 0.15.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.
- package/dist/chunk-EHMKLMMU.js +861 -0
- package/dist/{chunk-AHBZCBDO.js → chunk-HLZTKSGT.js} +397 -705
- package/dist/dashboard.d.ts +2 -90
- package/dist/dashboard.js +7 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/pages.d.ts +13 -11
- package/dist/pages.js +24 -50
- package/dist/template-card-DStb8boW.d.ts +183 -0
- package/package.json +1 -1
- package/dist/chunk-DNZ4DTNA.js +0 -547
- package/dist/template-card-UhV3pmRC.d.ts +0 -88
package/dist/chunk-DNZ4DTNA.js
DELETED
|
@@ -1,547 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn
|
|
3
|
-
} from "./chunk-EI44GEQ5.js";
|
|
4
|
-
|
|
5
|
-
// src/dashboard/billing-dashboard.tsx
|
|
6
|
-
import { Button } from "@tangle-network/ui/primitives";
|
|
7
|
-
import { Badge } from "@tangle-network/ui/primitives";
|
|
8
|
-
import {
|
|
9
|
-
Card,
|
|
10
|
-
CardContent,
|
|
11
|
-
CardDescription,
|
|
12
|
-
CardHeader,
|
|
13
|
-
CardTitle
|
|
14
|
-
} from "@tangle-network/ui/primitives";
|
|
15
|
-
import { Progress } from "@tangle-network/ui/primitives";
|
|
16
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
-
var variantColors = {
|
|
18
|
-
sandbox: {
|
|
19
|
-
accent: "text-[var(--accent-text)]",
|
|
20
|
-
accentBg: "bg-[var(--accent-surface-soft)]",
|
|
21
|
-
border: "border-[var(--border-accent)]",
|
|
22
|
-
progress: "bg-[image:var(--accent-gradient-strong)]"
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
function formatCredits(value) {
|
|
26
|
-
if (value >= 1e6) {
|
|
27
|
-
return `${(value / 1e6).toFixed(1)}M`;
|
|
28
|
-
}
|
|
29
|
-
if (value >= 1e3) {
|
|
30
|
-
return `${(value / 1e3).toFixed(1)}K`;
|
|
31
|
-
}
|
|
32
|
-
return value.toLocaleString();
|
|
33
|
-
}
|
|
34
|
-
function formatDate(dateStr) {
|
|
35
|
-
const date = new Date(dateStr);
|
|
36
|
-
return date.toLocaleDateString("en-US", {
|
|
37
|
-
month: "long",
|
|
38
|
-
day: "numeric",
|
|
39
|
-
year: "numeric"
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function getStatusBadgeVariant(status) {
|
|
43
|
-
switch (status.toLowerCase()) {
|
|
44
|
-
case "active":
|
|
45
|
-
return "success";
|
|
46
|
-
case "trialing":
|
|
47
|
-
case "past_due":
|
|
48
|
-
return "warning";
|
|
49
|
-
case "canceled":
|
|
50
|
-
case "unpaid":
|
|
51
|
-
return "error";
|
|
52
|
-
default:
|
|
53
|
-
return "secondary";
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function CreditCardIcon({ className }) {
|
|
57
|
-
return /* @__PURE__ */ jsxs(
|
|
58
|
-
"svg",
|
|
59
|
-
{
|
|
60
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
61
|
-
viewBox: "0 0 24 24",
|
|
62
|
-
fill: "none",
|
|
63
|
-
stroke: "currentColor",
|
|
64
|
-
strokeWidth: "2",
|
|
65
|
-
strokeLinecap: "round",
|
|
66
|
-
strokeLinejoin: "round",
|
|
67
|
-
className: cn("h-5 w-5", className),
|
|
68
|
-
children: [
|
|
69
|
-
/* @__PURE__ */ jsx("title", { children: "Credit card icon" }),
|
|
70
|
-
/* @__PURE__ */ jsx("rect", { width: "20", height: "14", x: "2", y: "5", rx: "2" }),
|
|
71
|
-
/* @__PURE__ */ jsx("line", { x1: "2", x2: "22", y1: "10", y2: "10" })
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
function CoinsIcon({ className }) {
|
|
77
|
-
return /* @__PURE__ */ jsxs(
|
|
78
|
-
"svg",
|
|
79
|
-
{
|
|
80
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
81
|
-
viewBox: "0 0 24 24",
|
|
82
|
-
fill: "none",
|
|
83
|
-
stroke: "currentColor",
|
|
84
|
-
strokeWidth: "2",
|
|
85
|
-
strokeLinecap: "round",
|
|
86
|
-
strokeLinejoin: "round",
|
|
87
|
-
className: cn("h-5 w-5", className),
|
|
88
|
-
children: [
|
|
89
|
-
/* @__PURE__ */ jsx("title", { children: "Coins icon" }),
|
|
90
|
-
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
|
|
91
|
-
/* @__PURE__ */ jsx("path", { d: "M18.09 10.37A6 6 0 1 1 10.34 18" }),
|
|
92
|
-
/* @__PURE__ */ jsx("path", { d: "M7 6h1v4" }),
|
|
93
|
-
/* @__PURE__ */ jsx("path", { d: "m16.71 13.88.7.71-2.82 2.82" })
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
function ChartIcon({ className }) {
|
|
99
|
-
return /* @__PURE__ */ jsxs(
|
|
100
|
-
"svg",
|
|
101
|
-
{
|
|
102
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
103
|
-
viewBox: "0 0 24 24",
|
|
104
|
-
fill: "none",
|
|
105
|
-
stroke: "currentColor",
|
|
106
|
-
strokeWidth: "2",
|
|
107
|
-
strokeLinecap: "round",
|
|
108
|
-
strokeLinejoin: "round",
|
|
109
|
-
className: cn("h-5 w-5", className),
|
|
110
|
-
children: [
|
|
111
|
-
/* @__PURE__ */ jsx("title", { children: "Chart icon" }),
|
|
112
|
-
/* @__PURE__ */ jsx("path", { d: "M3 3v18h18" }),
|
|
113
|
-
/* @__PURE__ */ jsx("path", { d: "m19 9-5 5-4-4-3 3" })
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
function BillingDashboard({
|
|
119
|
-
subscription,
|
|
120
|
-
balance,
|
|
121
|
-
usage,
|
|
122
|
-
onManageSubscription,
|
|
123
|
-
onAddCredits,
|
|
124
|
-
variant = "sandbox",
|
|
125
|
-
className,
|
|
126
|
-
cardClassName
|
|
127
|
-
}) {
|
|
128
|
-
const colors2 = variantColors[variant];
|
|
129
|
-
const totalCredits = balance.available + balance.used;
|
|
130
|
-
const usagePercent = totalCredits > 0 ? balance.used / totalCredits * 100 : 0;
|
|
131
|
-
const sortedModels = Object.entries(usage.byModel).sort(
|
|
132
|
-
([, a], [, b]) => b - a
|
|
133
|
-
);
|
|
134
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("grid gap-6 lg:grid-cols-3", className), children: [
|
|
135
|
-
/* @__PURE__ */ jsxs(Card, { variant, className: cn("lg:col-span-1", cardClassName), children: [
|
|
136
|
-
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
137
|
-
/* @__PURE__ */ jsxs(CardTitle, { className: "flex items-center gap-2 text-base", children: [
|
|
138
|
-
/* @__PURE__ */ jsx(CreditCardIcon, { className: colors2.accent }),
|
|
139
|
-
"Current Plan"
|
|
140
|
-
] }),
|
|
141
|
-
subscription && /* @__PURE__ */ jsx(Badge, { variant: getStatusBadgeVariant(subscription.status), children: subscription.status })
|
|
142
|
-
] }) }),
|
|
143
|
-
/* @__PURE__ */ jsx(CardContent, { className: "space-y-4", children: subscription ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
144
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
145
|
-
/* @__PURE__ */ jsx("p", { className: cn("font-bold text-2xl", colors2.accent), children: subscription.tierName }),
|
|
146
|
-
/* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-sm", children: [
|
|
147
|
-
"Renews ",
|
|
148
|
-
formatDate(subscription.renewsAt)
|
|
149
|
-
] })
|
|
150
|
-
] }),
|
|
151
|
-
/* @__PURE__ */ jsx(
|
|
152
|
-
Button,
|
|
153
|
-
{
|
|
154
|
-
variant: "outline",
|
|
155
|
-
className: "w-full",
|
|
156
|
-
onClick: onManageSubscription,
|
|
157
|
-
children: "Manage Subscription"
|
|
158
|
-
}
|
|
159
|
-
)
|
|
160
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
161
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
162
|
-
/* @__PURE__ */ jsx("p", { className: "font-bold text-2xl text-muted-foreground", children: "No Active Plan" }),
|
|
163
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Subscribe to get started" })
|
|
164
|
-
] }),
|
|
165
|
-
/* @__PURE__ */ jsx(
|
|
166
|
-
Button,
|
|
167
|
-
{
|
|
168
|
-
variant,
|
|
169
|
-
className: "w-full",
|
|
170
|
-
onClick: onManageSubscription,
|
|
171
|
-
children: "View Plans"
|
|
172
|
-
}
|
|
173
|
-
)
|
|
174
|
-
] }) })
|
|
175
|
-
] }),
|
|
176
|
-
/* @__PURE__ */ jsxs(Card, { variant, className: cn("lg:col-span-1", cardClassName), children: [
|
|
177
|
-
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
178
|
-
/* @__PURE__ */ jsxs(CardTitle, { className: "flex items-center gap-2 text-base", children: [
|
|
179
|
-
/* @__PURE__ */ jsx(CoinsIcon, { className: colors2.accent }),
|
|
180
|
-
"Credit Balance"
|
|
181
|
-
] }),
|
|
182
|
-
/* @__PURE__ */ jsxs(CardDescription, { children: [
|
|
183
|
-
formatCredits(balance.available),
|
|
184
|
-
" credits remaining"
|
|
185
|
-
] })
|
|
186
|
-
] }),
|
|
187
|
-
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
|
|
188
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
189
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
190
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Used" }),
|
|
191
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: formatCredits(balance.used) })
|
|
192
|
-
] }),
|
|
193
|
-
/* @__PURE__ */ jsx(Progress, { value: usagePercent, variant, className: "h-3" }),
|
|
194
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
195
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Available" }),
|
|
196
|
-
/* @__PURE__ */ jsx("span", { className: cn("font-medium", colors2.accent), children: formatCredits(balance.available) })
|
|
197
|
-
] })
|
|
198
|
-
] }),
|
|
199
|
-
/* @__PURE__ */ jsx(Button, { variant, className: "w-full", onClick: onAddCredits, children: "Add Credits" })
|
|
200
|
-
] })
|
|
201
|
-
] }),
|
|
202
|
-
/* @__PURE__ */ jsxs(Card, { variant, className: cn("lg:col-span-1", cardClassName), children: [
|
|
203
|
-
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
204
|
-
/* @__PURE__ */ jsxs(CardTitle, { className: "flex items-center gap-2 text-base", children: [
|
|
205
|
-
/* @__PURE__ */ jsx(ChartIcon, { className: colors2.accent }),
|
|
206
|
-
"Usage Breakdown"
|
|
207
|
-
] }),
|
|
208
|
-
/* @__PURE__ */ jsx(CardDescription, { children: usage.period })
|
|
209
|
-
] }),
|
|
210
|
-
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
|
|
211
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between", children: [
|
|
212
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: "Total Usage" }),
|
|
213
|
-
/* @__PURE__ */ jsx("span", { className: cn("font-bold text-2xl", colors2.accent), children: formatCredits(usage.total) })
|
|
214
|
-
] }),
|
|
215
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
216
|
-
/* @__PURE__ */ jsx("p", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wider", children: "By Model" }),
|
|
217
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
218
|
-
sortedModels.slice(0, 5).map(([model, credits]) => {
|
|
219
|
-
const modelPercent = usage.total > 0 ? credits / usage.total * 100 : 0;
|
|
220
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
221
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
222
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-muted-foreground", children: model }),
|
|
223
|
-
/* @__PURE__ */ jsx("span", { className: "ml-2 font-medium", children: formatCredits(credits) })
|
|
224
|
-
] }),
|
|
225
|
-
/* @__PURE__ */ jsx("div", { className: "h-1.5 w-full overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ jsx(
|
|
226
|
-
"div",
|
|
227
|
-
{
|
|
228
|
-
className: cn(
|
|
229
|
-
"h-full rounded-full transition-all",
|
|
230
|
-
variant === "sandbox" && colors2.progress
|
|
231
|
-
),
|
|
232
|
-
style: { width: `${modelPercent}%` }
|
|
233
|
-
}
|
|
234
|
-
) })
|
|
235
|
-
] }, model);
|
|
236
|
-
}),
|
|
237
|
-
sortedModels.length > 5 && /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-xs", children: [
|
|
238
|
-
"+",
|
|
239
|
-
sortedModels.length - 5,
|
|
240
|
-
" more models"
|
|
241
|
-
] }),
|
|
242
|
-
sortedModels.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "No usage this period" })
|
|
243
|
-
] })
|
|
244
|
-
] })
|
|
245
|
-
] })
|
|
246
|
-
] })
|
|
247
|
-
] });
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// src/dashboard/pricing-page.tsx
|
|
251
|
-
import { Check, Zap } from "lucide-react";
|
|
252
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
253
|
-
function formatPrice(cents) {
|
|
254
|
-
if (!Number.isFinite(cents) || cents < 0) return "$0";
|
|
255
|
-
return cents % 100 === 0 ? `$${cents / 100}` : `$${(cents / 100).toFixed(2)}`;
|
|
256
|
-
}
|
|
257
|
-
function PricingPage({
|
|
258
|
-
tiers,
|
|
259
|
-
currentTierId,
|
|
260
|
-
billingPeriod,
|
|
261
|
-
onBillingPeriodChange,
|
|
262
|
-
onSelectTier,
|
|
263
|
-
loading = false,
|
|
264
|
-
className
|
|
265
|
-
}) {
|
|
266
|
-
const tiersWithRecommended = tiers.map((tier, i) => ({
|
|
267
|
-
...tier,
|
|
268
|
-
recommended: tier.recommended ?? (tiers.length === 3 && i === 1)
|
|
269
|
-
}));
|
|
270
|
-
return /* @__PURE__ */ jsxs2("div", { className: cn("w-full space-y-10", className), children: [
|
|
271
|
-
/* @__PURE__ */ jsx2("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs2("div", { className: "inline-flex items-center rounded-full border border-border bg-muted/50 p-1", children: [
|
|
272
|
-
/* @__PURE__ */ jsx2(
|
|
273
|
-
"button",
|
|
274
|
-
{
|
|
275
|
-
type: "button",
|
|
276
|
-
onClick: () => onBillingPeriodChange("monthly"),
|
|
277
|
-
className: cn(
|
|
278
|
-
"rounded-full px-5 py-2 text-sm font-medium transition-all",
|
|
279
|
-
billingPeriod === "monthly" ? "bg-card text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
280
|
-
),
|
|
281
|
-
children: "Monthly"
|
|
282
|
-
}
|
|
283
|
-
),
|
|
284
|
-
/* @__PURE__ */ jsxs2(
|
|
285
|
-
"button",
|
|
286
|
-
{
|
|
287
|
-
type: "button",
|
|
288
|
-
onClick: () => onBillingPeriodChange("yearly"),
|
|
289
|
-
className: cn(
|
|
290
|
-
"rounded-full px-5 py-2 text-sm font-medium transition-all",
|
|
291
|
-
billingPeriod === "yearly" ? "bg-card text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
292
|
-
),
|
|
293
|
-
children: [
|
|
294
|
-
"Yearly",
|
|
295
|
-
/* @__PURE__ */ jsx2("span", { className: "ml-2 rounded-full bg-[var(--surface-success-bg)] px-2 py-0.5 text-[10px] font-bold text-[var(--surface-success-text)]", children: "Save 20%" })
|
|
296
|
-
]
|
|
297
|
-
}
|
|
298
|
-
)
|
|
299
|
-
] }) }),
|
|
300
|
-
/* @__PURE__ */ jsx2("div", { className: "grid grid-cols-1 gap-6 lg:grid-cols-3 items-start", children: tiersWithRecommended.map((tier) => {
|
|
301
|
-
const isCurrentTier = tier.id === currentTierId;
|
|
302
|
-
const isRecommended = tier.recommended;
|
|
303
|
-
const isFree = tier.monthlyPriceCents === 0;
|
|
304
|
-
const price = billingPeriod === "yearly" && tier.yearlyPriceCents !== void 0 ? tier.yearlyPriceCents : tier.monthlyPriceCents;
|
|
305
|
-
const displayPrice = billingPeriod === "yearly" ? Math.round(price / 12) : price;
|
|
306
|
-
return /* @__PURE__ */ jsxs2(
|
|
307
|
-
"div",
|
|
308
|
-
{
|
|
309
|
-
className: cn(
|
|
310
|
-
"relative flex flex-col rounded-2xl border transition-all",
|
|
311
|
-
isRecommended ? "border-primary shadow-[var(--shadow-glow)] scale-[1.02] z-10" : "border-border hover:border-primary/30"
|
|
312
|
-
),
|
|
313
|
-
children: [
|
|
314
|
-
isRecommended && /* @__PURE__ */ jsx2("div", { className: "absolute -top-4 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsxs2("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-primary px-4 py-1.5 text-xs font-bold text-primary-foreground shadow-sm", children: [
|
|
315
|
-
/* @__PURE__ */ jsx2(Zap, { className: "h-3 w-3" }),
|
|
316
|
-
"Most Popular"
|
|
317
|
-
] }) }),
|
|
318
|
-
isCurrentTier && !isRecommended && /* @__PURE__ */ jsx2("div", { className: "absolute -top-4 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsx2("span", { className: "inline-flex items-center rounded-full bg-muted border border-border px-4 py-1.5 text-xs font-bold text-foreground", children: "Current Plan" }) }),
|
|
319
|
-
/* @__PURE__ */ jsxs2("div", { className: cn("flex flex-col p-8", isRecommended && "pt-10"), children: [
|
|
320
|
-
/* @__PURE__ */ jsxs2("div", { className: "mb-6", children: [
|
|
321
|
-
/* @__PURE__ */ jsx2("h3", { className: "text-lg font-bold text-foreground", children: tier.name }),
|
|
322
|
-
/* @__PURE__ */ jsx2("p", { className: "mt-1 text-sm text-muted-foreground", children: tier.description })
|
|
323
|
-
] }),
|
|
324
|
-
/* @__PURE__ */ jsxs2("div", { className: "mb-8", children: [
|
|
325
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-baseline gap-1", children: [
|
|
326
|
-
/* @__PURE__ */ jsx2("span", { className: cn("text-5xl font-extrabold tracking-tight", isRecommended ? "text-primary" : "text-foreground"), children: isFree ? "Free" : formatPrice(displayPrice) }),
|
|
327
|
-
!isFree && /* @__PURE__ */ jsx2("span", { className: "text-muted-foreground text-sm font-medium", children: "/mo" })
|
|
328
|
-
] }),
|
|
329
|
-
billingPeriod === "yearly" && tier.yearlyPriceCents !== void 0 && !isFree && /* @__PURE__ */ jsxs2("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
330
|
-
formatPrice(tier.yearlyPriceCents),
|
|
331
|
-
" billed annually"
|
|
332
|
-
] })
|
|
333
|
-
] }),
|
|
334
|
-
/* @__PURE__ */ jsx2(
|
|
335
|
-
"button",
|
|
336
|
-
{
|
|
337
|
-
type: "button",
|
|
338
|
-
onClick: () => onSelectTier(tier.id),
|
|
339
|
-
disabled: isCurrentTier || loading,
|
|
340
|
-
className: cn(
|
|
341
|
-
"w-full rounded-xl py-3 text-sm font-bold transition-all active:scale-[0.98] disabled:opacity-50",
|
|
342
|
-
isRecommended ? "bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm" : isCurrentTier ? "bg-muted text-muted-foreground border border-border cursor-default" : "bg-card text-foreground border border-border hover:border-primary/50 hover:bg-muted"
|
|
343
|
-
),
|
|
344
|
-
children: isCurrentTier ? "Current Plan" : isFree ? "Get Started" : "Subscribe"
|
|
345
|
-
}
|
|
346
|
-
),
|
|
347
|
-
/* @__PURE__ */ jsx2("div", { className: "my-8 border-t border-border" }),
|
|
348
|
-
/* @__PURE__ */ jsx2("ul", { className: "space-y-3.5 flex-1", children: tier.features.map((feature) => /* @__PURE__ */ jsxs2("li", { className: "flex items-start gap-3", children: [
|
|
349
|
-
/* @__PURE__ */ jsx2("div", { className: cn(
|
|
350
|
-
"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full",
|
|
351
|
-
isRecommended ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"
|
|
352
|
-
), children: /* @__PURE__ */ jsx2(Check, { className: "h-3 w-3" }) }),
|
|
353
|
-
/* @__PURE__ */ jsx2("span", { className: "text-sm text-foreground/80", children: feature })
|
|
354
|
-
] }, feature)) })
|
|
355
|
-
] })
|
|
356
|
-
]
|
|
357
|
-
},
|
|
358
|
-
tier.id
|
|
359
|
-
);
|
|
360
|
-
}) })
|
|
361
|
-
] });
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// src/dashboard/usage-chart.tsx
|
|
365
|
-
import * as React from "react";
|
|
366
|
-
import { Card as Card2, CardContent as CardContent2, CardHeader as CardHeader2, CardTitle as CardTitle2 } from "@tangle-network/ui/primitives";
|
|
367
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
368
|
-
var colors = {
|
|
369
|
-
bar: "bg-[image:var(--accent-gradient-strong)]",
|
|
370
|
-
barHover: "hover:brightness-110",
|
|
371
|
-
text: "text-[var(--accent-text)]"
|
|
372
|
-
};
|
|
373
|
-
function formatDate2(dateStr) {
|
|
374
|
-
const date = new Date(dateStr);
|
|
375
|
-
return date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
376
|
-
}
|
|
377
|
-
function formatValue(value) {
|
|
378
|
-
if (value >= 1e6) {
|
|
379
|
-
return `${(value / 1e6).toFixed(1)}M`;
|
|
380
|
-
}
|
|
381
|
-
if (value >= 1e3) {
|
|
382
|
-
return `${(value / 1e3).toFixed(1)}K`;
|
|
383
|
-
}
|
|
384
|
-
return value.toLocaleString();
|
|
385
|
-
}
|
|
386
|
-
function UsageChart({ data, title, unit, className }) {
|
|
387
|
-
const maxValue = Math.max(...data.map((d) => d.value), 1);
|
|
388
|
-
const total = data.reduce((sum, d) => sum + d.value, 0);
|
|
389
|
-
const [hoveredIndex, setHoveredIndex] = React.useState(null);
|
|
390
|
-
return /* @__PURE__ */ jsxs3(Card2, { className, children: [
|
|
391
|
-
/* @__PURE__ */ jsxs3(CardHeader2, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
392
|
-
/* @__PURE__ */ jsx3(CardTitle2, { className: "font-medium text-base", children: title }),
|
|
393
|
-
/* @__PURE__ */ jsxs3("div", { className: "text-right", children: [
|
|
394
|
-
/* @__PURE__ */ jsx3("span", { className: cn("font-bold text-2xl", colors.text), children: formatValue(total) }),
|
|
395
|
-
/* @__PURE__ */ jsx3("span", { className: "ml-1 text-muted-foreground text-sm", children: unit })
|
|
396
|
-
] })
|
|
397
|
-
] }),
|
|
398
|
-
/* @__PURE__ */ jsxs3(CardContent2, { children: [
|
|
399
|
-
/* @__PURE__ */ jsxs3("div", { className: "relative", children: [
|
|
400
|
-
/* @__PURE__ */ jsxs3("div", { className: "absolute top-0 left-0 flex h-48 flex-col justify-between text-muted-foreground text-xs", children: [
|
|
401
|
-
/* @__PURE__ */ jsx3("span", { children: formatValue(maxValue) }),
|
|
402
|
-
/* @__PURE__ */ jsx3("span", { children: formatValue(Math.round(maxValue / 2)) }),
|
|
403
|
-
/* @__PURE__ */ jsx3("span", { children: "0" })
|
|
404
|
-
] }),
|
|
405
|
-
/* @__PURE__ */ jsx3("div", { className: "ml-10 flex h-48 items-end gap-1", children: data.map((point, index) => {
|
|
406
|
-
const heightPercent = point.value / maxValue * 100;
|
|
407
|
-
const isHovered = hoveredIndex === index;
|
|
408
|
-
return (
|
|
409
|
-
// biome-ignore lint/a11y/noStaticElementInteractions: chart bar uses hover for tooltip display
|
|
410
|
-
/* @__PURE__ */ jsxs3(
|
|
411
|
-
"div",
|
|
412
|
-
{
|
|
413
|
-
className: "group relative flex flex-1 flex-col items-center",
|
|
414
|
-
onMouseEnter: () => setHoveredIndex(index),
|
|
415
|
-
onMouseLeave: () => setHoveredIndex(null),
|
|
416
|
-
children: [
|
|
417
|
-
isHovered && /* @__PURE__ */ jsxs3("div", { className: "absolute -top-12 z-10 rounded-lg bg-popover px-3 py-1.5 text-sm shadow-lg", children: [
|
|
418
|
-
/* @__PURE__ */ jsxs3("p", { className: "font-medium", children: [
|
|
419
|
-
formatValue(point.value),
|
|
420
|
-
" ",
|
|
421
|
-
unit
|
|
422
|
-
] }),
|
|
423
|
-
/* @__PURE__ */ jsx3("p", { className: "text-muted-foreground text-xs", children: formatDate2(point.date) })
|
|
424
|
-
] }),
|
|
425
|
-
/* @__PURE__ */ jsx3(
|
|
426
|
-
"div",
|
|
427
|
-
{
|
|
428
|
-
className: cn(
|
|
429
|
-
"min-h-[2px] w-full rounded-t-sm transition-all duration-200",
|
|
430
|
-
colors.bar,
|
|
431
|
-
colors.barHover,
|
|
432
|
-
isHovered && "opacity-80"
|
|
433
|
-
),
|
|
434
|
-
style: { height: `${Math.max(heightPercent, 1)}%` }
|
|
435
|
-
}
|
|
436
|
-
)
|
|
437
|
-
]
|
|
438
|
-
},
|
|
439
|
-
point.date
|
|
440
|
-
)
|
|
441
|
-
);
|
|
442
|
-
}) }),
|
|
443
|
-
/* @__PURE__ */ jsx3("div", { className: "mt-2 ml-10 flex gap-1", children: data.map((point, index) => /* @__PURE__ */ jsx3(
|
|
444
|
-
"div",
|
|
445
|
-
{
|
|
446
|
-
className: cn(
|
|
447
|
-
"flex-1 truncate text-center text-muted-foreground text-xs",
|
|
448
|
-
hoveredIndex === index && colors.text
|
|
449
|
-
),
|
|
450
|
-
children: data.length <= 7 || index % Math.ceil(data.length / 7) === 0 ? formatDate2(point.date) : ""
|
|
451
|
-
},
|
|
452
|
-
point.date
|
|
453
|
-
)) })
|
|
454
|
-
] }),
|
|
455
|
-
/* @__PURE__ */ jsxs3("div", { className: "mt-4 grid grid-cols-3 gap-4 border-border border-t pt-4", children: [
|
|
456
|
-
/* @__PURE__ */ jsxs3("div", { className: "text-center", children: [
|
|
457
|
-
/* @__PURE__ */ jsx3("p", { className: "text-muted-foreground text-xs", children: "Average" }),
|
|
458
|
-
/* @__PURE__ */ jsxs3("p", { className: "font-medium", children: [
|
|
459
|
-
formatValue(Math.round(total / data.length)),
|
|
460
|
-
" ",
|
|
461
|
-
unit
|
|
462
|
-
] })
|
|
463
|
-
] }),
|
|
464
|
-
/* @__PURE__ */ jsxs3("div", { className: "text-center", children: [
|
|
465
|
-
/* @__PURE__ */ jsx3("p", { className: "text-muted-foreground text-xs", children: "Peak" }),
|
|
466
|
-
/* @__PURE__ */ jsxs3("p", { className: "font-medium", children: [
|
|
467
|
-
formatValue(maxValue),
|
|
468
|
-
" ",
|
|
469
|
-
unit
|
|
470
|
-
] })
|
|
471
|
-
] }),
|
|
472
|
-
/* @__PURE__ */ jsxs3("div", { className: "text-center", children: [
|
|
473
|
-
/* @__PURE__ */ jsx3("p", { className: "text-muted-foreground text-xs", children: "Total" }),
|
|
474
|
-
/* @__PURE__ */ jsxs3("p", { className: cn("font-medium", colors.text), children: [
|
|
475
|
-
formatValue(total),
|
|
476
|
-
" ",
|
|
477
|
-
unit
|
|
478
|
-
] })
|
|
479
|
-
] })
|
|
480
|
-
] })
|
|
481
|
-
] })
|
|
482
|
-
] });
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// src/dashboard/template-card.tsx
|
|
486
|
-
import { ArrowRight } from "lucide-react";
|
|
487
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
488
|
-
function TemplateCard({ template, onUseTemplate, className }) {
|
|
489
|
-
return /* @__PURE__ */ jsxs4(
|
|
490
|
-
"div",
|
|
491
|
-
{
|
|
492
|
-
className: cn(
|
|
493
|
-
"group relative flex flex-col justify-between rounded-2xl border border-border bg-card p-6 transition-all hover:border-primary/30 hover:shadow-md",
|
|
494
|
-
className
|
|
495
|
-
),
|
|
496
|
-
children: [
|
|
497
|
-
/* @__PURE__ */ jsxs4("div", { children: [
|
|
498
|
-
/* @__PURE__ */ jsx4("div", { className: "mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted border border-border", children: template.icon ?? /* @__PURE__ */ jsx4("span", { className: "text-lg font-bold text-primary", children: template.name.charAt(0).toUpperCase() }) }),
|
|
499
|
-
/* @__PURE__ */ jsx4("h3", { className: "mb-1 text-base font-bold text-foreground", children: template.name }),
|
|
500
|
-
/* @__PURE__ */ jsx4("p", { className: "text-sm text-muted-foreground leading-relaxed line-clamp-2", children: template.description }),
|
|
501
|
-
template.tags && template.tags.length > 0 && /* @__PURE__ */ jsx4("div", { className: "mt-3 flex flex-wrap gap-1.5", children: template.tags.map((tag, i) => /* @__PURE__ */ jsx4(
|
|
502
|
-
"span",
|
|
503
|
-
{
|
|
504
|
-
className: "rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",
|
|
505
|
-
children: tag
|
|
506
|
-
},
|
|
507
|
-
`${tag}-${i}`
|
|
508
|
-
)) })
|
|
509
|
-
] }),
|
|
510
|
-
/* @__PURE__ */ jsxs4(
|
|
511
|
-
"button",
|
|
512
|
-
{
|
|
513
|
-
type: "button",
|
|
514
|
-
onClick: () => onUseTemplate(template.id),
|
|
515
|
-
className: "mt-5 inline-flex w-full items-center justify-center gap-2 rounded-xl bg-primary/10 border border-primary/20 px-4 py-2.5 text-sm font-bold text-primary transition-colors hover:bg-primary hover:text-primary-foreground active:scale-[0.98]",
|
|
516
|
-
children: [
|
|
517
|
-
"Use Template",
|
|
518
|
-
/* @__PURE__ */ jsx4(ArrowRight, { className: "h-4 w-4 transition-transform group-hover:translate-x-0.5" })
|
|
519
|
-
]
|
|
520
|
-
}
|
|
521
|
-
)
|
|
522
|
-
]
|
|
523
|
-
}
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
// src/dashboard/info-panel.tsx
|
|
528
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
529
|
-
function InfoPanel({ label, title, description, className }) {
|
|
530
|
-
return /* @__PURE__ */ jsxs5("div", { className: cn("rounded-lg bg-[var(--brand-strong)] p-5 text-[var(--brand-strong-text)] relative overflow-hidden", className), children: [
|
|
531
|
-
/* @__PURE__ */ jsxs5("div", { className: "relative z-10", children: [
|
|
532
|
-
/* @__PURE__ */ jsx5("p", { className: "text-[10px] font-bold uppercase tracking-widest text-[var(--brand-strong-text-dim)]", children: label }),
|
|
533
|
-
/* @__PURE__ */ jsx5("h3", { className: "mt-1 text-lg font-bold", children: title }),
|
|
534
|
-
/* @__PURE__ */ jsx5("p", { className: "mt-1 text-sm text-[var(--brand-strong-text-muted)]", children: description })
|
|
535
|
-
] }),
|
|
536
|
-
/* @__PURE__ */ jsx5("div", { className: "absolute right-0 top-0 h-full w-1/3 bg-white/5 -skew-x-12 translate-x-12 pointer-events-none" })
|
|
537
|
-
] });
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
export {
|
|
541
|
-
BillingDashboard,
|
|
542
|
-
formatPrice,
|
|
543
|
-
PricingPage,
|
|
544
|
-
UsageChart,
|
|
545
|
-
TemplateCard,
|
|
546
|
-
InfoPanel
|
|
547
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
interface BillingSubscription {
|
|
5
|
-
status: string;
|
|
6
|
-
tierName: string;
|
|
7
|
-
renewsAt: string;
|
|
8
|
-
}
|
|
9
|
-
interface BillingBalance {
|
|
10
|
-
available: number;
|
|
11
|
-
used: number;
|
|
12
|
-
}
|
|
13
|
-
interface BillingUsage {
|
|
14
|
-
period: string;
|
|
15
|
-
total: number;
|
|
16
|
-
byModel: Record<string, number>;
|
|
17
|
-
}
|
|
18
|
-
interface BillingDashboardProps {
|
|
19
|
-
subscription: BillingSubscription | null;
|
|
20
|
-
balance: BillingBalance;
|
|
21
|
-
usage: BillingUsage;
|
|
22
|
-
onManageSubscription: () => void;
|
|
23
|
-
onAddCredits: () => void;
|
|
24
|
-
variant?: "sandbox";
|
|
25
|
-
className?: string;
|
|
26
|
-
cardClassName?: string;
|
|
27
|
-
}
|
|
28
|
-
declare function BillingDashboard({ subscription, balance, usage, onManageSubscription, onAddCredits, variant, className, cardClassName, }: BillingDashboardProps): react_jsx_runtime.JSX.Element;
|
|
29
|
-
|
|
30
|
-
interface PricingTier {
|
|
31
|
-
id: string;
|
|
32
|
-
name: string;
|
|
33
|
-
description: string;
|
|
34
|
-
monthlyPriceCents: number;
|
|
35
|
-
yearlyPriceCents?: number;
|
|
36
|
-
features: string[];
|
|
37
|
-
recommended?: boolean;
|
|
38
|
-
creditsPerMonth?: number;
|
|
39
|
-
monthlyPriceId?: string;
|
|
40
|
-
yearlyPriceId?: string;
|
|
41
|
-
}
|
|
42
|
-
interface PricingPageProps {
|
|
43
|
-
tiers: PricingTier[];
|
|
44
|
-
currentTierId?: string;
|
|
45
|
-
billingPeriod: "monthly" | "yearly";
|
|
46
|
-
onBillingPeriodChange: (period: "monthly" | "yearly") => void;
|
|
47
|
-
onSelectTier: (tierId: string) => void;
|
|
48
|
-
variant?: "sandbox";
|
|
49
|
-
loading?: boolean;
|
|
50
|
-
className?: string;
|
|
51
|
-
cardClassName?: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Formats an integer cent amount as a human-readable USD price.
|
|
55
|
-
* Whole-dollar amounts omit decimals ($10), fractional amounts show two ($10.99).
|
|
56
|
-
* Returns "$0" for non-finite or negative inputs.
|
|
57
|
-
* @param cents - Amount in whole US cents (e.g. 1099 for $10.99).
|
|
58
|
-
*/
|
|
59
|
-
declare function formatPrice(cents: number): string;
|
|
60
|
-
declare function PricingPage({ tiers, currentTierId, billingPeriod, onBillingPeriodChange, onSelectTier, loading, className, }: PricingPageProps): react_jsx_runtime.JSX.Element;
|
|
61
|
-
|
|
62
|
-
interface UsageDataPoint {
|
|
63
|
-
date: string;
|
|
64
|
-
value: number;
|
|
65
|
-
}
|
|
66
|
-
interface UsageChartProps {
|
|
67
|
-
data: UsageDataPoint[];
|
|
68
|
-
title: string;
|
|
69
|
-
unit: string;
|
|
70
|
-
className?: string;
|
|
71
|
-
}
|
|
72
|
-
declare function UsageChart({ data, title, unit, className }: UsageChartProps): react_jsx_runtime.JSX.Element;
|
|
73
|
-
|
|
74
|
-
interface TemplateCardData {
|
|
75
|
-
id: string;
|
|
76
|
-
name: string;
|
|
77
|
-
description: string;
|
|
78
|
-
icon?: React.ReactNode;
|
|
79
|
-
tags?: string[];
|
|
80
|
-
}
|
|
81
|
-
interface TemplateCardProps {
|
|
82
|
-
template: TemplateCardData;
|
|
83
|
-
onUseTemplate: (templateId: string) => void;
|
|
84
|
-
className?: string;
|
|
85
|
-
}
|
|
86
|
-
declare function TemplateCard({ template, onUseTemplate, className }: TemplateCardProps): react_jsx_runtime.JSX.Element;
|
|
87
|
-
|
|
88
|
-
export { type BillingBalance as B, PricingPage as P, TemplateCard as T, UsageChart as U, BillingDashboard as a, type BillingDashboardProps as b, type BillingSubscription as c, type BillingUsage as d, type PricingPageProps as e, type PricingTier as f, type TemplateCardData as g, type TemplateCardProps as h, type UsageChartProps as i, type UsageDataPoint as j, formatPrice as k };
|