import { type ReactNode, useState } from 'react'; import { ShipWheel } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { useLicense } from '@/context/LicenseContext'; interface AdmiralGateProps { children: ReactNode; featureName?: string; // Inline compact lock for list items (e.g. a single SSO provider card). Skips // the full-page upsell and dismiss timer; always renders the blurred + pill style. compact?: boolean; } const DISMISS_KEY = 'sencho-admiral-upgrade-prompt-dismissed'; const DISMISS_DURATION_MS = 24 * 60 * 60 * 1000; // 24 hours function isDismissedFromStorage(): boolean { const dismissedAt = localStorage.getItem(DISMISS_KEY); return !!dismissedAt && Date.now() - parseInt(dismissedAt, 10) < DISMISS_DURATION_MS; } export function AdmiralGate({ children, featureName = 'This feature', compact = false }: AdmiralGateProps) { const { isPaid, license } = useLicense(); const [dismissed, setDismissed] = useState(isDismissedFromStorage); if (isPaid && license?.variant === 'admiral') return <>{children}; if (compact || dismissed) { return (
{children}
Upgrade to Admiral to unlock
); } return (

{featureName} requires Sencho Admiral

Unlock team features like LDAP / Active Directory, audit logging, API tokens, and unlimited user accounts with a Sencho Admiral license. For enterprise pricing or questions, contact{' '} licensing@sencho.io.

); }