import { useState } from 'react'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faPhone, faCommentDots, faSquare, faMagnifyingGlass, faCamera, faGlobe, faEnvelope, faCopy, faCircleCheck, faCircleXmark, faGear, } from '@fortawesome/pro-duotone-svg-icons'; import { Badge } from '@/components/base/badges/badges'; import { Button } from '@/components/base/buttons/button'; import { TopBar } from '@/components/layout/top-bar'; import { IntegrationEditSlideout } from '@/components/integrations/integration-edit-slideout'; import { notify } from '@/lib/toast'; type IntegrationType = 'ozonetel' | 'whatsapp' | 'facebook' | 'google' | 'instagram' | 'website' | 'email'; type IntegrationConfig = { type: IntegrationType; name: string; details: { label: string; value: string }[]; webhookUrl?: string; }; type IntegrationStatus = 'connected' | 'disconnected' | 'configured'; type IntegrationCardProps = { name: string; description: string; icon: any; iconColor: string; status: IntegrationStatus; details: { label: string; value: string }[]; webhookUrl?: string; onConfigure?: () => void; }; const statusConfig: Record = { connected: { color: 'success', label: 'Connected' }, disconnected: { color: 'error', label: 'Not Connected' }, configured: { color: 'warning', label: 'Configured' }, }; const IntegrationCard = ({ name, description, icon, iconColor, status, details, webhookUrl, onConfigure }: IntegrationCardProps) => { const statusCfg = statusConfig[status]; const copyWebhook = () => { if (webhookUrl) { navigator.clipboard.writeText(webhookUrl); notify.success('Copied', 'Webhook URL copied to clipboard'); } }; return (

{name}

{description}

{onConfigure && ( )} {statusCfg.label}
{details.length > 0 && (
{details.map((d) => (
{d.label} {d.value}
))}
)} {webhookUrl && (
{webhookUrl}
)}
); }; export const IntegrationsPage = () => { const webhookBase = 'https://engage-api.srv1477139.hstgr.cloud'; const [editIntegration, setEditIntegration] = useState(null); const openEdit = (config: IntegrationConfig) => setEditIntegration(config); return (
{/* Telephony */} openEdit({ type: 'ozonetel', name: 'Ozonetel CloudAgent', details: [ { label: 'Account', value: 'global_healthx' }, { label: 'Agent ID', value: 'global' }, { label: 'SIP Extension', value: '523590' }, { label: 'Inbound Campaign', value: 'Inbound_918041763265' }, ], })} /> {/* WhatsApp */} openEdit({ type: 'whatsapp', name: 'WhatsApp Business', details: [] })} /> {/* Facebook Lead Ads */} openEdit({ type: 'facebook', name: 'Facebook Lead Ads', details: [] })} /> {/* Google Ads */} openEdit({ type: 'google', name: 'Google Ads', details: [] })} /> {/* Instagram */} openEdit({ type: 'instagram', name: 'Instagram Lead Ads', details: [] })} /> {/* Website */} openEdit({ type: 'website', name: 'Website Lead Forms', details: [{ label: 'Method', value: 'POST webhook' }], webhookUrl: `${webhookBase}/webhooks/website/lead`, })} /> {/* Email */} openEdit({ type: 'email', name: 'Email (SMTP)', details: [] })} />
{editIntegration && ( { if (!open) setEditIntegration(null); }} integration={editIntegration} /> )}
); };