import type { NewsroomRef } from './Newsroom'; import type { SenderAddress } from './SenderAddress'; import { SenderDomain } from './SenderDomain'; import type { StoryRef } from './Story'; import type { UserRef } from './User'; export interface Campaign { id: number; type: 'campaign'; author: UserRef; lifecycle_status: Campaign.LifecycleStatus; subject: string; /** * JSON-serialized document in Prezly Content Format * @see https://developers.prezly.com/docs/api/docs/07-prezly-content-format.md */ content: string; thumbnail_url: string; /** * This partially duplicates the `sender` property, but will always stay defined, * even if the linked sender gets deleted later. */ from: { name: string; email_address: string; }; story: StoryRef | null; newsroom: NewsroomRef | null; story_alignment: Campaign.StoryAlignment; story_appearance: Campaign.StoryAppearance; story_header_footer: Campaign.StoryHeaderFooter; sender: SenderAddress | null; sender_domain_verification_flow: SenderDomain.VerificationFlowVersion | null; sender_domain_verification_status: Campaign.SenderDomainVerificationStatus; created_at: string; updated_at: string; scheduled_at: string | null; sent_at: string | null; delivered_at: string | null; is_demo: boolean; is_open_tracking_enabled: boolean; is_click_tracking_enabled: boolean; click_tracking_version: Campaign.ClickTrackingVersion; recipients_number: number; stats: { bounces: number; clicks: number; clicks_rate: number; delivered: number; delivering: number; opens: number; opens_rate: number; skipped: number; undelivered: number; undelivered_rate: number; unsubscribes: number; unsubscribes_rate: number; links: Campaign.Link[]; }; } export declare namespace Campaign { type SenderDomainVerificationFlow = SenderDomain.VerificationFlowVersion; const SenderDomainVerificationFlow: typeof SenderDomain.VerificationFlowVersion; interface Link { url: string; clicks: number; } enum LifecycleStatus { DRAFT = "draft", SCHEDULED = "scheduled", PENDING = "pending", SENT = "sent" } enum StoryAlignment { CENTER = "center", LEFT = "left", RIGHT = "right" } enum StoryAppearance { INTRO = "intro", FULL = "full" } enum StoryHeaderFooter { NONE = "none", STANDARD = "standard", FULL = "full" } enum SenderDomainVerificationStatus { UNKNOWN = "unknown", VALID = "valid", INVALID = "invalid", NOT_APPLICABLE = "not-applicable" } enum ClickTrackingVersion { DEPRECATED = 1, ENHANCED = 2, INHOUSE = 3 } function isDraft(status: LifecycleStatus): boolean; function isDraft(campaign: Pick): boolean; function isScheduled(status: LifecycleStatus): boolean; function isScheduled(campaign: Pick): boolean; function isPending(status: LifecycleStatus): boolean; function isPending(campaign: Pick): boolean; function isSent(status: LifecycleStatus): boolean; function isSent(campaign: Pick): boolean; }