const fs = require('fs')
const path = require('path')
const musicLandLogoBase64 = fs.readFileSync(path.join(__dirname, '../assets/musicLandLogo.png'), {
encoding: 'base64',
})
const musicLandLogoSrc = `data:image/png;base64,${musicLandLogoBase64}`
function basicTemplate({ title = '', content = '', button = null }) {
const btn = button?.url
? `
${
button?.label || 'Ouvrir'
}
`
: ''
return `
${title}
${content}
${btn}
musicland
|
|
`
}
function cleanEmailName(firstName) {
return typeof firstName === 'string' ? firstName.replace(/[\r\n]+/g, ' ').trim() : ''
}
function escapeHtml(value) {
return value
.replace(/&/g, '&')
.replace(//g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''')
}
function getWelcomeLanguage(preferredLanguage) {
return preferredLanguage === 'en' ? 'en' : 'fr'
}
function welcomeEmailSubject({ firstName = '', preferredLanguage = 'fr' } = {}) {
const language = getWelcomeLanguage(preferredLanguage)
const cleanFirstName = cleanEmailName(firstName)
const subject = language === 'en' ? 'Welcome to Musicland' : 'Bienvenue à MusicLand'
return cleanFirstName ? `${subject}, ${cleanFirstName}` : subject
}
function welcomeTemplate({ firstName = '', preferredLanguage = 'fr' } = {}) {
const language = getWelcomeLanguage(preferredLanguage)
const cleanFirstName = cleanEmailName(firstName)
const safeFirstName = escapeHtml(cleanFirstName)
const greeting =
language === 'en'
? safeFirstName
? `Hi ${safeFirstName},`
: 'Hi,'
: safeFirstName
? `Salut ${safeFirstName},`
: 'Salut,'
const content =
language === 'en'
? `
That’s it, you’ve got your pass to MusicLand. Welcome to the land of song!
You’re about to embark on an extraordinary adventure!
You’ll write your own lyrics, add a melody, shoot your music video… and upload your song to the MusicLand streaming platform.
Three areas await you:
- The Songwriting Area: Céline will help you write original lyrics.
- The Studio: Malik will turn it into beautiful music.
- The Video Studio: With Théo, you’ll direct your first music video.
And don’t worry, you don’t need to know how to sing, you don’t need any musical or technical skills, and you’ll be blown away by the result.
See you soon in the halls of MusicLand,
And… Feel the good vibe!
The MusicLand Team
`
: `
Ça y est : tu as ton pass pour MusicLand. Bienvenue au pays de la chanson !
Tu vas vivre une aventure extraordinaire!
Tu vas écrire tes paroles, habiller ta mélodie, tourner ton clip… et déposer ta chanson sur la plateforme de streaming de MusicLand.
Trois espaces t'attendent:
- L'espace Écriture: Céline va t’aider à composer un texte original.
- Le studio: Malik va le sublimer en musique.
- Le studio vidéo: avec Théo tu réaliseras ton premier clip vidéo.
Et rassure toi, tu n’as pas besoin de savoir chanter, tu n'as besoin d’aucune compétence musicale ou technique et tu vas être bluffé par le résultat.
À très vite dans les allées de MusicLand,
And… Feel the good vibe!
L'équipe MusicLand
`
return `
|
minuit.app · Paris, France
|
`
}
exports.basicTemplate = basicTemplate
exports.welcomeEmailSubject = welcomeEmailSubject
exports.welcomeTemplate = welcomeTemplate