import { EMAIL_ACTION_LINK_COMPONENT, EMAIL_DATE_COMPONENT, EMAIL_USER_NAME_COMPONENT, } from '../extensions'; import type { ActionEmailData, ActionEmailTemplateProps, } from '../components/ActionEmailTemplate'; import { OwnerStatementEmailTemplate } from './OwnerStatementEmailTemplate'; /** * Default text of the `yearEndStatement` email: an owner's year-end statement * of a fiscal year is published. Owners open it by a no-login link, viewers * in the owner portal. Settings > Emails shows it; its text is fixed. */ export const getDefaultYearEndStatementEmailData = ( mode: 'tag' | 'text', args: { appName: string; href: string; userName: string; /** The fiscal year, such as `2025`. */ year: string; /** The months it covers, such as `Jan 2025 - Dec 2025`. */ period: string; } ): ActionEmailData => { const href = mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.href; const period = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.period; const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName; return { subject: mode === 'tag' ? 'Your year-end statement is ready' : `Your ${args.year} year-end statement`, shortDescription: mode === 'tag' ? 'Your year-end statement is ready to view.' : `Your ${args.year} year-end statement is ready to view.`, header: 'Your year-end statement is ready', bodyOne: `
Hi ${userName},
${args.appName} published your year-end statement for ${period}. It sums up your owner statements of the year. Open it with the button below.
`, buttonText: 'View year-end statement', bodyTwo: `If the button doesn't work, copy this link into your browser: ${href}
`, href: args.href, }; }; export const YearEndStatementEmailTemplate = ({ period, listings, ...props }: Omit