Merge pull request #7712 from overleaf/jpa-email-copy-changes

[web] make copy changes to trial onboarding email

GitOrigin-RevId: 027ba8d471c0cac56dff7c56135d091a96817cf3
This commit is contained in:
Timothée Alby 2022-04-25 13:05:44 +02:00 committed by Copybot
parent 62075a6ba9
commit f771119cb1
4 changed files with 54 additions and 19 deletions

View file

@ -66,7 +66,7 @@ async function _sendSubscriptionStartedEvent(userId, eventData) {
)
if (isTrial) {
await SubscriptionEmailHandler.sendTrialOnboardingEmail(userId)
await SubscriptionEmailHandler.sendTrialOnboardingEmail(userId, planCode)
}
}

View file

@ -3,11 +3,11 @@ const EmailMessageHelper = require('../Email/EmailMessageHelper')
const settings = require('@overleaf/settings')
EmailBuilder.templates.trialOnboarding = EmailBuilder.NoCTAEmailTemplate({
subject() {
return `Welcome to your ${settings.appName} Premium Features Trial`
subject(opts) {
return `Welcome to your Overleaf ${opts.planName} plan trial`
},
title() {
return `Welcome to your Overleaf Premium Features Trial`
title(opts) {
return `Welcome to your Overleaf ${opts.planName} plan trial`
},
greeting() {
return 'Hello,'
@ -102,39 +102,52 @@ EmailBuilder.templates.trialOnboarding = EmailBuilder.NoCTAEmailTemplate({
isPlainText
)
const canInviteMoreNamedCollaborators =
opts.features.collaborators === -1 ||
opts.features.collaborators > settings.defaultFeatures.collaborators
let n = 1
return [
`Welcome to your Overleaf Premium Features Trial! We really appreciate your support of Overleaf and are excited for you to use our premium features and get the most out of your trial.`,
`<b>During your trial period, be sure to check out these premium features: </b>`,
`1. <b>Invite more collaborators</b>: You can now invite named collaborators to your project via the share menu in your project (with read-only or edit access). Simply add their email address and an email invitation will be sent to them. You can remove these named collaborators at any time via the same share menu.`,
`<ul><li> Inviting Named Collaborators: ${invitingNamedCollaborators}</li></ul>`,
...(canInviteMoreNamedCollaborators
? [
`${n++}. <b>Invite more collaborators</b>: You can now invite named collaborators to your project via the share menu in your project (with read-only or edit access). Simply add their email address and an email invitation will be sent to them. You can remove these named collaborators at any time via the same share menu.`,
`<ul><li> Inviting Named Collaborators: ${invitingNamedCollaborators}</li></ul>`,
]
: []),
`2. <b>Increased compile timeout</b>: You now have more time for compilation (to generate a PDF of your document) before receiving a timeout error message.`,
`${n++}. <b>Increased compile timeout</b>: You now have more time for compilation (to generate a PDF of your document) before receiving a timeout error message.`,
`<ul><li> Compile Timeout: ${increasedCompileTimeout}</li></ul>`,
`3. <b>Real-time track changes</b>: The track changes mode lets you see exactly what has been changed by your collaborators, and allows you to accept or reject each individual change. `,
`<ul><li> Track Changes: ${realTimeTrackChanges}</li></ul>`,
...(opts.features.trackChanges
? [
`${n++}. <b>Real-time track changes</b>: The track changes mode lets you see exactly what has been changed by your collaborators, and allows you to accept or reject each individual change. `,
`<ul><li> Track Changes: ${realTimeTrackChanges}</li></ul>`,
]
: []),
`4. <b>Full document history and versioning</b>: View the entire history of your project with the ability to revert to previous versions of your document from your project history (versus only 24 hours of history availability on a free Overleaf account). No more fear of losing work or making changes you cant undo. `,
`${n++}. <b>Full document history and versioning</b>: View the entire history of your project with the ability to revert to previous versions of your document from your project history (versus only 24 hours of history availability on a free Overleaf account). No more fear of losing work or making changes you cant undo. `,
`<ul><li> History: ${history}</li>
<li>Versioning: ${versioning}</li></ul>`,
`5. <b>Advanced reference search</b>: You can search by citation key, and our premium feature allows the added ability to search by author, title, year, or journal.`,
`${n++}. <b>Advanced reference search</b>: You can search by citation key, and our premium feature allows the added ability to search by author, title, year, or journal.`,
`<ul><li>Advanced Reference Search: ${advancedReferenceSearch}</li></ul>`,
`6. <b>Reference manager sync </b>: You can link your Mendeley and Zotero accounts to your Overleaf account, allowing you to import your reference library and keep your Overleaf document in sync with the references stored in Mendeley / Zotero.`,
`${n++}. <b>Reference manager sync </b>: You can link your Mendeley and Zotero accounts to your Overleaf account, allowing you to import your reference library and keep your Overleaf document in sync with the references stored in Mendeley / Zotero.`,
`<ul><li> Reference Manager Sync: ${referenceManagerSync}</li></ul>`,
`7. <b>Dropbox Sync</b>: You can link your Dropbox account to your Overleaf account, allowing 2-way integration with Dropbox `,
`${n++}. <b>Dropbox Sync</b>: You can link your Dropbox account to your Overleaf account, allowing 2-way integration with Dropbox `,
`<ul><li> Dropbox Sync: ${dropboxSync}</li></ul>`,
`8. <b>Git and GitHub integration</b>: You can configure your Overleaf project to sync directly with a repository on GitHub, or you can use raw git access. This allows you to work offline and sync your files whenever you come back online. You can also use our Overleaf Git Bridge integration, which lets you git clone, push and pull changes between the online Overleaf editor, and your local offline git repository.`,
`${n++}. <b>Git and GitHub integration</b>: You can configure your Overleaf project to sync directly with a repository on GitHub, or you can use raw git access. This allows you to work offline and sync your files whenever you come back online. You can also use our Overleaf Git Bridge integration, which lets you git clone, push and pull changes between the online Overleaf editor, and your local offline git repository.`,
`<ul><li> Git, GitHub and Git Bridge: ${gitSync}</li></ul>`,
`9. <b>Symbol Palette</b>: A quick and convenient tool to insert math symbols into your document.`,
`${n++}. <b>Symbol Palette</b>: A quick and convenient tool to insert math symbols into your document.`,
`<ul><li> Symbol Palette: ${symbolPalette}</li></ul>`,
`10. <b>Online tutorials and knowledge base</b>: We have an extensive online knowledge base providing a wide range of platform guidance, LaTeX tutorials, technical articles, and webinars.`,
`${n++}. <b>Online tutorials and knowledge base</b>: We have an extensive online knowledge base providing a wide range of platform guidance, LaTeX tutorials, technical articles, and webinars.`,
`<ul><li>LaTeX tutorials: ${latexTutorials}</li>
<li>Knowledge base: ${knowledgeBase}</li>
<li>Technical articles: ${technicalArticles}</li>

View file

@ -1,16 +1,23 @@
const EmailHandler = require('../Email/EmailHandler')
const UserGetter = require('../User/UserGetter')
require('./SubscriptionEmailBuilder')
const PlansLocator = require('./PlansLocator')
const SubscriptionEmailHandler = {
async sendTrialOnboardingEmail(userId) {
async sendTrialOnboardingEmail(userId, planCode) {
const user = await UserGetter.promises.getUser(userId, {
email: 1,
})
const plan = PlansLocator.findLocalPlanInSettings(planCode)
if (!plan) {
throw new Error('unknown paid plan: ' + planCode)
}
const emailOptions = {
to: user.email,
sendingUser_id: userId,
planName: plan.name,
features: plan.features,
}
await EmailHandler.promises.sendEmail('trialOnboarding', emailOptions)
},

View file

@ -23,17 +23,32 @@ describe('SubscriptionEmailHandler', function () {
.resolves({ _id: this.userId, email: 'test@test.com' }),
},
}),
'./PlansLocator': (this.PlansLocator = {
findLocalPlanInSettings: sinon.stub().returns({
name: 'foo',
features: { collaborators: 42 },
}),
}),
},
})
})
it('sends trail onboarding email', async function () {
await this.SubscriptionEmailHandler.sendTrialOnboardingEmail(this.userId)
await this.SubscriptionEmailHandler.sendTrialOnboardingEmail(
this.userId,
'foo-plan-code'
)
expect(this.PlansLocator.findLocalPlanInSettings).to.have.been.calledWith(
'foo-plan-code'
)
expect(this.EmailHandler.promises.sendEmail.lastCall.args).to.deep.equal([
'trialOnboarding',
{
to: this.email,
sendingUser_id: this.userId,
planName: 'foo',
features: { collaborators: 42 },
},
])
})