import { useWebhookControls } from "@/hooks/use-plugin-webhook-controls"; import { useTranslation } from "react-i18next"; import { Button } from "@kandev/ui/button"; import { Input } from "@kandev/ui/input"; import { Label } from "@kandev/ui/label"; import type { AutomationTrigger } from "@/lib/types/automation"; import { copyToClipboard } from "@/lib/utils/copy-to-clipboard"; import TaskLink from "@/components/routing/task-link"; export function PluginWebhookControls({ trigger, dirty, }: { trigger: AutomationTrigger; dirty: boolean; }) { const { t } = useTranslation(); const { binding, receipts, busy, error, secret, saved, act, refresh, url, setError, setSecret } = useWebhookControls(trigger, dirty); return (

{t("automations:pluginWebhookHelp")}

{error &&

{t("automations:pluginWebhookError")}

}
{binding && ( <> )}
{binding && ( <> )} {secret && (
)} {saved && ( )} {receipts.map((receipt) => (

{new Date(receipt.created_at * 1000).toLocaleString()}:{" "} {t(`automations:pluginWebhookState_${receipt.state}`)}{" "} {receipt.task_id ? ( {receipt.run_id} ) : ( receipt.run_id )} {receipt.reason && ({receipt.reason})}

))}
); }