import { useId } from 'react'; import { appViewHref } from '../lib/appUrl'; import { getCatalogEntry, getLicensing, requiredPlanLabelForFeature } from '../lib/licensing'; import type { SikshyaReactConfig } from '../types'; import { PREMIUM_LOCK_CARD_CLASS, PremiumGatedSurface } from './PremiumGatedSurface'; type Props = { config: SikshyaReactConfig; featureId: string; /** Used when the catalog row is missing */ featureTitle: string; description: string; }; function sellingBullets(fullDescription: string): [string, string] { const cleaned = fullDescription.trim(); const sentences = cleaned .split(/(?<=[.!?])\s+/) .map((s) => s.trim()) .filter((s) => s.length > 8); if (sentences.length >= 2) { return [sentences[0], sentences[1]]; } if (sentences.length === 1) { return [ sentences[0], 'Upgrade to the right plan to turn this on for your site—no guesswork.', ]; } return [ 'This capability is part of the Pro add-on—unlock it when your plan includes it.', 'Compare plans and upgrade in one click. You can also enable modules from Addons after upgrading.', ]; } /** * Plan-gate overlay: full-bleed premium surface, conversion-focused copy, dialog semantics. * @see docs/AI_ADDON_PREMIUM_UX_IMPLEMENTATION_BLUEPRINT.md Part D */ export function PlanUpgradeOverlay(props: Props) { const { config, featureId, featureTitle, description } = props; const lic = getLicensing(config); const brandName = config.branding?.pluginName?.trim() || 'Sikshya'; const entry = getCatalogEntry(config, featureId); const title = entry?.label || featureTitle; const body = (entry?.description && entry.description.trim()) || description; const plan = requiredPlanLabelForFeature(config, featureId); const upgradeHref = config.brandLinks?.upgradeUrl || lic?.upgradeUrl || 'https://mantrabrain.com/plugins/sikshya/#pricing'; const titleId = useId(); const descId = useId(); const [bulletA, bulletB] = sellingBullets(body); return (
{brandName} Pro

Included on {plan} plan

Unlock {title}

{body}

  • {bulletA}
  • {bulletB}

You’re seeing a preview of this screen. Upgrade your plan to activate this feature—your data stays safe and nothing changes until you’re ready.

); }