import React from 'react'; import { EmailTemplate } from '../types'; interface InviteEmailData { inviteeName?: string; inviterName: string; inviteLink: string; role?: string; department?: string; expiresIn?: string; organizationName?: string; } export const InviteEmailTemplate: EmailTemplate = { id: 'invite', name: 'User Invitation Email', subject: ({ inviterName, organizationName }) => `${inviterName} invited you to join ${organizationName || 'our app'}`, preview: 'You have been invited to join our platform', body: { html: (data) => ` Invitation

You're Invited!

Hi${data.inviteeName ? ` ${data.inviteeName}` : ''},

${data.inviterName} has invited you to join ${data.organizationName || 'our platform'}.

${data.role || data.department ? `

You've been invited with the following access:

${data.role ? `Role: ${data.role}
` : ''} ${data.department ? `Department: ${data.department}` : ''} ` : ''}

Click the button below to accept the invitation and create your account:

Accept Invitation
⏰ Note: This invitation will expire ${data.expiresIn || 'in 7 days'}. Please accept it before then.

If you have any questions about this invitation, please contact ${data.inviterName} or our support team.

Best regards,
The ${data.organizationName || 'Team'}

`, text: (data) => ` You're Invited! Hi${data.inviteeName ? ` ${data.inviteeName}` : ''}, ${data.inviterName} has invited you to join ${data.organizationName || 'our platform'}. ${data.role || data.department ? `You've been invited with the following access: ${data.role ? `- Role: ${data.role}` : ''} ${data.department ? `- Department: ${data.department}` : ''}` : ''} Accept the invitation: ${data.inviteLink} ⏰ Note: This invitation will expire ${data.expiresIn || 'in 7 days'}. Please accept it before then. If you have any questions about this invitation, please contact ${data.inviterName} or our support team. Best regards, The ${data.organizationName || 'Team'} If you didn't expect this invitation, you can safely ignore this email. © 2024 ${data.organizationName || 'Your Company'}. All rights reserved. `.trim(), }, }; export function InviteEmail(props: InviteEmailData) { return (

You're Invited!

Hi{props.inviteeName ? ` ${props.inviteeName}` : ''},

{props.inviterName} has invited you to join {props.organizationName || 'our platform'}.

{(props.role || props.department) && ( <>

You've been invited with the following access:

{props.role && ( Role: {props.role} )} {props.role && props.department &&
} {props.department && ( Department: {props.department} )} )}

Click the button below to accept the invitation and create your account:

Accept Invitation
⏰ Note: This invitation will expire {props.expiresIn || 'in 7 days'}. Please accept it before then.

If you have any questions about this invitation, please contact {props.inviterName} or our support team.

Best regards,
The {props.organizationName || 'Team'}

If you didn't expect this invitation, you can safely ignore this email.

© 2024 {props.organizationName || 'Your Company'}. All rights reserved.

); }