import { useState } from "react"; import { Controller, useForm } from "react-hook-form"; import type { SSOConnection } from "@calcom/ee/sso/lib/saml"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Button, DialogFooter, Form, showToast, TextArea, Dialog, DialogContent } from "@calcom/ui"; interface FormValues { metadata: string; } export default function SAMLConnection({ teamId, connection, }: { teamId: number | null; connection: SSOConnection | null; }) { const { t } = useLocale(); const [openModal, setOpenModal] = useState(false); return (

{t("sso_saml_heading")}

{t("sso_saml_description")}

{!connection && (
)}
); } const CreateConnectionDialog = ({ teamId, openModal, setOpenModal, }: { teamId: number | null; openModal: boolean; setOpenModal: (open: boolean) => void; }) => { const { t } = useLocale(); const utils = trpc.useContext(); const form = useForm(); const mutation = trpc.viewer.saml.update.useMutation({ async onSuccess() { showToast( t("sso_connection_created_successfully", { connectionType: "SAML", }), "success" ); setOpenModal(false); await utils.viewer.saml.get.invalidate(); }, onError: (err) => { showToast(err.message, "error"); }, }); return (
{ mutation.mutate({ teamId, encodedRawMetadata: Buffer.from(values.metadata).toString("base64"), }); }}>

{t("sso_saml_configuration_title")}

{t("sso_saml_configuration_description")}

(