|
| 1 | +import { |
| 2 | + Body, |
| 3 | + Column, |
| 4 | + Container, |
| 5 | + Head, |
| 6 | + Hr, |
| 7 | + Html, |
| 8 | + Img, |
| 9 | + Link, |
| 10 | + Preview, |
| 11 | + Row, |
| 12 | + Section, |
| 13 | + Text, |
| 14 | +} from '@react-email/components' |
| 15 | +import EmailFooter from '@/components/emails/footer' |
| 16 | +import { getBrandConfig } from '@/lib/branding/branding' |
| 17 | +import { env } from '@/lib/env' |
| 18 | +import { baseStyles } from './base-styles' |
| 19 | + |
| 20 | +interface PlanWelcomeEmailProps { |
| 21 | + planName: 'Pro' | 'Team' |
| 22 | + userName?: string |
| 23 | + loginLink?: string |
| 24 | + createdDate?: Date |
| 25 | +} |
| 26 | + |
| 27 | +export function PlanWelcomeEmail({ |
| 28 | + planName, |
| 29 | + userName, |
| 30 | + loginLink, |
| 31 | + createdDate = new Date(), |
| 32 | +}: PlanWelcomeEmailProps) { |
| 33 | + const brand = getBrandConfig() |
| 34 | + const baseUrl = env.NEXT_PUBLIC_APP_URL || 'https://sim.ai' |
| 35 | + const cta = loginLink || `${baseUrl}/login` |
| 36 | + |
| 37 | + const previewText = `${brand.name}: Your ${planName} plan is active` |
| 38 | + |
| 39 | + return ( |
| 40 | + <Html> |
| 41 | + <Head /> |
| 42 | + <Preview>{previewText}</Preview> |
| 43 | + <Body style={baseStyles.main}> |
| 44 | + <Container style={baseStyles.container}> |
| 45 | + <Section style={{ padding: '30px 0', textAlign: 'center' }}> |
| 46 | + <Row> |
| 47 | + <Column style={{ textAlign: 'center' }}> |
| 48 | + <Img |
| 49 | + src={brand.logoUrl || '/logo/reverse/text/medium.png'} |
| 50 | + width='114' |
| 51 | + alt={brand.name} |
| 52 | + style={{ |
| 53 | + margin: '0 auto', |
| 54 | + }} |
| 55 | + /> |
| 56 | + </Column> |
| 57 | + </Row> |
| 58 | + </Section> |
| 59 | + |
| 60 | + <Section style={baseStyles.sectionsBorders}> |
| 61 | + <Row> |
| 62 | + <Column style={baseStyles.sectionBorder} /> |
| 63 | + <Column style={baseStyles.sectionCenter} /> |
| 64 | + <Column style={baseStyles.sectionBorder} /> |
| 65 | + </Row> |
| 66 | + </Section> |
| 67 | + |
| 68 | + <Section style={baseStyles.content}> |
| 69 | + <Text style={{ ...baseStyles.paragraph, marginTop: 0 }}> |
| 70 | + {userName ? `Hi ${userName},` : 'Hi,'} |
| 71 | + </Text> |
| 72 | + <Text style={baseStyles.paragraph}> |
| 73 | + Welcome to the <strong>{planName}</strong> plan on {brand.name}. You're all set to |
| 74 | + build, test, and scale your agentic workflows. |
| 75 | + </Text> |
| 76 | + |
| 77 | + <Link href={cta} style={{ textDecoration: 'none' }}> |
| 78 | + <Text style={baseStyles.button}>Open {brand.name}</Text> |
| 79 | + </Link> |
| 80 | + |
| 81 | + <Text style={baseStyles.paragraph}> |
| 82 | + Want to discuss your plan or get personalized help getting started?{' '} |
| 83 | + <Link href='https://cal.com/waleedlatif/15min' style={baseStyles.link}> |
| 84 | + Schedule a 15-minute call |
| 85 | + </Link>{' '} |
| 86 | + with our team. |
| 87 | + </Text> |
| 88 | + |
| 89 | + <Hr /> |
| 90 | + |
| 91 | + <Text style={baseStyles.paragraph}> |
| 92 | + Need to invite teammates, adjust usage limits, or manage billing? You can do that from |
| 93 | + Settings → Subscription. |
| 94 | + </Text> |
| 95 | + |
| 96 | + <Text style={baseStyles.paragraph}> |
| 97 | + Best regards, |
| 98 | + <br /> |
| 99 | + The Sim Team |
| 100 | + </Text> |
| 101 | + |
| 102 | + <Text style={{ ...baseStyles.paragraph, fontSize: '12px', color: '#666' }}> |
| 103 | + Sent on {createdDate.toLocaleDateString()} |
| 104 | + </Text> |
| 105 | + </Section> |
| 106 | + </Container> |
| 107 | + <EmailFooter baseUrl={baseUrl} /> |
| 108 | + </Body> |
| 109 | + </Html> |
| 110 | + ) |
| 111 | +} |
| 112 | + |
| 113 | +export default PlanWelcomeEmail |
0 commit comments