import { ChevronRightIcon, SwitchHorizontalIcon } from "@heroicons/react/solid"; import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@radix-ui/react-collapsible"; import { useState } from "react"; import { useWatch } from "react-hook-form"; import classNames from "@calcom/lib/classNames"; import { useLocale } from "@lib/hooks/useLocale"; import showToast from "@lib/notification"; import { trpc } from "@lib/trpc"; import { InputGroupBox } from "@components/form/fields"; import Button from "@components/ui/Button"; export default function WebhookTestDisclosure() { const subscriberUrl: string = useWatch({ name: "subscriberUrl" }); const payloadTemplate = useWatch({ name: "payloadTemplate" }) || null; const { t } = useLocale(); const [open, setOpen] = useState(false); const mutation = trpc.useMutation("viewer.webhook.testTrigger", { onError(err) { showToast(err.message, "error"); }, }); return ( setOpen(!open)}> {t("webhook_test")}

{t("webhook_response")}

{!mutation.data && {t("no_data_yet")}} {mutation.status === "success" && ( <>
{mutation.data.ok ? t("success") : t("failed")}
{JSON.stringify(mutation.data, null, 4)}
)}
); }