@tangle-network/sandbox-ui 0.20.3 → 0.21.0
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/chat.d.ts +51 -1
- package/dist/chat.js +5 -1
- package/dist/{chunk-QNVVKMEW.js → chunk-4KAPMTPU.js} +1 -542
- package/dist/{chunk-MQ52AYJX.js → chunk-666PYT5K.js} +146 -24
- package/dist/chunk-DNZ4DTNA.js +547 -0
- package/dist/chunk-ESRYVGHF.js +147 -0
- package/dist/{chunk-R6QNJQRH.js → chunk-FLWMBK77.js} +366 -507
- package/dist/{chunk-CMY7W45U.js → chunk-MEDE37J5.js} +8 -2
- package/dist/{chunk-CP2L6B53.js → chunk-R6NONXFC.js} +12 -8
- package/dist/dashboard.d.ts +4 -48
- package/dist/dashboard.js +12 -8
- package/dist/globals.css +0 -11
- package/dist/harness-picker-C1W3rTeb.d.ts +49 -0
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +19 -13
- package/dist/{template-card-gf-InrfN.d.ts → model-picker-DUfMTQo5.d.ts} +1 -86
- package/dist/pages.d.ts +5 -37
- package/dist/pages.js +208 -312
- package/dist/sdk-hooks-jUbIngSV.d.ts +96 -0
- package/dist/sdk-hooks.d.ts +2 -77
- package/dist/sdk-hooks.js +1 -1
- package/dist/styles.css +0 -11
- package/dist/template-card-UhV3pmRC.d.ts +88 -0
- package/dist/workspace.d.ts +7 -0
- package/dist/workspace.js +1 -1
- package/package.json +8 -8
package/dist/chat.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { MessageRole } from '@tangle-network/ui/chat';
|
|
2
2
|
export { AgentTimeline, AgentTimelineArtifactItem, AgentTimelineCustomItem, AgentTimelineItem, AgentTimelineMessageItem, AgentTimelineProps, AgentTimelineStatusItem, AgentTimelineTone, AgentTimelineToolGroupItem, AgentTimelineToolItem, ChatContainer, ChatContainerProps, ChatInput, ChatInputProps, ChatMessage, ChatMessageProps, MessageList, MessageListProps, MessageRole, PendingFile, ThinkingIndicator, ThinkingIndicatorProps, UserMessage, UserMessageProps } from '@tangle-network/ui/chat';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { M as ModelInfo } from './model-picker-DUfMTQo5.js';
|
|
6
|
+
import { e as HarnessType } from './harness-picker-C1W3rTeb.js';
|
|
4
7
|
|
|
5
8
|
type ReasoningLevel = "auto" | "low" | "medium" | "high";
|
|
6
9
|
interface ReasoningLevelOption {
|
|
@@ -19,6 +22,53 @@ interface ReasoningLevelPickerProps {
|
|
|
19
22
|
declare const DEFAULT_REASONING_LEVEL_OPTIONS: ReadonlyArray<ReasoningLevelOption>;
|
|
20
23
|
declare function ReasoningLevelPicker({ value, onChange, disabled, className, triggerClassName, options, }: ReasoningLevelPickerProps): react_jsx_runtime.JSX.Element;
|
|
21
24
|
|
|
25
|
+
interface AgentSessionHarnessControl {
|
|
26
|
+
value: HarnessType;
|
|
27
|
+
onChange: (next: HarnessType) => void;
|
|
28
|
+
/** Filter the selectable harnesses (e.g. by plan tier). Defaults to all. */
|
|
29
|
+
available?: ReadonlyArray<HarnessType>;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
}
|
|
32
|
+
interface AgentSessionModelControl {
|
|
33
|
+
/** Canonical model id (provider-prefixed, e.g. "anthropic/claude-opus-4-8"). */
|
|
34
|
+
value: string;
|
|
35
|
+
onChange: (modelId: string) => void;
|
|
36
|
+
/** Models to choose from. Pass `[]` while loading. */
|
|
37
|
+
models: ModelInfo[];
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
popular?: ReadonlyArray<string>;
|
|
40
|
+
recents?: ReadonlyArray<string>;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface AgentSessionReasoningControl {
|
|
44
|
+
value: ReasoningLevel;
|
|
45
|
+
onChange: (value: ReasoningLevel) => void;
|
|
46
|
+
options?: ReadonlyArray<ReasoningLevelOption>;
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
}
|
|
49
|
+
interface AgentSessionControlsProps {
|
|
50
|
+
/**
|
|
51
|
+
* Harness (agent backend) selection. Switching harness usually means
|
|
52
|
+
* re-creating the agent session — the consumer owns that lifecycle.
|
|
53
|
+
*/
|
|
54
|
+
harness?: AgentSessionHarnessControl;
|
|
55
|
+
/** Per-turn model override, fed by the router's model catalog. */
|
|
56
|
+
model?: AgentSessionModelControl;
|
|
57
|
+
/** Thinking-effort level applied to subsequent turns. */
|
|
58
|
+
reasoning?: AgentSessionReasoningControl;
|
|
59
|
+
/** Right-aligned extra content (token meter, cost, status). */
|
|
60
|
+
trailing?: React.ReactNode;
|
|
61
|
+
className?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Compact control strip for an agent chat composer: harness, model, and
|
|
65
|
+
* thinking-effort pickers in one row. Every section is optional and only
|
|
66
|
+
* renders when its control object is provided — never show a dead control.
|
|
67
|
+
*
|
|
68
|
+
* Designed to slot into `SandboxWorkbench`'s `session.composerControls`.
|
|
69
|
+
*/
|
|
70
|
+
declare function AgentSessionControls({ harness, model, reasoning, trailing, className, }: AgentSessionControlsProps): react_jsx_runtime.JSX.Element | null;
|
|
71
|
+
|
|
22
72
|
type ArtifactKind = string;
|
|
23
73
|
interface ArtifactScope {
|
|
24
74
|
kind: ArtifactKind;
|
|
@@ -116,4 +166,4 @@ declare function createFetchTransport(opts: {
|
|
|
116
166
|
fetchImpl?: typeof fetch;
|
|
117
167
|
}): ArtifactAgentDockTransport;
|
|
118
168
|
|
|
119
|
-
export { ArtifactAgentDock, type ArtifactAgentDockProps, type ArtifactAgentDockTransport, type ArtifactDockMessage, type ArtifactDockStreamEvent, type ArtifactKind, type ArtifactScope, DEFAULT_REASONING_LEVEL_OPTIONS, type ReasoningLevel, type ReasoningLevelOption, ReasoningLevelPicker, type ReasoningLevelPickerProps, createFetchTransport };
|
|
169
|
+
export { AgentSessionControls, type AgentSessionControlsProps, type AgentSessionHarnessControl, type AgentSessionModelControl, type AgentSessionReasoningControl, ArtifactAgentDock, type ArtifactAgentDockProps, type ArtifactAgentDockTransport, type ArtifactDockMessage, type ArtifactDockStreamEvent, type ArtifactKind, type ArtifactScope, DEFAULT_REASONING_LEVEL_OPTIONS, type ReasoningLevel, type ReasoningLevelOption, ReasoningLevelPicker, type ReasoningLevelPickerProps, createFetchTransport };
|
package/dist/chat.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AgentSessionControls,
|
|
2
3
|
AgentTimeline,
|
|
3
4
|
ArtifactAgentDock,
|
|
4
5
|
ChatContainer,
|
|
@@ -10,9 +11,12 @@ import {
|
|
|
10
11
|
ThinkingIndicator,
|
|
11
12
|
UserMessage,
|
|
12
13
|
createFetchTransport
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-666PYT5K.js";
|
|
15
|
+
import "./chunk-ESRYVGHF.js";
|
|
16
|
+
import "./chunk-4KAPMTPU.js";
|
|
14
17
|
import "./chunk-EI44GEQ5.js";
|
|
15
18
|
export {
|
|
19
|
+
AgentSessionControls,
|
|
16
20
|
AgentTimeline,
|
|
17
21
|
ArtifactAgentDock,
|
|
18
22
|
ChatContainer,
|
|
@@ -658,550 +658,9 @@ var BRAND_INFO = {
|
|
|
658
658
|
unknown: { key: "unknown", label: "Unknown" }
|
|
659
659
|
};
|
|
660
660
|
|
|
661
|
-
// src/dashboard/billing-dashboard.tsx
|
|
662
|
-
import { Button } from "@tangle-network/ui/primitives";
|
|
663
|
-
import { Badge } from "@tangle-network/ui/primitives";
|
|
664
|
-
import {
|
|
665
|
-
Card,
|
|
666
|
-
CardContent,
|
|
667
|
-
CardDescription,
|
|
668
|
-
CardHeader,
|
|
669
|
-
CardTitle
|
|
670
|
-
} from "@tangle-network/ui/primitives";
|
|
671
|
-
import { Progress } from "@tangle-network/ui/primitives";
|
|
672
|
-
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
673
|
-
var variantColors = {
|
|
674
|
-
sandbox: {
|
|
675
|
-
accent: "text-[var(--accent-text)]",
|
|
676
|
-
accentBg: "bg-[var(--accent-surface-soft)]",
|
|
677
|
-
border: "border-[var(--border-accent)]",
|
|
678
|
-
progress: "bg-[image:var(--accent-gradient-strong)]"
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
function formatCredits(value) {
|
|
682
|
-
if (value >= 1e6) {
|
|
683
|
-
return `${(value / 1e6).toFixed(1)}M`;
|
|
684
|
-
}
|
|
685
|
-
if (value >= 1e3) {
|
|
686
|
-
return `${(value / 1e3).toFixed(1)}K`;
|
|
687
|
-
}
|
|
688
|
-
return value.toLocaleString();
|
|
689
|
-
}
|
|
690
|
-
function formatDate(dateStr) {
|
|
691
|
-
const date = new Date(dateStr);
|
|
692
|
-
return date.toLocaleDateString("en-US", {
|
|
693
|
-
month: "long",
|
|
694
|
-
day: "numeric",
|
|
695
|
-
year: "numeric"
|
|
696
|
-
});
|
|
697
|
-
}
|
|
698
|
-
function getStatusBadgeVariant(status) {
|
|
699
|
-
switch (status.toLowerCase()) {
|
|
700
|
-
case "active":
|
|
701
|
-
return "success";
|
|
702
|
-
case "trialing":
|
|
703
|
-
case "past_due":
|
|
704
|
-
return "warning";
|
|
705
|
-
case "canceled":
|
|
706
|
-
case "unpaid":
|
|
707
|
-
return "error";
|
|
708
|
-
default:
|
|
709
|
-
return "secondary";
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
function CreditCardIcon({ className }) {
|
|
713
|
-
return /* @__PURE__ */ jsxs2(
|
|
714
|
-
"svg",
|
|
715
|
-
{
|
|
716
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
717
|
-
viewBox: "0 0 24 24",
|
|
718
|
-
fill: "none",
|
|
719
|
-
stroke: "currentColor",
|
|
720
|
-
strokeWidth: "2",
|
|
721
|
-
strokeLinecap: "round",
|
|
722
|
-
strokeLinejoin: "round",
|
|
723
|
-
className: cn("h-5 w-5", className),
|
|
724
|
-
children: [
|
|
725
|
-
/* @__PURE__ */ jsx2("title", { children: "Credit card icon" }),
|
|
726
|
-
/* @__PURE__ */ jsx2("rect", { width: "20", height: "14", x: "2", y: "5", rx: "2" }),
|
|
727
|
-
/* @__PURE__ */ jsx2("line", { x1: "2", x2: "22", y1: "10", y2: "10" })
|
|
728
|
-
]
|
|
729
|
-
}
|
|
730
|
-
);
|
|
731
|
-
}
|
|
732
|
-
function CoinsIcon({ className }) {
|
|
733
|
-
return /* @__PURE__ */ jsxs2(
|
|
734
|
-
"svg",
|
|
735
|
-
{
|
|
736
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
737
|
-
viewBox: "0 0 24 24",
|
|
738
|
-
fill: "none",
|
|
739
|
-
stroke: "currentColor",
|
|
740
|
-
strokeWidth: "2",
|
|
741
|
-
strokeLinecap: "round",
|
|
742
|
-
strokeLinejoin: "round",
|
|
743
|
-
className: cn("h-5 w-5", className),
|
|
744
|
-
children: [
|
|
745
|
-
/* @__PURE__ */ jsx2("title", { children: "Coins icon" }),
|
|
746
|
-
/* @__PURE__ */ jsx2("circle", { cx: "8", cy: "8", r: "6" }),
|
|
747
|
-
/* @__PURE__ */ jsx2("path", { d: "M18.09 10.37A6 6 0 1 1 10.34 18" }),
|
|
748
|
-
/* @__PURE__ */ jsx2("path", { d: "M7 6h1v4" }),
|
|
749
|
-
/* @__PURE__ */ jsx2("path", { d: "m16.71 13.88.7.71-2.82 2.82" })
|
|
750
|
-
]
|
|
751
|
-
}
|
|
752
|
-
);
|
|
753
|
-
}
|
|
754
|
-
function ChartIcon({ className }) {
|
|
755
|
-
return /* @__PURE__ */ jsxs2(
|
|
756
|
-
"svg",
|
|
757
|
-
{
|
|
758
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
759
|
-
viewBox: "0 0 24 24",
|
|
760
|
-
fill: "none",
|
|
761
|
-
stroke: "currentColor",
|
|
762
|
-
strokeWidth: "2",
|
|
763
|
-
strokeLinecap: "round",
|
|
764
|
-
strokeLinejoin: "round",
|
|
765
|
-
className: cn("h-5 w-5", className),
|
|
766
|
-
children: [
|
|
767
|
-
/* @__PURE__ */ jsx2("title", { children: "Chart icon" }),
|
|
768
|
-
/* @__PURE__ */ jsx2("path", { d: "M3 3v18h18" }),
|
|
769
|
-
/* @__PURE__ */ jsx2("path", { d: "m19 9-5 5-4-4-3 3" })
|
|
770
|
-
]
|
|
771
|
-
}
|
|
772
|
-
);
|
|
773
|
-
}
|
|
774
|
-
function BillingDashboard({
|
|
775
|
-
subscription,
|
|
776
|
-
balance,
|
|
777
|
-
usage,
|
|
778
|
-
onManageSubscription,
|
|
779
|
-
onAddCredits,
|
|
780
|
-
variant = "sandbox",
|
|
781
|
-
className,
|
|
782
|
-
cardClassName
|
|
783
|
-
}) {
|
|
784
|
-
const colors2 = variantColors[variant];
|
|
785
|
-
const totalCredits = balance.available + balance.used;
|
|
786
|
-
const usagePercent = totalCredits > 0 ? balance.used / totalCredits * 100 : 0;
|
|
787
|
-
const sortedModels = Object.entries(usage.byModel).sort(
|
|
788
|
-
([, a], [, b]) => b - a
|
|
789
|
-
);
|
|
790
|
-
return /* @__PURE__ */ jsxs2("div", { className: cn("grid gap-6 lg:grid-cols-3", className), children: [
|
|
791
|
-
/* @__PURE__ */ jsxs2(Card, { variant, className: cn("lg:col-span-1", cardClassName), children: [
|
|
792
|
-
/* @__PURE__ */ jsx2(CardHeader, { children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between", children: [
|
|
793
|
-
/* @__PURE__ */ jsxs2(CardTitle, { className: "flex items-center gap-2 text-base", children: [
|
|
794
|
-
/* @__PURE__ */ jsx2(CreditCardIcon, { className: colors2.accent }),
|
|
795
|
-
"Current Plan"
|
|
796
|
-
] }),
|
|
797
|
-
subscription && /* @__PURE__ */ jsx2(Badge, { variant: getStatusBadgeVariant(subscription.status), children: subscription.status })
|
|
798
|
-
] }) }),
|
|
799
|
-
/* @__PURE__ */ jsx2(CardContent, { className: "space-y-4", children: subscription ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
800
|
-
/* @__PURE__ */ jsxs2("div", { children: [
|
|
801
|
-
/* @__PURE__ */ jsx2("p", { className: cn("font-bold text-2xl", colors2.accent), children: subscription.tierName }),
|
|
802
|
-
/* @__PURE__ */ jsxs2("p", { className: "text-muted-foreground text-sm", children: [
|
|
803
|
-
"Renews ",
|
|
804
|
-
formatDate(subscription.renewsAt)
|
|
805
|
-
] })
|
|
806
|
-
] }),
|
|
807
|
-
/* @__PURE__ */ jsx2(
|
|
808
|
-
Button,
|
|
809
|
-
{
|
|
810
|
-
variant: "outline",
|
|
811
|
-
className: "w-full",
|
|
812
|
-
onClick: onManageSubscription,
|
|
813
|
-
children: "Manage Subscription"
|
|
814
|
-
}
|
|
815
|
-
)
|
|
816
|
-
] }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
817
|
-
/* @__PURE__ */ jsxs2("div", { children: [
|
|
818
|
-
/* @__PURE__ */ jsx2("p", { className: "font-bold text-2xl text-muted-foreground", children: "No Active Plan" }),
|
|
819
|
-
/* @__PURE__ */ jsx2("p", { className: "text-muted-foreground text-sm", children: "Subscribe to get started" })
|
|
820
|
-
] }),
|
|
821
|
-
/* @__PURE__ */ jsx2(
|
|
822
|
-
Button,
|
|
823
|
-
{
|
|
824
|
-
variant,
|
|
825
|
-
className: "w-full",
|
|
826
|
-
onClick: onManageSubscription,
|
|
827
|
-
children: "View Plans"
|
|
828
|
-
}
|
|
829
|
-
)
|
|
830
|
-
] }) })
|
|
831
|
-
] }),
|
|
832
|
-
/* @__PURE__ */ jsxs2(Card, { variant, className: cn("lg:col-span-1", cardClassName), children: [
|
|
833
|
-
/* @__PURE__ */ jsxs2(CardHeader, { children: [
|
|
834
|
-
/* @__PURE__ */ jsxs2(CardTitle, { className: "flex items-center gap-2 text-base", children: [
|
|
835
|
-
/* @__PURE__ */ jsx2(CoinsIcon, { className: colors2.accent }),
|
|
836
|
-
"Credit Balance"
|
|
837
|
-
] }),
|
|
838
|
-
/* @__PURE__ */ jsxs2(CardDescription, { children: [
|
|
839
|
-
formatCredits(balance.available),
|
|
840
|
-
" credits remaining"
|
|
841
|
-
] })
|
|
842
|
-
] }),
|
|
843
|
-
/* @__PURE__ */ jsxs2(CardContent, { className: "space-y-4", children: [
|
|
844
|
-
/* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
845
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between text-sm", children: [
|
|
846
|
-
/* @__PURE__ */ jsx2("span", { className: "text-muted-foreground", children: "Used" }),
|
|
847
|
-
/* @__PURE__ */ jsx2("span", { className: "font-medium", children: formatCredits(balance.used) })
|
|
848
|
-
] }),
|
|
849
|
-
/* @__PURE__ */ jsx2(Progress, { value: usagePercent, variant, className: "h-3" }),
|
|
850
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between text-sm", children: [
|
|
851
|
-
/* @__PURE__ */ jsx2("span", { className: "text-muted-foreground", children: "Available" }),
|
|
852
|
-
/* @__PURE__ */ jsx2("span", { className: cn("font-medium", colors2.accent), children: formatCredits(balance.available) })
|
|
853
|
-
] })
|
|
854
|
-
] }),
|
|
855
|
-
/* @__PURE__ */ jsx2(Button, { variant, className: "w-full", onClick: onAddCredits, children: "Add Credits" })
|
|
856
|
-
] })
|
|
857
|
-
] }),
|
|
858
|
-
/* @__PURE__ */ jsxs2(Card, { variant, className: cn("lg:col-span-1", cardClassName), children: [
|
|
859
|
-
/* @__PURE__ */ jsxs2(CardHeader, { children: [
|
|
860
|
-
/* @__PURE__ */ jsxs2(CardTitle, { className: "flex items-center gap-2 text-base", children: [
|
|
861
|
-
/* @__PURE__ */ jsx2(ChartIcon, { className: colors2.accent }),
|
|
862
|
-
"Usage Breakdown"
|
|
863
|
-
] }),
|
|
864
|
-
/* @__PURE__ */ jsx2(CardDescription, { children: usage.period })
|
|
865
|
-
] }),
|
|
866
|
-
/* @__PURE__ */ jsxs2(CardContent, { className: "space-y-4", children: [
|
|
867
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-baseline justify-between", children: [
|
|
868
|
-
/* @__PURE__ */ jsx2("span", { className: "text-muted-foreground text-sm", children: "Total Usage" }),
|
|
869
|
-
/* @__PURE__ */ jsx2("span", { className: cn("font-bold text-2xl", colors2.accent), children: formatCredits(usage.total) })
|
|
870
|
-
] }),
|
|
871
|
-
/* @__PURE__ */ jsxs2("div", { className: "space-y-3", children: [
|
|
872
|
-
/* @__PURE__ */ jsx2("p", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wider", children: "By Model" }),
|
|
873
|
-
/* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
874
|
-
sortedModels.slice(0, 5).map(([model, credits]) => {
|
|
875
|
-
const modelPercent = usage.total > 0 ? credits / usage.total * 100 : 0;
|
|
876
|
-
return /* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
|
|
877
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between text-sm", children: [
|
|
878
|
-
/* @__PURE__ */ jsx2("span", { className: "truncate text-muted-foreground", children: model }),
|
|
879
|
-
/* @__PURE__ */ jsx2("span", { className: "ml-2 font-medium", children: formatCredits(credits) })
|
|
880
|
-
] }),
|
|
881
|
-
/* @__PURE__ */ jsx2("div", { className: "h-1.5 w-full overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ jsx2(
|
|
882
|
-
"div",
|
|
883
|
-
{
|
|
884
|
-
className: cn(
|
|
885
|
-
"h-full rounded-full transition-all",
|
|
886
|
-
variant === "sandbox" && colors2.progress
|
|
887
|
-
),
|
|
888
|
-
style: { width: `${modelPercent}%` }
|
|
889
|
-
}
|
|
890
|
-
) })
|
|
891
|
-
] }, model);
|
|
892
|
-
}),
|
|
893
|
-
sortedModels.length > 5 && /* @__PURE__ */ jsxs2("p", { className: "text-muted-foreground text-xs", children: [
|
|
894
|
-
"+",
|
|
895
|
-
sortedModels.length - 5,
|
|
896
|
-
" more models"
|
|
897
|
-
] }),
|
|
898
|
-
sortedModels.length === 0 && /* @__PURE__ */ jsx2("p", { className: "text-muted-foreground text-sm", children: "No usage this period" })
|
|
899
|
-
] })
|
|
900
|
-
] })
|
|
901
|
-
] })
|
|
902
|
-
] })
|
|
903
|
-
] });
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
// src/dashboard/pricing-page.tsx
|
|
907
|
-
import { Check, Zap } from "lucide-react";
|
|
908
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
909
|
-
function formatPrice(cents) {
|
|
910
|
-
if (!Number.isFinite(cents) || cents < 0) return "$0";
|
|
911
|
-
return cents % 100 === 0 ? `$${cents / 100}` : `$${(cents / 100).toFixed(2)}`;
|
|
912
|
-
}
|
|
913
|
-
function PricingPage({
|
|
914
|
-
tiers,
|
|
915
|
-
currentTierId,
|
|
916
|
-
billingPeriod,
|
|
917
|
-
onBillingPeriodChange,
|
|
918
|
-
onSelectTier,
|
|
919
|
-
loading = false,
|
|
920
|
-
className
|
|
921
|
-
}) {
|
|
922
|
-
const tiersWithRecommended = tiers.map((tier, i) => ({
|
|
923
|
-
...tier,
|
|
924
|
-
recommended: tier.recommended ?? (tiers.length === 3 && i === 1)
|
|
925
|
-
}));
|
|
926
|
-
return /* @__PURE__ */ jsxs3("div", { className: cn("w-full space-y-10", className), children: [
|
|
927
|
-
/* @__PURE__ */ jsx3("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs3("div", { className: "inline-flex items-center rounded-full border border-border bg-muted/50 p-1", children: [
|
|
928
|
-
/* @__PURE__ */ jsx3(
|
|
929
|
-
"button",
|
|
930
|
-
{
|
|
931
|
-
type: "button",
|
|
932
|
-
onClick: () => onBillingPeriodChange("monthly"),
|
|
933
|
-
className: cn(
|
|
934
|
-
"rounded-full px-5 py-2 text-sm font-medium transition-all",
|
|
935
|
-
billingPeriod === "monthly" ? "bg-card text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
936
|
-
),
|
|
937
|
-
children: "Monthly"
|
|
938
|
-
}
|
|
939
|
-
),
|
|
940
|
-
/* @__PURE__ */ jsxs3(
|
|
941
|
-
"button",
|
|
942
|
-
{
|
|
943
|
-
type: "button",
|
|
944
|
-
onClick: () => onBillingPeriodChange("yearly"),
|
|
945
|
-
className: cn(
|
|
946
|
-
"rounded-full px-5 py-2 text-sm font-medium transition-all",
|
|
947
|
-
billingPeriod === "yearly" ? "bg-card text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
948
|
-
),
|
|
949
|
-
children: [
|
|
950
|
-
"Yearly",
|
|
951
|
-
/* @__PURE__ */ jsx3("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%" })
|
|
952
|
-
]
|
|
953
|
-
}
|
|
954
|
-
)
|
|
955
|
-
] }) }),
|
|
956
|
-
/* @__PURE__ */ jsx3("div", { className: "grid grid-cols-1 gap-6 lg:grid-cols-3 items-start", children: tiersWithRecommended.map((tier) => {
|
|
957
|
-
const isCurrentTier = tier.id === currentTierId;
|
|
958
|
-
const isRecommended = tier.recommended;
|
|
959
|
-
const isFree = tier.monthlyPriceCents === 0;
|
|
960
|
-
const price = billingPeriod === "yearly" && tier.yearlyPriceCents !== void 0 ? tier.yearlyPriceCents : tier.monthlyPriceCents;
|
|
961
|
-
const displayPrice = billingPeriod === "yearly" ? Math.round(price / 12) : price;
|
|
962
|
-
return /* @__PURE__ */ jsxs3(
|
|
963
|
-
"div",
|
|
964
|
-
{
|
|
965
|
-
className: cn(
|
|
966
|
-
"relative flex flex-col rounded-2xl border transition-all",
|
|
967
|
-
isRecommended ? "border-primary shadow-[var(--shadow-glow)] scale-[1.02] z-10" : "border-border hover:border-primary/30"
|
|
968
|
-
),
|
|
969
|
-
children: [
|
|
970
|
-
isRecommended && /* @__PURE__ */ jsx3("div", { className: "absolute -top-4 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsxs3("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: [
|
|
971
|
-
/* @__PURE__ */ jsx3(Zap, { className: "h-3 w-3" }),
|
|
972
|
-
"Most Popular"
|
|
973
|
-
] }) }),
|
|
974
|
-
isCurrentTier && !isRecommended && /* @__PURE__ */ jsx3("div", { className: "absolute -top-4 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsx3("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" }) }),
|
|
975
|
-
/* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col p-8", isRecommended && "pt-10"), children: [
|
|
976
|
-
/* @__PURE__ */ jsxs3("div", { className: "mb-6", children: [
|
|
977
|
-
/* @__PURE__ */ jsx3("h3", { className: "text-lg font-bold text-foreground", children: tier.name }),
|
|
978
|
-
/* @__PURE__ */ jsx3("p", { className: "mt-1 text-sm text-muted-foreground", children: tier.description })
|
|
979
|
-
] }),
|
|
980
|
-
/* @__PURE__ */ jsxs3("div", { className: "mb-8", children: [
|
|
981
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex items-baseline gap-1", children: [
|
|
982
|
-
/* @__PURE__ */ jsx3("span", { className: cn("text-5xl font-extrabold tracking-tight", isRecommended ? "text-primary" : "text-foreground"), children: isFree ? "Free" : formatPrice(displayPrice) }),
|
|
983
|
-
!isFree && /* @__PURE__ */ jsx3("span", { className: "text-muted-foreground text-sm font-medium", children: "/mo" })
|
|
984
|
-
] }),
|
|
985
|
-
billingPeriod === "yearly" && tier.yearlyPriceCents !== void 0 && !isFree && /* @__PURE__ */ jsxs3("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
986
|
-
formatPrice(tier.yearlyPriceCents),
|
|
987
|
-
" billed annually"
|
|
988
|
-
] })
|
|
989
|
-
] }),
|
|
990
|
-
/* @__PURE__ */ jsx3(
|
|
991
|
-
"button",
|
|
992
|
-
{
|
|
993
|
-
type: "button",
|
|
994
|
-
onClick: () => onSelectTier(tier.id),
|
|
995
|
-
disabled: isCurrentTier || loading,
|
|
996
|
-
className: cn(
|
|
997
|
-
"w-full rounded-xl py-3 text-sm font-bold transition-all active:scale-[0.98] disabled:opacity-50",
|
|
998
|
-
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"
|
|
999
|
-
),
|
|
1000
|
-
children: isCurrentTier ? "Current Plan" : isFree ? "Get Started" : "Subscribe"
|
|
1001
|
-
}
|
|
1002
|
-
),
|
|
1003
|
-
/* @__PURE__ */ jsx3("div", { className: "my-8 border-t border-border" }),
|
|
1004
|
-
/* @__PURE__ */ jsx3("ul", { className: "space-y-3.5 flex-1", children: tier.features.map((feature) => /* @__PURE__ */ jsxs3("li", { className: "flex items-start gap-3", children: [
|
|
1005
|
-
/* @__PURE__ */ jsx3("div", { className: cn(
|
|
1006
|
-
"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full",
|
|
1007
|
-
isRecommended ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"
|
|
1008
|
-
), children: /* @__PURE__ */ jsx3(Check, { className: "h-3 w-3" }) }),
|
|
1009
|
-
/* @__PURE__ */ jsx3("span", { className: "text-sm text-foreground/80", children: feature })
|
|
1010
|
-
] }, feature)) })
|
|
1011
|
-
] })
|
|
1012
|
-
]
|
|
1013
|
-
},
|
|
1014
|
-
tier.id
|
|
1015
|
-
);
|
|
1016
|
-
}) })
|
|
1017
|
-
] });
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
// src/dashboard/usage-chart.tsx
|
|
1021
|
-
import * as React2 from "react";
|
|
1022
|
-
import { Card as Card2, CardContent as CardContent2, CardHeader as CardHeader2, CardTitle as CardTitle2 } from "@tangle-network/ui/primitives";
|
|
1023
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1024
|
-
var colors = {
|
|
1025
|
-
bar: "bg-[image:var(--accent-gradient-strong)]",
|
|
1026
|
-
barHover: "hover:brightness-110",
|
|
1027
|
-
text: "text-[var(--accent-text)]"
|
|
1028
|
-
};
|
|
1029
|
-
function formatDate2(dateStr) {
|
|
1030
|
-
const date = new Date(dateStr);
|
|
1031
|
-
return date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
1032
|
-
}
|
|
1033
|
-
function formatValue(value) {
|
|
1034
|
-
if (value >= 1e6) {
|
|
1035
|
-
return `${(value / 1e6).toFixed(1)}M`;
|
|
1036
|
-
}
|
|
1037
|
-
if (value >= 1e3) {
|
|
1038
|
-
return `${(value / 1e3).toFixed(1)}K`;
|
|
1039
|
-
}
|
|
1040
|
-
return value.toLocaleString();
|
|
1041
|
-
}
|
|
1042
|
-
function UsageChart({ data, title, unit, className }) {
|
|
1043
|
-
const maxValue = Math.max(...data.map((d) => d.value), 1);
|
|
1044
|
-
const total = data.reduce((sum, d) => sum + d.value, 0);
|
|
1045
|
-
const [hoveredIndex, setHoveredIndex] = React2.useState(null);
|
|
1046
|
-
return /* @__PURE__ */ jsxs4(Card2, { className, children: [
|
|
1047
|
-
/* @__PURE__ */ jsxs4(CardHeader2, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
1048
|
-
/* @__PURE__ */ jsx4(CardTitle2, { className: "font-medium text-base", children: title }),
|
|
1049
|
-
/* @__PURE__ */ jsxs4("div", { className: "text-right", children: [
|
|
1050
|
-
/* @__PURE__ */ jsx4("span", { className: cn("font-bold text-2xl", colors.text), children: formatValue(total) }),
|
|
1051
|
-
/* @__PURE__ */ jsx4("span", { className: "ml-1 text-muted-foreground text-sm", children: unit })
|
|
1052
|
-
] })
|
|
1053
|
-
] }),
|
|
1054
|
-
/* @__PURE__ */ jsxs4(CardContent2, { children: [
|
|
1055
|
-
/* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
1056
|
-
/* @__PURE__ */ jsxs4("div", { className: "absolute top-0 left-0 flex h-48 flex-col justify-between text-muted-foreground text-xs", children: [
|
|
1057
|
-
/* @__PURE__ */ jsx4("span", { children: formatValue(maxValue) }),
|
|
1058
|
-
/* @__PURE__ */ jsx4("span", { children: formatValue(Math.round(maxValue / 2)) }),
|
|
1059
|
-
/* @__PURE__ */ jsx4("span", { children: "0" })
|
|
1060
|
-
] }),
|
|
1061
|
-
/* @__PURE__ */ jsx4("div", { className: "ml-10 flex h-48 items-end gap-1", children: data.map((point, index) => {
|
|
1062
|
-
const heightPercent = point.value / maxValue * 100;
|
|
1063
|
-
const isHovered = hoveredIndex === index;
|
|
1064
|
-
return (
|
|
1065
|
-
// biome-ignore lint/a11y/noStaticElementInteractions: chart bar uses hover for tooltip display
|
|
1066
|
-
/* @__PURE__ */ jsxs4(
|
|
1067
|
-
"div",
|
|
1068
|
-
{
|
|
1069
|
-
className: "group relative flex flex-1 flex-col items-center",
|
|
1070
|
-
onMouseEnter: () => setHoveredIndex(index),
|
|
1071
|
-
onMouseLeave: () => setHoveredIndex(null),
|
|
1072
|
-
children: [
|
|
1073
|
-
isHovered && /* @__PURE__ */ jsxs4("div", { className: "absolute -top-12 z-10 rounded-lg bg-popover px-3 py-1.5 text-sm shadow-lg", children: [
|
|
1074
|
-
/* @__PURE__ */ jsxs4("p", { className: "font-medium", children: [
|
|
1075
|
-
formatValue(point.value),
|
|
1076
|
-
" ",
|
|
1077
|
-
unit
|
|
1078
|
-
] }),
|
|
1079
|
-
/* @__PURE__ */ jsx4("p", { className: "text-muted-foreground text-xs", children: formatDate2(point.date) })
|
|
1080
|
-
] }),
|
|
1081
|
-
/* @__PURE__ */ jsx4(
|
|
1082
|
-
"div",
|
|
1083
|
-
{
|
|
1084
|
-
className: cn(
|
|
1085
|
-
"min-h-[2px] w-full rounded-t-sm transition-all duration-200",
|
|
1086
|
-
colors.bar,
|
|
1087
|
-
colors.barHover,
|
|
1088
|
-
isHovered && "opacity-80"
|
|
1089
|
-
),
|
|
1090
|
-
style: { height: `${Math.max(heightPercent, 1)}%` }
|
|
1091
|
-
}
|
|
1092
|
-
)
|
|
1093
|
-
]
|
|
1094
|
-
},
|
|
1095
|
-
point.date
|
|
1096
|
-
)
|
|
1097
|
-
);
|
|
1098
|
-
}) }),
|
|
1099
|
-
/* @__PURE__ */ jsx4("div", { className: "mt-2 ml-10 flex gap-1", children: data.map((point, index) => /* @__PURE__ */ jsx4(
|
|
1100
|
-
"div",
|
|
1101
|
-
{
|
|
1102
|
-
className: cn(
|
|
1103
|
-
"flex-1 truncate text-center text-muted-foreground text-xs",
|
|
1104
|
-
hoveredIndex === index && colors.text
|
|
1105
|
-
),
|
|
1106
|
-
children: data.length <= 7 || index % Math.ceil(data.length / 7) === 0 ? formatDate2(point.date) : ""
|
|
1107
|
-
},
|
|
1108
|
-
point.date
|
|
1109
|
-
)) })
|
|
1110
|
-
] }),
|
|
1111
|
-
/* @__PURE__ */ jsxs4("div", { className: "mt-4 grid grid-cols-3 gap-4 border-border border-t pt-4", children: [
|
|
1112
|
-
/* @__PURE__ */ jsxs4("div", { className: "text-center", children: [
|
|
1113
|
-
/* @__PURE__ */ jsx4("p", { className: "text-muted-foreground text-xs", children: "Average" }),
|
|
1114
|
-
/* @__PURE__ */ jsxs4("p", { className: "font-medium", children: [
|
|
1115
|
-
formatValue(Math.round(total / data.length)),
|
|
1116
|
-
" ",
|
|
1117
|
-
unit
|
|
1118
|
-
] })
|
|
1119
|
-
] }),
|
|
1120
|
-
/* @__PURE__ */ jsxs4("div", { className: "text-center", children: [
|
|
1121
|
-
/* @__PURE__ */ jsx4("p", { className: "text-muted-foreground text-xs", children: "Peak" }),
|
|
1122
|
-
/* @__PURE__ */ jsxs4("p", { className: "font-medium", children: [
|
|
1123
|
-
formatValue(maxValue),
|
|
1124
|
-
" ",
|
|
1125
|
-
unit
|
|
1126
|
-
] })
|
|
1127
|
-
] }),
|
|
1128
|
-
/* @__PURE__ */ jsxs4("div", { className: "text-center", children: [
|
|
1129
|
-
/* @__PURE__ */ jsx4("p", { className: "text-muted-foreground text-xs", children: "Total" }),
|
|
1130
|
-
/* @__PURE__ */ jsxs4("p", { className: cn("font-medium", colors.text), children: [
|
|
1131
|
-
formatValue(total),
|
|
1132
|
-
" ",
|
|
1133
|
-
unit
|
|
1134
|
-
] })
|
|
1135
|
-
] })
|
|
1136
|
-
] })
|
|
1137
|
-
] })
|
|
1138
|
-
] });
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
// src/dashboard/template-card.tsx
|
|
1142
|
-
import { ArrowRight } from "lucide-react";
|
|
1143
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1144
|
-
function TemplateCard({ template, onUseTemplate, className }) {
|
|
1145
|
-
return /* @__PURE__ */ jsxs5(
|
|
1146
|
-
"div",
|
|
1147
|
-
{
|
|
1148
|
-
className: cn(
|
|
1149
|
-
"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",
|
|
1150
|
-
className
|
|
1151
|
-
),
|
|
1152
|
-
children: [
|
|
1153
|
-
/* @__PURE__ */ jsxs5("div", { children: [
|
|
1154
|
-
/* @__PURE__ */ jsx5("div", { className: "mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted border border-border", children: template.icon ?? /* @__PURE__ */ jsx5("span", { className: "text-lg font-bold text-primary", children: template.name.charAt(0).toUpperCase() }) }),
|
|
1155
|
-
/* @__PURE__ */ jsx5("h3", { className: "mb-1 text-base font-bold text-foreground", children: template.name }),
|
|
1156
|
-
/* @__PURE__ */ jsx5("p", { className: "text-sm text-muted-foreground leading-relaxed line-clamp-2", children: template.description }),
|
|
1157
|
-
template.tags && template.tags.length > 0 && /* @__PURE__ */ jsx5("div", { className: "mt-3 flex flex-wrap gap-1.5", children: template.tags.map((tag, i) => /* @__PURE__ */ jsx5(
|
|
1158
|
-
"span",
|
|
1159
|
-
{
|
|
1160
|
-
className: "rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",
|
|
1161
|
-
children: tag
|
|
1162
|
-
},
|
|
1163
|
-
`${tag}-${i}`
|
|
1164
|
-
)) })
|
|
1165
|
-
] }),
|
|
1166
|
-
/* @__PURE__ */ jsxs5(
|
|
1167
|
-
"button",
|
|
1168
|
-
{
|
|
1169
|
-
type: "button",
|
|
1170
|
-
onClick: () => onUseTemplate(template.id),
|
|
1171
|
-
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]",
|
|
1172
|
-
children: [
|
|
1173
|
-
"Use Template",
|
|
1174
|
-
/* @__PURE__ */ jsx5(ArrowRight, { className: "h-4 w-4 transition-transform group-hover:translate-x-0.5" })
|
|
1175
|
-
]
|
|
1176
|
-
}
|
|
1177
|
-
)
|
|
1178
|
-
]
|
|
1179
|
-
}
|
|
1180
|
-
);
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
// src/dashboard/info-panel.tsx
|
|
1184
|
-
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1185
|
-
function InfoPanel({ label, title, description, className }) {
|
|
1186
|
-
return /* @__PURE__ */ jsxs6("div", { className: cn("rounded-lg bg-[var(--brand-strong)] p-5 text-[var(--brand-strong-text)] relative overflow-hidden", className), children: [
|
|
1187
|
-
/* @__PURE__ */ jsxs6("div", { className: "relative z-10", children: [
|
|
1188
|
-
/* @__PURE__ */ jsx6("p", { className: "text-[10px] font-bold uppercase tracking-widest text-[var(--brand-strong-text-dim)]", children: label }),
|
|
1189
|
-
/* @__PURE__ */ jsx6("h3", { className: "mt-1 text-lg font-bold", children: title }),
|
|
1190
|
-
/* @__PURE__ */ jsx6("p", { className: "mt-1 text-sm text-[var(--brand-strong-text-muted)]", children: description })
|
|
1191
|
-
] }),
|
|
1192
|
-
/* @__PURE__ */ jsx6("div", { className: "absolute right-0 top-0 h-full w-1/3 bg-white/5 -skew-x-12 translate-x-12 pointer-events-none" })
|
|
1193
|
-
] });
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
661
|
export {
|
|
1197
662
|
canonicalModelId,
|
|
1198
663
|
formatPricing,
|
|
1199
664
|
formatContext,
|
|
1200
|
-
ModelPicker
|
|
1201
|
-
BillingDashboard,
|
|
1202
|
-
formatPrice,
|
|
1203
|
-
PricingPage,
|
|
1204
|
-
UsageChart,
|
|
1205
|
-
TemplateCard,
|
|
1206
|
-
InfoPanel
|
|
665
|
+
ModelPicker
|
|
1207
666
|
};
|