@tracked/emails
v0.2.8
Published
Email templates for Tracked Training Platform
Maintainers
Readme
@tracked/emails
Email templates and utilities for Tracked Training Platform.
Features
- 📧 Pre-built React Email templates for common use cases
- ✅ Email and username validation utilities
- 🎨 Consistent branding and styling
- 📦 TypeScript support with full type definitions
- 🧪 Comprehensive test coverage
Installation
npm install @tracked/emails
# or
yarn add @tracked/emails
# or
pnpm add @tracked/emailsUsage
Email Templates
Import and use any of the pre-built email templates:
import { TrackedMagicLink, WelcomeEmail } from '@tracked/emails';
import { render } from '@react-email/components';
// Magic link email
const magicLinkHtml = render(
<TrackedMagicLink url="https://app.tracked.com/verify?token=..." />
);
// Welcome email
const welcomeHtml = render(
<WelcomeEmail username="john_doe" />
);Available Templates
TrackedMagicLink- Magic link authentication emailsTrackedMagicLinkActivate- Account activation emailsWelcomeEmail- Welcome new usersCoachInviteEmail- Coach invitation emailsTeamInviteEmail- Team invitation emailsFirstWorkoutAssignedEmail- First workout assignment notificationFirstWorkoutCompletedEmail- First workout completion celebrationNewFollowerEmail- New follower notificationsDirectMessageEmail- Direct message notificationsSupportEmail- Support request confirmationsFeatureDiscoveryEmail- Feature announcement emailsWeekOneCheckinEmail- First week check-inClientAcceptedInvitationEmail- Client acceptance notificationCoachRemovedClientEmail- Client removal notificationTeamMemberRemovedEmail- Team member removal notificationSubscriptionCanceledEmail- Subscription cancellation confirmationBodyweightGoalReachedEmail- Goal achievement celebration
Validation Utilities
Email Validation
import {
isValidEmailFormat,
isPrivateRelayEmail,
shouldSendEmailTo
} from '@tracked/emails';
// Check email format
isValidEmailFormat('[email protected]'); // true
isValidEmailFormat('invalid-email'); // false
// Detect Apple private relay emails
isPrivateRelayEmail('[email protected]'); // true
isPrivateRelayEmail('[email protected]'); // false
// Main validation function (recommended)
shouldSendEmailTo('[email protected]'); // true
shouldSendEmailTo('[email protected]'); // false
shouldSendEmailTo(null); // falseUsername Validation
import {
isAnonymousUsername,
getSafeDisplayName
} from '@tracked/emails';
// Detect auto-generated UUIDs
isAnonymousUsername('01944f9e-8e64-7a78-9e1e-3daba7b13e9f'); // true
isAnonymousUsername('john_doe'); // false
// Get safe display name with intelligent fallback
getSafeDisplayName('john_doe', 'John', 'John Smith'); // 'john_doe'
getSafeDisplayName('01944f9e-...', 'John', 'John Smith'); // 'John'
getSafeDisplayName('01944f9e-...', null, 'John Smith'); // 'John Smith'
getSafeDisplayName('01944f9e-...', null, null); // 'there'
getSafeDisplayName('01944f9e-...', null, null, 'friend'); // 'friend'Development
Setup
# Install dependencies
yarn install
# Run tests
yarn test
# Run tests in watch mode
yarn test:watch
# Build the package
yarn build
# Type check
yarn typecheck
# Lint
yarn lint
# Format code
yarn format:fixPreview Emails
This package uses React Email for email development.
# Start the email preview server
yarn dev:emailThen open http://localhost:3000 to preview all email templates.
Testing
The package includes comprehensive tests for all validation utilities:
# Run all tests
yarn test
# Run with coverage
yarn test:coverage
# Watch mode for development
yarn test:watchBuilding
yarn buildThis will:
- Clean the
dist/directory - Compile TypeScript to ESM format
- Generate type definitions and source maps
Publishing
# Version bump (patch/minor/major)
npm version patch
# Publish to npm
npm publish --access publicPackage Structure
@tracked/emails/
├── src/
│ ├── emails/ # Email template components
│ ├── utils/ # Validation utilities
│ └── index.ts # Main entry point
├── static/ # Static assets (logos, images)
├── dist/ # Build output
└── package.jsonTypeScript
This package is written in TypeScript and includes full type definitions. All exports are fully typed for the best developer experience.
License
MIT © Tracked Training Platform Inc.
Contributing
This package is part of the Tracked Training Platform ecosystem. For issues or feature requests, please contact the development team.
