{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "lifetime-deal-card",
  "title": "Lifetime Deal Card",
  "description": "A one-time-payment offer card: licence tiers, a struck-through price, a live countdown, spots left, a pays-for-itself line and a guarantee, with a soft glow to make it feel like an event.",
  "dependencies": [
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/lifetime-deal-card/lifetime-deal-card.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type LifetimeDealTheme = \"dark\" | \"light\";\n\nexport interface LifetimeTier {\n  label: string;\n  /** What this tier covers, e.g. \"3 workspaces\". */\n  covers: string;\n  price: number;\n  /** Normal price, shown struck through. */\n  was: number;\n}\n\nexport interface LifetimeDealCardProps extends Omit<\n  React.ComponentPropsWithoutRef<\"div\">,\n  \"title\"\n> {\n  theme?: LifetimeDealTheme;\n  eyebrow?: string;\n  title?: string;\n  tiers?: LifetimeTier[];\n  features?: string[];\n  /** What the same thing costs monthly, for the pays-for-itself line. */\n  monthlyPrice?: number;\n  /** When the deal ends (ISO date). Leave it out for a rolling window from page load. */\n  endsAt?: string;\n  /** Length of the rolling window, in hours. */\n  windowHours?: number;\n  /** Licences on offer, and how many are left. */\n  totalSpots?: number;\n  spotsLeft?: number;\n  guarantee?: string;\n  currency?: string;\n  ctaLabel?: string;\n  onBuy?: (tier: LifetimeTier) => void;\n}\n\nconst PALETTES = {\n  dark: {\n    card: \"#0E0E0E\",\n    border: \"rgba(255,255,255,0.1)\",\n    text: \"#F4F5F7\",\n    sub: \"rgba(255,255,255,0.58)\",\n    faint: \"rgba(255,255,255,0.36)\",\n    chip: \"rgba(255,255,255,0.06)\",\n    tile: \"#17181B\",\n    accent: \"#F2C14E\",\n    accentText: \"#2B1F00\",\n    glow: \"rgba(242,193,78,0.16)\",\n    btn: \"#F2C14E\",\n    btnText: \"#2B1F00\",\n    tick: \"#87FFE3\",\n  },\n  light: {\n    card: \"#FFFFFF\",\n    border: \"rgba(0,0,0,0.09)\",\n    text: \"#111317\",\n    sub: \"rgba(17,19,23,0.6)\",\n    faint: \"rgba(17,19,23,0.42)\",\n    chip: \"rgba(17,19,23,0.05)\",\n    tile: \"#F4F3EF\",\n    accent: \"#B7791F\",\n    accentText: \"#FFFFFF\",\n    glow: \"rgba(183,121,31,0.1)\",\n    btn: \"#111317\",\n    btnText: \"#FFFFFF\",\n    tick: \"#0E9F80\",\n  },\n};\n\nconst DEFAULT_TIERS: LifetimeTier[] = [\n  { label: \"Solo\", covers: \"1 workspace\", price: 59, was: 348 },\n  { label: \"Team\", covers: \"5 workspaces\", price: 149, was: 1188 },\n  { label: \"Agency\", covers: \"25 workspaces\", price: 299, was: 3588 },\n];\nconst DEFAULT_FEATURES = [\n  \"All future updates included\",\n  \"Unlimited projects and exports\",\n  \"Priority email support\",\n  \"No monthly fees, ever\",\n];\n\nexport function LifetimeDealCard({\n  theme = \"dark\",\n  eyebrow = \"Lifetime deal\",\n  title = \"Pay once. Keep it forever.\",\n  tiers = DEFAULT_TIERS,\n  features = DEFAULT_FEATURES,\n  monthlyPrice = 29,\n  endsAt,\n  windowHours = 71,\n  totalSpots = 500,\n  spotsLeft = 83,\n  guarantee = \"60-day money-back guarantee\",\n  currency = \"$\",\n  ctaLabel = \"Get lifetime access\",\n  onBuy,\n  className,\n  style,\n  ...props\n}: LifetimeDealCardProps) {\n  const pal = PALETTES[theme];\n  const groupRef = React.useRef<HTMLDivElement>(null);\n  const [index, setIndex] = React.useState(0);\n  // Null until mounted, so the server and first client render agree.\n  const [left, setLeft] = React.useState<number | null>(null);\n  const tier = tiers[index] ?? tiers[0];\n\n  React.useEffect(() => {\n    const end = endsAt\n      ? Date.parse(endsAt)\n      : Date.now() + windowHours * 3600000;\n    const tick = () => setLeft(Math.max(0, end - Date.now()));\n    const first = setTimeout(tick, 0);\n    const id = setInterval(tick, 1000);\n    return () => {\n      clearTimeout(first);\n      clearInterval(id);\n    };\n  }, [endsAt, windowHours]);\n\n  const ended = left === 0;\n  const secs = Math.floor((left ?? 0) / 1000);\n  const parts: [string, number][] = [\n    [\"Days\", Math.floor(secs / 86400)],\n    [\"Hours\", Math.floor(secs / 3600) % 24],\n    [\"Mins\", Math.floor(secs / 60) % 60],\n    [\"Secs\", secs % 60],\n  ];\n  const off = Math.round((1 - tier.price / tier.was) * 100);\n  const months = monthlyPrice ? Math.ceil(tier.price / monthlyPrice) : 0;\n  const claimed = totalSpots\n    ? ((totalSpots - spotsLeft) / totalSpots) * 100\n    : 0;\n\n  const onKey = (e: React.KeyboardEvent) => {\n    const dir =\n      e.key === \"ArrowRight\" || e.key === \"ArrowDown\"\n        ? 1\n        : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\"\n          ? -1\n          : 0;\n    if (!dir) return;\n    e.preventDefault();\n    const next = (index + dir + tiers.length) % tiers.length;\n    setIndex(next);\n    groupRef.current\n      ?.querySelectorAll<HTMLElement>(\"[role=radio]\")\n      [next]?.focus();\n  };\n\n  return (\n    <div\n      className={cn(\n        \"relative w-full overflow-hidden rounded-[24px] p-6 sm:p-8\",\n        className,\n      )}\n      style={{\n        background: pal.card,\n        border: `1px solid ${pal.border}`,\n        color: pal.text,\n        fontFamily: \"Inter, -apple-system, BlinkMacSystemFont, sans-serif\",\n        ...style,\n      }}\n      {...props}\n    >\n      <div\n        aria-hidden=\"true\"\n        className=\"pointer-events-none absolute -top-24 left-1/2 h-56 w-[120%] -translate-x-1/2 rounded-[50%] blur-2xl\"\n        style={{ background: pal.glow }}\n      />\n      <div className=\"relative\">\n        <div className=\"flex items-center justify-between gap-3\">\n          <span\n            className=\"rounded-full px-2.5 py-1 text-[11px] font-semibold tracking-[0.04em] uppercase\"\n            style={{ background: pal.accent, color: pal.accentText }}\n          >\n            {eyebrow}\n          </span>\n          <span\n            className=\"text-[12px] font-medium tabular-nums\"\n            style={{ color: pal.accent }}\n          >\n            −{off}%\n          </span>\n        </div>\n        <h3 className=\"m-0 mt-4 text-[26px] leading-[1.1] font-semibold tracking-[-0.025em]\">\n          {title}\n        </h3>\n\n        <div\n          ref={groupRef}\n          role=\"radiogroup\"\n          aria-label=\"Licence\"\n          onKeyDown={onKey}\n          className=\"mt-4 grid rounded-xl p-1\"\n          style={{\n            gridTemplateColumns: `repeat(${tiers.length}, 1fr)`,\n            background: pal.chip,\n          }}\n        >\n          {tiers.map((t, i) => (\n            <button\n              key={t.label}\n              type=\"button\"\n              role=\"radio\"\n              aria-checked={i === index}\n              tabIndex={i === index ? 0 : -1}\n              onClick={() => setIndex(i)}\n              className=\"cursor-pointer rounded-lg px-2 py-1.5 text-[12.5px] font-medium transition-colors\"\n              style={{\n                background: i === index ? pal.card : \"transparent\",\n                color: i === index ? pal.text : pal.sub,\n                boxShadow: i === index ? \"0 1px 3px rgba(0,0,0,.2)\" : \"none\",\n              }}\n            >\n              {t.label}\n            </button>\n          ))}\n        </div>\n\n        <p className=\"m-0 mt-5 flex items-baseline gap-2.5\">\n          <span\n            key={tier.label}\n            className=\"text-[52px] leading-none font-semibold tracking-[-0.04em] tabular-nums\"\n          >\n            {currency}\n            {tier.price}\n          </span>\n          <s className=\"text-[18px] tabular-nums\" style={{ color: pal.faint }}>\n            {currency}\n            {tier.was.toLocaleString(\"en-US\")}\n          </s>\n          <span className=\"text-[12.5px]\" style={{ color: pal.sub }}>\n            once\n          </span>\n        </p>\n        <p className=\"m-0 mt-1.5 text-[12.5px]\" style={{ color: pal.sub }}>\n          {tier.covers}\n          {months > 0 &&\n            ` · pays for itself in ${months} ${months === 1 ? \"month\" : \"months\"} vs ${currency}${monthlyPrice}/mo`}\n        </p>\n\n        <div\n          className=\"mt-5\"\n          role=\"timer\"\n          aria-label={ended ? \"This deal has ended\" : \"Time left on this deal\"}\n        >\n          {ended ? (\n            <p\n              className=\"m-0 rounded-xl py-3 text-center text-[13px] font-medium\"\n              style={{ background: pal.tile, color: pal.sub }}\n            >\n              This deal has ended\n            </p>\n          ) : (\n            <div className=\"grid grid-cols-4 gap-1.5\">\n              {parts.map(([label, v]) => (\n                <div\n                  key={label}\n                  className=\"rounded-xl py-2 text-center\"\n                  style={{ background: pal.tile }}\n                >\n                  <span className=\"block text-[20px] leading-tight font-semibold tabular-nums\">\n                    {left === null ? \"--\" : String(v).padStart(2, \"0\")}\n                  </span>\n                  <span\n                    className=\"block text-[10px] tracking-[0.06em] uppercase\"\n                    style={{ color: pal.faint }}\n                  >\n                    {label}\n                  </span>\n                </div>\n              ))}\n            </div>\n          )}\n        </div>\n\n        {totalSpots > 0 && (\n          <div className=\"mt-4\">\n            <div className=\"flex justify-between text-[12px] tabular-nums\">\n              <span className=\"font-medium\">\n                {spotsLeft} of {totalSpots} left\n              </span>\n              <span style={{ color: pal.sub }}>\n                {Math.round(claimed)}% claimed\n              </span>\n            </div>\n            <div\n              className=\"mt-1.5 h-1.5 overflow-hidden rounded-full\"\n              style={{ background: pal.chip }}\n            >\n              <div\n                className=\"h-full rounded-full\"\n                style={{ width: `${claimed}%`, background: pal.accent }}\n              />\n            </div>\n          </div>\n        )}\n\n        <ul className=\"m-0 mt-5 grid list-none gap-2 p-0 text-[13px]\">\n          {features.map((f) => (\n            <li key={f} className=\"flex items-start gap-2\">\n              <svg\n                width=\"15\"\n                height=\"15\"\n                viewBox=\"0 0 16 16\"\n                fill=\"none\"\n                stroke={pal.tick}\n                strokeWidth=\"2\"\n                strokeLinecap=\"round\"\n                strokeLinejoin=\"round\"\n                aria-hidden=\"true\"\n                className=\"mt-[2px] shrink-0\"\n              >\n                <path d=\"M3.2 8.4 6.5 11.6 12.8 4.6\" />\n              </svg>\n              {f}\n            </li>\n          ))}\n        </ul>\n\n        <button\n          type=\"button\"\n          disabled={ended}\n          onClick={() => onBuy?.(tier)}\n          className=\"mt-5 w-full cursor-pointer rounded-xl py-3 text-[14px] font-semibold transition-opacity hover:opacity-90 disabled:cursor-default disabled:opacity-40\"\n          style={{ background: pal.btn, color: pal.btnText }}\n        >\n          {ctaLabel}\n        </button>\n        {guarantee && (\n          <p\n            className=\"m-0 mt-2.5 text-center text-[11.5px]\"\n            style={{ color: pal.faint }}\n          >\n            {guarantee}\n          </p>\n        )}\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}