import MarkdownLite from '~/components/Chat/Messages/Content/MarkdownLite'; import DialogTemplate from '~/components/ui/DialogTemplate'; import { useAcceptTermsMutation } from '~/data-provider'; import { useToastContext } from '~/Providers'; import { OGDialog } from '~/components/ui'; import { useLocalize } from '~/hooks'; const TermsAndConditionsModal = ({ open, onOpenChange, onAccept, onDecline, title, modalContent, }: { open: boolean; onOpenChange: (isOpen: boolean) => void; onAccept: () => void; onDecline: () => void; title?: string; contentUrl?: string; modalContent?: string; }) => { const localize = useLocalize(); const { showToast } = useToastContext(); const acceptTermsMutation = useAcceptTermsMutation({ onSuccess: () => { onAccept(); onOpenChange(false); }, onError: () => { showToast({ message: 'Failed to accept terms' }); }, }); const handleAccept = () => { acceptTermsMutation.mutate(); }; const handleDecline = () => { onDecline(); onOpenChange(false); }; const handleOpenChange = (isOpen: boolean) => { if (open && !isOpen) { return; } onOpenChange(isOpen); }; return (
{modalContent != null && modalContent ? ( ) : (

{localize('com_ui_no_terms_content')}

)}
} buttons={ <> } />
); }; export default TermsAndConditionsModal;