import React from 'react'; import { Settings2, ListRestart, Database, Languages, Type, Layout, ShieldCheck, Smartphone, Trash2 } from 'lucide-react'; import { cn } from '../../lib/utils'; import { Label } from '../ui/label'; import { Switch } from '../ui/switch'; import { SearchableSelect } from '../ui/searchable-select'; import { SettingInput } from '../ui/settings-ui'; interface WhatsAppAuthSettingsProps { settings: Record; updateSetting: (key: string, value: string | number) => void; optionNames: Record; availability?: Record; msgs?: Record; } const WhatsAppAuthSettings: React.FC = ({ settings, updateSetting, optionNames, msgs: t = {} }) => { const opts = optionNames || {}; return (
{/* Auth Method Selection */}
{[ { id: 'otp', label: 'Standard OTP', desc: '6-digit code via Message', icon: Smartphone, color: 'text-emerald-600', bg: 'bg-emerald-50', border: 'border-emerald-100' }, { id: 'list', label: 'Interactive List', desc: 'One-tap Verify/Reject', icon: ListRestart, color: 'text-[#004449]', bg: 'bg-slate-50', border: 'border-slate-200' } ].map(item => (
))}
{/* Content Customization based on type */}
{settings[opts.whatsappAuthType] === 'otp' ? (

{t.msg_config_label || "Message Configuration"}

updateSetting(opts.whatsappOtpLangType, val)} className="h-11 bg-white border-slate-200 text-slate-700 font-bold text-[13px] hover:border-[#004449]/30 transition-all rounded-[5px]" />
{settings[opts.whatsappOtpLangType] === 'custom' && (
({ value: l.code, label: l.name }))} value={(settings[opts.whatsappOtpCustomLang] as string) || 'ar'} onChange={(val) => updateSetting(opts.whatsappOtpCustomLang, val)} className="h-11 bg-white border-slate-200 text-slate-700 font-bold text-[13px] hover:border-[#004449]/30 transition-all rounded-[5px]" />
)}
updateSetting(opts.whatsappOtpFooterEnabled, checked ? 1 : 0)} />
{settings[opts.whatsappOtpFooterEnabled] == 1 && ( updateSetting(opts.whatsappOtpFooter, val)} placeholder="Support Wawp Engine" icon={Layout} showFormatting={false} showEmoji={true} /> )}
) : (

{t.list_ui_label || "List Interface Design"}

updateSetting(opts.whatsappListTitle, val)} icon={Type} placeholder="Secure Authentication" showFormatting={false} showEmoji={true} /> updateSetting(opts.whatsappListDesc, val)} icon={Languages} placeholder="Verify your identity to continue" showFormatting={false} showEmoji={true} />
Item 1 (Success Action)
updateSetting(opts.whatsappListItem1, val)} placeholder="Approve Request" showFormatting={false} showEmoji={true} /> updateSetting(opts.whatsappListItem1Desc, val)} placeholder="This is my login attempt" showFormatting={false} showEmoji={true} />
Item 2 (Reject Action)
updateSetting(opts.whatsappListItem2, val)} placeholder="Reject & Report" showFormatting={false} showEmoji={true} /> updateSetting(opts.whatsappListItem2Desc, val)} placeholder="I don't recognize this" showFormatting={false} showEmoji={true} />
updateSetting(opts.whatsappListButton, val)} icon={Settings2} placeholder="Choose Action" showFormatting={false} showEmoji={true} /> updateSetting(opts.whatsappListFooter, val)} icon={Layout} placeholder="Authorized by Wawp Engine" showFormatting={false} showEmoji={true} />
)}
); }; export default WhatsAppAuthSettings;