= {
+ owner: [
+ 'Full control over company settings',
+ 'Manage all team members and roles',
+ 'Create, edit, and delete all events',
+ 'Access billing and subscription',
+ 'View all analytics and reports'
+ ],
+ admin: [
+ 'Create, edit, and publish events',
+ 'Manage team members (except owners)',
+ 'View analytics and reports',
+ 'Manage company profile'
+ ],
+ editor: [
+ 'Create and edit draft events',
+ 'View published events',
+ 'View basic analytics'
+ ],
+ viewer: [
+ 'View company events',
+ 'View basic analytics',
+ 'Read-only access'
+ ]
+ }
+
+ const permissions = rolePermissions[params.newRole.toLowerCase()] || []
+
+ const content = `
+
+ Your Role Has Been Updated
+
+
+
+ Hi ${params.memberName},
+
+
+
+ Your role at ${params.companyName} has been updated by ${params.changedBy}.
+
+
+
+
+
+ |
+ Previous Role:
+ |
+
+ ${params.oldRole.charAt(0).toUpperCase() + params.oldRole.slice(1)}
+ |
+
+
+ |
+ New Role:
+ |
+
+
+ ${params.newRole.charAt(0).toUpperCase() + params.newRole.slice(1)}
+
+ |
+
+
+
+
+
+ Your new permissions include:
+
+
+
+ ${permissions.map(perm => `- ${perm}
`).join('')}
+
+
+
+ Go to Dashboard
+
+
+
+ If you have questions about your new role or permissions, please contact your team administrator.
+
+ `
+
+ return {
+ subject: `Your role at ${params.companyName} has been updated`,
+ html: getEmailTemplate(content)
+ }
+}
+
// Send email function using Resend
export async function sendCompanyEmail(params: EmailParams) {
try {