import React from "react"; import { cn } from "../hooks"; // Version info for dial-cli package (injected at build time) declare const __DIAL_VERSION__: string; declare const __DIAL_PACKAGE_NAME__: string; declare const __DIAL_GIT_HASH__: string; const DIAL_PACKAGE_NAME = typeof __DIAL_PACKAGE_NAME__ !== "undefined" ? __DIAL_PACKAGE_NAME__ : "@vuer-ai/dial-cli"; const DIAL_PACKAGE_VERSION = typeof __DIAL_VERSION__ !== "undefined" ? __DIAL_VERSION__ : "dev"; const DIAL_GIT_HASH = typeof __DIAL_GIT_HASH__ !== "undefined" ? __DIAL_GIT_HASH__ : "unknown"; interface DialBadgeProps { /** * Additional CSS classes to apply to the badge */ className?: string; /** * Whether to show the package name */ package?: boolean; /** * Whether to show just the version or include "v" prefix */ prefix?: boolean; /** * Whether the badge should be clickable (links to npm) */ linkable?: boolean; /** * Whether to show the version */ version?: boolean; /** * Whether to show the git hash instead of version */ hash?: boolean; } /** * Badge component that displays the dial-cli package version or git hash * Format: [ dial-cli | v0.0.11 ] or [ dial-cli | abc1234 ] */ function DialBadge({ className, package: showPackage = true, prefix = true, linkable = true, version = true, hash = false, }: DialBadgeProps) { const packageShortName = "dial-cli"; const displayValue = hash ? DIAL_GIT_HASH : DIAL_PACKAGE_VERSION; const versionText = version || hash ? (prefix && !hash ? `v${displayValue}` : displayValue) : undefined; const npmUrl = `https://www.npmjs.com/package/${DIAL_PACKAGE_NAME}/v/${DIAL_PACKAGE_VERSION}`; return (