import { EMAIL_ACTION_LINK_COMPONENT, EMAIL_DATE_COMPONENT, EMAIL_USER_NAME_COMPONENT, } from '../extensions'; import { type ActionEmailData, ActionEmailTemplate, type ActionEmailTemplateProps, } from '../components'; type Tax1099EmailType = | 'taxInfoRequest' | 'emailDeliveryRequest' | 'tax1099Ready' | 'tax1099Corrected'; // PRO-20621: the 1099 owner emails teams edit in Settings > Emails. The date // token renders the tax year. Subject and preview text are plain text without // tokens, so they name no year. export const getDefaultTax1099EmailData = ( type: Tax1099EmailType, mode: 'tag' | 'text', args: { teamName: string; href: string; userName: string; taxYear: string; } ): ActionEmailData => { const href = mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.href; const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName; const taxYear = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.taxYear; const team = args.teamName; const linkLine = `

If the button doesn't work, copy this link into your browser: ${href}

`; if (type === 'taxInfoRequest') return { subject: `${team} needs your tax info`, shortDescription: `Add your tax ID in your owner portal so ${team} can send your 1099.`, header: 'Complete your tax info', bodyOne: `

Hi ${userName},

${team} needs your tax ID to send your ${taxYear} 1099. Add it on Tax info in your owner portal.

`, buttonText: 'Complete tax info', bodyTwo: `

Never send your tax ID by email. If you did not expect this request, contact ${team} before you enter it.

${linkLine}`, href: args.href, }; if (type === 'emailDeliveryRequest') return { subject: `Get your 1099s from ${team} by email`, shortDescription: 'Confirm in your owner portal that you want your 1099s by email only.', header: 'Get your 1099s by email', bodyOne: `

Hi ${userName},

${team} asks whether you want your 1099s by email only, without a paper copy by mail. You then get an email when your 1099 is ready, and it stays in Tax Statements in your owner portal.

Nothing changes until you confirm on Tax info.

`, buttonText: 'Choose 1099 delivery', bodyTwo: linkLine, href: args.href, }; if (type === 'tax1099Ready') return { subject: `Your 1099 from ${team} is ready`, shortDescription: 'Open it in Tax Statements in your owner portal.', header: 'Your 1099 is ready', bodyOne: `

Hi ${userName},

Your ${taxYear} 1099 from ${team} is in Tax Statements in your owner portal. You can download and print it there.

`, buttonText: 'Open Tax Statements', bodyTwo: `

If you get your 1099 by mail too, the paper copy is on its way.

${linkLine}`, href: args.href, }; return { subject: `Your corrected 1099 from ${team}`, shortDescription: 'Open it in Tax Statements in your owner portal.', header: 'Your 1099 was corrected', bodyOne: `

Hi ${userName},

${team} filed a corrected ${taxYear} 1099 for you. It replaces the earlier one and is in Tax Statements in your owner portal.

`, buttonText: 'Open Tax Statements', bodyTwo: `

If you get your 1099 by mail too, the corrected paper copy is on its way.

${linkLine}`, href: args.href, }; }; export const Tax1099EmailTemplate = ({ type, taxYear, ...props }: Omit & { type: Tax1099EmailType; taxYear: string; }) => ( );