import { Link, Section, Text } from '@react-email/components' import { baseStyles } from '@/components/emails/_styles' import { EmailLayout } from '@/components/emails/components' import { dollarsToCredits } from '@/lib/billing/credits/conversion' import { getBrandConfig } from '@/ee/whitelabeling' interface UsageThresholdEmailProps { userName?: string planName: string percentUsed: number currentUsage: number limit: number ctaLink: string } export function UsageThresholdEmail({ userName, planName, percentUsed, currentUsage, limit, ctaLink, }: UsageThresholdEmailProps) { const brand = getBrandConfig() const previewText = `${brand.name}: You're at ${percentUsed}% of your ${planName} monthly budget` return ( {userName ? `Hi ${userName},` : 'Hi,'} You're approaching your monthly budget on the {planName} plan.
Usage {dollarsToCredits(currentUsage).toLocaleString()} of{' '} {dollarsToCredits(limit).toLocaleString()} credits used ({percentUsed}%)
{/* Divider */}
To avoid interruptions, consider increasing your monthly limit. Review Limits {/* Divider */}
One-time notification at 80% usage. ) } export default UsageThresholdEmail