Documentation
¶
Overview ¶
Package readiness is Send Readiness (spec 5.1, 7.5): every check a campaign must pass before it goes out, each Pass, Warn, Block or Unknown with its evidence and a fix, plus the estimates around the send (final audience, route, cost and duration, throttling per mailbox provider).
A run gathers facts from the other domains and Assemble turns them into checks. Assemble is pure, so the demo seeds runs through it and tests feed it fixtures. Runs are stored in readiness_runs; the run in progress is in readiness_progress so the review screen can tick the groups in.
Index ¶
- Constants
- Variables
- func ArgAnd[T any](items []T) map[string]any
- func ArgDay(t time.Time) map[string]any
- func ArgDayMonth(t time.Time) map[string]any
- func ArgDayMonthTime(t time.Time) map[string]any
- func ArgDayTime(t time.Time) map[string]any
- func ArgLanguage(code string) map[string]any
- func ArgMoney(v float64) map[string]any
- func ArgOr[T any](items []T) map[string]any
- func ArgPercent(v float64) map[string]any
- func ArgPercent1(v float64) map[string]any
- func ArgTime(t time.Time) map[string]any
- func Clock(t, now time.Time, loc *time.Location) string
- func Count(n int64) string
- func EncodeResult(res ReadinessResult) (checks, estimates json.RawMessage, err error)
- func Fingerprint(c store.ReadinessCampaignRow, routing json.RawMessage) string
- func GroupTitle(g string) string
- func InsertFooter(src, address string) (string, bool)
- func InsertFooterIn(l i18n.Lang, src, address string) (string, bool)
- func JoinAnd(items []string) string
- func MailboxName(k string) string
- func Minutes(seconds float64) int
- func Money(v float64) string
- func Pct(v float64) string
- func Pct1(v float64) string
- func Per1000(v float64) string
- func Plural(n int64, one, many string) string
- func Rate(v float64) string
- func Register(h huma.API, s *Service)
- func ReplaceLink(src, from, to string) (string, int)
- func RoutingKey(ctx context.Context, q *store.Queries, wsID uuid.UUID) json.RawMessage
- func RunningText(g string) string
- func ShareStatusIn(english string, kept Text, status string, day, days int, l i18n.Lang) string
- func SplitLabelIn(english string, l i18n.Lang) string
- func ThresholdsLine(t ReadinessThresholds) string
- func WithLanguages(fingerprint, digest string) string
- func WithoutTexts(raw json.RawMessage) json.RawMessage
- type A
- type AccessibilityChecker
- type AfterChange
- type AudienceDef
- type AudienceFacts
- type AuthFacts
- type CampaignFacts
- type ComplianceFacts
- type ConditionalChecker
- type ConditionalFacts
- type ContentFacts
- type Deliverability
- type DownFacts
- type EndedUpgradeOffer
- type Facts
- type GrowChecker
- type GrowLink
- type GrowRow
- type LanguagesFacts
- type ListingFacts
- type PaidAudienceFacts
- type PollFacts
- type ProviderAuthFacts
- type ReadinessAudience
- type ReadinessAudienceRow
- type ReadinessCampaignPath
- type ReadinessCheck
- type ReadinessCheckRow
- type ReadinessCounts
- type ReadinessEstimates
- type ReadinessFix
- type ReadinessFixOutcome
- type ReadinessFixRequest
- type ReadinessFixResult
- type ReadinessFixesInput
- type ReadinessGroup
- type ReadinessHeldMove
- type ReadinessProgress
- type ReadinessProgressGroup
- type ReadinessProgressView
- type ReadinessResult
- type ReadinessRoute
- type ReadinessRouteShare
- type ReadinessRun
- type ReadinessSchedule
- type ReadinessSendSettings
- type ReadinessThresholds
- type ReadinessThrottle
- type Recipient
- type ReputationFacts
- type RouteConfig
- type RouteFacts
- type RouteOverride
- type RunOptions
- type Schedule
- type SegmentResolver
- type Service
- func (s *Service) AcceptUnknown(ctx context.Context, ws *store.Workspace, p *authz.Principal, ...) (ReadinessRun, error)
- func (s *Service) ApplyFixes(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, ...) (ReadinessFixResult, error)
- func (s *Service) Audience(ctx context.Context, ws *store.Workspace, raw json.RawMessage) (AudienceFacts, error)
- func (s *Service) Campaign(ctx context.Context, ws *store.Workspace, id uuid.UUID) (store.ReadinessCampaignRow, error)
- func (s *Service) ClearRouteOverride(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) error
- func (s *Service) CurrentFingerprint(ctx context.Context, ws *store.Workspace, c store.ReadinessCampaignRow) string
- func (s *Service) Get(ctx context.Context, campaignID, runID uuid.UUID) (*ReadinessRun, error)
- func (s *Service) Latest(ctx context.Context, campaignID uuid.UUID) (*ReadinessRun, error)
- func (s *Service) Progress(ctx context.Context, campaignID uuid.UUID) (*ReadinessProgress, error)
- func (s *Service) Route(ctx context.Context, ws *store.Workspace, override json.RawMessage) (RouteConfig, error)
- func (s *Service) Run(ctx context.Context, ws *store.Workspace, id uuid.UUID, o RunOptions) (ReadinessRun, error)
- func (s *Service) UpdateSendSettings(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, ...) error
- type ShareFacts
- type SponsorChecker
- type SponsorFacts
- type Text
- type UpgradeOfferChecker
- type VerificationChecker
- type VerificationFacts
- type VersionReport
- type WebCheck
- type WebFacts
- type WebsiteChecker
Constants ¶
const ( FixAccessibilityDecorative = accessibility.ActionDecorative FixAccessibilityColor = accessibility.ActionColor FixAccessibilityOneClick = accessibility.ActionOneClick )
Fix actions of the Accessibility group.
const ( UnengagedWarnCount = 500 )
UnengagedWarnShare and UnengagedWarnCount decide when unengaged contacts are worth a warning: 1% of the audience or 500 contacts.
const ( FixVisibilityShowEveryone = visibility.FixShowEveryone FixVisibilityHideBlock = visibility.FixHideBlock FixVisibilityRemoveCondition = visibility.FixRemoveCondition FixPollCloseDays = polls.FixCloseDays )
Fix actions of conditional content and polls.
const ( BaseAll = "all" // every public list: "All subscribers" BaseList = "list" // one list: "Weekly Digest list" BaseSegment = "segment" // one segment: "Customers segment" BaseNone = "none" // nothing named: "Audience" BaseMany = "many" // several: "Weekly Digest + Product Updates" )
Kinds of audience a base label names (AudienceFacts.BaseKind).
const ( AuthCNAMEs = "cnames" // CNAMEs Easy DKIM CNAMEs verified AuthSelector = "selector" // selector Selector verified AuthUnverified = "unverified" // DKIM records not verified AuthSPFAdd = "spf_add" // add Value to the SPF record of Name )
What a provider's record detail says (ProviderAuthFacts.DetailKind).
const ( FixMarkLanguageUpToDate = "mark_language_up_to_date" FixMarkLanguageTranslated = "mark_language_translated" FixHoldLanguage = "hold_language" FixReleaseLanguage = "release_language" )
Fix actions of the Languages group.
const ( FixSponsorRemove = "sponsor_remove_block" FixSponsorRefresh = "sponsor_refresh_block" )
Fix actions of the Sponsor block.
const ( VerdictReady = "ready" VerdictWarnings = "warnings" VerdictBlocked = "blocked" )
Verdicts.
const ( Pass = "pass" Warn = "warn" Block = "block" Unknown = "unknown" )
Check statuses.
const ( GroupReputation = "reputation" GroupAuthentication = "authentication" GroupContent = "content" GroupLinks = "links" GroupCompliance = "compliance" GroupAudience = "audience" GroupRouting = "routing" )
Check groups, in the order of the checklist.
const ( TriggerManual = "manual" TriggerComposer = "composer" TriggerSchedule = "schedule" TriggerSendTime = "send_time" TriggerApproval = "approval" )
Triggers of a run (readiness_runs.trigger).
const ( FixExcludeSunset = "exclude_sunset" FixRouteOnly = "route_only" FixReplaceLink = "replace_link" FixUseSubject = "use_subject" FixMinify = "minify" )
Fix actions applied by POST …/readiness/fixes.
const ( // FixExcludeRisky leaves the audience's risky addresses out of the send. FixExcludeRisky = "exclude_risky" // FixVerifyAddresses opens the Verify addresses dialog on Review & send; // the dialog starts the job, so the fixes endpoint never applies it. FixVerifyAddresses = "verify_addresses" )
Fix actions of the address checks.
const ( )
Thresholds of the address checks.
const GroupAccessibility = "accessibility"
GroupAccessibility is the Accessibility group's key.
const GroupConditional = "conditional"
GroupConditional is the Conditional content group's key.
const GroupLanguages = "languages"
GroupLanguages is the Languages group: who gets which version.
Variables ¶
var DefaultMailboxRates = map[string]float64{"gmail": 0, "outlook": 5, "yahoo": 4, "icloud": 3, "other": 0}
DefaultMailboxRates are the per-mailbox-provider throttles: Outlook, Yahoo and iCloud accept slower streams more reliably; Gmail and the rest take each provider's full rate. The sending engine adapts them when deferrals rise.
var ErrRunning = errors.New("send readiness is already running for this campaign")
ErrRunning means a run of the campaign is already in progress.
var Groups = []string{GroupReputation, GroupAuthentication, GroupContent, GroupLanguages, GroupAccessibility, GroupConditional, GroupLinks, GroupCompliance, GroupAudience, GroupRouting}
Groups lists the check groups in checklist order.
var MailboxOrder = []string{"gmail", "outlook", "yahoo", "icloud", "other"}
MailboxOrder is the chart order of mailbox providers.
var URIBlocklists = []string{"SURBL", "URIBL", "Spamhaus DBL"}
URIBlocklists are the URI blocklists link domains are checked on.
Functions ¶
func ArgAnd ¶
ArgAnd joins items as a list: "SES, Postal and Postmark", "SES, Postal và Postmark". Items are strings or Texts.
func ArgDayMonth ¶
ArgDayMonth is a day without its weekday: "12 Oct".
func ArgDayMonthTime ¶
ArgDayMonthTime is a day and a time without the weekday: "12 Oct, 09:40".
func ArgDayTime ¶
ArgDayTime is a day and a time: "Mon 12 Oct, 09:40".
func ArgLanguage ¶
ArgLanguage is a content language's name in the reader's language: "Spanish", "Tiếng Tây Ban Nha".
func ArgPercent ¶
ArgPercent is a percentage with up to two decimals: "0.6%", "0,04%".
func ArgPercent1 ¶
ArgPercent1 is a percentage with one decimal: "3.0%".
func Clock ¶
Clock formats a time in the workspace zone: "09:40" today, "Mon 12 Oct, 09:40" on another day.
func EncodeResult ¶
func EncodeResult(res ReadinessResult) (checks, estimates json.RawMessage, err error)
EncodeResult is the stored form of a result: readiness_runs.checks (verdict, counts, groups and checks) and readiness_runs.estimates, with the messages their texts are written from.
func Fingerprint ¶
func Fingerprint(c store.ReadinessCampaignRow, routing json.RawMessage) string
Fingerprint identifies what a run checks: content, sender, audience, route override, the Broadcasts routing rules and the schedule. Any change to them makes the latest run stale.
func GroupTitle ¶
GroupTitle is the heading of a check group ("Audience quality").
func InsertFooter ¶
InsertFooter adds the footer block at the end of the MJML body, or puts the composer's footer block back as new when it lost its address or links.
func InsertFooterIn ¶
InsertFooterIn is InsertFooter with the block's words in a language.
func MailboxName ¶
MailboxName is the display name of a mailbox provider key.
func Minutes ¶
Minutes rounds a duration in seconds up to whole minutes (at least 1 when anything is sent).
func Pct ¶
Pct formats a percentage with up to two decimals, trailing zeros trimmed: 0.6 → "0.6%", 0.04 → "0.04%", 5 → "5%".
func ReplaceLink ¶
ReplaceLink points every link to from at to.
func RoutingKey ¶
RoutingKey is the Broadcasts routing as it stands, part of a run's fingerprint.
func RunningText ¶
RunningText is what a group shows while its checks run, before facts exist.
func ShareStatusIn ¶
ShareStatusIn is a copied status label of a route's provider in a reader's language: from its kept message, or from its status and warm-up day when they say what the copied English says. Any other label stays as it was copied.
func SplitLabelIn ¶
SplitLabelIn is a copied split label of the Broadcasts route ("Broadcasts 90 / 10", as Route writes it for an approval's snapshot) in a reader's language. Any other label stays as it was copied.
func ThresholdsLine ¶
func ThresholdsLine(t ReadinessThresholds) string
ThresholdsLine is "bounce 2.0% · complaint 0.10%".
func WithLanguages ¶
WithLanguages adds a campaign's language versions (languages.CampaignDigest) to its fingerprint; a campaign without versions keeps its fingerprint.
func WithoutTexts ¶
func WithoutTexts(raw json.RawMessage) json.RawMessage
WithoutTexts drops the kept messages ("i18n" members) from stored JSON, for readers that get it as it is stored (MCP agents read English). Everything else keeps its order and values.
Types ¶
type AccessibilityChecker ¶
type AccessibilityChecker interface {
ReadinessFacts(ctx context.Context, ws *store.Workspace, c accessibility.CampaignContent) accessibility.ReadinessFacts
FixMJML(ctx context.Context, ws *store.Workspace, src, action string, params map[string]string) (string, accessibility.FixChange, error)
RecordFix(ctx context.Context, ws *store.Workspace, p *authz.Principal, campaignID uuid.UUID, campaign, contentHash string, languages []string, changes []accessibility.FixChange) error
}
AccessibilityChecker runs the accessibility checks for a run and applies the group's one-click fixes.
type AfterChange ¶
AfterChange is told when a fix or a send setting changed the campaign (the approvals domain re-checks open approvals).
type AudienceDef ¶
type AudienceDef struct {
Lists []string `json:"lists,omitempty"`
Segments []string `json:"segments,omitempty"`
ExcludeLists []string `json:"exclude_lists,omitempty"`
ExcludeSegments []string `json:"exclude_segments,omitempty"`
ExcludeTiers []string `json:"exclude_tiers,omitempty"`
// IncludeSunset is the campaign overriding the sunset policy: contacts
// whose Broadcasts the policy stopped receive this one anyway.
IncludeSunset bool `json:"include_sunset,omitempty"`
// Paid is who on the lists gets a paid-only campaign (Earn): paid
// members only, at a tier and above, or free subscribers only.
Paid paidaccess.Audience `json:"-"`
}
AudienceDef is campaigns.audience as stored by the composer, plus the tiers Send Readiness can exclude.
func ParseAudience ¶
func ParseAudience(raw json.RawMessage) AudienceDef
ParseAudience reads a stored audience definition.
func (AudienceDef) Empty ¶
func (a AudienceDef) Empty() bool
Empty reports whether the definition selects nobody.
func (AudienceDef) ExcludesSunset ¶
func (a AudienceDef) ExcludesSunset() bool
ExcludesSunset reports whether the sunset tier is excluded.
type AudienceFacts ¶
type AudienceFacts struct {
// BaseLabel names the audience ("Weekly Digest list", "All subscribers").
BaseLabel string
// GroupLabel is the caption of the audience-quality group ("Weekly Digest").
GroupLabel string
// BaseKind says what BaseLabel names and BaseName the list or segment,
// so the labels read in each reader's language; empty shows the labels
// as they are.
BaseKind string
BaseName string
Lists []string
// Base counts the subscribed contacts of the lists and segments (minus
// excluded lists and segments).
Base int64
Suppressed int64
Role int64
Duplicates int64
// Stopped counts contacts the sunset policy stopped Broadcasts to.
Stopped int64
// SunsetOverride is true when the campaign overrides the sunset policy;
// StoppedIncluded counts the stopped contacts it sends to anyway.
SunsetOverride bool
StoppedIncluded int64
// SunsetExcluded counts the sunset-tier contacts removed because the
// campaign excludes that tier; UnengagedExcluded says it does.
SunsetExcluded int64
UnengagedExcluded bool
Final int64
// Unengaged counts final recipients with no open or click in
// UnengagedDays days (the sunset tier).
Unengaged int64
UnengagedDays int
// RecentlyBounced counts final recipients who bounced in the last 30
// days without being suppressed (soft bounces).
RecentlyBounced int64
// Mailboxes counts final recipients per mailbox provider.
Mailboxes map[string]int64
// Languages counts final recipients per contact language code
// (lowercase, "" for none), for content languages.
Languages map[string]int64
// Empty is true when the campaign has no audience yet.
Empty bool
// SegmentsSkipped is true when segments couldn't be counted.
SegmentsSkipped bool
// SuppressedEmails are the suppressed contacts' addresses, for the
// address checks' count of invalid ones (verification.go).
SuppressedEmails []string `json:"-"`
// Paid describes a paid-only campaign's recipients (paid.go); nil for
// everyone on the lists.
Paid *PaidAudienceFacts `json:"-"`
}
AudienceFacts are the audience counts after exclusions.
type AuthFacts ¶
type AuthFacts struct {
Domain string
// Checked is false until deliverability has checked the domain.
Checked bool
CheckedAt *time.Time
SPFRecord string
SPF []ProviderAuthFacts
DKIM []ProviderAuthFacts
MailFrom []ProviderAuthFacts
// DMARC: status (pass, missing, invalid), policy, the record and the
// share of aligned mail over the last 7 days (nil without reports).
DMARCStatus string
DMARCPolicy string
DMARCRecord string
DMARCAligned *float64
// BIMIStatus is pass, missing or invalid.
BIMIStatus string
BIMILogo string
}
AuthFacts are the authentication results of the sending domain.
type CampaignFacts ¶
type CampaignFacts struct {
ID string
Name string
Subject string
Preheader string
Version int
// CompiledAt is when the content was last compiled (saved).
CompiledAt *time.Time
SenderName string
// SenderEmail is the From address; SenderDomain its domain.
SenderEmail string
SenderDomain string
// StartAt is when the send would start (the schedule, or now).
StartAt time.Time
// ScheduleMode is now, at or best_time.
ScheduleMode string
}
CampaignFacts describes the campaign being checked.
type ComplianceFacts ¶
type ComplianceFacts struct {
// UnsubscribeURL is the one-click unsubscribe link with a {token} placeholder.
UnsubscribeURL string
HTTPS bool
// ComplaintRate is the route's 7-day complaint rate in percent.
ComplaintRate *float64
}
ComplianceFacts are what the bulk-sender rules need.
type ConditionalChecker ¶
type ConditionalChecker interface {
ConditionalFacts(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID) ConditionalFacts
PollFacts(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, src string) PollFacts
}
ConditionalChecker gives the facts of the Conditional content group and of the poll checks; nil leaves them out.
type ConditionalFacts ¶
type ConditionalFacts struct {
Ran bool
// Checked is false when the versions couldn't be counted; Problem says why.
Checked bool
Problem string
Report visibility.VisibilityReport
}
ConditionalFacts are an email's conditional blocks and the versions its audience gets.
type ContentFacts ¶
type ContentFacts struct {
Report contentcheck.ContentCheckReport
// Checked is false when the content check couldn't run.
Checked bool
FooterRemovedAt *time.Time
// Address is the postal address of the workspace branding.
Address string
// InlineCSSBytes is the size of the inline style attributes.
InlineCSSBytes int
// URIBlocklists are the lists link domains were checked on.
URIBlocklists []string
// OwnDomain is the registrable domain of the sending domain ("acme.io").
OwnDomain string
// Versions are the content checks of the language versions that are
// sent, besides the source's (Report).
Versions []VersionReport
}
ContentFacts are the composer's content and link checks.
type Deliverability ¶
type Deliverability interface {
Overview(ctx context.Context, ws *store.Workspace) (deliverability.DeliverabilityOverview, error)
Reputation(ctx context.Context, ws *store.Workspace) (deliverability.DeliverabilityReputation, error)
}
Deliverability is what a run reads from the deliverability domain: blocklist results, authentication and provider account health.
type DownFacts ¶
DownFacts is why a provider can't take mail: since when, the host or provider it's about, and either rejected credentials (Auth) or refused connections with the error code (Code).
type EndedUpgradeOffer ¶
type EndedUpgradeOffer struct {
Code string
Name string
EndedOn *time.Time
// Path is the block's element path from mj-body.
Path []int
}
EndedUpgradeOffer is an offer an email's Upgrade block carries after it ended.
type Facts ¶
type Facts struct {
Now time.Time
// Location is the workspace time zone (clock times in the evidence).
Location *time.Location
// Workspace is the slug, for links to other screens.
Workspace string
Campaign CampaignFacts
Audience AudienceFacts
Route RouteFacts
Reputation ReputationFacts
Auth AuthFacts
Content ContentFacts
Compliance ComplianceFacts
// Languages are the email's language versions (content languages).
Languages LanguagesFacts
// Accessibility is the accessibility checks of every language version.
Accessibility accessibility.ReadinessFacts
// Conditional is the email's conditional blocks and versions, Polls its
// polls and surveys (design expansion, X11).
Conditional ConditionalFacts
Polls PollFacts
// Verification is the audience's address-check results (verification.go).
Verification VerificationFacts
// Web is the campaign's post on the website (design expansion, X18).
Web WebFacts
// Sponsor is the email's Sponsor block, UpgradeOffers the offers its
// Upgrade blocks still carry after they ended (Earn, design expansion X17).
Sponsor SponsorFacts
UpgradeOffers []EndedUpgradeOffer
// MailboxRates are the per-mailbox-provider throttles (messages per
// second, 0 = full rate).
MailboxRates map[string]float64
// Grow are the Referral and Recommendations blocks' rows (grow.go).
Grow []GrowRow
}
Facts is everything a run looked at. Gather collects them from the other domains; the demo and tests build them by hand. Assemble turns them into the checklist and the estimates.
type GrowChecker ¶
type GrowChecker interface {
ReadinessRows(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, html string, byList map[uuid.UUID]int64, recipients int64) []GrowRow
}
GrowChecker reads what Grow's blocks do in a campaign: the campaign's HTML, its recipients per list and how many there are.
type GrowRow ¶
type GrowRow struct {
Key string
Status string // pass or warn
Title Text
Detail Text
Label Text
Short Text
Ack Text
// Links open the campaign or Grow ("Remove the block", "Referral
// settings", "Open recommendations"), as workspace paths.
Links []GrowLink
}
GrowRow is one of Grow's Content rows. Its texts are kept messages of Grow's catalogs (Kept), so the row reads in each reader's language.
type LanguagesFacts ¶
type LanguagesFacts = languages.ReadinessFacts
LanguagesFacts are the email's language versions and who gets which.
type ListingFacts ¶
type ListingFacts struct {
Asset string
Type string // domain, ip
Source string
Impact string // high, medium, low
Detail string
DelistURL string
Since *time.Time
}
ListingFacts is one asset on one blocklist.
type PaidAudienceFacts ¶
type PaidAudienceFacts struct {
// Who is paid (paid members only) or free (free subscribers only).
Who string
// Tier is the lowest tier's short name ("Insider"), empty for any paid
// tier; TierTop says it is the highest tier ("Founding member" rather
// than "Founding member and above").
Tier string
TierTop bool
// What the paid members' access is.
Trialing int64
Complimentary int64
Gift int64
PastDue int64
}
PaidAudienceFacts are a paid-only campaign's final recipients by paid status.
type PollFacts ¶
type PollFacts = polls.ReadinessFacts
PollFacts are an email's polls, the surveys it links to and where their links go.
type ProviderAuthFacts ¶
type ProviderAuthFacts struct {
Short string
// OK is true when the record is verified (and aligned, for MAIL FROM).
OK bool
// Detail: "3 Easy DKIM CNAMEs verified", "selector postal-2026 verified",
// the MAIL FROM domain, or what's wrong. DetailKind says which, with
// its parts (CNAMEs, Selector, Value and Name), so it reads in each
// reader's language; empty shows Detail as it is.
Detail string
DetailKind string
CNAMEs int
Selector string
Value string
Name string
KeyBits int
Domain string
}
ProviderAuthFacts is one provider's record of one kind.
type ReadinessAudience ¶
type ReadinessAudience struct {
Rows []ReadinessAudienceRow `json:"rows"`
Final int64 `json:"final"`
// Lists names the lists and segments of the audience.
Lists []string `json:"lists"`
// Suppressed, Role and Duplicates repeat the excluded counts for the
// confirmation ("331 suppressed · 27 role · 26 duplicates").
Suppressed int64 `json:"suppressed"`
Role int64 `json:"role"`
Duplicates int64 `json:"duplicates"`
Unengaged int64 `json:"unengaged"`
// UnengagedExcluded is true when the sunset tier is excluded.
UnengagedExcluded bool `json:"unengagedExcluded"`
}
ReadinessAudience is the final count after exclusions.
type ReadinessAudienceRow ¶
type ReadinessAudienceRow struct {
Label string `json:"label"`
Count int64 `json:"count"`
// Kind: base (the lists or segments), minus (excluded), plus (added back).
Kind string `json:"kind" enum:"base,minus,plus"`
}
ReadinessAudienceRow is one line of the audience card.
type ReadinessCampaignPath ¶
type ReadinessCampaignPath struct {
api.WorkspaceInput
CampaignID string `path:"campaignId" format:"uuid"`
}
ReadinessCampaignPath is the {workspace}/{campaignId} of readiness operations.
type ReadinessCheck ¶
type ReadinessCheck struct {
// Key identifies the check: "audience.unengaged", "reputation.provider.ses".
Key string `json:"key"`
Group string `json:"group" enum:"reputation,authentication,content,languages,links,compliance,audience,routing,accessibility,conditional"`
Status string `json:"status" enum:"pass,warn,block,unknown"`
// Title states the finding; FlatTitle is the same finding prefixed with
// its group, for lists ordered by severity ("Links: go.acme-promo.link…").
Title string `json:"title"`
FlatTitle string `json:"flatTitle"`
// Detail is the evidence. Mono is true when it is a record or a header.
Detail string `json:"detail,omitempty"`
Mono bool `json:"mono,omitempty"`
// Label names the check in compact tables ("URL shortener"); Evidence is
// a one-sentence version of title and detail for them.
Label string `json:"label,omitempty"`
Evidence string `json:"evidence,omitempty"`
// Short is the passing finding in a few words, used in group summaries.
Short string `json:"short,omitempty"`
// Ack is the sentence a person confirms before sending with this warning
// ("I understand 412 unengaged contacts are included.").
Ack string `json:"ack,omitempty"`
// AckKey is the same for warnings confirmed with the same sentence,
// whatever language it is read in: they are confirmed together.
AckKey string `json:"ackKey,omitempty"`
// Note is a short right-aligned note ("timed out").
Note string `json:"note,omitempty"`
Fixes []ReadinessFix `json:"fixes"`
// Rows are a small table of the finding ("Recipients per language":
// English 26,890 gets English · …).
Rows []ReadinessCheckRow `json:"rows,omitempty"`
// contains filtered or unexported fields
}
ReadinessCheck is one row of the checklist.
func InChecks ¶
func InChecks(checks []ReadinessCheck, l i18n.Lang) []ReadinessCheck
InChecks is checks as a reader reads them.
func (ReadinessCheck) In ¶
func (c ReadinessCheck) In(l i18n.Lang) ReadinessCheck
In is the check as a reader reads it, in their language and region, without its kept messages.
func (ReadinessCheck) MarshalJSON ¶
func (c ReadinessCheck) MarshalJSON() ([]byte, error)
MarshalJSON adds the kept messages ("i18n") to the check.
func (*ReadinessCheck) UnmarshalJSON ¶
func (c *ReadinessCheck) UnmarshalJSON(b []byte) error
UnmarshalJSON reads a check and its kept messages.
type ReadinessCheckRow ¶
type ReadinessCheckRow struct {
Label string `json:"label"`
Count int64 `json:"count"`
Detail string `json:"detail"`
// Language is the readers' language and Gets the version they get
// (Recipients per language: Audience › By version and the
// confirmation step read them).
Language string `json:"language,omitempty"`
Gets string `json:"gets,omitempty"`
GetsName string `json:"getsName,omitempty"`
}
ReadinessCheckRow is one line of a check's table.
type ReadinessCounts ¶
type ReadinessCounts struct {
Passed int `json:"passed"`
Warnings int `json:"warnings"`
Blocks int `json:"blocks"`
Unknown int `json:"unknown"`
Total int `json:"total"`
}
ReadinessCounts adds up the checks.
type ReadinessEstimates ¶
type ReadinessEstimates struct {
Audience ReadinessAudience `json:"audience"`
Route ReadinessRoute `json:"route"`
Throttling []ReadinessThrottle `json:"throttling"`
// contains filtered or unexported fields
}
ReadinessEstimates are the numbers around the send.
func (ReadinessEstimates) In ¶
func (e ReadinessEstimates) In(l i18n.Lang) ReadinessEstimates
In is the estimates as a reader reads them.
func (ReadinessEstimates) MarshalJSON ¶
func (e ReadinessEstimates) MarshalJSON() ([]byte, error)
MarshalJSON adds the labels' kept messages ("i18n") to the estimates.
func (ReadinessEstimates) ShareStatus ¶
func (e ReadinessEstimates) ShareStatus(i int) Text
ShareStatus is the kept message of the status label of the route's i-th provider, for a reader that copies the label (an approval's snapshot); nothing when the run kept none.
func (*ReadinessEstimates) UnmarshalJSON ¶
func (e *ReadinessEstimates) UnmarshalJSON(b []byte) error
UnmarshalJSON reads the estimates and their labels' kept messages.
type ReadinessFix ¶
type ReadinessFix struct {
Kind string `json:"kind" enum:"apply,link"`
Action string `` /* 417-byte string literal not displayed */
Label string `json:"label"`
Tone string `json:"tone,omitempty" enum:"primary,danger"`
Href string `json:"href,omitempty"`
Params map[string]string `json:"params,omitempty"`
}
ReadinessFix is one fix offered with a check: an action ReputeCast applies in one click (Kind "apply", Action and Params) or a link to the screen where it's fixed (Kind "link", Href is an app path).
type ReadinessFixOutcome ¶
type ReadinessFixOutcome struct {
ReadinessFixResult
Run *ReadinessRun `json:"run,omitempty"`
}
ReadinessFixOutcome is the result of applying fixes and the run after them.
type ReadinessFixRequest ¶
type ReadinessFixRequest struct {
Action string `` /* 407-byte string literal not displayed */
Params map[string]string `json:"params,omitempty"`
}
ReadinessFixRequest is one fix to apply.
type ReadinessFixResult ¶
type ReadinessFixResult struct {
// Applied are the fix labels in the product voice ("Excluded 412 unengaged contacts").
Applied []string `json:"applied"`
// Version is the campaign version after content fixes.
Version int `json:"version"`
}
ReadinessFixResult says what changed.
type ReadinessFixesInput ¶
type ReadinessFixesInput struct {
Fixes []ReadinessFixRequest `json:"fixes" minItems:"1" maxItems:"10"`
}
ReadinessFixesInput applies one or more fixes ("Apply all 3 fixes").
type ReadinessGroup ¶
type ReadinessGroup struct {
Key string `json:"key" enum:"reputation,authentication,content,languages,links,compliance,audience,routing,accessibility,conditional"`
Title string `json:"title"`
Caption string `json:"caption"`
Status string `json:"status" enum:"pass,warn,block,unknown"`
Passed int `json:"passed"`
Total int `json:"total"`
// Summary is "SPF, DKIM, DMARC p=quarantine and custom MAIL FROM verified for SES".
Summary string `json:"summary"`
// Running describes the group while it runs ("checking 203.0.113.25 and
// news.acme.io on 84 sources").
Running string `json:"running"`
// Note is a sentence the verdict adds when the group blocks the send
// ("Your workspace blocks sends with serious accessibility issues…").
Note string `json:"note,omitempty"`
// contains filtered or unexported fields
}
ReadinessGroup is a group heading with its caption and a summary of what passed (the collapsed "Passed" list and the running state show it).
func (ReadinessGroup) In ¶
func (g ReadinessGroup) In(l i18n.Lang) ReadinessGroup
In is the group as a reader reads it.
func (ReadinessGroup) MarshalJSON ¶
func (g ReadinessGroup) MarshalJSON() ([]byte, error)
MarshalJSON adds the kept messages ("i18n") to the group.
func (*ReadinessGroup) UnmarshalJSON ¶
func (g *ReadinessGroup) UnmarshalJSON(b []byte) error
UnmarshalJSON reads a group and its kept messages.
type ReadinessHeldMove ¶
type ReadinessHeldMove struct {
From string `json:"from"`
To string `json:"to"`
ToID string `json:"toId"`
AddCost float64 `json:"addCost"`
AddMinutes int `json:"addMinutes"`
}
ReadinessHeldMove is what moving a held share to an available provider costs.
type ReadinessProgress ¶
type ReadinessProgress struct {
RunID string `json:"runId"`
Trigger string `json:"trigger"`
StartedAt time.Time `json:"startedAt"`
StartedBy string `json:"startedBy,omitempty"`
Done int `json:"done"`
Total int `json:"total"`
Groups []ReadinessProgressGroup `json:"groups"`
}
ReadinessProgress is a run in progress.
func ProgressForReader ¶
func ProgressForReader(ctx context.Context, p *ReadinessProgress) *ReadinessProgress
ProgressForReader is a run in progress in the request's language.
func (ReadinessProgress) In ¶
func (p ReadinessProgress) In(l i18n.Lang) ReadinessProgress
In is the run in progress as a reader reads it.
type ReadinessProgressGroup ¶
type ReadinessProgressGroup struct {
Key string `json:"key" enum:"reputation,authentication,content,languages,links,compliance,audience,routing,accessibility,conditional"`
Title string `json:"title"`
Status string `json:"status" enum:"queued,running,pass,warn,block,unknown"`
Text string `json:"text"`
Done int `json:"done"`
Total int `json:"total"`
Checked int `json:"checked"`
// contains filtered or unexported fields
}
ReadinessProgressGroup is one group of a run in progress.
func (ReadinessProgressGroup) In ¶
func (g ReadinessProgressGroup) In(l i18n.Lang) ReadinessProgressGroup
In is the group in progress as a reader reads it.
func (ReadinessProgressGroup) MarshalJSON ¶
func (g ReadinessProgressGroup) MarshalJSON() ([]byte, error)
MarshalJSON adds the kept messages ("i18n") to the group in progress.
func (*ReadinessProgressGroup) UnmarshalJSON ¶
func (g *ReadinessProgressGroup) UnmarshalJSON(b []byte) error
UnmarshalJSON reads a group in progress and its kept messages.
type ReadinessProgressView ¶
type ReadinessProgressView struct {
Running *ReadinessProgress `json:"running,omitempty"`
}
ReadinessProgressView is the run in progress, if any.
type ReadinessResult ¶
type ReadinessResult struct {
Verdict string `json:"verdict" enum:"ready,warnings,blocked"`
Counts ReadinessCounts `json:"counts"`
Groups []ReadinessGroup `json:"groups"`
Checks []ReadinessCheck `json:"checks"`
// Incomplete is true when some checks couldn't run (Unknown); the
// verdict then can't be Ready until a person continues without them.
Incomplete bool `json:"incomplete"`
// Problem says why checks are unknown ("api.hostrepute.com timed out…").
Problem string `json:"problem,omitempty"`
Estimates ReadinessEstimates `json:"estimates"`
// contains filtered or unexported fields
}
ReadinessResult is what Assemble produces and a run stores.
func Assemble ¶
func Assemble(f Facts) ReadinessResult
Assemble builds the checklist and the estimates from what a run gathered.
func (ReadinessResult) In ¶
func (r ReadinessResult) In(l i18n.Lang) ReadinessResult
In is the result as a reader reads it.
type ReadinessRoute ¶
type ReadinessRoute struct {
Stream string `json:"stream" enum:"broadcast,automation,system"`
// StreamLabel is "Broadcasts"; SplitLabel "Broadcasts 90 / 10".
StreamLabel string `json:"streamLabel"`
SplitLabel string `json:"splitLabel"`
Policy string `json:"policy" enum:"automatic,pause_and_ask,warm_only"`
Override bool `json:"override"`
TotalCost float64 `json:"totalCost"`
// TotalMinutes is the longest route (routes run in parallel) or the
// slowest mailbox provider throttle, whichever is longer.
TotalMinutes int `json:"totalMinutes"`
Down int `json:"down"`
Move *ReadinessHeldMove `json:"move,omitempty"`
}
ReadinessRoute is the route breakdown with cost and duration estimates.
type ReadinessRouteShare ¶
type ReadinessRouteShare struct {
// StatusLabel is "Healthy", "Warming up · day 9 of 21", "Down since 08:52".
// webhooks silent); its share is held.
Available bool `json:"available"`
// Cost in US dollars; PriceLabel is "$0.10 per 1,000" or "self-hosted";
// Pricing is how the provider is paid for.
// Rate is messages per second; RateLabel "14 /s" or "2 /s ramp".
}
ReadinessRouteShare is one sending provider's part of the send.
type ReadinessRun ¶
type ReadinessRun struct {
ID string `json:"id"`
CampaignID string `json:"campaignId"`
Trigger string `json:"trigger" enum:"manual,composer,schedule,send_time,approval"`
RanAt time.Time `json:"ranAt"`
RanBy string `json:"ranBy,omitempty"`
DurationMs int `json:"durationMs"`
// Version is the campaign version the run checked.
Version int `json:"version"`
ReadinessResult
// UnknownAccepted is set when someone chose to continue with provider
// data only.
UnknownAcceptedAt *time.Time `json:"unknownAcceptedAt,omitempty"`
UnknownAcceptedBy string `json:"unknownAcceptedBy,omitempty"`
// Fingerprint is what the run checked; it changes with the content,
// audience, route or schedule.
Fingerprint string `json:"-"`
}
ReadinessRun is a stored run.
func ForReader ¶
func ForReader(ctx context.Context, r *ReadinessRun) *ReadinessRun
ForReader is a run in the request's language (nil stays nil).
func (ReadinessRun) In ¶
func (r ReadinessRun) In(l i18n.Lang) ReadinessRun
In is the run as a reader reads it: its texts in their language and region, or as stored for English readers with the standard formats (API clients, agents) and for runs stored before their texts were kept.
type ReadinessSchedule ¶
type ReadinessSchedule struct {
Mode string `json:"mode" enum:"now,at,best_time"`
// Date and Time are local to Timezone ("2026-10-14", "09:00").
Date string `json:"date,omitempty" pattern:"^\\d{4}-\\d{2}-\\d{2}$"`
Time string `json:"time,omitempty" pattern:"^([01]\\d|2[0-3]):[0-5]\\d$"`
Timezone string `json:"timezone,omitempty" maxLength:"64"`
// At is the resulting instant (read-only).
At *time.Time `json:"at,omitempty" readOnly:"true"`
}
ReadinessSchedule is when the campaign goes out: now, at a local date and time in a time zone, or at each recipient's usual open time within 24 h of that time.
func ScheduleView ¶
func ScheduleView(raw json.RawMessage, wsTZ string) ReadinessSchedule
ScheduleView turns the stored schedule into the API shape, in the workspace's zone when the schedule has none.
type ReadinessSendSettings ¶
type ReadinessSendSettings struct {
Thresholds *ReadinessThresholds `json:"thresholds,omitempty"`
Schedule *ReadinessSchedule `json:"schedule,omitempty"`
}
ReadinessSendSettings are the editable settings of Review & send.
type ReadinessThresholds ¶
type ReadinessThresholds struct {
// Bounce rate in percent.
Bounce float64 `json:"bounce" minimum:"0.1" maximum:"20"`
// Complaint rate in percent, overall and per mailbox provider.
Complaint float64 `json:"complaint" minimum:"0.01" maximum:"5"`
MailboxComplaint float64 `json:"mailboxComplaint" minimum:"0.01" maximum:"5"`
// ProviderErrors is the share of failed API calls over 3 minutes, in percent.
ProviderErrors float64 `json:"providerErrors" minimum:"1" maximum:"100"`
// Scope: pause only the affected route or mailbox provider, or the whole campaign.
Scope string `json:"scope" enum:"route,campaign"`
}
ReadinessThresholds are the auto-pause thresholds of a send. The sending engine enforces them; they're stored on campaigns.thresholds as {"bounce":2.0,"complaint":0.10,"mailbox_complaint":0.10,"provider_errors":5,"scope":"route"}.
func ParseThresholds ¶
func ParseThresholds(campaign, workspace json.RawMessage) ReadinessThresholds
ParseThresholds reads a campaign's thresholds, falling back to the workspace's defaults (send_thresholds) and then to 2% / 0.10% / 0.10% / 5%.
type ReadinessThrottle ¶
type ReadinessThrottle struct {
Key string `json:"key" enum:"gmail,outlook,yahoo,icloud,other"`
Name string `json:"name"`
Recipients int64 `json:"recipients"`
// Rate is messages per second; 0 means the provider's full rate.
Rate float64 `json:"rate"`
}
ReadinessThrottle is the rate for one mailbox provider.
type Recipient ¶
type Recipient struct {
Email string
MailboxProvider string
Lists []string
Tier string
// Language is the contact's language code as stored.
Language string
}
Recipient is one final recipient, as routing needs it.
func FinalRecipients ¶
func FinalRecipients(ctx context.Context, q *store.Queries, wsID uuid.UUID, audience, sunsetPolicy json.RawMessage, now time.Time) ([]Recipient, error)
FinalRecipients are an audience's final recipients as a run counts them, read with q (the demo gives the Weekly Digest's readers their languages inside its transaction).
type ReputationFacts ¶
type ReputationFacts struct {
// Status is pass, warn, block or unknown (deliverability's verdict).
Status string
// Via is hostrepute, builtin or none; Sources is how many lists.
Via string
Sources int
// Reason explains an unknown status; Outage is HostRepute's error
// ("Couldn't reach api.hostrepute.com (timeout after 30 s, 3 attempts)").
// ReasonText is Reason when Send Readiness wrote it itself.
Reason string
ReasonText Text
Outage string
CheckedAt *time.Time
// DomainSources and IPSources name the lists that check domains and IPs,
// most important first.
DomainSources []string
IPSources []string
// Listings of the campaign's assets.
Listings []ListingFacts
}
ReputationFacts are the blocklist results (HostRepute or the built-in checks).
type RouteConfig ¶
RouteConfig describes the routing a campaign uses: its override, or the Broadcasts default split. Key changes when the split changes; Label is "SES 90 / Postal 10" and StreamLabel "Broadcasts 90 / 10".
type RouteFacts ¶
type RouteFacts struct {
Stream string
// Policy is the stream's failover policy.
Policy string
Override bool
// NoRoute is true when the stream has no provider.
NoRoute bool
}
RouteFacts is the sending route of the campaign and its providers.
type RouteOverride ¶
RouteOverride is campaigns.route_override: a split that replaces the stream's rules for this campaign ("Send via SES only").
func ParseRouteOverride ¶
func ParseRouteOverride(raw json.RawMessage) *RouteOverride
ParseRouteOverride reads campaigns.route_override (nil when unset).
type RunOptions ¶
type RunOptions struct {
Trigger string
// By is the person who asked (nil for jobs).
By *uuid.UUID
}
RunOptions describe a run.
type Schedule ¶
type Schedule struct {
Mode string `json:"mode"`
At string `json:"at,omitempty"`
Timezone string `json:"timezone,omitempty"`
}
Schedule is campaigns.schedule.
func ParseSchedule ¶
func ParseSchedule(raw json.RawMessage) Schedule
ParseSchedule reads campaigns.schedule (mode "now" when unset).
type SegmentResolver ¶
type SegmentResolver interface {
ContactIDs(ctx context.Context, workspaceID, segmentID uuid.UUID) ([]uuid.UUID, error)
}
SegmentResolver lists a segment's contacts (the audience domain's segments.Service). Without one, segments in an audience aren't counted.
type Service ¶
type Service struct {
Pool *pgxpool.Pool
Q *store.Queries
Audit *audit.Logger
Log *slog.Logger
Now func() time.Time
// Campaigns runs the composer's content and link checks and saves the
// content changes fixes make.
Campaigns *campaigns.Service
// Deliverability reads blocklists, authentication and provider health.
Deliverability Deliverability
// Segments resolves segment members; nil until the audience domain wires it.
Segments SegmentResolver
// URLs builds the one-click unsubscribe link.
URLs publicurl.Builder
// AfterChange is told when a fix or a send setting changed a campaign.
AfterChange AfterChange
// Languages gives the facts of the Languages group and checks every
// language version; nil leaves them out.
Languages *languages.Service
// Accessibility runs the Accessibility group and its fixes; nil leaves
// the group out.
Accessibility AccessibilityChecker
// Conditional gives the Conditional content group and the poll checks;
// nil leaves them out.
Conditional ConditionalChecker
// Verification gives the address checks in Audience quality; nil
// leaves them out.
Verification VerificationChecker
// Website gives the web checks of a campaign that publishes to the
// website; nil leaves them out.
Website WebsiteChecker
// Sponsor gives the Sponsor block's checks and fixes; nil leaves them
// out.
Sponsor SponsorChecker
// UpgradeOffers finds Upgrade blocks whose offer ended; nil leaves the
// check out.
UpgradeOffers UpgradeOfferChecker
// Grow checks the Referral and Recommendations blocks (Content rows);
// nil leaves them out.
Grow GrowChecker
}
Service runs Send Readiness and applies its fixes.
func (*Service) AcceptUnknown ¶
func (s *Service) AcceptUnknown(ctx context.Context, ws *store.Workspace, p *authz.Principal, campaignID uuid.UUID, runID uuid.UUID) (ReadinessRun, error)
AcceptUnknown records "Continue with provider data only" on the latest run.
func (*Service) ApplyFixes ¶
func (s *Service) ApplyFixes(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in ReadinessFixesInput) (ReadinessFixResult, error)
ApplyFixes applies one-click fixes to a campaign. Content fixes save a new version through the composer; audience and route fixes change the campaign. Each change is audited.
func (*Service) Audience ¶
func (s *Service) Audience(ctx context.Context, ws *store.Workspace, raw json.RawMessage) (AudienceFacts, error)
Audience counts the final recipients of a stored audience definition.
func (*Service) Campaign ¶
func (s *Service) Campaign(ctx context.Context, ws *store.Workspace, id uuid.UUID) (store.ReadinessCampaignRow, error)
Campaign loads a campaign as a run sees it.
func (*Service) ClearRouteOverride ¶
func (s *Service) ClearRouteOverride(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) error
ClearRouteOverride puts the campaign back on the stream's routing.
func (*Service) CurrentFingerprint ¶
func (s *Service) CurrentFingerprint(ctx context.Context, ws *store.Workspace, c store.ReadinessCampaignRow) string
CurrentFingerprint is the fingerprint of the campaign as it stands, language versions included.
func (*Service) Route ¶
func (s *Service) Route(ctx context.Context, ws *store.Workspace, override json.RawMessage) (RouteConfig, error)
Route returns the routing configuration of a campaign.
func (*Service) Run ¶
func (s *Service) Run(ctx context.Context, ws *store.Workspace, id uuid.UUID, o RunOptions) (ReadinessRun, error)
Run runs every check on a campaign and stores the result. It returns ErrRunning when a run is already in progress.
func (*Service) UpdateSendSettings ¶
func (s *Service) UpdateSendSettings(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in ReadinessSendSettings) error
UpdateSendSettings saves the thresholds and the schedule the person chose. Changing the schedule after approval invalidates the approval.
type ShareFacts ¶
type ShareFacts struct {
Percent float64
// Status is the provider status (healthy, warming_up, down…).
// DownSince and DownDetail describe an outage ("mta.acme.io has refused
// connections since 08:52 (ECONNREFUSED on port 25 and 443)"); Down says
// it in parts, so it reads in each reader's language.
// Warm-up: day and length of the plan, the cap on the send day and
// whether that day is today.
// Rate is the provider's send rate (messages per second); RateRamp is
// true when it comes from a warm-up plan.
// Bounce and Complaint are 7-day rates in percent (nil without volume);
// ProviderReported is true when the provider measured them.
// Account is the account standing ("Production · no enforcement").
// BulkAllowed says whether the provider's terms allow bulk marketing;
// Terms explains it ("yes, with production access") and TermsKind names
// the explanation (terms.<kind> in the messages; empty shows Terms).
// IPs are the provider's dedicated IPs (empty for shared pools).
}
ShareFacts is one provider of the route with what the checks need.
type SponsorChecker ¶
type SponsorChecker interface {
SponsorFacts(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, src string) SponsorFacts
FixSponsor(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, src, action string) (next, applied string, err error)
}
SponsorChecker gives the facts of an email's Sponsor block and applies its fixes; nil leaves the checks out.
type SponsorFacts ¶
type SponsorFacts struct {
HasBlock bool
// State is ready (the creative), waiting (a placeholder) or none (no
// booking: the block is left out).
State string
Sponsor string
Issue int
// BookingID and CreativeDue name the booking to open.
BookingID string
CreativeDue *time.Time
// Stale: the creative or the booking changed since the email was saved.
Stale bool
// Labelled: the block carries the "Sponsored" label.
Labelled bool
}
SponsorFacts are what Send Readiness checks of an email's Sponsor block.
type Text ¶
Text is a text of a run, kept for the people who read it later: the messages it is written from, each with its arguments. One message is the text; several are sentences, each ended with a full stop and joined with a space.
Arguments are strings, numbers, other Texts (a phrase inside a sentence) and the values the Arg functions make (lists, money, percentages, times, language names), which are written in each reader's language and region.
func RawText ¶
RawText is text the run didn't write, such as a provider's own words or a DNS record: every reader reads it as it is.
func (Text) In ¶
In writes the text in a reader's language and region. It returns "" when a message isn't known any more: the caller shows the English it stored.
func (Text) MarshalJSON ¶
MarshalJSON stores one message as an object and several as an array.
func (*Text) UnmarshalJSON ¶
UnmarshalJSON reads what MarshalJSON stored.
type UpgradeOfferChecker ¶
type UpgradeOfferChecker interface {
EndedUpgradeOffers(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, src string) []EndedUpgradeOffer
}
UpgradeOfferChecker finds the ended offers of an email's Upgrade blocks; nil leaves the check out.
type VerificationChecker ¶
type VerificationChecker interface {
ReadinessFacts(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, recipients []Recipient, suppressed []string) VerificationFacts
// RiskySegment makes or refreshes a static segment of these risky
// addresses' contacts, for the campaign to exclude.
RiskySegment(ctx context.Context, ws *store.Workspace, campaign string, emails []string) (uuid.UUID, error)
}
VerificationChecker gives the address checks' facts for a run (the verification domain, wired in internal/app) and makes the exclusion.
type VerificationFacts ¶
type VerificationFacts struct {
// Connected is true when a verification service is connected; Ran
// when the checker looked at the audience.
Connected bool
Ran bool
// The service a check would use, its price per check (dollars) and balance.
Service string
ServiceName string
Price float64
Balance *int64
// At risk and Sunset recipients, and those not checked in 90 days.
AtRisk, AtRiskUnchecked int64
Sunset, SunsetUnchecked int64
// When the checked ones were last checked.
AtRiskCheckedOn, SunsetCheckedOn *time.Time
// Risky recipients by reason (catch_all, disposable, role…), their
// addresses (for the exclusion) and when they were checked.
Risky int64
RiskyReasons map[string]int64
RiskyEmails []string
RiskyCheckedOn *time.Time
// InvalidSuppressed counts the audience's contacts a check found invalid,
// already suppressed and left out at send time.
InvalidSuppressed int64
InvalidCheckedOn *time.Time
}
VerificationFacts are the audience's address-check results.
type VersionReport ¶
type VersionReport struct {
Language string
Report contentcheck.ContentCheckReport
}
VersionReport is the content check of one language version.
type WebCheck ¶
type WebCheck struct {
Key string // address, cover, tokens, hidden
Status string // pass, warn, block
Title string
Detail string
// Href opens the composer's Web tab.
Href string
}
WebCheck is one web check of a campaign's post.