"use client"; import { ArrowRight, Info, Sparkles } from "lucide-react"; import posthog from "posthog-js"; import { useCallback } from "react"; const DEFAULT_SIGNUP_URL = "https://dashboard.operations.copilotkit.ai/"; const SIGNUP_URL = process.env.NEXT_PUBLIC_INTELLIGENCE_SIGNUP_URL || DEFAULT_SIGNUP_URL; export type OpsPlatformCTAVariant = "tile" | "inline" | "card" | "info"; export interface OpsPlatformCTAProps { /** Visual style: tile = full-width hero, inline = mid-page callout, card = footer */ variant?: OpsPlatformCTAVariant; /** Headline shown to the user */ title: string; /** Body copy under the headline */ body?: string; /** Stable identifier for analytics, e.g. "docs:langgraph/quickstart:whats-next" */ surface: string; /** Optional override for the link label. Defaults to "Get Intelligence free" */ ctaLabel?: string; /** Optional className override for the outermost element */ className?: string; } function buildHref(surface: string): string { const url = new URL(SIGNUP_URL); url.searchParams.set("utm_source", "docs"); url.searchParams.set("utm_medium", "cta"); url.searchParams.set("utm_campaign", "intelligence"); url.searchParams.set("utm_content", surface); return url.toString(); } export function OpsPlatformCTA({ variant = "card", title, body, surface, ctaLabel = "Get Intelligence free", className, }: OpsPlatformCTAProps) { const handleClick = useCallback(() => { try { posthog.capture("try_for_free_clicked", { location: surface }); } catch { // PostHog may be blocked by ad blockers — never let analytics block navigation. } }, [surface]); const href = buildHref(surface); if (variant === "info") { return (
{title}
{body ? (
{body}
) : null} {ctaLabel}
); } if (variant === "inline") { return (
{title}
{body ? (
{body}
) : null}
{ctaLabel}
); } if (variant === "tile") { return (
{title}
{body ? (
{body}
) : null}
); } // variant === "card" (default) return (
{title}
{body ? (
{body}
) : null}
{ctaLabel}
); }