(
email: string,
workspaceName: string,
registerLink: string,
platform: Platform = Platform.ENTERPRISE,
inviteType: 'new' | 'update' = 'new'
)
| 64 | } |
| 65 | |
| 66 | const sendWorkspaceInvite = async ( |
| 67 | email: string, |
| 68 | workspaceName: string, |
| 69 | registerLink: string, |
| 70 | platform: Platform = Platform.ENTERPRISE, |
| 71 | inviteType: 'new' | 'update' = 'new' |
| 72 | ) => { |
| 73 | let htmlToSend |
| 74 | let textContent |
| 75 | |
| 76 | const template = |
| 77 | platform === Platform.ENTERPRISE |
| 78 | ? getEmailTemplate( |
| 79 | inviteType === 'new' ? 'workspace_new_invite_enterprise.hbs' : 'workspace_update_invite_enterprise.hbs', |
| 80 | process.env.WORKSPACE_INVITE_TEMPLATE_PATH |
| 81 | ) |
| 82 | : getEmailTemplate( |
| 83 | inviteType === 'new' ? 'workspace_new_invite_cloud.hbs' : 'workspace_update_invite_cloud.hbs', |
| 84 | process.env.WORKSPACE_INVITE_TEMPLATE_PATH |
| 85 | ) |
| 86 | const compiledWorkspaceInviteTemplateSource = handlebars.compile(template) |
| 87 | htmlToSend = compiledWorkspaceInviteTemplateSource({ workspaceName, registerLink }) |
| 88 | textContent = `You have been invited to ${workspaceName}. Click here to register: ${registerLink}` // plain text body |
| 89 | |
| 90 | await transporter.sendMail({ |
| 91 | from: SENDER_EMAIL || '"FlowiseAI Team" <team@mail.flowiseai.com>', // sender address |
| 92 | to: email, |
| 93 | subject: `You have been invited to ${workspaceName}`, // Subject line |
| 94 | text: textContent, // plain text body |
| 95 | html: htmlToSend // html body |
| 96 | }) |
| 97 | } |
| 98 | |
| 99 | const sendPasswordResetEmail = async (email: string, resetLink: string) => { |
| 100 | const passwordResetTemplateSource = fs.readFileSync(path.join(__dirname, '../', 'emails', 'workspace_user_reset_password.hbs'), 'utf8') |
no test coverage detected