import { Alert, AlertDescription } from '@documenso/ui/primitives/alert'; import { Button } from '@documenso/ui/primitives/button'; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from '@documenso/ui/primitives/dialog'; import { Trans } from '@lingui/react/macro'; import { useState } from 'react'; export type DocumentPreferencesResetDialogProps = { isSubmitting: boolean; onReset: () => Promise; showAiFeatures?: boolean; showDocumentVisibility?: boolean; showIncludeSenderDetails?: boolean; }; export const DocumentPreferencesResetDialog = ({ isSubmitting, onReset, showAiFeatures = false, showDocumentVisibility = false, showIncludeSenderDetails = false, }: DocumentPreferencesResetDialogProps) => { const [open, setOpen] = useState(false); const [isResetting, setIsResetting] = useState(false); const isLoading = isSubmitting || isResetting; const handleResetToDefaults = async () => { setIsResetting(true); try { await onReset(); setOpen(false); } catch { // The submit handler surfaces its own error toast. Keep the dialog open // so the user can retry. } finally { setIsResetting(false); } }; return ( !isLoading && setOpen(value)}> Reset document preferences This will reset all document preferences to their default values and save the changes immediately.

Once confirmed, the following will be reset:

    {showDocumentVisibility && (
  • Default document visibility
  • )}
  • Default document language
  • Default date format
  • Default time zone
  • Default signature settings
  • {showIncludeSenderDetails && (
  • Send on behalf of team
  • )}
  • Include the signing certificate in the document
  • Include the audit logs in the document
  • Default recipients
  • Delegate document ownership
  • Default envelope expiration
  • Default signing reminders
  • {showAiFeatures && (
  • AI features
  • )}
); };