From 1187cafd07f2fefed34151534357da6dddf7eaff Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 11 Apr 2025 18:16:14 +0200 Subject: [PATCH] update email templates --- consumer/src/EmailController.ts | 8 +- email/src/services/email.ts | 12 +- email/src/services/server.ts | 18 ++- email/templates/ConfirmEmail.ts | 7 +- email/templates/Limit50Email.ts | 18 +-- email/templates/Limit90Email.ts | 19 +-- email/templates/LimitMaxEmail.ts | 29 ++-- email/templates/PurchaseEmail.ts | 109 ++++++++++++--- email/templates/WelcomeEmail.ts | 183 ++++++++++++++++++++----- shared_global/services/EmailService.ts | 8 +- 10 files changed, 290 insertions(+), 121 deletions(-) diff --git a/consumer/src/EmailController.ts b/consumer/src/EmailController.ts index 51966c6..a107535 100644 --- a/consumer/src/EmailController.ts +++ b/consumer/src/EmailController.ts @@ -15,7 +15,7 @@ export async function checkLimitsForEmail(projectCounts: TUserLimit) { await LimitNotifyModel.create({ user_id, limit1: false, limit2: false, limit3: false }) } - const owner = await UserModel.findById(project.owner); + const owner = await UserModel.findById(user_id); if (!owner) return; const userName = owner.given_name || owner.name || 'no_name'; @@ -25,7 +25,7 @@ export async function checkLimitsForEmail(projectCounts: TUserLimit) { if (hasNotifyEntry.limit3 === true) return; setImmediate(() => { - const emailData = EmailService.getEmailServerInfo('limit_max', { target: owner.email, userName }); + const emailData = EmailService.getEmailServerInfo('limit_max', { target: owner.email }); EmailServiceHelper.sendEmail(emailData); }); @@ -36,7 +36,7 @@ export async function checkLimitsForEmail(projectCounts: TUserLimit) { if (hasNotifyEntry.limit2 === true) return; setImmediate(() => { - const emailData = EmailService.getEmailServerInfo('limit_90', { target: owner.email, userName }); + const emailData = EmailService.getEmailServerInfo('limit_90', { target: owner.email }); EmailServiceHelper.sendEmail(emailData); }); @@ -47,7 +47,7 @@ export async function checkLimitsForEmail(projectCounts: TUserLimit) { if (hasNotifyEntry.limit1 === true) return; setImmediate(() => { - const emailData = EmailService.getEmailServerInfo('limit_50', { target: owner.email, userName }); + const emailData = EmailService.getEmailServerInfo('limit_50', { target: owner.email }); EmailServiceHelper.sendEmail(emailData); }); diff --git a/email/src/services/email.ts b/email/src/services/email.ts index c58beef..9faee2d 100644 --- a/email/src/services/email.ts +++ b/email/src/services/email.ts @@ -62,7 +62,7 @@ export class EmailService { } } - static async sendLimitEmail50(target: string, projectName: string) { + static async sendLimitEmail50(target: string) { try { const sendSmtpEmail = new SendSmtpEmail(); sendSmtpEmail.subject = "⚡ You've reached 50% limit on Litlyx"; @@ -70,7 +70,6 @@ export class EmailService { sendSmtpEmail.to = [{ "email": target }]; sendSmtpEmail.htmlContent = TEMPLATE.LIMIT_50_EMAIL - .replace(/\[Project Name\]/, projectName) .toString(); await this.apiInstance.sendTransacEmail(sendSmtpEmail); @@ -81,14 +80,13 @@ export class EmailService { } } - static async sendLimitEmail90(target: string, projectName: string) { + static async sendLimitEmail90(target: string) { try { const sendSmtpEmail = new SendSmtpEmail(); sendSmtpEmail.subject = "⚡ You've reached 90% limit on Litlyx"; sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" }; sendSmtpEmail.to = [{ "email": target }]; sendSmtpEmail.htmlContent = TEMPLATE.LIMIT_90_EMAIL - .replace(/\[Project Name\]/, projectName) .toString(); await this.apiInstance.sendTransacEmail(sendSmtpEmail); return true; @@ -98,14 +96,13 @@ export class EmailService { } } - static async sendLimitEmailMax(target: string, projectName: string) { + static async sendLimitEmailMax(target: string) { try { const sendSmtpEmail = new SendSmtpEmail(); sendSmtpEmail.subject = "🚨 You've reached your limit on Litlyx!"; sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" }; sendSmtpEmail.to = [{ "email": target }]; sendSmtpEmail.htmlContent = TEMPLATE.LIMIT_MAX_EMAIL - .replace(/\[Project Name\]/, projectName) .toString(); await this.apiInstance.sendTransacEmail(sendSmtpEmail); return true; @@ -130,14 +127,13 @@ export class EmailService { } } - static async sendPurchaseEmail(target: string, projectName: string) { + static async sendPurchaseEmail(target: string) { try { const sendSmtpEmail = new SendSmtpEmail(); sendSmtpEmail.subject = "Thank You for Upgrading Your Litlyx Plan!"; sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" }; sendSmtpEmail.to = [{ "email": target }]; sendSmtpEmail.htmlContent = TEMPLATE.PURCHASE_EMAIL - .replace(/\[Project Name\]/, projectName) .toString(); await this.apiInstance.sendTransacEmail(sendSmtpEmail); return true; diff --git a/email/src/services/server.ts b/email/src/services/server.ts index a42b020..4773cf0 100644 --- a/email/src/services/server.ts +++ b/email/src/services/server.ts @@ -90,10 +90,8 @@ app.post('/send/welcome', express.json(), async (req, res) => { app.post('/send/purchase', express.json(), async (req, res) => { try { - console.log('PURCHASE EMAIL DISABLED') - return; - const { target, projectName } = req.body; - const ok = await EmailService.sendPurchaseEmail(target, projectName); + const { target } = req.body; + const ok = await EmailService.sendPurchaseEmail(target); res.json({ ok }); } catch (ex) { res.status(500).json({ error: ex.message }); @@ -132,8 +130,8 @@ app.post('/send/anomaly/visits_events', express.json(), async (req, res) => { app.post('/send/limit/50', express.json(), async (req, res) => { try { - const { target, projectName } = req.body; - const ok = await EmailService.sendLimitEmail50(target, projectName); + const { target } = req.body; + const ok = await EmailService.sendLimitEmail50(target); res.json({ ok }); } catch (ex) { res.status(500).json({ error: ex.message }); @@ -142,8 +140,8 @@ app.post('/send/limit/50', express.json(), async (req, res) => { app.post('/send/limit/90', express.json(), async (req, res) => { try { - const { target, projectName } = req.body; - const ok = await EmailService.sendLimitEmail90(target, projectName); + const { target } = req.body; + const ok = await EmailService.sendLimitEmail90(target); res.json({ ok }); } catch (ex) { res.status(500).json({ error: ex.message }); @@ -152,8 +150,8 @@ app.post('/send/limit/90', express.json(), async (req, res) => { app.post('/send/limit/max', express.json(), async (req, res) => { try { - const { target, projectName } = req.body; - const ok = await EmailService.sendLimitEmailMax(target, projectName); + const { target } = req.body; + const ok = await EmailService.sendLimitEmailMax(target); res.json({ ok }); } catch (ex) { res.status(500).json({ error: ex.message }); diff --git a/email/templates/ConfirmEmail.ts b/email/templates/ConfirmEmail.ts index 05f9a3b..523f00b 100644 --- a/email/templates/ConfirmEmail.ts +++ b/email/templates/ConfirmEmail.ts @@ -1,5 +1,6 @@ -export const CONFIRM_EMAIL = ` +export const CONFIRM_EMAIL = ` + @@ -35,7 +36,7 @@ export const CONFIRM_EMAIL = ` .button { display: inline-block; padding: 10px 20px; - background-color: #007bff; + background-color: #0a0a0a; color: #ffffff; text-decoration: none; border-radius: 5px; @@ -61,7 +62,7 @@ export const CONFIRM_EMAIL = `

We hope to hear from you soon!

diff --git a/email/templates/Limit50Email.ts b/email/templates/Limit50Email.ts index 496a909..131612d 100644 --- a/email/templates/Limit50Email.ts +++ b/email/templates/Limit50Email.ts @@ -1,14 +1,10 @@ -export const LIMIT_50_EMAIL = ` - +export const LIMIT_50_EMAIL = ` + + - - -

- You’ve Reached 50% of Your Litlyx Project Limit on [Project Name] + You’ve Reached 50% of Your Litlyx's Tracking Limits

To avoid losing precious data, please remember to monitor your usage on the Litlyx Dashboard. You can find your current - usage details under Settings > Billing Tab + usage details in your account section.

If you need more data collection storage, you may consider upgrading @@ -65,7 +61,7 @@ export const LIMIT_50_EMAIL = `Have a nice day!

Antonio,

-

CEO | Litlyx

+

CEO at Litlyx

- 2024 © Litlyx. All rights reserved. + 2025 © Litlyx. All rights reserved.
Litlyx S.R.L. - Viale Tirreno, 187 - 00141 Rome - P.IVA: 17814721001- REA: RM-1743194 diff --git a/email/templates/Limit90Email.ts b/email/templates/Limit90Email.ts index dc53f84..9ab0183 100644 --- a/email/templates/Limit90Email.ts +++ b/email/templates/Limit90Email.ts @@ -1,14 +1,10 @@ -export const LIMIT_90_EMAIL = ` - +export const LIMIT_90_EMAIL = ` + + - - -

- You’ve Reached 90% of Your Litlyx Project Limit on [Project Name] + You’ve Reached 90% of Your Litlyx's Tracking Limits

To avoid losing precious data, please remember to monitor your usage on the Litlyx Dashboard. You can find your current - usage details under Settings > Billing Tab + usage details in your account section.

If you need more data collection storage, you may consider upgrading @@ -65,7 +61,7 @@ export const LIMIT_90_EMAIL = `Have a nice day!

Antonio,

-

CEO | Litlyx

+

CEO at Litlyx

- 2024 © Litlyx. All rights reserved. + 2025 © Litlyx. All rights reserved.
Litlyx S.R.L. - Viale Tirreno, 187 - 00141 Rome - P.IVA: 17814721001- REA: RM-1743194 @@ -113,5 +109,4 @@ export const LIMIT_90_EMAIL = ` - ` diff --git a/email/templates/LimitMaxEmail.ts b/email/templates/LimitMaxEmail.ts index 8d15df3..198c828 100644 --- a/email/templates/LimitMaxEmail.ts +++ b/email/templates/LimitMaxEmail.ts @@ -1,14 +1,9 @@ -export const LIMIT_MAX_EMAIL = ` - +export const LIMIT_MAX_EMAIL = ` + - - -

- You’ve Reached Your Litlyx Project Limit on [Project Name] + You’ve Reached Your Litlyx's Tracking Limits

- We noticed that Litlyx has stopped collecting data for your project. + Litlyx has stopped collecting data for your project.

@@ -62,14 +57,9 @@ export const LIMIT_MAX_EMAIL = ` If you need additional storage for data collection, consider upgrading your plan to unlock more benefits and ensure uninterrupted - service. + service. You can find out more here: Our pricing

-

- As a token of appreciation, we're offering you 25% off for life at - checkout with the code LIT25. -

- Thank you for choosing Litlyx as your trusted analytics tool. -

+

If you have any questions or need assistance, feel free to reply to @@ -82,8 +72,8 @@ export const LIMIT_MAX_EMAIL = `

- Antonio - CEO | Litlyx + Antonio, + CEO at Litlyx

@@ -113,7 +103,7 @@ export const LIMIT_MAX_EMAIL = `

- 2024 © Litlyx. All rights reserved. + 2025 © Litlyx. All rights reserved.
Litlyx S.R.L. - Viale Tirreno, 187 - 00141 Rome - P.IVA: 17814721001- REA: RM-1743194 @@ -134,5 +124,4 @@ export const LIMIT_MAX_EMAIL = ` - ` diff --git a/email/templates/PurchaseEmail.ts b/email/templates/PurchaseEmail.ts index 6d7da9d..1d726d8 100644 --- a/email/templates/PurchaseEmail.ts +++ b/email/templates/PurchaseEmail.ts @@ -1,29 +1,104 @@ -export const PURCHASE_EMAIL = ` - +export const PURCHASE_EMAIL = ` + + + - - - - Thank You for Upgrading Your Litlyx Plan! + + - - + + + + + + + +
-

Dear User,

+ + + + + + +
+ Founder +
-

We are thrilled to inform you that [Project Name] on Litlyx has successfully been upgraded to a higher plan! Thank you for choosing to elevate your experience with us and for believing in our project.

+ + + + + + +
+ + + + + + +
+

+ Your upgrade is live! +

-

We appreciate your trust in Litlyx and are committed to providing you with the best analytics experience. Your support helps us to continually improve our platform and bring new features to make your analytics journey even better.

+

Thank you for choosing Litlyx as your go-to website analytics tool. Our mission is simple: to make everyday tracking effortless and effective.

-

You can find your current plan details and download your invoices under Settings > Billing Tab.

+

We’re super happy to have you with us, and we can’t wait to keep improving Litlyx every single day. You’re part of this journey now, and we’re building it with you in mind.

-

If you have any questions about your new plan or need assistance, feel free to reach out to our support team at help@litlyx.com. We’re here to help you make the most out of your upgraded plan!

+

If you have any questions, need help, or want to share feedback, just reply to this email or reach out at help@litlyx.com. I’d love to hear from you.

-

Best regards,

+

Thanks again for being with us. We won't let you down.

-

Antonio,

-

CEO @ Litlyx

+

Have a great day!

+

Antonio,
CEO at Litlyx

+ + + + Go to Dashboard + + +
+
+ +
+ + + + + + + +
+ + + + + + +
+

+ 2025 © Litlyx. All rights reserved. +
+ Litlyx S.R.L. - Viale Tirreno, 187 - 00141 Rome - P.IVA: 17814721001 - REA: RM-1743194 +

+
+
+ +
-` \ No newline at end of file + + +` \ No newline at end of file diff --git a/email/templates/WelcomeEmail.ts b/email/templates/WelcomeEmail.ts index 803b828..63db259 100644 --- a/email/templates/WelcomeEmail.ts +++ b/email/templates/WelcomeEmail.ts @@ -1,39 +1,158 @@ export const WELCOME_EMAIL = ` - + + - - - - Welcome to Litlyx! + + - - -

We’re happy to have you onboard,

- -

At Litlyx, we’re committed to creating the best analytics collection experience for everybody, starting from developers.

- -

Here are a few things you can do to get started tracking analytics today:

- -
    -
  1. Create a new project – by just naming it
  2. -
  3. Copy the universal Script – we provide you the snippets to copy in your index.html file and start instantly to track metrics on your website or web app.
  4. -
  5. Deploy – Litlyx is production ready.
  6. -
- -

If you have any questions or need support, visit docs.litlyx.com.

- -

Feel free to reply to this email or reach out to our team at help@litlyx.com. We’re here to help!

- -

Link to Discord for developer support: https://discord.com/invite/9cQykjsmWX

- -

Thank you for joining us, and we look forward to seeing you around.

- -

We want to make analytics the freshest thing on the web.

- -

Antonio,

-

CEO | Litlyx

- + + + + + + + + +
+ + + + + + + +
+ Founder +
+ + + + + + + +
+ + + + + + +
+

+ Welcome to Litlyx! +

+ +

+ Hey, I’m Antonio, CEO at Litlyx. Just wanted to say a quick + thank you for signing up. +

+ +

+ We built Litlyx to make website analytics easy, fast, and + privacy-conscious. Your personal AI assistant can learn to serve your needs over time advicing you on growing your audience and improve your product. +

+ +

+ Here’s how to get started in under 1 minute: +

+ +
    +
  1. Create + a new project – name it and you’re good + to go
  2. +
  3. Copy the tracking script – paste it in your + index.html and start collecting data instantly +
  4. +
  5. Deploy – Litlyx is ready for production and + incredibly lightweight
  6. +
+ +

+ Using WordPress, Google Tag Manager, or a modern framework? Head + over to our docs for full setup + instructions. +

+ +

+ Got questions or feedback? Just reply to this email or reach out + to help@litlyx.com. We’re always + here to help. +

+ +

+ You can also join our Discord community for live + support and product updates. +

+ +

+ Thanks again for joining us. We’re excited to have you on board. +

+ +

+ Let’s make analytics the simplest part of your stack. +

+ +

Antonio,

+

CEO at + Litlyx

+ + + + Go to Dashboard + + +
+
+ +
+ + + + + + + +
+ + + + + + +
+

+ 2025 © Litlyx. All rights reserved. +
+ Litlyx S.R.L. – Viale Tirreno, 187 – 00141 Rome – P.IVA: + 17814721001 – REA: RM-1743194 +

+
+
+ +
+ ` \ No newline at end of file diff --git a/shared_global/services/EmailService.ts b/shared_global/services/EmailService.ts index 91caf58..96b06fa 100644 --- a/shared_global/services/EmailService.ts +++ b/shared_global/services/EmailService.ts @@ -19,13 +19,13 @@ export type EmailServerInfo = { url: string, body: Record, headers: type EmailData = | { template: 'confirm', data: { target: string, link: string } } | { template: 'welcome', data: { target: string } } - | { template: 'purchase', data: { target: string, projectName: string } } + | { template: 'purchase', data: { target: string } } | { template: 'reset_password', data: { target: string, newPassword: string } } | { template: 'anomaly_domain', data: { target: string, projectName: string, domains: string[] } } | { template: 'anomaly_visits_events', data: { target: string, projectName: string, data: any[] } } - | { template: 'limit_50', data: { target: string, projectName: string } } - | { template: 'limit_90', data: { target: string, projectName: string } } - | { template: 'limit_max', data: { target: string, projectName: string } } + | { template: 'limit_50', data: { target: string } } + | { template: 'limit_90', data: { target: string } } + | { template: 'limit_max', data: { target: string } } | { template: 'invite_project', data: { target: string, projectName: string, link: string } } | { template: 'invite_project_noaccount', data: { target: string, projectName: string, link: string } } | { template: 'brevolist_add', data: { email: string } }