import type { ReactNode } from 'react'; import { AddonEnablePanel } from './AddonEnablePanel'; import { FeaturePreviewSkeleton } from './FeaturePreviewSkeleton'; import { PlanUpgradeOverlay } from './PlanUpgradeOverlay'; import { PREMIUM_GATE_VIEWPORT_MIN_H, PremiumGatedSurface } from './PremiumGatedSurface'; import { __ } from '../lib/i18n'; import { sikshyaPricingUrl } from '../lib/upgradeUrl'; import type { GatedWorkspaceMode, SikshyaReactConfig } from '../types'; type PreviewVariant = 'form' | 'table' | 'cards' | 'generic'; type Props = { mode: GatedWorkspaceMode; featureId: string; config: SikshyaReactConfig; featureTitle: string; featureDescription: string; previewVariant?: PreviewVariant; renderPreview?: () => ReactNode; addonEnableTitle: string; addonEnableDescription: string; canEnable: boolean; enableBusy: boolean; onEnable: () => Promise; addonError?: unknown; children: ReactNode; }; /** * Single wrapper for gated admin pages (plan lock vs addon off vs full). * @see docs/AI_ADDON_PREMIUM_UX_IMPLEMENTATION_BLUEPRINT.md Part D.2 */ export function GatedFeatureWorkspace(props: Props) { const { mode, featureId, config, featureTitle, featureDescription, previewVariant, renderPreview, addonEnableTitle, addonEnableDescription, canEnable, enableBusy, onEnable, addonError, children, } = props; if (mode === 'full') { return <>{children}; } // Always route the addon-off "Upgrade" CTA to the canonical Sikshya LMS // pricing page with UTM tracking. Carrying the featureId in utm_term lets // mantrabrain.com analytics attribute clicks back to the specific feature // gate that triggered them. const upgradeUrl = sikshyaPricingUrl('addon-enable-upgrade', featureId); return (
{renderPreview ? renderPreview() : }
{mode === 'locked-plan' ? ( ) : null} {mode === 'addon-off' ? ( ) : null} {mode === 'pending-addon' ? (
{__('Loading add-on status…', 'sikshya')}
) : null}
); }