import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Switch } from "@/components/ui/switch" import { GeneralSettings, BackInStockProSettings } from "../../types" import { Settings, Shield } from "lucide-react" import { usePro } from "@/contexts/pro-context" interface GeneralTabProps { settings: GeneralSettings updateGeneralSettings: (key: K, value: GeneralSettings[K]) => void proSettings: BackInStockProSettings updateProSettings: (key: K, value: BackInStockProSettings[K]) => void } export function GeneralTab({ settings, updateGeneralSettings, proSettings, updateProSettings, }: GeneralTabProps) { const { isPro } = usePro() return (
{/* Display Settings */} Display Settings Control when and where the notification form appears

Display the subscription form when products are out of stock

updateGeneralSettings('showOnOutOfStock', checked)} />

Display the form for products on backorder

updateGeneralSettings('showOnBackorder', checked)} />

Let non-logged-in users subscribe for notifications

updateGeneralSettings('allowGuests', checked)} />

Remove subscription when customer purchases the product

updateGeneralSettings('autoRemoveOnPurchase', checked)} />

Confirm ownership before adding an address to the waitlist

updateGeneralSettings('requireDoubleOptIn', checked)} />
updateGeneralSettings('subscriptionLimit', parseInt(e.target.value) || 0)} placeholder="0 = unlimited" />

Maximum number of products a user can subscribe to (0 for unlimited)

updateGeneralSettings('minStockToNotify', parseInt(e.target.value) || 1)} />

Only send notifications when stock reaches this level

{/* Pro Settings */} {isPro && (
Advanced Settings
Per-product subscription limits and CAPTCHA protection
updateProSettings('perProductSubscriptionLimit', parseInt(e.target.value) || 0)} placeholder="0 = unlimited" />

Maximum number of subscriptions allowed per product (0 for unlimited)

Protect the subscription form with CAPTCHA. Configure your CAPTCHA provider in the reCAPTCHA feature settings.

updateProSettings('enableCaptcha', checked)} />
)}
) }