import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Checkbox } from "@/components/ui/checkbox" import { Label } from "@/components/ui/label" import { Badge } from "@/components/ui/badge" import { Textarea } from "@/components/ui/textarea" import { usePro } from "@/contexts/pro-context" import { ProIndicator } from "@/components/pro/pro-indicator" import { RecaptchaState, RecaptchaLocation, recaptchaLocations, recaptchaThemes, recaptchaSizes, RecaptchaTheme, RecaptchaSize, captchaRoleOptions, } from "../../config" interface SettingsTabProps { settings: RecaptchaState toggleLocation: (locationId: RecaptchaLocation) => void toggleBypassRole: (role: string) => void updateSettings: (key: K, value: RecaptchaState[K]) => void } export function SettingsTab({ settings, toggleLocation, toggleBypassRole, updateSettings }: SettingsTabProps) { const { isPro } = usePro() // Free locations are always shown const freeLocations = recaptchaLocations.filter(loc => !loc.isPro) // Pro locations only shown to Pro users const proLocations = recaptchaLocations.filter(loc => loc.isPro) return (
{/* Left Column - Protected Pages */}
{/* Protected Pages - Free Locations */} Protected Pages Select which pages should be protected by reCAPTCHA
{freeLocations.map((location) => { const locationKey = location.id as RecaptchaLocation const isChecked = settings.locations[locationKey] || false return (
toggleLocation(locationKey)} > toggleLocation(locationKey)} className="mt-0.5" />
{location.requiresWooCommerce && ( WooCommerce )}

{location.description}

) })}
{/* Pro Locations — hidden entirely for Free users */} {isPro && ( Additional Locations Protect more forms with reCAPTCHA
{proLocations.map((location) => { const locationKey = location.id as RecaptchaLocation const isChecked = settings.locations[locationKey] || false return (
toggleLocation(locationKey)} > toggleLocation(locationKey)} className="mt-0.5" />
{location.requiresWooCommerce && ( WooCommerce )}

{location.description}

) })}
)}
{/* Right Column — Pro-only sections hidden entirely for Free users */} {isPro && (
{/* Appearance Settings */} Appearance Customize the look of your reCAPTCHA widget {/* Theme Selection */}
{recaptchaThemes.map((theme) => { const isSelected = settings.theme === theme.id return (
updateSettings('theme', theme.id as RecaptchaTheme)} >
{theme.name}
) })}
{/* Size Selection */}
{recaptchaSizes.map((size) => { const isSelected = settings.size === size.id return (
updateSettings('size', size.id as RecaptchaSize)} >
{size.name}
) })}
{/* IP Whitelist */} IP Whitelist Disable reCAPTCHA for specific IP addresses or ranges