"use client" import { useCallback, useState } from "react" import { Check, Copy } from "lucide-react" import { toast } from "sonner" import { WEBHOOK_TEMPLATE_VARIABLE_GROUPS, type WebhookTemplateVariable, } from "@/lib/mail-automation/webhook-template-variables" import { cn } from "@/lib/utils" function VariableChip({ variable, copied, onCopy, }: { variable: WebhookTemplateVariable copied: boolean onCopy: (token: string) => void }) { return ( ) } export function WebhookTemplateVariablesPanel() { const [copiedToken, setCopiedToken] = useState(null) const copyToken = useCallback(async (token: string) => { try { await navigator.clipboard.writeText(token) setCopiedToken(token) toast.success(`${token} copié`) window.setTimeout(() => { setCopiedToken((current) => (current === token ? null : current)) }, 1500) } catch { toast.error("Impossible de copier la variable") } }, []) return (

Variables du template

Insérez ces variables dans votre JSON{" "} body_template. Cliquez sur une puce pour la copier dans le presse-papiers.

{WEBHOOK_TEMPLATE_VARIABLE_GROUPS.map((group) => (

{group.label}

{group.description}

    {group.variables.map((variable) => (
  • {variable.label} — {variable.description} {variable.example ? ( Ex. {variable.example} ) : null}
  • ))}
))}
) }