import { ReactElement } from 'react'; /** * Email Campaign Composer — modal Dialog + horizontal Stepper. * * GHL-aligned 3-step flow: * 1. Content — template and subject line. * 2. Recipients & Sender — send-to (all / smart list / by tag) + the read-only sender. * 3. Schedule & Review — send now / schedule / recurring, then a summary. * * The sender is **read-only** (one configured identity — not editable per * campaign; deliverability/brand), the unsubscribe footer is always included, * scheduling can't be set to a past date, and the recurring cadence is a plain * day count (7 / 14 / 30 presets provided). * * Fully controlled: templates, smart lists and the sender identity come in as * props, and `onSend` receives the composed campaign payload. */ interface CampaignTemplateOption { id: string; title: string; subject: string; } interface CampaignSmartListOption { id: string; name: string; count: number; } interface CampaignSenderIdentity { fromName: string; fromEmail: string; } type CampaignRecipientMode = "all" | "smart_list" | "tags"; type CampaignSendMode = "now" | "one_off" | "recurring"; /** Everything the composer collected, ready for the create-campaign API. */ interface EmailCampaignPayload { name: string; templateId: string | null; subject: string; recipientMode: CampaignRecipientMode; smartListId: string | null; /** Selected tags when recipientMode is "tags" — a contact matching ANY is included. */ tags: string[]; sendMode: CampaignSendMode; /** Local date+time combined; undefined for send-now. */ scheduledAt?: Date; /** Days between sends; only for recurring. */ recurrenceIntervalDays?: number; } interface EmailCampaignComposerProps { open: boolean; onOpenChange: (open: boolean) => void; /** Templates the broker can start from — both System and Personal. */ templates: CampaignTemplateOption[]; /** * Typing in the template picker. `templates` is a capped first page, so anything past the cap * is only reachable by searching server-side — the picker filters nothing locally. */ onTemplateSearch?: (term: string) => void; isTemplateLoading?: boolean; /** Saved Contacts segments the composer can send to. */ smartLists: CampaignSmartListOption[]; /** The company's configured sender identity (read-only display). */ sender: CampaignSenderIdentity; onSend?: (payload: EmailCampaignPayload) => void; initialCampaignName?: string; /** Preselect a template (e.g. opened via a template card's "Create campaign"). */ initialTemplateId?: string | null; /** * The selected template's name, for when it is not in `templates` — the list is a searched * page, so an edited campaign's template, or one carried in from a template card, is often * absent from it. Without this the trigger falls back to rendering the raw id. */ initialTemplateName?: string; initialSubject?: string; initialRecipientMode?: CampaignRecipientMode; initialSmartListId?: string | null; /** The broker's tag library, for autocomplete when targeting by tag. */ tagSuggestions?: string[]; initialTags?: string[]; initialSendMode?: CampaignSendMode; /** The campaign's current send time — seeds both the date and the time controls. */ initialScheduledAt?: Date | null; initialRecurrenceIntervalDays?: number; /** Header text; edit flows pass the campaign's own heading. */ title?: string; /** Final-step button; edit flows pass something other than "Confirm & Send". */ submitLabel?: string; /** * Editing an existing campaign. Its content was snapshotted at creation, so the template is * fixed — and a campaign that already exists is saved, not sent. */ isEdit?: boolean; /** Manage-smart-lists affordance (links out to Contacts in the app). */ onManageSmartLists?: () => void; } declare function EmailCampaignComposer({ open, onOpenChange, templates, onTemplateSearch, isTemplateLoading, smartLists, sender, onSend, initialCampaignName, initialTemplateId, initialTemplateName, initialSubject, initialRecipientMode, initialSmartListId, tagSuggestions, initialTags, initialSendMode, initialScheduledAt, initialRecurrenceIntervalDays, title, submitLabel, isEdit, onManageSmartLists, }: EmailCampaignComposerProps): ReactElement; export { type CampaignRecipientMode, type CampaignSendMode, type CampaignSenderIdentity, type CampaignSmartListOption, type CampaignTemplateOption, EmailCampaignComposer, type EmailCampaignComposerProps, type EmailCampaignPayload, EmailCampaignComposer as default };