import React, { useEffect, useState } from 'react'; import { __ } from '@wordpress/i18n'; import { api } from '../api'; import { Card, Button, Badge, Notice, PageState } from '../components/ui'; import Explain from '../components/Explain'; export default function Packs() { const [data, setData] = useState(null); const [pack, setPack] = useState(''); const [region, setRegion] = useState(''); const [city, setCity] = useState(''); const [busy, setBusy] = useState(false); const [result, setResult] = useState(null); const [error, setError] = useState(null); useEffect(() => { api .get('/packs') .then((d) => { setData(d); if (d.applied) { setPack(d.applied.pack); setRegion(d.applied.region); setCity(d.applied.city || ''); } }) .catch((e) => setError(e.message)); }, []); if (!data) return ; const chosen = data.packs.find((p) => p.id === pack); const chosenRegion = data.regions.find((r) => r.id === region); const apply = async () => { setBusy(true); setError(null); try { setResult(await api.post('/packs/apply', { pack, region, city })); } catch (e) { setError(e.message); } finally { setBusy(false); } }; return (
✓ {data.packs.find((p) => p.id === data.applied.pack)?.label} ·{' '} {data.regions.find((r) => r.id === data.applied.region)?.short} ) : ( {__('Nothing applied yet', 'ai-rank-suite')} ) } >

{__('A dentist does not know that schema.org has a Dentist type, that', 'ai-rank-suite')}{' '}knowsAbout{' '} {__('is the strongest expertise signal an assistant reads, or which four questions patients type into ChatGPT before booking. They know they run a practice in Munich. A pack turns that one fact into configuration.', 'ai-rank-suite')}

{__('Applying a pack is additive. It fills empty fields, adds subjects and prompts that are not already there, and leaves every value you have typed exactly as it is — so pressing it twice is safe, and pressing it after months of tuning does not undo any of that tuning.', 'ai-rank-suite')}

{data.packs.map((p) => ( ))}
{data.regions.map((r) => ( ))}
{chosen && chosenRegion && (
setCity(e.target.value)} />
{__('Why this pack matters', 'ai-rank-suite')}

{chosen.why}

{chosen.schema.map((t) => ( {t} ))}
{__('Nothing you have already set will be overwritten.', 'ai-rank-suite')}
{error && {error}}
)} {result && ( <>
{__('Applied', 'ai-rank-suite')}
{result.changed.length === 0 ? (

{__('Everything this pack sets was already in place.', 'ai-rank-suite')}

) : (
    {result.changed.map((c, i) => (
  • {c}
  • ))}
)}
{__('Left as you set it', 'ai-rank-suite')}
{result.kept.length === 0 ? (

{__('Nothing to preserve — these fields were empty.', 'ai-rank-suite')}

) : (
    {result.kept.map((c, i) => (
  • {c}
  • ))}
)}
{__('Market notes', 'ai-rank-suite')}
    {result.notes.map((n, i) => (
  • {n}
  • ))}
{__('Identifiers worth adding', 'ai-rank-suite')}

{result.identifiers.join(', ')} — fill these in under Schema → Identity.

{__('Profiles to link (sameAs)', 'ai-rank-suite')}

{result.directories.join(', ')}

{__('FAQ questions that get quoted', 'ai-rank-suite')}
    {result.faq.map((q, i) => (
  • {q}
  • ))}
)}
); }