import type { SSOConnection } from "@calcom/ee/sso/lib/saml"; import { APP_NAME } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Button, showToast, Tooltip, ConfirmationDialogContent, Dialog, DialogTrigger, Label, } from "@calcom/ui"; import { FiClipboard } from "@calcom/ui/components/icon"; export default function ConnectionInfo({ teamId, connection, }: { teamId: number | null; connection: SSOConnection; }) { const { t } = useLocale(); const utils = trpc.useContext(); const connectionType = connection.type.toUpperCase(); // Delete SSO connection const mutation = trpc.viewer.saml.delete.useMutation({ async onSuccess() { showToast( t("sso_connection_deleted_successfully", { connectionType, }), "success" ); await utils.viewer.saml.get.invalidate(); }, }); const deleteConnection = async () => { mutation.mutate({ teamId, }); }; return (
{connection.type === "saml" ? ( ) : ( )}
{t("delete_sso_configuration_confirmation_description", { appName: APP_NAME, connectionType })}
); } // Connection info for SAML const SAMLInfo = ({ acsUrl, entityId }: { acsUrl: string | null; entityId: string | null }) => { const { t } = useLocale(); if (!acsUrl || !entityId) { return null; } return (
{acsUrl}
{entityId}
); }; // Connection info for OIDC const OIDCInfo = ({ callbackUrl }: { callbackUrl: string | null }) => { const { t } = useLocale(); if (!callbackUrl) { return null; } return (
{callbackUrl}
); };