import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from './dialog'; import { Button } from './button'; import { ProBadge } from './pro-badge'; import { Check, Zap, ExternalLink } from 'lucide-react'; interface UpgradeModalProps { /** Whether the modal is open */ open: boolean; /** Callback when modal should close */ onOpenChange: (open: boolean) => void; /** Feature that triggered the modal */ feature?: string; /** Feature category for contextual benefits */ featureCategory?: 'field_type' | 'module' | 'setting' | 'location_rule' | 'general'; } const proFeatures = [ '14+ Advanced Field Types', 'Query Builder & Saved Queries', 'Listings & Dynamic Output', 'Relations & Connections', 'Import Diff + Rollback', 'AI Assistant', ]; const featureDescriptions: Record = { // Field Types group: 'Group fields let you nest multiple fields as a single object, perfect for structured data.', repeater: 'Repeater fields allow unlimited rows of fields - ideal for galleries, team members, features lists.', wysiwyg: 'Rich text editor with full formatting options for content that needs styling.', gallery: 'Upload and manage multiple images with drag-drop reordering.', datetime: 'Date and time picker for events, schedules, and time-sensitive content.', time: 'Time-only picker for schedules and operating hours.', color: 'Color picker with transparency support for design-focused content.', relationship: 'Connect posts to other posts - perfect for related content, authors, and more.', taxonomy_picker: 'Select taxonomy terms with tree view for hierarchical data.', user_picker: 'Select users for author attribution, team assignments, and permissions.', // Modules query_builder: 'Build and save complex queries with filters, ordering, and macros.', listings: 'Create dynamic listing templates to display your content beautifully.', relations: 'Define relationships between content types for connected data.', visibility: 'Show or hide content based on user roles, login status, and more.', admin_columns: 'Customize admin list columns to see important data at a glance.', admin_filters: 'Filter admin lists by custom fields and taxonomies.', // Settings conditional_logic: 'Show or hide fields based on other field values.', regex_validation: 'Advanced pattern validation for precise data control.', // Default default: 'Unlock this feature and many more with Rox Dynamic CPT Fields Engine Pro.', }; /** * UpgradeModal - Shows when Free user clicks on Pro feature * * Features: * - Contextual description based on clicked feature * - List of Pro benefits * - Upgrade CTA * - Close option */ export function UpgradeModal({ open, onOpenChange, feature, featureCategory = 'general', }: UpgradeModalProps) { const featureKey = feature?.toLowerCase().replace(/\s+/g, '_') || 'default'; const description = featureDescriptions[featureKey] || featureDescriptions.default; const getTitle = () => { if (!feature) return 'Upgrade to Pro'; switch (featureCategory) { case 'field_type': return `${feature} is a Pro Field`; case 'module': return `${feature} is a Pro Module`; case 'setting': return `${feature} is a Pro Feature`; case 'location_rule': return `${feature} is a Pro Location Rule`; default: return `${feature} requires Pro`; } }; // Get upgrade URL from global settings or use default const upgradeUrl = (window as any).rdcfeSettings?.upgradeUrl || 'https://wpmet.com/plugin/dynamic-engine/'; return (
{getTitle()}
{description}

Unlock with Pro:

    {proFeatures.map((feature) => (
  • {feature}
  • ))}
); } export default UpgradeModal;