import React, { useState, useEffect } from 'react'; import { useMCPApp } from '../../hooks/useMCPApp'; import { PageHeader } from '../../components/layout/PageHeader'; import { Card } from '../../components/layout/Card'; import { ComplianceChecklist } from '../../components/shared/ComplianceChecklist'; export function App() { const { app, isConnected, toolResult } = useMCPApp(); const [activeTab, setActiveTab] = useState<'optin' | 'privacy' | 'terms'>('optin'); const [landingPageHtml, setLandingPageHtml] = useState(''); const [privacyPolicyHtml, setPrivacyPolicyHtml] = useState(''); const [termsHtml, setTermsHtml] = useState(''); useEffect(() => { if (toolResult) { if (toolResult.landingPageHtml) setLandingPageHtml(toolResult.landingPageHtml); if (toolResult.privacyPolicyHtml) setPrivacyPolicyHtml(toolResult.privacyPolicyHtml); if (toolResult.termsHtml) setTermsHtml(toolResult.termsHtml); } }, [toolResult]); // Analyze HTML for compliance elements const analyzeCompliance = (html: string) => { const lower = html.toLowerCase(); return { hasConsent: lower.includes('consent') || lower.includes('agree'), hasFrequency: lower.includes('frequency') || lower.includes('messages per'), hasRates: lower.includes('msg & data rates') || lower.includes('message and data rates'), hasStop: lower.includes('stop') && lower.includes('opt'), hasHelp: lower.includes('help'), hasPrivacyLink: lower.includes('privacy') && (lower.includes('href') || lower.includes('link')), hasTermsLink: lower.includes('terms') && (lower.includes('href') || lower.includes('link')), hasCarrierDisclosure: lower.includes('carrier') || lower.includes('t-mobile') || lower.includes('at&t'), hasContact: lower.includes('contact') || lower.includes('email') || lower.includes('phone'), }; }; const compliance = analyzeCompliance(landingPageHtml); const complianceItems = [ { label: 'Explicit consent checkbox', checked: compliance.hasConsent, description: 'Clear opt-in mechanism for users', }, { label: 'Message frequency disclosed', checked: compliance.hasFrequency, description: 'How often users will receive messages', }, { label: 'Msg & data rates notice', checked: compliance.hasRates, description: 'Standard carrier charges disclosure', }, { label: 'STOP instructions', checked: compliance.hasStop, description: 'How to opt out of messages', }, { label: 'HELP instructions', checked: compliance.hasHelp, description: 'How to get support', }, { label: 'Privacy policy link', checked: compliance.hasPrivacyLink, description: 'Link to privacy policy', }, { label: 'Terms of service link', checked: compliance.hasTermsLink, description: 'Link to terms', }, { label: 'Carrier disclosure', checked: compliance.hasCarrierDisclosure, description: 'Carrier liability disclosure', }, { label: 'Business contact info', checked: compliance.hasContact, description: 'How to reach the business', }, ]; const tabs = [ { id: 'optin' as const, label: 'Opt-In Page', content: landingPageHtml }, { id: 'privacy' as const, label: 'Privacy Policy', content: privacyPolicyHtml }, { id: 'terms' as const, label: 'Terms of Service', content: termsHtml }, ]; const activeContent = tabs.find((t) => t.id === activeTab)?.content || ''; if (!isConnected) { return (

Connecting to MCP host...

); } if (!landingPageHtml && !privacyPolicyHtml && !termsHtml) { return (

No landing page data loaded

This app displays landing pages passed via tool result. Request a landing page from the model.

); } return (
{/* Main Preview */}
{/* Tab Bar */}
{tabs.map((tab) => ( ))}
{/* Preview Frame */} {activeContent ? (