@hanzo/ui 8.0.2 → 8.0.5
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/package.json +63 -4
- package/src/billing.ts +9 -0
- package/src/canvas.ts +11 -0
- package/src/cd/layout.ts +184 -0
- package/src/cd/status.ts +158 -0
- package/src/cd/time.ts +52 -0
- package/src/cd/types.ts +318 -0
- package/src/dashboard.ts +8 -0
- package/src/gitops.ts +5 -0
- package/src/network.ts +11 -0
- package/src/product/AppHeader.tsx +175 -0
- package/src/product/BrandMark.tsx +27 -0
- package/src/product/HanzoMark.tsx +7 -4
- package/src/product/OrgSwitcher.tsx +332 -0
- package/src/product/index.ts +10 -5
- package/src/product/scope.test.ts +92 -0
- package/src/product/scope.ts +123 -0
- package/src/usage.ts +8 -0
- package/src/wallet.ts +11 -0
- package/types/billing.d.ts +2 -0
- package/types/billing.d.ts.map +1 -0
- package/types/canvas.d.ts +2 -0
- package/types/canvas.d.ts.map +1 -0
- package/types/cd/layout.d.ts +57 -0
- package/types/cd/layout.d.ts.map +1 -0
- package/types/cd/status.d.ts +50 -0
- package/types/cd/status.d.ts.map +1 -0
- package/types/cd/time.d.ts +15 -0
- package/types/cd/time.d.ts.map +1 -0
- package/types/cd/types.d.ts +269 -0
- package/types/cd/types.d.ts.map +1 -0
- package/types/dashboard.d.ts +2 -0
- package/types/dashboard.d.ts.map +1 -0
- package/types/gitops.d.ts +2 -0
- package/types/gitops.d.ts.map +1 -0
- package/types/network.d.ts +2 -0
- package/types/network.d.ts.map +1 -0
- package/types/product/AppHeader.d.ts +49 -0
- package/types/product/AppHeader.d.ts.map +1 -0
- package/types/product/BrandMark.d.ts +8 -0
- package/types/product/BrandMark.d.ts.map +1 -0
- package/types/product/Charts.d.ts +5 -5
- package/types/product/Charts.d.ts.map +1 -1
- package/types/product/ComboBox.d.ts +1 -1
- package/types/product/ComboBox.d.ts.map +1 -1
- package/types/product/DataTable.d.ts +1 -1
- package/types/product/DataTable.d.ts.map +1 -1
- package/types/product/Donut.d.ts +1 -1
- package/types/product/Donut.d.ts.map +1 -1
- package/types/product/EmptyState.d.ts +1 -1
- package/types/product/EmptyState.d.ts.map +1 -1
- package/types/product/FadeIn.d.ts +1 -1
- package/types/product/FadeIn.d.ts.map +1 -1
- package/types/product/Field.d.ts +6 -6
- package/types/product/Field.d.ts.map +1 -1
- package/types/product/HanzoMark.d.ts +6 -5
- package/types/product/HanzoMark.d.ts.map +1 -1
- package/types/product/Metric.d.ts +4 -4
- package/types/product/Metric.d.ts.map +1 -1
- package/types/product/OrgSwitcher.d.ts +19 -0
- package/types/product/OrgSwitcher.d.ts.map +1 -0
- package/types/product/PageHeader.d.ts +1 -1
- package/types/product/PageHeader.d.ts.map +1 -1
- package/types/product/PrimaryButton.d.ts +1 -1
- package/types/product/PrimaryButton.d.ts.map +1 -1
- package/types/product/ProductIcon.d.ts +1 -1
- package/types/product/ProductIcon.d.ts.map +1 -1
- package/types/product/ProviderLogo.d.ts +2 -2
- package/types/product/ProviderLogo.d.ts.map +1 -1
- package/types/product/Reorder.d.ts +1 -1
- package/types/product/Reorder.d.ts.map +1 -1
- package/types/product/SelectMenu.d.ts +1 -1
- package/types/product/SelectMenu.d.ts.map +1 -1
- package/types/product/SlideOver.d.ts +1 -1
- package/types/product/SlideOver.d.ts.map +1 -1
- package/types/product/StatusTag.d.ts +1 -1
- package/types/product/StatusTag.d.ts.map +1 -1
- package/types/product/ThemeToggle.d.ts +1 -1
- package/types/product/ThemeToggle.d.ts.map +1 -1
- package/types/product/Toast.d.ts +1 -1
- package/types/product/Toast.d.ts.map +1 -1
- package/types/product/index.d.ts +4 -2
- package/types/product/index.d.ts.map +1 -1
- package/types/product/scope.d.ts +56 -0
- package/types/product/scope.d.ts.map +1 -0
- package/types/usage.d.ts +2 -0
- package/types/usage.d.ts.map +1 -0
- package/types/wallet.d.ts +2 -0
- package/types/wallet.d.ts.map +1 -0
- package/src/product/social/CampaignCard.tsx +0 -62
- package/src/product/social/ChannelBadge.tsx +0 -60
- package/src/product/social/PostCard.tsx +0 -80
- package/src/product/social/index.ts +0 -6
- package/src/product/usage/UsageDashboard.tsx +0 -54
- package/src/product/usage/UsageMeter.tsx +0 -75
- package/src/product/usage/UsageProviderCard.tsx +0 -153
- package/src/product/usage/index.ts +0 -10
- package/types/product/social/CampaignCard.d.ts +0 -14
- package/types/product/social/CampaignCard.d.ts.map +0 -1
- package/types/product/social/ChannelBadge.d.ts +0 -7
- package/types/product/social/ChannelBadge.d.ts.map +0 -1
- package/types/product/social/PostCard.d.ts +0 -16
- package/types/product/social/PostCard.d.ts.map +0 -1
- package/types/product/social/index.d.ts +0 -4
- package/types/product/social/index.d.ts.map +0 -1
- package/types/product/usage/UsageDashboard.d.ts +0 -10
- package/types/product/usage/UsageDashboard.d.ts.map +0 -1
- package/types/product/usage/UsageMeter.d.ts +0 -15
- package/types/product/usage/UsageMeter.d.ts.map +0 -1
- package/types/product/usage/UsageProviderCard.d.ts +0 -35
- package/types/product/usage/UsageProviderCard.d.ts.map +0 -1
- package/types/product/usage/index.d.ts +0 -4
- package/types/product/usage/index.d.ts.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Usage meter — the ONE labeled rate-limit bar every Hanzo app renders for an AI
|
|
5
|
-
* quota (session / weekly / a custom window). A thin track + tone-by-value fill
|
|
6
|
-
* (green calm → amber → red hot, the same `utilColor` semantics as the console's
|
|
7
|
-
* `UtilBar`), a "% left" read-out, and an honest reset countdown ("resets in 2h
|
|
8
|
-
* 14m") computed from a real `resetsAt` — never a fabricated number.
|
|
9
|
-
*
|
|
10
|
-
* Built only from @hanzo/gui primitives (the nested-YStack track/fill is the house
|
|
11
|
-
* bar idiom from `Charts.BarRows`), so it themes to the shell and works web +
|
|
12
|
-
* native + desktop. No DOM APIs: `Date` only.
|
|
13
|
-
*/
|
|
14
|
-
import { Text, XStack, YStack } from '@hanzo/gui'
|
|
15
|
-
|
|
16
|
-
import { utilColor } from '../Metric'
|
|
17
|
-
|
|
18
|
-
/** A single quota window: how much is spent (0–100) and when it refills. */
|
|
19
|
-
export type UsageWindow = {
|
|
20
|
-
usedPercent: number
|
|
21
|
-
/** ISO string or Date the window resets — drives the honest countdown. */
|
|
22
|
-
resetsAt?: string | Date
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** "resets in 2h 14m" from a real reset time, or null when there is none/past. */
|
|
26
|
-
export function resetCountdown(resetsAt?: string | Date): string | null {
|
|
27
|
-
if (resetsAt == null) return null
|
|
28
|
-
const t = typeof resetsAt === 'string' ? Date.parse(resetsAt) : resetsAt.getTime()
|
|
29
|
-
if (!Number.isFinite(t)) return null
|
|
30
|
-
const mins = Math.floor((t - Date.now()) / 60000)
|
|
31
|
-
if (mins <= 0) return 'resets now'
|
|
32
|
-
const d = Math.floor(mins / 1440)
|
|
33
|
-
const h = Math.floor((mins % 1440) / 60)
|
|
34
|
-
const m = mins % 60
|
|
35
|
-
if (d > 0) return `resets in ${d}d ${h}h`
|
|
36
|
-
if (h > 0) return `resets in ${h}h ${m}m`
|
|
37
|
-
return `resets in ${m}m`
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function UsageMeter({
|
|
41
|
-
label,
|
|
42
|
-
usedPercent,
|
|
43
|
-
resetsAt,
|
|
44
|
-
compact,
|
|
45
|
-
}: {
|
|
46
|
-
label: string
|
|
47
|
-
usedPercent: number
|
|
48
|
-
resetsAt?: string | Date
|
|
49
|
-
compact?: boolean
|
|
50
|
-
}) {
|
|
51
|
-
const used = Math.max(0, Math.min(100, usedPercent))
|
|
52
|
-
const left = Math.round(100 - used)
|
|
53
|
-
const reset = resetCountdown(resetsAt)
|
|
54
|
-
const h = compact ? 6 : 8
|
|
55
|
-
return (
|
|
56
|
-
<YStack gap={compact ? '$1' : '$1.5'}>
|
|
57
|
-
<XStack items="center" justify="space-between" gap="$2">
|
|
58
|
-
<Text fontSize="$2" color="$color11" numberOfLines={1} flex={1}>
|
|
59
|
-
{label}
|
|
60
|
-
</Text>
|
|
61
|
-
<Text fontSize="$2" color="$color12" fontWeight="600">
|
|
62
|
-
{left}% left
|
|
63
|
-
</Text>
|
|
64
|
-
</XStack>
|
|
65
|
-
<YStack height={h} bg="$color3" rounded="$2" overflow="hidden">
|
|
66
|
-
<YStack height={h} width={`${Math.max(2, used)}%`} bg={utilColor(used) as never} rounded="$2" />
|
|
67
|
-
</YStack>
|
|
68
|
-
{reset && !compact ? (
|
|
69
|
-
<Text fontSize="$1" color="$color10">
|
|
70
|
-
{reset}
|
|
71
|
-
</Text>
|
|
72
|
-
) : null}
|
|
73
|
-
</YStack>
|
|
74
|
-
)
|
|
75
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Usage provider card — one AI provider's quota at a glance, mirroring the Codex
|
|
5
|
-
* menu card: a session bar, a weekly bar, any extra windows, credits/spend, and a
|
|
6
|
-
* used-% history Sparkline. Composes `UsageMeter` rows + the canonical
|
|
7
|
-
* `Charts.Sparkline` + `Metric` idioms; nothing is fabricated (a missing window
|
|
8
|
-
* renders no row, a <2-point history renders no spark, `error`/`sourceLabel`/
|
|
9
|
-
* `updatedAt` surface honest provenance).
|
|
10
|
-
*
|
|
11
|
-
* @hanzo/gui primitives only — themes to the shell, works web + native + desktop.
|
|
12
|
-
*/
|
|
13
|
-
import { Card, Text, XStack, YStack } from '@hanzo/gui'
|
|
14
|
-
|
|
15
|
-
import { Sparkline } from '../Charts'
|
|
16
|
-
import { UsageMeter, type UsageWindow } from './UsageMeter'
|
|
17
|
-
|
|
18
|
-
/** Format a monetary amount; falls back to "12.34 USD" where Intl currency is absent. */
|
|
19
|
-
export function formatUsageCurrency(value: number, currencyCode: string): string {
|
|
20
|
-
try {
|
|
21
|
-
return new Intl.NumberFormat(undefined, { style: 'currency', currency: currencyCode, maximumFractionDigits: 2 }).format(value)
|
|
22
|
-
} catch {
|
|
23
|
-
return `${value.toFixed(2)} ${currencyCode}`
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/** Compact count (1.2K / 3.4M / 5.6B) for token/request totals. */
|
|
28
|
-
export function formatUsageCount(n: number): string {
|
|
29
|
-
if (!Number.isFinite(n)) return '—'
|
|
30
|
-
const abs = Math.abs(n)
|
|
31
|
-
if (abs >= 1e9) return `${(n / 1e9).toFixed(1)}B`
|
|
32
|
-
if (abs >= 1e6) return `${(n / 1e6).toFixed(1)}M`
|
|
33
|
-
if (abs >= 1e3) return `${(n / 1e3).toFixed(1)}K`
|
|
34
|
-
return String(Math.round(n))
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** "updated 2m ago" from a real timestamp, or null when there is none. */
|
|
38
|
-
function updatedLabel(t?: string | Date): string | null {
|
|
39
|
-
if (t == null) return null
|
|
40
|
-
const ms = typeof t === 'string' ? Date.parse(t) : t.getTime()
|
|
41
|
-
if (!Number.isFinite(ms)) return null
|
|
42
|
-
const mins = Math.floor((Date.now() - ms) / 60000)
|
|
43
|
-
if (mins < 1) return 'updated just now'
|
|
44
|
-
if (mins < 60) return `updated ${mins}m ago`
|
|
45
|
-
const h = Math.floor(mins / 60)
|
|
46
|
-
if (h < 24) return `updated ${h}h ago`
|
|
47
|
-
return `updated ${Math.floor(h / 24)}d ago`
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export type UsageProviderCardProps = {
|
|
51
|
-
name: string
|
|
52
|
-
/** Accent dot color (hex/rgb) — the provider's brand mark. */
|
|
53
|
-
color?: string
|
|
54
|
-
/** Plan/tier badge (e.g. "Pro", "Team"). */
|
|
55
|
-
plan?: string
|
|
56
|
-
session?: UsageWindow
|
|
57
|
-
weekly?: UsageWindow
|
|
58
|
-
/** Additional named windows (e.g. per-model or per-tool quotas). */
|
|
59
|
-
extras?: Array<{ id: string; title: string; usedPercent: number; resetsAt?: string | Date }>
|
|
60
|
-
spend?: { used: number; limit?: number; currencyCode: string }
|
|
61
|
-
/** Used-% samples over time — drawn with the canonical Sparkline. */
|
|
62
|
-
history?: number[]
|
|
63
|
-
/** An honest load/refresh error for this provider. */
|
|
64
|
-
error?: string
|
|
65
|
-
/** Where the numbers came from (e.g. "OAuth", "API key"). */
|
|
66
|
-
sourceLabel?: string
|
|
67
|
-
updatedAt?: string | Date
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function UsageProviderCard({
|
|
71
|
-
name,
|
|
72
|
-
color,
|
|
73
|
-
plan,
|
|
74
|
-
session,
|
|
75
|
-
weekly,
|
|
76
|
-
extras,
|
|
77
|
-
spend,
|
|
78
|
-
history,
|
|
79
|
-
error,
|
|
80
|
-
sourceLabel,
|
|
81
|
-
updatedAt,
|
|
82
|
-
}: UsageProviderCardProps) {
|
|
83
|
-
const updated = updatedLabel(updatedAt)
|
|
84
|
-
return (
|
|
85
|
-
<Card p="$4" gap="$3" borderWidth={1} borderColor="$borderColor" flex={1} minW={260}>
|
|
86
|
-
<XStack items="center" justify="space-between" gap="$2">
|
|
87
|
-
<XStack items="center" gap="$2" flex={1}>
|
|
88
|
-
{color ? <YStack width={10} height={10} rounded="$2" bg={color as never} /> : null}
|
|
89
|
-
<Text fontSize="$4" fontWeight="800" color="$color12" numberOfLines={1}>
|
|
90
|
-
{name}
|
|
91
|
-
</Text>
|
|
92
|
-
</XStack>
|
|
93
|
-
{plan ? (
|
|
94
|
-
<Text fontSize="$1" px="$2" py="$1" rounded="$2" bg="$color3" color="$color11">
|
|
95
|
-
{plan}
|
|
96
|
-
</Text>
|
|
97
|
-
) : null}
|
|
98
|
-
</XStack>
|
|
99
|
-
|
|
100
|
-
{error ? (
|
|
101
|
-
<Text fontSize="$2" color="#e5534b">
|
|
102
|
-
{error}
|
|
103
|
-
</Text>
|
|
104
|
-
) : null}
|
|
105
|
-
|
|
106
|
-
{session ? <UsageMeter label="Session" usedPercent={session.usedPercent} resetsAt={session.resetsAt} /> : null}
|
|
107
|
-
{weekly ? <UsageMeter label="Weekly" usedPercent={weekly.usedPercent} resetsAt={weekly.resetsAt} /> : null}
|
|
108
|
-
{extras?.map((e) => (
|
|
109
|
-
<UsageMeter key={e.id} label={e.title} usedPercent={e.usedPercent} resetsAt={e.resetsAt} />
|
|
110
|
-
))}
|
|
111
|
-
|
|
112
|
-
{spend ? (
|
|
113
|
-
spend.limit != null ? (
|
|
114
|
-
<UsageMeter
|
|
115
|
-
label={`Spend · ${formatUsageCurrency(spend.used, spend.currencyCode)} / ${formatUsageCurrency(spend.limit, spend.currencyCode)}`}
|
|
116
|
-
usedPercent={spend.limit > 0 ? (spend.used / spend.limit) * 100 : 0}
|
|
117
|
-
compact
|
|
118
|
-
/>
|
|
119
|
-
) : (
|
|
120
|
-
<XStack items="center" justify="space-between" gap="$2">
|
|
121
|
-
<Text fontSize="$2" color="$color11">
|
|
122
|
-
Spend
|
|
123
|
-
</Text>
|
|
124
|
-
<Text fontSize="$2" color="$color12" fontWeight="600">
|
|
125
|
-
{formatUsageCurrency(spend.used, spend.currencyCode)}
|
|
126
|
-
</Text>
|
|
127
|
-
</XStack>
|
|
128
|
-
)
|
|
129
|
-
) : null}
|
|
130
|
-
|
|
131
|
-
{history && history.length >= 2 ? (
|
|
132
|
-
<XStack justify="flex-end">
|
|
133
|
-
<Sparkline values={history} />
|
|
134
|
-
</XStack>
|
|
135
|
-
) : null}
|
|
136
|
-
|
|
137
|
-
{sourceLabel || updated ? (
|
|
138
|
-
<XStack items="center" justify="space-between" gap="$2">
|
|
139
|
-
{sourceLabel ? (
|
|
140
|
-
<Text fontSize="$1" color="$color10" numberOfLines={1}>
|
|
141
|
-
{sourceLabel}
|
|
142
|
-
</Text>
|
|
143
|
-
) : null}
|
|
144
|
-
{updated ? (
|
|
145
|
-
<Text fontSize="$1" color="$color10">
|
|
146
|
-
{updated}
|
|
147
|
-
</Text>
|
|
148
|
-
) : null}
|
|
149
|
-
</XStack>
|
|
150
|
-
) : null}
|
|
151
|
-
</Card>
|
|
152
|
-
)
|
|
153
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// @hanzo/ui/product/usage — the shared AI-usage surface (the ONE way every Hanzo
|
|
2
|
-
// app renders quota bars, per-provider cards, and the usage dashboard).
|
|
3
|
-
//
|
|
4
|
-
// UsageMeter (labeled rate-limit bar) → UsageProviderCard (one provider) →
|
|
5
|
-
// UsageDashboard (totals header + provider grid). Presentational, host-agnostic,
|
|
6
|
-
// cross-platform on @hanzo/gui.
|
|
7
|
-
|
|
8
|
-
export * from './UsageMeter'
|
|
9
|
-
export * from './UsageProviderCard'
|
|
10
|
-
export * from './UsageDashboard'
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type Campaign = {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
channel: string;
|
|
5
|
-
status: string;
|
|
6
|
-
objective?: string;
|
|
7
|
-
/** minor units (cents) */
|
|
8
|
-
budget: number;
|
|
9
|
-
spend: number;
|
|
10
|
-
};
|
|
11
|
-
export declare function CampaignCard({ campaign }: {
|
|
12
|
-
campaign: Campaign;
|
|
13
|
-
}): import("react").JSX.Element;
|
|
14
|
-
//# sourceMappingURL=CampaignCard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CampaignCard.d.ts","sourceRoot":"","sources":["../../../src/product/social/CampaignCard.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAID,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,+BAsChE"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type Channel = 'x' | 'facebook' | 'instagram' | 'linkedin' | 'tiktok' | 'youtube' | 'threads';
|
|
2
|
-
export declare function ChannelBadge({ channel, showLabel, size, }: {
|
|
3
|
-
channel: Channel;
|
|
4
|
-
showLabel?: boolean;
|
|
5
|
-
size?: number;
|
|
6
|
-
}): import("react").JSX.Element;
|
|
7
|
-
//# sourceMappingURL=ChannelBadge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelBadge.d.ts","sourceRoot":"","sources":["../../../src/product/social/ChannelBadge.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GACf,GAAG,GACH,UAAU,GACV,WAAW,GACX,UAAU,GACV,QAAQ,GACR,SAAS,GACT,SAAS,CAAA;AAYb,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,SAAiB,EACjB,IAAS,GACV,EAAE;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,+BAuBA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type Channel } from './ChannelBadge';
|
|
2
|
-
export type Post = {
|
|
3
|
-
id: string;
|
|
4
|
-
content: string;
|
|
5
|
-
channel: Channel;
|
|
6
|
-
status: string;
|
|
7
|
-
/** unix seconds; 0/undefined = not scheduled */
|
|
8
|
-
scheduleAt?: number;
|
|
9
|
-
media?: string[];
|
|
10
|
-
};
|
|
11
|
-
export declare function PostCard({ post, onEdit, onDelete, }: {
|
|
12
|
-
post: Post;
|
|
13
|
-
onEdit?: (p: Post) => void;
|
|
14
|
-
onDelete?: (p: Post) => void;
|
|
15
|
-
}): import("react").JSX.Element;
|
|
16
|
-
//# sourceMappingURL=PostCard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PostCard.d.ts","sourceRoot":"","sources":["../../../src/product/social/PostCard.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE3D,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB,CAAA;AAYD,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,MAAM,EACN,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;IAC1B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;CAC7B,+BAuCA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product/social/index.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type UsageProviderCardProps } from './UsageProviderCard';
|
|
2
|
-
export declare function UsageDashboard({ providers, totals, }: {
|
|
3
|
-
providers: UsageProviderCardProps[];
|
|
4
|
-
totals?: {
|
|
5
|
-
spendUSD?: number;
|
|
6
|
-
tokens?: number;
|
|
7
|
-
requests?: number;
|
|
8
|
-
};
|
|
9
|
-
}): import("react").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=UsageDashboard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UsageDashboard.d.ts","sourceRoot":"","sources":["../../../src/product/usage/UsageDashboard.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAqB,KAAK,sBAAsB,EAAyC,MAAM,qBAAqB,CAAA;AAE3H,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,sBAAsB,EAAE,CAAA;IACnC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACnE,+BA8BA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** A single quota window: how much is spent (0–100) and when it refills. */
|
|
2
|
-
export type UsageWindow = {
|
|
3
|
-
usedPercent: number;
|
|
4
|
-
/** ISO string or Date the window resets — drives the honest countdown. */
|
|
5
|
-
resetsAt?: string | Date;
|
|
6
|
-
};
|
|
7
|
-
/** "resets in 2h 14m" from a real reset time, or null when there is none/past. */
|
|
8
|
-
export declare function resetCountdown(resetsAt?: string | Date): string | null;
|
|
9
|
-
export declare function UsageMeter({ label, usedPercent, resetsAt, compact, }: {
|
|
10
|
-
label: string;
|
|
11
|
-
usedPercent: number;
|
|
12
|
-
resetsAt?: string | Date;
|
|
13
|
-
compact?: boolean;
|
|
14
|
-
}): import("react").JSX.Element;
|
|
15
|
-
//# sourceMappingURL=UsageMeter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UsageMeter.d.ts","sourceRoot":"","sources":["../../../src/product/usage/UsageMeter.tsx"],"names":[],"mappings":"AAiBA,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAYtE;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,GACR,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,+BAyBA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type UsageWindow } from './UsageMeter';
|
|
2
|
-
/** Format a monetary amount; falls back to "12.34 USD" where Intl currency is absent. */
|
|
3
|
-
export declare function formatUsageCurrency(value: number, currencyCode: string): string;
|
|
4
|
-
/** Compact count (1.2K / 3.4M / 5.6B) for token/request totals. */
|
|
5
|
-
export declare function formatUsageCount(n: number): string;
|
|
6
|
-
export type UsageProviderCardProps = {
|
|
7
|
-
name: string;
|
|
8
|
-
/** Accent dot color (hex/rgb) — the provider's brand mark. */
|
|
9
|
-
color?: string;
|
|
10
|
-
/** Plan/tier badge (e.g. "Pro", "Team"). */
|
|
11
|
-
plan?: string;
|
|
12
|
-
session?: UsageWindow;
|
|
13
|
-
weekly?: UsageWindow;
|
|
14
|
-
/** Additional named windows (e.g. per-model or per-tool quotas). */
|
|
15
|
-
extras?: Array<{
|
|
16
|
-
id: string;
|
|
17
|
-
title: string;
|
|
18
|
-
usedPercent: number;
|
|
19
|
-
resetsAt?: string | Date;
|
|
20
|
-
}>;
|
|
21
|
-
spend?: {
|
|
22
|
-
used: number;
|
|
23
|
-
limit?: number;
|
|
24
|
-
currencyCode: string;
|
|
25
|
-
};
|
|
26
|
-
/** Used-% samples over time — drawn with the canonical Sparkline. */
|
|
27
|
-
history?: number[];
|
|
28
|
-
/** An honest load/refresh error for this provider. */
|
|
29
|
-
error?: string;
|
|
30
|
-
/** Where the numbers came from (e.g. "OAuth", "API key"). */
|
|
31
|
-
sourceLabel?: string;
|
|
32
|
-
updatedAt?: string | Date;
|
|
33
|
-
};
|
|
34
|
-
export declare function UsageProviderCard({ name, color, plan, session, weekly, extras, spend, history, error, sourceLabel, updatedAt, }: UsageProviderCardProps): import("react").JSX.Element;
|
|
35
|
-
//# sourceMappingURL=UsageProviderCard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UsageProviderCard.d.ts","sourceRoot":"","sources":["../../../src/product/usage/UsageProviderCard.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAE3D,yFAAyF;AACzF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAM/E;AAED,mEAAmE;AACnE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAOlD;AAeD,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,oEAAoE;IACpE,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;IAC5F,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9D,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACP,KAAK,EACL,WAAW,EACX,SAAS,GACV,EAAE,sBAAsB,+BAuExB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product/usage/index.ts"],"names":[],"mappings":"AAOA,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|