"use client"; import { Button } from "@mdxui/primitives/button"; import { Card } from "@mdxui/primitives/card"; import { Input } from "@mdxui/primitives/input"; import { Label } from "@mdxui/primitives/label"; import { cn } from "@mdxui/primitives/lib/utils"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@mdxui/primitives/select"; import { Toggle } from "@mdxui/primitives/toggle"; import Link from "@tiptap/extension-link"; import { EditorContent, useEditor } from "@tiptap/react"; import StarterKit from "@tiptap/starter-kit"; import { Bold, Code, Eye, Italic, Link as LinkIcon, Monitor, Smartphone, } from "lucide-react"; import type React from "react"; import { useCallback, useState } from "react"; export interface EmailBuilderProps { /** Initial email HTML */ initialValue?: string; /** Callback when content changes */ onChange?: (html: string, subject: string) => void; /** Initial subject line */ initialSubject?: string; /** Template presets */ templates?: EmailTemplate[]; /** Additional CSS class */ className?: string; /** Preview width */ previewWidth?: "mobile" | "desktop"; } export interface EmailTemplate { id: string; name: string; subject: string; html: string; } const DEFAULT_TEMPLATES: EmailTemplate[] = [ { id: "welcome", name: "Welcome Email", subject: "Welcome to {{company_name}}!", html: "
Thank you for joining us.
", }, { id: "notification", name: "Notification", subject: "You have a new notification", html: "You have a new notification from {{app_name}}.
", }, { id: "reset-password", name: "Password Reset", subject: "Reset your password", html: "Click the link below to reset your password.
", }, ]; export const EmailBuilder: React.FC
{emailHtml}
) : (