mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-09 23:48:36 +01:00
.
This commit is contained in:
@@ -3,6 +3,7 @@ import { WELCOME_EMAIL } from './email_templates/WelcomeEmail';
|
||||
import { LIMIT_50_EMAIL } from './email_templates/Limit50Email';
|
||||
import { LIMIT_90_EMAIL } from './email_templates/Limit90Email';
|
||||
import { LIMIT_MAX_EMAIL } from './email_templates/LimitMaxEmail';
|
||||
import { PURCHASE_EMAIL } from './email_templates/PurchaseEmail';
|
||||
|
||||
|
||||
class EmailService {
|
||||
@@ -17,7 +18,7 @@ class EmailService {
|
||||
try {
|
||||
const sendSmtpEmail = new SendSmtpEmail();
|
||||
sendSmtpEmail.subject = "You've reached 50% limit on Litlyx";
|
||||
sendSmtpEmail.sender = { "name": "Litlyx", "email": "no-reply@litlyx.com" };
|
||||
sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" };
|
||||
sendSmtpEmail.to = [{ "email": target }];
|
||||
|
||||
sendSmtpEmail.htmlContent = LIMIT_50_EMAIL
|
||||
@@ -36,7 +37,7 @@ class EmailService {
|
||||
try {
|
||||
const sendSmtpEmail = new SendSmtpEmail();
|
||||
sendSmtpEmail.subject = "You've reached 90% limit on Litlyx";
|
||||
sendSmtpEmail.sender = { "name": "Litlyx", "email": "no-reply@litlyx.com" };
|
||||
sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" };
|
||||
sendSmtpEmail.to = [{ "email": target }];
|
||||
sendSmtpEmail.htmlContent = LIMIT_90_EMAIL
|
||||
.replace(/\[Project Name\]/, projectName)
|
||||
@@ -53,7 +54,7 @@ class EmailService {
|
||||
try {
|
||||
const sendSmtpEmail = new SendSmtpEmail();
|
||||
sendSmtpEmail.subject = "You've reached your limit on Litlyx!";
|
||||
sendSmtpEmail.sender = { "name": "Litlyx", "email": "no-reply@litlyx.com" };
|
||||
sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" };
|
||||
sendSmtpEmail.to = [{ "email": target }];
|
||||
sendSmtpEmail.htmlContent = LIMIT_MAX_EMAIL
|
||||
.replace(/\[Project Name\]/, projectName)
|
||||
@@ -70,7 +71,7 @@ class EmailService {
|
||||
try {
|
||||
const sendSmtpEmail = new SendSmtpEmail();
|
||||
sendSmtpEmail.subject = "Welcome to Litlyx!";
|
||||
sendSmtpEmail.sender = { "name": "Litlyx", "email": "no-reply@litlyx.com" };
|
||||
sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" };
|
||||
sendSmtpEmail.to = [{ "email": target }];
|
||||
sendSmtpEmail.htmlContent = WELCOME_EMAIL;
|
||||
await this.apiInstance.sendTransacEmail(sendSmtpEmail);
|
||||
@@ -81,6 +82,21 @@ class EmailService {
|
||||
}
|
||||
}
|
||||
|
||||
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 = PURCHASE_EMAIL;
|
||||
await this.apiInstance.sendTransacEmail(sendSmtpEmail);
|
||||
return true;
|
||||
} catch (ex) {
|
||||
console.error('ERROR SENDING EMAIL', ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const instance = new EmailService();
|
||||
|
||||
@@ -36,7 +36,11 @@ export class RedisStreamService {
|
||||
setTimeout(() => this.readingLoop(options, processFunction), 1);
|
||||
return;
|
||||
}
|
||||
await processFunction(result);
|
||||
try {
|
||||
await processFunction(result);
|
||||
} catch (ex) {
|
||||
console.error('Error on processing function');
|
||||
}
|
||||
RedisStreamService.processed++;
|
||||
await new Promise(r => setTimeout(r, options.delay?.base || 100));
|
||||
setTimeout(() => this.readingLoop(options, processFunction), 1);
|
||||
@@ -49,7 +53,7 @@ export class RedisStreamService {
|
||||
console.log('Processed:', (RedisStreamService.processed / 30).toFixed(), '/s');
|
||||
RedisStreamService.processed = 0;
|
||||
}, 30_000)
|
||||
|
||||
|
||||
try {
|
||||
console.log('Start reading loop');
|
||||
await this.client.xGroupCreate(options.streamName, 'broker', '0', { MKSTREAM: true, });
|
||||
|
||||
45
shared/services/email_templates/PurchaseEmail.ts
Normal file
45
shared/services/email_templates/PurchaseEmail.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
export const PURCHASE_EMAIL = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Thank You for Upgrading Your Litlyx Plan!</title>
|
||||
</head>
|
||||
<body style="font-family: Arial, sans-serif; line-height: 1.6; color: #333;">
|
||||
|
||||
<!-- Email Content -->
|
||||
|
||||
<p>Dear User,</p>
|
||||
|
||||
<p>We are thrilled to inform you that <strong>[Project Name]</strong> on <strong>Litlyx</strong> has successfully been upgraded to a higher plan! Thank you for choosing to elevate your experience with us and for believing in our project.</p>
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
<p>You can find your current plan details and download your invoices under <strong>Settings > Billing Tab</strong>.</p>
|
||||
|
||||
<h3>What does this mean for you?</h3>
|
||||
|
||||
<p>With your upgraded plan, you can now enjoy more data collection, advanced features, and additional benefits to enhance your data analysis capabilities:</p>
|
||||
|
||||
<ol>
|
||||
<li>Access to more storage and increased data limits.</li>
|
||||
<li>Advanced analytics tools like IP-Company Matching, download CSV for your raw data, AI insights, and more.</li>
|
||||
<li>Priority support to help you make the most of your Litlyx experience on Slack or Discord!</li>
|
||||
</ol>
|
||||
|
||||
<p>If you have any questions about your new plan or need assistance, feel free to reach out to our support team at <a href="mailto:help@litlyx.com" style="color: #28a745; text-decoration: none;"><strong>help@litlyx.com</strong></a>. We’re here to help you make the most out of your upgraded plan!</p>
|
||||
|
||||
<p><strong>Thank you for using Litlyx every day as your analytics tool and for being a part of our journey.</strong></p>
|
||||
|
||||
<p>We look forward to continuing to support your growth and success!</p>
|
||||
|
||||
<p>Best regards,</p>
|
||||
|
||||
<p>Antonio,</p>
|
||||
<p>CEO | Litlyx</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
47
shared/services/email_templates/anomaly-dns-email.html
Normal file
47
shared/services/email_templates/anomaly-dns-email.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>❗️ Anomaly detected by our AI</title>
|
||||
</head>
|
||||
<body style="font-family: Arial, sans-serif; line-height: 1.6; color: #333;">
|
||||
|
||||
<!-- Email Content -->
|
||||
<h2 style="color: #D32F2F;">❗️ Anomaly detected by our AI</h2>
|
||||
|
||||
<p>Dear User,</p>
|
||||
|
||||
<p>We wanted to let you know that <strong>[Project Name]</strong> on <strong>Litlyx</strong> has an anomaly that our AI agent detected. Here is the report:</p>
|
||||
|
||||
<p><strong>Anomaly:</strong> Suspicious DNS</p>
|
||||
<p><strong>Message:</strong> [Suspicious DNS name] is logging data in your project. Is that you?</p>
|
||||
<p><strong>Date:</strong> Current date!</p>
|
||||
|
||||
<p>You can analyze the suspicious DNS on your Litlyx dashboard. We put a symbol next to each suspicious DNS to let users know something might be wrong!</p>
|
||||
|
||||
<h3>What can I do?</h3>
|
||||
|
||||
<p>To resolve this issue, you should reach out to the webmasters of the websites that have duplicated your content and request them to remove it or give you proper attribution (if available).</p>
|
||||
|
||||
<p>You can also use <a href="https://www.whois.com/whois/" style="color: #D32F2F; text-decoration: none;">https://www.whois.com/whois/</a> to get the contact details of the webmaster or domain owner.</p>
|
||||
|
||||
<p>If webmasters don't respond or cooperate, <strong>you can file a DMCA complaint here:</strong> <a href="https://support.google.com/legal/answer/3110420?hl=en" style="color: #D32F2F; text-decoration: none;">https://support.google.com/legal/answer/3110420?hl=en</a> <strong>with Google to request the removal of the duplicate content from their search results.</strong></p>
|
||||
|
||||
<h3>Please refer to this for more information:</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://support.google.com/legal/answer/3110420?hl=en&sjid=14235884554806745995-AP&authuser=2" style="color: #D32F2F; text-decoration: none;">Report Content for Legal Reasons</a></li>
|
||||
<li><a href="https://www.dmca.com/FAQ/How-can-I-get-a-webpage-removed-from-Google-search-results" style="color: #D32F2F; text-decoration: none;">How can I get a webpage removed from Google search results?</a></li>
|
||||
</ul>
|
||||
|
||||
<p>Your safety is our main priority.</p>
|
||||
|
||||
<p>Thank you for choosing Litlyx every day as your analytics tool!</p>
|
||||
|
||||
<p>Antonio,</p>
|
||||
<p>CEO | Litlyx</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
42
shared/services/email_templates/anomaly-usage-email.html
Normal file
42
shared/services/email_templates/anomaly-usage-email.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>🚨 Unexpected Activity Detected by our AI</title>
|
||||
</head>
|
||||
<body style="font-family: Arial, sans-serif; line-height: 1.6; color: #333;">
|
||||
|
||||
<!-- Email Content -->
|
||||
<h2 style="color: #D32F2F;">🚨 Unexpected Activity Detected by our AI</h2>
|
||||
|
||||
<p>Dear User,</p>
|
||||
|
||||
<p>We wanted to let you know that <strong>[Project Name]</strong> on <strong>Litlyx</strong> is receiving an unexpected amount of visits or events. This could indicate unusual activity that might require your attention.</p>
|
||||
|
||||
<p>If this spike in activity is expected, there’s no need to worry. However, if you believe this could be unexpected or suspicious, we recommend taking a closer look at your data on the <strong>Litlyx Dashboard</strong>. You can analyze your recent traffic and event logs to identify any irregularities or potential issues.</p>
|
||||
|
||||
<h3>What can I do?</h3>
|
||||
|
||||
<p>To better understand the situation, you can:</p>
|
||||
|
||||
<ol>
|
||||
<li>Review your traffic sources to see where the visits or events are coming from.</li>
|
||||
<li>Check for any unexpected patterns, such as a high number of visits from unknown sources or abnormal event triggers.</li>
|
||||
<li>Check your code to find bugs on a specific action that is triggered in loops.</li>
|
||||
</ol>
|
||||
|
||||
<p>If you need help understanding this activity or have any concerns, feel free to reach out to our support team at <a href="mailto:help@litlyx.com" style="color: #D32F2F; text-decoration: none;"><strong>help@litlyx.com</strong></a>. We are here to assist you!</p>
|
||||
|
||||
<p><strong>Your safety and data integrity are our top priorities.</strong></p>
|
||||
|
||||
<p>Thank you for trusting Litlyx as your analytics tool!</p>
|
||||
|
||||
<p>Best regards,</p>
|
||||
|
||||
<p>Antonio,</p>
|
||||
<p>CEO | Litlyx</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,32 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>You’ve reached 50% limit on Litlyx</title>
|
||||
</head>
|
||||
<body style="font-family: Arial, sans-serif; line-height: 1.6; color: #333;">
|
||||
|
||||
<!-- Email Content -->
|
||||
<h2 style="color: #FF5733;">You’ve reached 50% limit on Litlyx</h2>
|
||||
|
||||
<p>Dear User,</p>
|
||||
|
||||
<p>We wanted to let you know that <strong>[Project Name]</strong> on <strong>Litlyx</strong> has reached 50% of its data collection limit for this month.</p>
|
||||
|
||||
<p>To avoid losing precious data, please remember to monitor your usage on the <strong>Litlyx Dashboard</strong>. You can find your current usage details under <strong>Settings > Billing Tab</strong>.</p>
|
||||
|
||||
<p>If you need more data collection storage, you may consider upgrading your plan to get additional benefits and ensure uninterrupted data collection.</p>
|
||||
|
||||
<p>Feel free to reply to this email or contact us at <a href="mailto:help@litlyx.com" style="color: #FF5733; text-decoration: none;">help@litlyx.com</a> if you have any questions or need assistance.</p>
|
||||
|
||||
<p>Thank you for choosing Litlyx every day as your analytics tool.</p>
|
||||
|
||||
<p>Have a nice day!</p>
|
||||
|
||||
<p>Antonio,</p>
|
||||
<p>CEO | Litlyx</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,32 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>You’ve reached 90% limit on Litlyx</title>
|
||||
</head>
|
||||
<body style="font-family: Arial, sans-serif; line-height: 1.6; color: #333;">
|
||||
|
||||
<!-- Email Content -->
|
||||
<h2 style="color: #FF0000;">You’ve reached 90% limit on Litlyx</h2>
|
||||
|
||||
<p>Dear User,</p>
|
||||
|
||||
<p>We wanted to let you know that <strong>[Project Name]</strong> on <strong>Litlyx</strong> has reached 90% of its data collection limit for this month.</p>
|
||||
|
||||
<p>To avoid losing precious data, please remember to monitor your usage on the <strong>Litlyx Dashboard</strong>. You can find your current usage details under <strong>Settings > Billing Tab</strong>.</p>
|
||||
|
||||
<p>If you need more data collection storage, you may consider upgrading your plan to get additional benefits and ensure uninterrupted data collection.</p>
|
||||
|
||||
<p>Feel free to reply to this email or contact us at <a href="mailto:help@litlyx.com" style="color: #FF0000; text-decoration: none;">help@litlyx.com</a> if you have any questions or need assistance.</p>
|
||||
|
||||
<p>Thank you for choosing Litlyx every day as your analytics tool.</p>
|
||||
|
||||
<p>Have a nice day!</p>
|
||||
|
||||
<p>Antonio,</p>
|
||||
<p>CEO | Litlyx</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,32 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>❗️ You’ve reached your limit on Litlyx!</title>
|
||||
</head>
|
||||
<body style="font-family: Arial, sans-serif; line-height: 1.6; color: #333;">
|
||||
|
||||
<!-- Email Content -->
|
||||
<h2 style="color: #D32F2F;">❗️ You’ve reached your limit on Litlyx!</h2>
|
||||
|
||||
<p>Dear User,</p>
|
||||
|
||||
<p>We wanted to let you know that <strong>[Project Name]</strong> on <strong>Litlyx</strong> has reached the limit of your current plan.</p>
|
||||
|
||||
<p>To avoid losing precious data, please remember to monitor your usage on the <strong>Litlyx Dashboard</strong>. You can find your current usage details under <strong>Settings > Billing Tab</strong>.</p>
|
||||
|
||||
<p>If you need more data collection storage, you may consider upgrading your plan to get additional benefits and ensure uninterrupted data collection.</p>
|
||||
|
||||
<p>Feel free to reply to this email or contact us at <a href="mailto:help@litlyx.com" style="color: #D32F2F; text-decoration: none;">help@litlyx.com</a> if you have any questions or need assistance.</p>
|
||||
|
||||
<p>Thank you for choosing Litlyx every day as your analytics tool.</p>
|
||||
|
||||
<p>Have a nice day!</p>
|
||||
|
||||
<p>Antonio,</p>
|
||||
<p>CEO | Litlyx</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,40 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Welcome to Litlyx!</title>
|
||||
</head>
|
||||
<body style="font-family: Arial, sans-serif; line-height: 1.6; color: #333;">
|
||||
|
||||
<!-- Subject -->
|
||||
<h2 style="color: #007BFF;">Welcome to Litlyx!</h2>
|
||||
|
||||
<p>We’re happy to have you onboard,</p>
|
||||
|
||||
<p>At Litlyx, we’re committed to creating the best analytics collection experience for everybody, starting from developers.</p>
|
||||
|
||||
<p>Here are a few things you can do to get started tracking analytics today:</p>
|
||||
|
||||
<ol>
|
||||
<li><strong><a href="https://dashboard.litlyx.com" style="color: #007BFF; text-decoration: none;">Create a new project</a></strong> – by just naming it</li>
|
||||
<li><strong><a style="color: #0a0a0a; text-decoration: none;">Copy the universal Script</a></strong> – we provide you the snippets to copy in your index.html file and start instantly to track metrics on your website or web app.</li>
|
||||
<li><strong><a style="color: #0a0a0a; text-decoration: none;">Third Step</a></strong> – Encourage engagement or interaction.</li>
|
||||
</ol>
|
||||
|
||||
<p>If you have any questions or need support, visit <a href="http://docs.litlyx.com" style="color: #007BFF;">docs.litlyx.com</a>.</p>
|
||||
|
||||
<p>Feel free to reply to this email or reach out to our team at <a href="mailto:help@litlyx.com" style="color: #007BFF;">help@litlyx.com</a>. We’re here to help!</p>
|
||||
|
||||
<p>Link to Discord for developer support: <a href="https://discord.com/invite/9cQykjsmWX" style="color: #007BFF;">https://discord.com/invite/9cQykjsmWX</a></p>
|
||||
|
||||
<p>Thank you for joining us, and we look forward to seeing you around.</p>
|
||||
|
||||
<p>We want to make analytics the freshest thing on the web.</p>
|
||||
|
||||
<p>Antonio,</p>
|
||||
<p>CEO | Litlyx</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user