mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-21 03:15:19 +00:00
Squash merge of shadcn-ui/ui main branch into hanzo/ui, bringing in: - [email protected] through [email protected] releases - New apps/v4 directory structure - Registry system improvements and MCP server - Framework support (Vue, Svelte, React Native) - New templates (vite-app, monorepo-next, laravel) - Zod 4 compatibility (scoped override for zod@>4) - Test fixture corrections for alias resolution All 867 merge conflicts resolved preserving Hanzo customizations. 1020/1020 shadcn tests pass.
41 lines
914 B
TypeScript
41 lines
914 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",
|
|
"enable_lift_mode",
|
|
"copy_chart_code",
|
|
"copy_chart_theme",
|
|
"copy_chart_data",
|
|
"copy_color",
|
|
]),
|
|
// 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
|
|
)
|
|
}
|
|
}
|