import { TrashIcon, PencilAltIcon } from "@heroicons/react/outline"; import showToast from "@lib/notification"; import { Webhook } from "@lib/webhook"; import { Dialog, DialogTrigger } from "@components/Dialog"; import { Tooltip } from "@components/Tooltip"; import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent"; import Button from "@components/ui/Button"; export default function WebhookListItem(props: { onChange: () => void; key: number; webhook: Webhook; onEditWebhook: () => void; }) { const handleErrors = async (resp: Response) => { if (!resp.ok) { const err = await resp.json(); throw new Error(err.message); } return resp.json(); }; const deleteWebhook = (webhookId: string) => { fetch("/api/webhooks/" + webhookId, { method: "DELETE", headers: { "Content-Type": "application/json", }, }) .then(handleErrors) .then(() => { showToast("Webhook removed successfully!", "success"); props.onChange(); }); }; return (
  • {props.webhook.eventTriggers.map((eventTrigger, ind) => ( {eventTrigger} ))}
    {props.webhook.subscriberUrl}
    {!props.webhook.active && ( Disabled )} {!!props.webhook.active && ( Enabled )} { deleteWebhook(props.webhook.id); }}> Are you sure you want to delete this webhook? You will no longer receive Cal.com meeting data at a specified URL, in real-time, when an event is scheduled or canceled .
  • ); }