mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
add anomaly + fix billing + add emails templates
This commit is contained in:
@@ -4,6 +4,8 @@ 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';
|
||||
import { ANOMALY_VISITS_EVENTS_EMAIL } from './email_templates/AnomalyUsageEmail';
|
||||
import { ANOMALY_DOMAIN_EMAIL } from './email_templates/AnomalyDomainEmail';
|
||||
|
||||
|
||||
class EmailService {
|
||||
@@ -99,6 +101,40 @@ class EmailService {
|
||||
}
|
||||
}
|
||||
|
||||
async sendAnomalyVisitsEventsEmail(target: string, projectName: string) {
|
||||
try {
|
||||
const sendSmtpEmail = new SendSmtpEmail();
|
||||
sendSmtpEmail.subject = "🚨 Unexpected Activity Detected by our AI";
|
||||
sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" };
|
||||
sendSmtpEmail.to = [{ "email": target }];
|
||||
sendSmtpEmail.htmlContent = ANOMALY_VISITS_EVENTS_EMAIL
|
||||
.replace(/\[Project Name\]/, projectName)
|
||||
.toString();;
|
||||
await this.apiInstance.sendTransacEmail(sendSmtpEmail);
|
||||
return true;
|
||||
} catch (ex) {
|
||||
console.error('ERROR SENDING EMAIL', ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async sendAnomalyDomainEmail(target: string, projectName: string) {
|
||||
try {
|
||||
const sendSmtpEmail = new SendSmtpEmail();
|
||||
sendSmtpEmail.subject = "🚨 Anomaly detected by our AI";
|
||||
sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" };
|
||||
sendSmtpEmail.to = [{ "email": target }];
|
||||
sendSmtpEmail.htmlContent = ANOMALY_DOMAIN_EMAIL
|
||||
.replace(/\[Project Name\]/, projectName)
|
||||
.toString();;
|
||||
await this.apiInstance.sendTransacEmail(sendSmtpEmail);
|
||||
return true;
|
||||
} catch (ex) {
|
||||
console.error('ERROR SENDING EMAIL', ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const instance = new EmailService();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
export const ANOMALY_DOMAIN_EMAIL = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
@@ -9,17 +9,12 @@
|
||||
<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>We wanted to let you know that <strong>[Project Name]</strong> on <strong>Litlyx</strong> has an anomaly that our AI agent detected.</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>
|
||||
<p>You can analyze a 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>
|
||||
|
||||
@@ -45,3 +40,4 @@
|
||||
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
export const ANOMALY_VISITS_EVENTS_EMAIL = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
@@ -9,7 +9,6 @@
|
||||
<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>
|
||||
|
||||
@@ -40,3 +39,4 @@
|
||||
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
Reference in New Issue
Block a user