util.ts 750 B

12345678910111213141516171819202122232425
  1. export const generateMailToLink = (email: string, subject?: string, body?: string): string => {
  2. let mailtoLink = `mailto:${email}`
  3. if (subject)
  4. mailtoLink += `?subject=${encodeURIComponent(subject)}`
  5. if (body)
  6. mailtoLink += `&body=${encodeURIComponent(body)}`
  7. return mailtoLink
  8. }
  9. export const mailToSupport = (account: string, plan: string, version: string) => {
  10. const subject = `Technical Support Request ${plan} ${account}`
  11. const body = `
  12. Please do not remove the following information:
  13. -----------------------------------------------
  14. Current Plan: ${plan}
  15. Account: ${account}
  16. Version: ${version}
  17. Platform:
  18. Problem Description:
  19. `
  20. return generateMailToLink('support@dify.ai', subject, body)
  21. }