UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

57 lines (56 loc) 1.87 kB
import { jsx as o, jsxs as l, Fragment as h } from "react/jsx-runtime"; import { useVerifyWebhook as m } from "../../synapse-queries/webhook/useWebhook.js"; import { Typography as u, TextField as b, Alert as y } from "@mui/material"; import { useState as p } from "react"; import { ConfirmationDialog as v } from "../ConfirmationDialog/ConfirmationDialog.js"; import { displayToast as a } from "../ToastMessage/ToastMessage.js"; function W(i) { const { open: d, onClose: r } = i, [n, c] = p(""), { mutate: f, isPending: t, error: s } = m({ onSuccess: (e) => { e.isValid ? a("Webhook verified", "success") : a( `Webhook was not verified: ${e.invalidReason}`, "danger" ), r(); } }); return /* @__PURE__ */ o( v, { title: "Verify Webhook", onCancel: () => { t || r(); }, open: d, content: /* @__PURE__ */ l(h, { children: [ /* @__PURE__ */ o(u, { variant: "body1", gutterBottom: !0, children: "Enter the code sent to your webhook to verify it. Once the webhook has been verified, Synapse will start sending the events you chose to your webhook endpoint." }), /* @__PURE__ */ o( b, { label: "Verification code", value: n, onChange: (e) => c(e.target.value), sx: { mt: 1 } } ), s && /* @__PURE__ */ o(y, { severity: "error", sx: { mt: 2 }, children: s.reason }) ] }), onConfirm: () => { f({ webhookId: i.webhookId, verifyWebhookRequest: { verificationCode: n } }); }, confirmButtonProps: { children: "Verify", disabled: t }, cancelButtonProps: { disabled: t } } ); } export { W as WebhookVerificationDialog }; //# sourceMappingURL=WebhookVerificationDialog.js.map