import type { Theme } from "../../types.js" /** * Email HTML body * Insert invisible space into domains from being turned into a hyperlink by email * clients like Outlook and Apple mail, as this is confusing because it seems * like they are supposed to click on it to sign in. * * @note We don't add the email address to avoid needing to escape it, if you do, remember to sanitize it! */ export function html(params: { url: string; host: string; theme: Theme }) { const { url, host, theme } = params const escapedHost = host.replace(/\./g, "​.") // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const brandColor = theme.brandColor || "#346df1" // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const buttonText = theme.buttonText || "#fff" const color = { background: "#f9f9f9", text: "#444", mainBackground: "#fff", buttonBackground: brandColor, buttonBorder: brandColor, buttonText, } return `
Sign in to ${escapedHost}
Sign in
If you did not request this email you can safely ignore it.
` } /** Email Text body (fallback for email clients that don't render HTML, e.g. feature phones) */ export function text({ url, host }: { url: string; host: string }) { return `Sign in to ${host}\n${url}\n\n` }