mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-20 22:36:27 +00:00
Major fixes: - Fixed wagmi/Web3 SSR errors by lazy-loading config in Web3Provider - Added SidebarProvider to sidebar-demo components - Added 'use client' to 14 demo files with hooks/state/event handlers - Temporarily disabled force-static on blocks page Build progress: 0 → 258/1035 pages (25%) before hitting /blocks error Remaining issue: - /blocks page has function-passing error during static generation Package versions confirmed: - React 19.2.0 ✅ - Next.js 16.0.0 ✅ - Tailwind CSS 4.1.14 ✅
38 lines
844 B
TypeScript
38 lines
844 B
TypeScript
import va from "@vercel/analytics"
|
|
import { z } from "zod"
|
|
|
|
const eventSchema = z.object({
|
|
name: z.enum([
|
|
"copy_npm_command",
|
|
"copy_usage_import_code",
|
|
"copy_usage_code",
|
|
"copy_primitive_code",
|
|
"copy_theme_code",
|
|
"copy_block_code",
|
|
"copy_chunk_code",
|
|
"copy_color",
|
|
"enable_lift_mode",
|
|
]),
|
|
// declare type AllowedPropertyValues = string | number | boolean | null
|
|
properties: z
|
|
.record(
|
|
z.string(),
|
|
z.union([z.string(), z.number(), z.boolean(), z.null()])
|
|
)
|
|
.optional(),
|
|
})
|
|
|
|
export type Event = z.infer<typeof eventSchema>
|
|
|
|
export function trackEvent(input: Event): void {
|
|
const event = eventSchema.parse(input)
|
|
if (event) {
|
|
va.track(
|
|
event.name,
|
|
event.properties as
|
|
| Record<string, string | number | boolean | null>
|
|
| undefined
|
|
)
|
|
}
|
|
}
|