mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
f771119cb1
[web] make copy changes to trial onboarding email GitOrigin-RevId: 027ba8d471c0cac56dff7c56135d091a96817cf3
26 lines
773 B
JavaScript
26 lines
773 B
JavaScript
const EmailHandler = require('../Email/EmailHandler')
|
|
const UserGetter = require('../User/UserGetter')
|
|
require('./SubscriptionEmailBuilder')
|
|
const PlansLocator = require('./PlansLocator')
|
|
|
|
const SubscriptionEmailHandler = {
|
|
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)
|
|
},
|
|
}
|
|
|
|
module.exports = SubscriptionEmailHandler
|