sim
sim copied to clipboard
feat(email): welcome email; improvement(emails): ui/ux
Summary
Improved email ui/ux.
Added welcome email.
Type of Change
- [x] New feature
Testing
Solo.
Checklist
- [x] Code follows project style guidelines
- [x] Self-reviewed my changes
- [ ] Tests added/updated and passing
- [x] No new warnings introduced
- [x] I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
The latest updates on your projects. Learn more about Vercel for GitHub.
Greptile Summary
- Complete email system refactor with centralized styling, EmailLayout component, and organized directory structure moving from flat file organization to feature-based subdirectories (auth/, billing/, careers/, invitations/, support/)
- New welcome email functionality for user onboarding with personalized sender configuration that automatically sends to OAuth users and email-verified users during registration
- Template simplification removing unnecessary props (dates, emails) and consolidating email rendering through barrel exports for improved maintainability and consistency
Important Files Changed
| Filename | Overview |
|---|---|
apps/sim/components/emails/_styles/base.ts |
New comprehensive design system with color tokens, typography, and styling constants for email consistency |
apps/sim/components/emails/components/email-layout.tsx |
New shared EmailLayout component that eliminates code duplication across all email templates |
apps/sim/lib/auth/auth.ts |
Added welcome email sending for OAuth users and email verification users with personalized sender configuration |
apps/sim/components/emails/index.ts |
Major refactoring from flat exports to organized barrel exports by category (auth, billing, careers, etc.) |
apps/sim/components/emails/render.ts |
Restructured email rendering functions with simplified signatures and reorganized imports by domain |
Confidence score: 4/5
- This PR modernizes the email system with comprehensive architectural improvements that are generally well-implemented and follow established patterns
- Score reflects mostly safe changes with proper error handling and backwards compatibility, but deducted one point due to hardcoded Pro plan pricing in the free tier upgrade email that could become outdated
- Pay close attention to
apps/sim/components/emails/billing/free-tier-upgrade-email.tsxwhich contains hardcoded pricing information that may need updates if plan details change
Sequence Diagram
sequenceDiagram
participant User
participant "Chat Page" as Chat
participant "OTP API" as API
participant "Database" as DB
participant "Storage" as Storage
participant "Email Service" as Email
User->>Chat: "Access chat with email auth"
Chat->>API: "POST /api/chat/[identifier]/otp"
API->>DB: "Get chat deployment by identifier"
DB-->>API: "Chat deployment details"
API->>API: "Validate email is authorized"
API->>API: "Generate 6-digit OTP"
API->>Storage: "Store OTP with 15min expiry"
API->>Email: "Send OTP email to user"
Email-->>User: "OTP verification email"
API-->>Chat: "Success: OTP sent"
User->>Chat: "Enter OTP code"
Chat->>API: "PUT /api/chat/[identifier]/otp"
API->>DB: "Get chat deployment"
API->>Storage: "Retrieve stored OTP"
API->>API: "Verify OTP matches"
API->>Storage: "Delete used OTP"
API->>API: "Set auth cookie"
API-->>Chat: "Success: authenticated"
Chat-->>User: "Access granted to chat"
@greptile