"use client"; import React, { useCallback, useEffect, useState } from "react"; import { Plus, Pencil, Trash2 } from "lucide-react"; import { apiFetch } from "@/lib/api"; import { errorMessage } from "@/lib/utils"; type Operator = { id: string; name: string; purpose: string; dataShared: string; location: string | null; website: string | null; active: boolean; order: number }; type Form = { name: string; purpose: string; dataShared: string; location: string; website: string; active: boolean }; const EMPTY: Form = { name: "", purpose: "", dataShared: "", location: "", website: "", active: true }; const inputCls = "w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-500"; function OperatorForm({ initial, onSave, onCancel, busy }: { initial: Form; onSave: (f: Form) => void; onCancel: () => void; busy: boolean }) { const [f, setF] = useState(initial); const set = (k: keyof Form) => (e: React.ChangeEvent) => setF({ ...f, [k]: k === "active" ? e.target.checked : e.target.value }); return (
{ e.preventDefault(); onSave(f); }} className="grid sm:grid-cols-2 gap-3 border rounded-xl p-4 bg-gray-50">
); } /** Admin → Privacy → Operators: the third parties that process personal information. */ export function OperatorsPanel({ token }: { token: string }) { const [ops, setOps] = useState(null); const [editing, setEditing] = useState(null); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); const load = useCallback(async () => { try { setOps(await apiFetch("/api/privacy/operators", { authToken: token })); } catch (e) { setError(errorMessage(e) || "Could not load operators."); } }, [token]); useEffect(() => { load(); }, [load]); const save = async (f: Form) => { setBusy(true); setError(null); try { const body = { ...f, location: f.location || null, website: f.website || null }; if (editing === "new") await apiFetch("/api/privacy/operators", { method: "POST", authToken: token, body }); else await apiFetch(`/api/privacy/operators/${editing}`, { method: "PUT", authToken: token, body }); setEditing(null); await load(); } catch (e) { setError(errorMessage(e) || "Could not save."); } finally { setBusy(false); } }; const remove = async (op: Operator) => { if (!confirm(`Remove ${op.name} from the register? (Untick "In use" instead if you might use them again.)`)) return; try { await apiFetch(`/api/privacy/operators/${op.id}`, { method: "DELETE", authToken: token }); await load(); } catch (e) { setError(errorMessage(e) || "Could not remove."); } }; return (

Services outside your organisation that process personal information for you (POPIA calls them "operators"). The ones in use are listed in the privacy notice wherever it says {"{operators}"}. Check each one's details — especially your email and hosting provider — and that you have an agreement with it.

{error &&

{error}

} {ops === null ?

Loading…

: (
    {ops.map(op => (
  • {editing === op.id ? ( setEditing(null)} onSave={save} initial={{ name: op.name, purpose: op.purpose, dataShared: op.dataShared, location: op.location || "", website: op.website || "", active: op.active }} /> ) : (
    {op.name}{op.location ? · {op.location} : null} {!op.active && not in use}
    {op.purpose}
    {op.dataShared &&
    Receives: {op.dataShared}
    } {op.website && {op.website}}
    )}
  • ))}
)} {editing === "new" ? ( setEditing(null)} onSave={save} /> ) : ( )}
); }