"use client"; import { Card, CardBody, CardHeader } from "@heroui/card"; import { CheckIcon, Trash2Icon } from "lucide-react"; import { useState } from "react"; import { deleteSamlConfig } from "@/actions/integrations"; import { useToast } from "@/components/ui"; import { CustomAlertModal, CustomButton } from "@/components/ui/custom"; import { CustomLink } from "@/components/ui/custom/custom-link"; import { SamlConfigForm } from "./saml-config-form"; export const SamlIntegrationCard = ({ samlConfig }: { samlConfig?: any }) => { const [isSamlModalOpen, setIsSamlModalOpen] = useState(false); const [isDeleting, setIsDeleting] = useState(false); const { toast } = useToast(); const id = samlConfig?.id; 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, }); } else if (result.errors?.general) { toast({ variant: "destructive", title: "Error removing SAML configuration", description: result.errors.general, }); } } catch (error) { toast({ variant: "destructive", title: "Error", description: "Failed to remove SAML configuration. Please try again.", }); } finally { setIsDeleting(false); } }; return ( <>

SAML SSO Integration

{id && }

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

Status: {id ? "Enabled" : "Disabled"}
setIsSamlModalOpen(true)} > {id ? "Update" : "Enable"} {id && ( : null} onPress={handleRemoveSaml} > Remove )}
); };