"use client"; import { useEffect, useRef } from "react"; import Link from "next/link"; import { Button } from "@/components/ui"; export function UpgradePrompt({ open, title = "ارتقا لازم است", message, requiredPlan, requiredCapability, requiredBundle, onClose, billingHref = "/billing", }: { open: boolean; title?: string; message?: string; requiredPlan?: string | null; requiredCapability?: string | null; requiredBundle?: string | null; onClose?: () => void; billingHref?: string; }) { const closeRef = useRef(null); useEffect(() => { if (!open) return; closeRef.current?.focus(); const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") onClose?.(); }; window.addEventListener("keydown", onKey); return () => window.removeEventListener("keydown", onKey); }, [open, onClose]); if (!open) return null; return (
onClose?.()} >
e.stopPropagation()} >

{title}

{message || "این قابلیت در پلن فعلی یا دوره آزمایشی محدود شده است."}

    {requiredPlan ? (
  • پلن لازم: {requiredPlan}
  • ) : null} {requiredCapability ? (
  • قابلیت لازم:{" "} {requiredCapability}
  • ) : null} {requiredBundle ? (
  • باندل لازم:{" "} {requiredBundle}
  • ) : null}

مسیر ارتقا: Billing → انتخاب پلن → فعال‌سازی

{onClose ? ( ) : null}
); }