"use client"; import { Trash2Icon } from "lucide-react"; import { useState } from "react"; import { deleteSamlConfig } from "@/actions/integrations"; import { Badge, Button, Card, CardAction, CardContent, CardHeader, useToast, } from "@/components/shadcn"; import { CustomLink } from "@/components/shadcn/custom/custom-link"; import { Modal } from "@/components/shadcn/modal"; import type { SamlConfiguration } from "@/types/saml"; import { SamlConfigForm } from "./saml-config-form"; export const SamlIntegrationCard = ({ samlConfig, }: { samlConfig?: SamlConfiguration; }) => { const [isSamlModalOpen, setIsSamlModalOpen] = useState(false); const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); const [isDeleting, setIsDeleting] = useState(false); const { toast } = useToast(); const id = samlConfig?.id; const statusLabel = id ? "Enabled" : "Disabled"; const handleRemoveSaml = async () => { if (!id) return; setIsDeleting(true); try { const result = await deleteSamlConfig(id); if (result.success) { toast({ title: "SAML configuration removed", description: result.success, }); setIsDeleteModalOpen(false); } else if (result.errors?.general) { toast({ variant: "destructive", title: "Error removing SAML configuration", description: result.errors.general, }); } } catch { toast({ variant: "destructive", title: "Error", description: "Failed to remove SAML configuration. Please try again.", }); } finally { setIsDeleting(false); } }; return ( <> {/* Configure SAML Modal */} {/* Delete Confirmation Modal */}

Are you sure you want to remove the SAML SSO configuration? Users will no longer be able to sign in using SAML.

SAML SSO Integration

{id ? ( "SAML Single Sign-On is enabled for this organization" ) : ( <> Configure SAML Single Sign-On for secure authentication.{" "} Read the docs )}

{statusLabel}
{id && ( )}
); };