Documentation
¶
Overview ¶
Package visibility is conditional content (design expansion, M21): the Visibility rule of a section or block, who it shows the block to, and what that does to an email.
A rule lives in the email's MJML, in the block's rc-visible attribute, so it is versioned with the content and kept by language versions. When the email is compiled, every conditional block is wrapped in two markers (mjml.PrepareCompile); a send decides once, when its audience is built, which blocks each recipient doesn't get, and cuts those out of the compiled HTML (Apply). No MJML is compiled per recipient.
Conditions come from a registry (RegisterKind) so later phases add their own: the score and its band (score.go) are in the Engagement group, a paid tier (phase 6) gets a group of its own.
Index ¶
- Constants
- Variables
- func Apply(src string, hidden Hidden) string
- func ApplyWhy(src string, hidden Hidden, line func(id string) string) string
- func CountKeys(src string, audience json.RawMessage) (rules, aud string)
- func Cut(html, hidden string) string
- func Describe(r VisibilityRule, n *Names) string
- func EmptyLine(text string) string
- func Fix(src, action string, params map[string]string) (next, label, applied string, err error)
- func FixIn(l i18n.Lang, src, action string, params map[string]string) (next, label, applied string, err error)
- func LoadFacts(ctx context.Context, q *store.Queries, wsID uuid.UUID, ids []uuid.UUID, ...) (map[uuid.UUID]*Facts, error)
- func NewID() string
- func Offered(tag string) bool
- func Possible(e Email) int64
- func PublicHidden(src string) string
- func Register(h huma.API, s *Service)
- func RegisterKind(k Kind)
- func Size(src string, hidden Hidden) int
- func Validate(r VisibilityRule, n *Names) error
- func Why(r VisibilityRule, matched []bool, f *Facts, n *Names) string
- type Audience
- type Block
- type Decision
- type Deletion
- type Email
- type EmailSection
- type Facts
- type Hidden
- type Kind
- type NamedField
- type Names
- type Operator
- type Planner
- type PreviewInput
- type Ref
- type ReportInput
- type SegmentResolver
- type Segments
- type Service
- func (s *Service) BrowserHTML(ctx context.Context, wsID, campaignID, messageID uuid.UUID, html string) string
- func (s *Service) Catalog(ctx context.Context, ws *store.Workspace) (VisibilityCatalog, error)
- func (s *Service) HiddenFor(ctx context.Context, wsID, campaignID, contactID uuid.UUID) (string, error)
- func (s *Service) PreviewAs(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, ...) (VisibilityPreview, error)
- func (s *Service) PreviewContacts(ctx context.Context, ws *store.Workspace, p *authz.Principal, ...) ([]VisibilityPreviewContact, error)
- func (s *Service) PreviewHTML(ctx context.Context, ws *store.Workspace, campaignID, contactID uuid.UUID, ...) (string, *VisibilityPreview, error)
- func (s *Service) Report(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, in ReportInput) (VisibilityReport, error)
- func (s *Service) SendPlanner(ctx context.Context, wsID, campaignID uuid.UUID) (*Planner, error)
- func (s *Service) Usage(ctx context.Context, ws *store.Workspace, kind, ref string) (VisibilityUsage, error)
- type Tally
- type VisibilityBlockInfo
- type VisibilityBroken
- type VisibilityCampaignPath
- type VisibilityCatalog
- type VisibilityCatalogField
- type VisibilityCatalogKind
- type VisibilityCatalogScore
- type VisibilityCondition
- type VisibilityHiddenBlock
- type VisibilityOption
- type VisibilityPreview
- type VisibilityPreviewContact
- type VisibilityPreviewContactList
- type VisibilityReport
- type VisibilityRule
- type VisibilityUsage
- type VisibilityUseEmail
- type VisibilityVersion
Constants ¶
const ( // FixShowEveryone removes a block's rule ("Show the content to everyone"). FixShowEveryone = "visibility_show_everyone" // FixHideBlock hides a block for everyone ("Hide this block for everyone"). FixHideBlock = "visibility_hide_block" // FixRemoveCondition removes one condition of a block's rule ("Remove // the condition"). FixRemoveCondition = "visibility_remove_condition" )
Fixes Send Readiness offers for conditional content.
const ( GroupLists = "lists" GroupContact = "contact" GroupEngagement = "engagement" )
Groups of the condition picker, in its order. Later phases add theirs (paid tiers get a group of their own); the score and its band are in Engagement (score.go).
const ( KindSegment = "segment" KindList = "list" KindTag = "tag" KindField = "field" KindLanguage = "language" KindTier = "tier" // The contact's score and its band (contact scoring, score.go). KindScore = "score" KindScoreBand = "score_band" )
Built-in condition kinds.
const ( // ShowEveryone is the default: no rule. ShowEveryone = "everyone" // ShowOnly shows the block to contacts who match the conditions. ShowOnly = "only" // ShowExcept shows it to everyone except contacts who match. ShowExcept = "except" // ShowNobody hides it for everyone ("Hide this block for everyone"). ShowNobody = "nobody" )
Who sees a block.
const ( MatchAll = "all" MatchAny = "any" )
How conditions combine.
const MaxChecked = 50
MaxChecked is how many versions Send Readiness renders and checks one by one; beyond it, the most common ones plus the largest and the smallest.
Variables ¶
Bands are the score bands in the picker's order.
var ErrNoBlock = errors.New("that block isn't in the email any more; run the checks again")
ErrNoBlock is a fix for a block the email doesn't have (any more).
var ErrNoRule = errors.New("visibility: no rule")
ErrNoRule is returned for an element without a Visibility rule.
var Tiers = []string{"active", "cooling", "at_risk", "sunset"}
Tiers are the engagement tiers in the picker's order.
Functions ¶
func Apply ¶
Apply cuts the hidden blocks out of compiled HTML and removes every marker: the email one recipient gets. HTML without markers comes back as is (minus nothing).
func ApplyWhy ¶
ApplyWhy is Apply for previews: each hidden block becomes a thin line saying what was left out and why ("Hidden: Beta corner · Sam Rivera isn't on Beta Program"); line(id) returns its text, "" to leave it out.
func CountKeys ¶
func CountKeys(src string, audience json.RawMessage) (rules, aud string)
CountKeys are the hashes a count is kept under (visibility_counts): the email's rules and the campaign's audience. The demo seeds the sample's count with them.
func Cut ¶
Cut is the email a recipient gets from the compiled HTML of the whole email and their hidden blocks.
func Describe ¶
func Describe(r VisibilityRule, n *Names) string
Describe says a rule in words: the badge on the block ("Beta Program list", "plan is empty", "Except At risk tier and 1 more").
func Fix ¶
Fix applies a Visibility fix to an email's MJML and returns the new source with the label of the version it saves and the line Review & send shows, in English.
func FixIn ¶
func FixIn(l i18n.Lang, src, action string, params map[string]string) (next, label, applied string, err error)
FixIn is Fix with the line Review & send shows in a reader's language. The version's label stays in English: it joins the other fixes' labels in the version's note.
func LoadFacts ¶
func LoadFacts(ctx context.Context, q *store.Queries, wsID uuid.UUID, ids []uuid.UUID, segs Segments, e Email) (map[uuid.UUID]*Facts, error)
LoadFacts reads what conditions need about some contacts, including what registered kinds load for themselves.
func PublicHidden ¶
PublicHidden is the blocks someone who isn't a contact doesn't get (the web archive): every "Only contacts who match" block, none of the "Everyone except" ones.
func RegisterKind ¶
func RegisterKind(k Kind)
RegisterKind adds a condition kind. Later phases call it from their own package's init (phase 6's paid tier).
func Validate ¶
func Validate(r VisibilityRule, n *Names) error
Validate checks a rule against the workspace: known kinds and operators, values where the operator needs one. It doesn't check references (a deleted segment is a broken condition, reported by Broken).
Types ¶
type Audience ¶
type Audience struct {
Lists []string `json:"lists"`
Segments []string `json:"segments"`
ExcludeLists []string `json:"excludeLists"`
ExcludeLists2 []string `json:"exclude_lists"`
ExcludeSegments []string `json:"excludeSegments"`
ExcludeSegs2 []string `json:"exclude_segments"`
ExcludeTiers []string `json:"exclude_tiers"`
ExcludeTiers2 []string `json:"excludeTiers"`
IncludeSunset bool `json:"include_sunset"`
IncludeSunset2 bool `json:"includeSunset"`
// Paid is who on the lists gets a paid-only campaign (Earn).
Paid paidaccess.Audience `json:"-"`
}
Audience is campaigns.audience as the composer stores it.
func ParseAudience ¶
func ParseAudience(raw json.RawMessage) Audience
ParseAudience reads campaigns.audience (both key styles).
type Block ¶
type Block struct {
ID string
// Name is the block's name in the layer tree: its own (rc-name, "Beta
// corner"), else what it is ("text", "2 columns").
Name string
Tag string
// Path is the element-index path from mj-body, as the composer and the
// content checks locate elements.
Path []int
Section bool
Rule VisibilityRule
// Parent is the conditional block this one sits in, "" for none: a
// block inside a hidden one is hidden with it.
Parent string
}
Block is a conditional block of an email: a section or a content element with a Visibility rule that leaves some contacts out.
type Decision ¶
Decision is what a contact gets: the blocks left out, and for each block whether each condition matched (for "Show why").
type Email ¶
type Email struct {
Blocks []Block
// Sections are mj-body's elements in order, with the conditional block
// each one is (empty when it isn't).
Sections []EmailSection
// Invalid are the rc-visible attributes that couldn't be read.
Invalid []string
}
Email is what an email's MJML says about conditional content.
func Read ¶
Read finds an email's conditional blocks. MJML that doesn't parse has none (the compile reports it). The footer is always shown: a rule on it is ignored, as on a block of a kind Visibility isn't offered on.
func (Email) Empty ¶
Empty reports whether a version shows nothing between the header and the footer: every content section is hidden (an email with no content sections at all isn't empty because of its rules).
type EmailSection ¶
type EmailSection struct {
Index int
Label string
// Role is header, footer or content: a version is empty when it shows
// no content section.
Role string
// Block is the id of the section's own conditional block, if any.
Block string
}
EmailSection is one top-level element of the body.
type Facts ¶
type Facts struct {
ID uuid.UUID
FirstName string
LastName string
Email string
// Lists the contact is subscribed to, and the segments (of those the
// rules refer to) they are in, by id.
Lists map[string]bool
Segments map[string]bool
Tags map[string]bool
// Attributes are the custom fields.
Attributes map[string]any
// Language is the contact's language code as stored ("es-MX").
Language string
Tier string
// Extra is what kinds load for themselves (Kind.Load), by kind key: the
// score and band under KindScore.
Extra map[string]any
}
Facts is what conditions read about one contact. Contacts are read in bulk once per count or send, never one query per contact.
func FinalRecipients ¶
func FinalRecipients(ctx context.Context, q *store.Queries, segs SegmentResolver, wsID uuid.UUID, a Audience, ruleSegments Segments) ([]*Facts, error)
FinalRecipients reads an audience's final recipients the way Send Readiness counts them (suppressed, role and duplicate addresses and contacts the sunset policy stopped left out), with what conditions read.
type Hidden ¶
Hidden is the set of conditional blocks a recipient doesn't get.
func ParseHidden ¶
ParseHidden reads messages.hidden_blocks ("a1b2c3,d4e5f6").
type Kind ¶
type Kind struct {
Key string
Group string
// Ops are the operators; field conditions take their custom field's
// operators (FieldOps) instead.
Ops []Operator
// Ref names what the condition refers to (zero Ref for none).
Ref func(c VisibilityCondition) Ref
// Match decides the condition for a contact.
Match func(c VisibilityCondition, f *Facts) bool
// Load reads what Match needs beyond the base facts, for the given
// contacts, into Facts.Extra. Nil for kinds that read the base facts.
Load func(ctx context.Context, q *store.Queries, workspaceID uuid.UUID, conditions []VisibilityCondition, facts map[uuid.UUID]*Facts) error
// Check validates a condition's value beyond "there is one" (nil: any).
Check func(c VisibilityCondition) error
// Describe says the condition in words for badges and summaries
// ("Beta Program list", "plan is empty").
Describe func(c VisibilityCondition, n *Names) string
// Why says why a contact doesn't get a block because of this condition
// ("Sam Rivera isn't on Beta Program"). matched is the condition's result.
Why func(c VisibilityCondition, f *Facts, matched bool, n *Names) string
// Options are the values the picker offers for kinds registered by
// later phases (the catalog's options under the kind's key); nil for
// none.
Options func(ctx context.Context, q *store.Queries, workspaceID uuid.UUID, n *Names) ([]VisibilityOption, error)
// Trait says what the condition reads about a contact for the preview
// ("Insider · trialing"); nil leaves it out.
Trait func(c VisibilityCondition, f *Facts, n *Names) string
}
Kind is a condition the picker offers. Built-in kinds are registered in this package; later phases register theirs (RegisterKind) from their own.
type NamedField ¶
NamedField is a custom field.
type Names ¶
type Names struct {
Lang i18n.Lang
Lists map[string]string
Segments map[string]string
Fields map[string]NamedField
// Deleted are the segments, lists and fields the workspace deleted,
// by Ref (who and when, from the audit log). LoadDeletions fills it.
Deleted map[Ref]Deletion
}
Names resolves what rules refer to, for words and broken conditions.
type Planner ¶
type Planner struct {
// contains filtered or unexported fields
}
Planner decides the hidden blocks of a send's recipients, page by page, while its audience is built. The rules are the source's: language versions keep the source's block ids.
type PreviewInput ¶
type PreviewInput struct {
ContactID string `json:"contactId" format:"uuid"`
MJML string `json:"mjml,omitempty" maxLength:"2000000"`
HTML string `json:"html,omitempty" maxLength:"2500000"`
}
PreviewInput asks for a contact's version; MJML carries the composer's unsaved rules.
type Ref ¶
Ref is what a condition refers to: a segment, a list or a custom field (by id or key). A condition whose reference is gone is broken: Send Readiness blocks until someone fixes it.
type ReportInput ¶
type ReportInput struct {
MJML string `json:"mjml,omitempty" maxLength:"2000000"`
HTML string `json:"html,omitempty" maxLength:"2500000"`
// Recount counts the audience again even when the rules didn't change.
Recount bool `json:"recount,omitempty"`
}
ReportInput is the content to report on: the composer's unsaved MJML and the HTML it compiled. Empty fields read the saved content.
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).
type Segments ¶
Segments is the members of the segments rules refer to, read once per count, send or preview.
type Service ¶
type Service struct {
Pool *pgxpool.Pool
Q *store.Queries
Segments SegmentResolver
Log *slog.Logger
Now func() time.Time
}
Service counts versions, previews them and answers what uses what.
func (*Service) BrowserHTML ¶
func (s *Service) BrowserHTML(ctx context.Context, wsID, campaignID, messageID uuid.UUID, html string) string
BrowserHTML is an email shown in the browser: a message's recipient gets their version (view online), anyone else the archive's (no message).
func (*Service) HiddenFor ¶
func (s *Service) HiddenFor(ctx context.Context, wsID, campaignID, contactID uuid.UUID) (string, error)
HiddenFor is the blocks a contact doesn't get in a campaign's saved content (a test email sent as that contact).
func (*Service) PreviewAs ¶
func (s *Service) PreviewAs(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, in PreviewInput) (VisibilityPreview, error)
PreviewAs decides a campaign's conditional blocks for one contact.
func (*Service) PreviewContacts ¶
func (s *Service) PreviewContacts(ctx context.Context, ws *store.Workspace, p *authz.Principal, campaignID uuid.UUID) ([]VisibilityPreviewContact, error)
PreviewContacts picks contacts who get each version, so a person can preview them all from the canvas.
func (*Service) PreviewHTML ¶
func (s *Service) PreviewHTML(ctx context.Context, ws *store.Workspace, campaignID, contactID uuid.UUID, src, html string, showWhy bool) (string, *VisibilityPreview, error)
PreviewHTML is the email a contact gets, for the composer's preview: the hidden blocks cut out of html, or, with showWhy, each replaced by a line saying why. src is the source's MJML (its rules decide every language version's blocks).
func (*Service) Report ¶
func (s *Service) Report(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, in ReportInput) (VisibilityReport, error)
Report describes an email's conditional blocks and counts its versions.
func (*Service) SendPlanner ¶
SendPlanner reads a campaign's rules when its send starts. It returns nil when the email has no conditional blocks.
type Tally ¶
type Tally struct {
Total int64
// ByHidden counts recipients per hidden set (Hidden.String()).
ByHidden map[string]int64
// Shown counts, for each block, the recipients who see it.
Shown map[string]int64
}
Tally is a count of an audience by version: how many recipients get each set of hidden blocks.
type VisibilityBlockInfo ¶
type VisibilityBlockInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Tag string `json:"tag"`
Path []int `json:"path"`
Section bool `json:"section"`
Rule VisibilityRule `json:"rule"`
// Words says the rule as the badge does ("Beta Program list").
Words string `json:"words"`
// Shown is how many recipients see it; Versions the versions that
// show it.
Shown int64 `json:"shown"`
Versions []int `json:"versions"`
Broken []VisibilityBroken `json:"broken"`
}
VisibilityBlockInfo is one conditional block of an email.
type VisibilityBroken ¶
type VisibilityBroken struct {
// Condition is the condition's position in the rule (0-based).
Condition int `json:"condition"`
Kind string `json:"kind" enum:"segment,list,field"`
// Name is what it was called ("Customers with mrr over $50").
Name string `json:"name"`
DeletedBy string `json:"deletedBy,omitempty"`
DeletedAt *time.Time `json:"deletedAt,omitempty"`
}
VisibilityBroken is a condition that refers to something deleted.
type VisibilityCampaignPath ¶
type VisibilityCampaignPath struct {
api.WorkspaceInput
CampaignID string `path:"campaignId" format:"uuid"`
}
type VisibilityCatalog ¶
type VisibilityCatalog struct {
// Groups in the picker's order; kinds in each group's order.
Groups []string `json:"groups"`
Kinds []VisibilityCatalogKind `json:"kinds"`
Segments []VisibilityOption `json:"segments"`
Lists []VisibilityOption `json:"lists"`
Tags []VisibilityOption `json:"tags"`
Fields []VisibilityCatalogField `json:"fields"`
Languages []VisibilityOption `json:"languages"`
Tiers []VisibilityOption `json:"tiers"`
Bands []VisibilityOption `json:"bands"`
Score VisibilityCatalogScore `json:"score"`
// Options are the values of kinds later phases register, by kind
// (paid tiers under "paid").
Options map[string][]VisibilityOption `json:"options"`
}
VisibilityCatalog is everything the condition picker offers.
type VisibilityCatalogField ¶
type VisibilityCatalogField struct {
Key string `json:"key"`
Label string `json:"label"`
Type string `json:"type"`
Ops []Operator `json:"ops"`
Options []string `json:"options"`
}
VisibilityCatalogField is a custom field with its operators.
type VisibilityCatalogKind ¶
type VisibilityCatalogKind struct {
Key string `json:"key"`
Group string `json:"group"`
Ops []Operator `json:"ops"`
}
VisibilityCatalogKind is one condition of the picker. The app names groups, kinds and operators by their keys.
type VisibilityCatalogScore ¶
type VisibilityCatalogScore struct {
// Configured is false while the workspace has no scoring: nobody has a
// score or a band yet.
Configured bool `json:"configured"`
WarmFrom int `json:"warmFrom"`
HotFrom int `json:"hotFrom"`
}
VisibilityCatalogScore is how the workspace's scores fall into bands.
type VisibilityCondition ¶
type VisibilityCondition struct {
// Kind is a registered condition: segment, list, tag, field, language,
// tier, and what later phases register.
Kind string `json:"kind"`
Op string `json:"op"`
// Field is the custom field a field condition reads ("plan").
Field string `json:"field,omitempty"`
// Value is a segment or list id, a tag, a field value, a language code,
// a tier key, a score (0–100) or a score band, depending on the kind.
Value string `json:"value,omitempty"`
// To is the top of a score range ("is between Value and To").
To string `json:"to,omitempty"`
// Label is the name of the segment or list when it was picked, so a
// condition still names it after it was deleted.
Label string `json:"label,omitempty"`
}
VisibilityCondition is one row of the rule: what is checked, how, and against what ("List membership · includes · Beta Program").
type VisibilityHiddenBlock ¶
type VisibilityHiddenBlock struct {
ID string `json:"id"`
Name string `json:"name"`
// Why is "Sam Rivera isn't on Beta Program".
Why string `json:"why"`
}
VisibilityHiddenBlock is a block a contact doesn't get, and why.
type VisibilityOption ¶
type VisibilityOption struct {
Value string `json:"value"`
Label string `json:"label"`
Contacts *int64 `json:"contacts,omitempty"`
}
VisibilityOption is a value a condition can take, with how many contacts have it.
type VisibilityPreview ¶
type VisibilityPreview struct {
ContactID string `json:"contactId"`
Name string `json:"name"`
Email string `json:"email"`
// Hidden are the blocks the contact doesn't get; Shown the ids of those
// they do.
Hidden []VisibilityHiddenBlock `json:"hidden"`
Shown []string `json:"shown"`
// Version is the version's number in the versions table (0 when the
// audience isn't counted), Versions how many there are, Recipients
// how many get this one.
Version int `json:"version"`
Versions int `json:"versions"`
Recipients int64 `json:"recipients"`
// Shows names the conditional blocks it shows ("" for none of them).
Shows string `json:"shows"`
// Empty is true when nothing is left between the header and the footer.
Empty bool `json:"empty"`
// Traits say what the rules read about the contact ("Active", "plan
// team", "not on Beta Program").
Traits []string `json:"traits"`
// InAudience is false for a contact the campaign wouldn't reach.
InAudience bool `json:"inAudience"`
}
VisibilityPreview is the version one contact gets.
type VisibilityPreviewContact ¶
type VisibilityPreviewContact struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Language string `json:"language"`
// Trait is what sets them apart ("English", "Beta Program").
Trait string `json:"trait"`
// Version is the version they get.
Version int `json:"version"`
}
VisibilityPreviewContact is a contact to preview as: one per version (the most common first), then one per other language.
type VisibilityPreviewContactList ¶
type VisibilityPreviewContactList struct {
Items []VisibilityPreviewContact `json:"items"`
}
VisibilityPreviewContactList is who the canvas can preview as.
type VisibilityReport ¶
type VisibilityReport struct {
Blocks []VisibilityBlockInfo `json:"blocks"`
Versions []VisibilityVersion `json:"versions"`
// Total is the audience's final recipients, as Send Readiness counts them.
Total int64 `json:"total"`
// Possible is the number of combinations the blocks allow; Missing how
// many of them no recipient gets.
Possible int64 `json:"possible"`
Missing int64 `json:"missing"`
CountedAt *time.Time `json:"countedAt,omitempty"`
DurationMs int `json:"durationMs"`
// Counted is false when the audience is empty (nothing to count).
Counted bool `json:"counted"`
// MinSize and MaxSize are the smallest and largest version, in bytes.
MinSize int `json:"minSize"`
MaxSize int `json:"maxSize"`
// Checked is how many versions Send Readiness renders one by one.
Checked int `json:"checked"`
// Invalid are rules that couldn't be read.
Invalid []string `json:"invalid"`
}
VisibilityReport is an email's conditional content: its blocks and the versions its audience gets ("3 conditional blocks · 6 versions").
type VisibilityRule ¶
type VisibilityRule struct {
// ID names the block in compiled HTML markers and in each recipient's
// hidden blocks. Language versions keep the source's ids.
ID string `json:"id"`
Show string `json:"show" enum:"everyone,only,except,nobody"`
Match string `json:"match,omitempty" enum:"all,any"`
Conditions []VisibilityCondition `json:"conditions"`
}
VisibilityRule is a block's Visibility setting, as stored in its rc-visible attribute.
func ParseRule ¶
func ParseRule(raw string) (VisibilityRule, error)
ParseRule reads an rc-visible attribute value.
func (VisibilityRule) Conditional ¶
func (r VisibilityRule) Conditional() bool
Conditional reports whether the rule can leave some contacts out.
func (VisibilityRule) Encode ¶
func (r VisibilityRule) Encode() string
Encode writes the rule as the attribute value.
func (VisibilityRule) Shows ¶
func (r VisibilityRule) Shows(matched []bool) bool
Shows decides the rule for a contact: whether the block is shown, given whether each condition matched (in order).
type VisibilityUsage ¶
type VisibilityUsage struct {
Blocks int `json:"blocks"`
Emails []VisibilityUseEmail `json:"emails"`
}
VisibilityUsage is where something is used by Visibility rules, in emails that haven't gone out yet.
type VisibilityUseEmail ¶
type VisibilityUseEmail struct {
CampaignID string `json:"campaignId"`
Name string `json:"name"`
Status string `json:"status"`
ScheduledAt *time.Time `json:"scheduledAt,omitempty"`
// Blocks are the blocks' names ("Annual billing offer"), and Paths
// where they are (to open the block in the composer).
Blocks []string `json:"blocks"`
Paths [][]int `json:"paths"`
}
VisibilityUseEmail is an email whose conditional blocks use a segment, list, field or tag.
type VisibilityVersion ¶
type VisibilityVersion struct {
Number int `json:"number"`
// Hidden are the ids of the blocks it leaves out; Shown the ones it
// shows, in the email's order.
Hidden []string `json:"hidden"`
Shown []string `json:"shown"`
// Shows names what it shows: "Beta corner, Start a free trial", or ""
// for none of the conditional blocks.
Shows string `json:"shows"`
Recipients int64 `json:"recipients"`
SizeBytes int `json:"sizeBytes"`
// OverClip is true over Gmail's clipping size (102 KB).
OverClip bool `json:"overClip"`
// Empty is true when nothing is left between the header and the footer.
Empty bool `json:"empty"`
// Largest and Smallest mark the extremes by size.
Largest bool `json:"largest,omitempty"`
Smallest bool `json:"smallest,omitempty"`
// Checked is false for versions Send Readiness doesn't render one by one
// (beyond the 50 with the most recipients, except the extremes).
Checked bool `json:"checked"`
}
VisibilityVersion is one combination of conditional blocks that some of the audience gets.