2014-03-04 13:10:06 -05:00
_ = require ( ' underscore ' )
2017-12-21 05:26:14 -05:00
settings = require ( " settings-sharelatex " )
2016-12-15 12:22:39 -05:00
2014-03-04 13:10:06 -05:00
PersonalEmailLayout = require ( " ./Layouts/PersonalEmailLayout " )
NotificationEmailLayout = require ( " ./Layouts/NotificationEmailLayout " )
2017-12-21 05:26:14 -05:00
BaseWithHeaderEmailLayout = require ( " ./Layouts/ " + settings . brandPrefix + " BaseWithHeaderEmailLayout " )
2016-06-28 12:07:27 -04:00
2017-12-21 05:26:14 -05:00
SingleCTAEmailBody = require ( " ./Bodies/ " + settings . brandPrefix + " SingleCTAEmailBody " )
2016-06-28 12:07:27 -04:00
2014-03-04 13:10:06 -05:00
templates = { }
2016-08-03 09:06:08 -04:00
templates.registered =
2015-03-19 10:22:48 -04:00
subject: _ . template " Activate your #{ settings . appName } Account "
2014-03-04 13:10:06 -05:00
layout: PersonalEmailLayout
2015-03-19 10:22:48 -04:00
type: " notification "
2016-10-27 09:41:13 -04:00
plainTextTemplate: _ . template """
Congratulations , you ' ve just had an account created for you on # {settings.appName} with the email address " <%= to %> " .
Click here to set your password and log in : < %= setNewPasswordUrl % >
If you have any questions or problems , please contact #{settings.adminEmail}
"""
2015-03-19 10:22:48 -04:00
compiledTemplate: _ . template """
< p > Congratulations , you ' ve just had an account created for you on # {settings.appName} with the email address " <%= to %> " .</p>
2014-10-16 07:46:38 -04:00
2015-03-19 10:22:48 -04:00
< p > < a href = " <%= setNewPasswordUrl %> " > Click here to set your password and log in . < / a > < / p >
2014-03-04 13:10:06 -05:00
2015-03-19 10:22:48 -04:00
< p > If you have any questions or problems , please contact < a href = " mailto: #{ settings . adminEmail } " > #{settings.adminEmail}</a>.</p>
"""
2014-03-04 13:10:06 -05:00
2016-10-27 09:41:13 -04:00
2016-08-03 09:06:08 -04:00
templates.canceledSubscription =
2014-03-04 13:10:06 -05:00
subject: _ . template " ShareLaTeX thoughts "
layout: PersonalEmailLayout
2014-03-05 06:22:34 -05:00
type : " lifecycle "
2016-10-27 09:41:13 -04:00
plainTextTemplate: _ . template """
Hi < %= first_name % > ,
I ' m sorry to see you cancelled your ShareLaTeX premium account. Would you mind giving me some advice on what the site is lacking at the moment via this survey?:
https : / / sharelatex . typeform . com / to / f5lBiZ
Thank you in advance .
Henry
ShareLaTeX Co - founder
"""
2014-03-04 13:10:06 -05:00
compiledTemplate: _ . template '''
2014-10-16 07:46:38 -04:00
< p > Hi < %= first_name % > , < / p >
2014-03-04 13:10:06 -05:00
2016-09-14 05:51:19 -04:00
< p > I ' m sorry to see you cancelled your ShareLaTeX premium account. Would you mind giving me some advice on what the site is lacking at the moment via <a href= " https://sharelatex.typeform.com/to/f5lBiZ " >this survey</a>?</p>
2014-03-04 13:10:06 -05:00
2014-10-16 07:46:38 -04:00
< p > Thank you in advance . < / p >
2014-03-04 13:10:06 -05:00
< p >
Henry < br >
ShareLaTeX Co - founder
2014-10-16 07:46:38 -04:00
< / p >
2014-03-04 13:10:06 -05:00
'''
2016-10-27 09:41:13 -04:00
2016-08-03 09:06:08 -04:00
templates.passwordResetRequested =
2015-03-19 10:22:48 -04:00
subject: _ . template " Password Reset - #{ settings . appName } "
2016-12-16 09:57:59 -05:00
layout: BaseWithHeaderEmailLayout
2014-03-05 06:22:34 -05:00
type : " notification "
2016-10-27 09:41:13 -04:00
plainTextTemplate: _ . template """
Password Reset
We got a request to reset your #{settings.appName} password.
Click this link to reset your password: < %= setNewPasswordUrl % >
If you ignore this message , your password won ' t be changed.
If you didn ' t request a password reset, let us know.
Thank you
#{settings.appName} - <%= siteUrl %>
"""
2018-05-30 06:29:21 -04:00
compiledTemplate: (opts) ->
2016-12-16 07:16:45 -05:00
SingleCTAEmailBody ( {
title: " Password Reset "
greeting: " Hi, "
message: " We got a request to reset your #{ settings . appName } password. "
secondaryMessage: " If you ignore this message, your password won ' t be changed.<br>If you didn ' t request a password reset, let us know. "
ctaText: " Reset password "
ctaURL: opts . setNewPasswordUrl
2016-12-16 12:04:26 -05:00
gmailGoToAction: null
2016-12-16 07:16:45 -05:00
} )
2014-03-04 13:10:06 -05:00
2016-10-27 09:41:13 -04:00
2016-07-21 10:56:41 -04:00
templates.projectInvite =
2017-01-27 10:26:58 -05:00
subject: _ . template " <%= project.name %> - shared by <%= owner.email %> "
2016-12-15 12:22:39 -05:00
layout: BaseWithHeaderEmailLayout
2016-07-21 10:56:41 -04:00
type : " notification "
2016-12-16 10:15:06 -05:00
plainTextTemplate: _ . template """
2016-10-03 10:25:38 -04:00
Hi , < %= owner . email % > wants to share ' <%= project.name %> ' with you .
Follow this link to view the project: < %= inviteUrl % >
Thank you
#{settings.appName} - <%= siteUrl %>
"""
2018-05-30 06:29:21 -04:00
compiledTemplate: (opts) ->
2016-12-15 12:22:39 -05:00
SingleCTAEmailBody ( {
2017-01-27 10:26:58 -05:00
title: " #{ opts . project . name } – shared by #{ opts . owner . email } "
2016-12-15 12:22:39 -05:00
greeting: " Hi, "
2017-01-27 10:26:58 -05:00
message: " #{ opts . owner . email } wants to share “ #{ opts . project . name } ” with you. "
2016-12-16 07:16:45 -05:00
secondaryMessage: null
2016-12-16 05:06:56 -05:00
ctaText: " View project "
2016-12-15 12:22:39 -05:00
ctaURL: opts . inviteUrl
2018-05-30 06:29:21 -04:00
gmailGoToAction:
2016-12-16 12:04:26 -05:00
target: opts . inviteUrl
name: " View project "
2017-01-27 10:26:58 -05:00
description: " Join #{ opts . project . name } at ShareLaTeX "
2016-12-15 12:22:39 -05:00
} )
2018-05-30 06:29:21 -04:00
templates.verifyEmailToJoinTeam =
2018-06-01 11:17:11 -04:00
subject: _ . template " <%= inviterName %> has invited you to join a team on #{ settings . appName } "
2018-05-30 06:29:21 -04:00
layout: BaseWithHeaderEmailLayout
type : " notification "
plainTextTemplate: _ . template """
2018-06-06 12:11:25 -04:00
Please click the button below to join the team and enjoy the benefits of an upgraded < %= appName % > account .
2018-05-30 06:29:21 -04:00
2018-06-06 07:47:59 -04:00
< %= acceptInviteUrl % >
2018-05-30 06:29:21 -04:00
Thank You
#{settings.appName} - <%= siteUrl %>
"""
compiledTemplate: (opts) ->
SingleCTAEmailBody ( {
2018-06-01 11:17:11 -04:00
title: " #{ opts . inviterName } has invited you to join a team on #{ settings . appName } "
2018-05-30 06:29:21 -04:00
greeting: " Hi, "
2018-06-07 09:21:53 -04:00
message: " Please click the button below to join the team and enjoy the benefits of an upgraded #{ opts . appName } account. "
2018-05-30 06:29:21 -04:00
secondaryMessage: null
ctaText: " Verify now "
ctaURL: opts . acceptInviteUrl
gmailGoToAction: null
} )
2017-01-17 05:52:04 -05:00
templates.testEmail =
2017-01-18 10:28:51 -05:00
subject: _ . template " A Test Email from ShareLaTeX "
layout: BaseWithHeaderEmailLayout
type : " notification "
2017-01-17 05:52:04 -05:00
plainTextTemplate: _ . template """
Hi ,
2017-01-18 10:28:51 -05:00
This is a test email sent from ShareLaTeX .
2017-01-17 05:52:04 -05:00
#{settings.appName} - <%= siteUrl %>
"""
2018-05-30 06:29:21 -04:00
compiledTemplate: (opts) ->
2017-01-18 10:28:51 -05:00
SingleCTAEmailBody ( {
title: " A Test Email from ShareLaTeX "
greeting: " Hi, "
message: " This is a test email sent from ShareLaTeX "
secondaryMessage: null
ctaText: " Open ShareLaTeX "
ctaURL: " / "
gmailGoToAction: null
} )
2017-01-17 05:52:04 -05:00
2014-03-04 13:10:06 -05:00
module.exports =
2015-03-19 13:19:56 -04:00
templates: templates
2014-03-04 13:10:06 -05:00
buildEmail: (templateName, opts)->
template = templates [ templateName ]
2014-06-17 11:28:52 -04:00
opts.siteUrl = settings . siteUrl
2014-03-04 13:10:06 -05:00
opts.body = template . compiledTemplate ( opts )
2016-06-28 12:07:27 -04:00
if settings . email ? . templates ? . customFooter ?
opts . body += settings . email ? . templates ? . customFooter
2014-03-04 13:10:06 -05:00
return {
subject : template . subject ( opts )
html: template . layout ( opts )
2016-10-03 10:25:38 -04:00
text: template ? . plainTextTemplate ? ( opts )
2014-03-05 06:22:34 -05:00
type : template . type
2017-01-17 05:52:04 -05:00
}