Files
g-butandClaude Opus 4.5 0c2b798cb8 refactor: modularize large components and centralize email config
Component splits (all >400 lines to modular directories):
- AICaseAnalysis.tsx → ai-case-analysis/ (utils, states, report)
- DemoSection.tsx → demo-section/ (steps, navigation, progress)
- WorkspaceDashboard.tsx → workspace-dashboard/ (sections, UI)
- ExampleSection.tsx → example-section/ (tabs for different views)
- AgencyProfile.tsx → agency-profile/ (tabs for overview, etc)
- CitizenProfile.tsx → citizen-profile/ (sections, tabs)
- TransactionWithTraceability.tsx → transaction-traceability/

Email configuration:
- Created lib/config/email.ts with centralized settings
- Replaced hardcoded emails with environment variables
- Added EmailServiceError class for proper error handling
- Updated templates to use centralized config

Added Zod validation schemas for API input validation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 08:39:31 +01:00

90 lines
4.1 KiB
TypeScript

import { EMAIL_ADDRESSES, EMAIL_URLS } from '@/lib/config/email';
/**
* Generate welcome email HTML template
*/
export const getWelcomeEmailTemplate = (data: {
name: string;
preferences: { newsletter: boolean; productUpdates: boolean };
}): string => `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
/* Tailwind-inspired styles */
.container { max-width: 600px; margin: 0 auto; padding: 20px; font-family: system-ui, -apple-system, sans-serif; }
.heading { font-size: 24px; color: #1a202c; margin-bottom: 16px; font-weight: bold; }
.text { color: #4a5568; line-height: 1.5; margin-bottom: 12px; }
.highlight { color: #4f46e5; font-weight: 500; }
.button { display: inline-block; background-color: #4f46e5; color: white; padding: 12px 24px; border-radius: 6px; text-decoration: none; margin-top: 16px; font-weight: 500; }
.footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid #e2e8f0; color: #718096; font-size: 14px; }
</style>
</head>
<body>
<div class="container">
<h1 class="heading">Welcome to Botsmann, ${data.name}!</h1>
<p class="text">Thank you for reaching out. We're excited to help you explore innovative <span class="highlight">AI and robotic solutions</span> that can transform your business.</p>
<p class="text">Our team will carefully review your message and get back to you shortly with personalized recommendations tailored to your specific needs.</p>
${
data.preferences.newsletter
? '<p class="text">You\'ll receive our newsletter with the latest updates, industry insights, and success stories from businesses like yours.</p>'
: ''
}
${
data.preferences.productUpdates
? '<p class="text">We\'ll keep you informed about new features and improvements that can benefit your business.</p>'
: ''
}
<a href="${EMAIL_URLS.dashboard}" class="button">Visit Your Dashboard</a>
<div class="footer">
<p>Best regards,<br>The Botsmann Team</p>
<p>Questions? Reply to this email or contact us at ${EMAIL_ADDRESSES.support}</p>
</div>
</div>
</body>
</html>
`;
/**
* Legacy template export for backwards compatibility
* @deprecated Use getWelcomeEmailTemplate() instead
*/
export const welcomeEmailTemplate = `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
/* Tailwind-inspired styles */
.container { max-width: 600px; margin: 0 auto; padding: 20px; font-family: system-ui, -apple-system, sans-serif; }
.heading { font-size: 24px; color: #1a202c; margin-bottom: 16px; font-weight: bold; }
.text { color: #4a5568; line-height: 1.5; margin-bottom: 12px; }
.highlight { color: #4f46e5; font-weight: 500; }
.button { display: inline-block; background-color: #4f46e5; color: white; padding: 12px 24px; border-radius: 6px; text-decoration: none; margin-top: 16px; font-weight: 500; }
.footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid #e2e8f0; color: #718096; font-size: 14px; }
</style>
</head>
<body>
<div class="container">
<h1 class="heading">Welcome to Botsmann, {{name}}!</h1>
<p class="text">Thank you for reaching out. We're excited to help you explore innovative <span class="highlight">AI and robotic solutions</span> that can transform your business.</p>
<p class="text">Our team will carefully review your message and get back to you shortly with personalized recommendations tailored to your specific needs.</p>
{{#if preferences.newsletter}}
<p class="text">You'll receive our newsletter with the latest updates, industry insights, and success stories from businesses like yours.</p>
{{/if}}
{{#if preferences.productUpdates}}
<p class="text">We'll keep you informed about new features and improvements that can benefit your business.</p>
{{/if}}
<a href="{{dashboardUrl}}" class="button">Visit Your Dashboard</a>
<div class="footer">
<p>Best regards,<br>The Botsmann Team</p>
<p>Questions? Reply to this email or contact us at {{supportEmail}}</p>
</div>
</div>
</body>
</html>
`;