import { Markdown } from 'components/interfaces/Markdown' import InformationBox from 'components/ui/InformationBox' import { ValidateSpamResponse } from 'data/auth/validate-spam-mutation' import { cn, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, WarningIcon } from 'ui' interface SpamValidationProps { validationResult?: ValidateSpamResponse } // [Joshen] According to API, we label as a spam risk as long as there are spam // rules identified with scores above 0. Scores are irrelevant in our context and // are hence not visualized in the UI export const SpamValidation = ({ validationResult }: SpamValidationProps) => { const spamRules = (validationResult?.rules ?? []).filter((rule) => rule.score >= 0) const hasSpamWarning = spamRules.length > 0 return ( } title={ hasSpamWarning ? 'Email has a high probability of being marked as spam and deliverability may be affected' : 'Email content is unlikely to be marked as spam' } description={ hasSpamWarning ? ( <> {spamRules.length > 0 && (

{hasSpamWarning ? ` Rectify the following issues to improve your email's deliverability in order of priority:` : ` Address the following issues to improve your email's deliverability:`}

Warning Description {spamRules.map((rule) => ( {rule.name} {rule.desc} ))}
)} ) : null } /> ) }