mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-20 20:07:34 +00:00
backup/dbc-ui-feat-commerce-metering-client
The TypeScript counterpart of github.com/hanzoai/go-sdk/metering — the one way every Hanzo product meters usage to commerce (the billing source of truth) so everything can be paid for, not just the LLM/cloud path. Shares an identical wire contract with the Go client. - Metering class composes the existing Commerce client (no HTTP dup): authorize() pre-request balance gate (fail-closed by default; 402 vs 503), record() post-request usage write. tierAware gates on effectiveAvailable (prepaid + included plan allotment). - S2S auth: Authorization: Bearer COMMERCE_SERVICE_TOKEN (KMS-sourced) + X-IAM-Org-Id. Metering.fromEnv() for canonical env wiring. - identityFromHeaders(): reads gateway-minted X-User-Id/X-Org-Id. - client.ts: getTier() + custom-headers support on request/getBalance/ addUsageRecord (DRY enablers for the S2S org header). - 14 contract tests (mock fetch) mirroring the Go suite; isolated tsc clean. - exports: ./metering ; index re-exports ; version 7.6.1 -> 7.6.2. Refs universe task #28.
@hanzo/ui
Accessible and customizable components for React, Vue, Svelte, and React Native. Built on shadcn/ui with multi-framework support, 3D components, AI components, and advanced features.
Features
- 161+ Components - 3x more than shadcn/ui
- Multi-Framework - React, Vue, Svelte, React Native
- Two Themes - Default & New York variants
- AI Components - Chat, assistants, playground
- 3D Components - Interactive 3D elements
- Animations - Advanced motion components
- Page Builder - Visual drag-drop interface
- White-Label - Fork and rebrand easily
- Blocks - 24+ production-ready templates
- Accessible - Built with Radix UI primitives
- Customizable - Tailwind CSS powered
- TypeScript - Fully typed
Quick Start
Installation
npm install @hanzo/ui
# or
pnpm add @hanzo/ui
Usage
import { Button, Card, Input } from '@hanzo/ui'
export function App() {
return (
<Card>
<Card.Header>
<Card.Title>Welcome</Card.Title>
</Card.Header>
<Card.Content>
<Input placeholder="Enter text..." />
</Card.Content>
<Card.Footer>
<Button>Submit</Button>
</Card.Footer>
</Card>
)
}
Documentation
Visit ui.hanzo.ai for full docs.
CLI
npx @hanzo/ui add button
npx @hanzo/ui add card dialog
Packages
@hanzo/ui- Main UI library (161 components)@hanzo/auth- Authentication components@hanzo/commerce- E-commerce components@hanzo/brand- Branding system
Development
git clone https://github.com/hanzoai/ui.git
cd ui
pnpm install
pnpm dev
Contributing
Please read the contributing guide.
License
MIT - See LICENSE.md for details.
Built by Hanzo
Languages
TypeScript
84.3%
MDX
11.7%
JavaScript
2.2%
HTML
0.9%
CSS
0.8%
