website

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 55 Imported by: 0

Documentation

Overview

Package website is the publication website (design expansion phase 7, M28; brief docs/spec/reputecast-design-addon-publish-sell.md): the publisher's site at their custom domain, grown out of the public archive.

  • Turning it on makes every archived campaign a public post (its old archive address redirects), each archived list a tag, the root of the domain the home page and members able to sign in. Turning it off brings the archive back and keeps everything for next time.
  • Posts come from campaigns ("Publish to web": with the send, at a set time, or now for a sent campaign) or are written for the web only in the composer's post mode. A post's web version is drawn from its MJML by internal/website/render, in the site's theme.
  • Visibility, the free preview marker and the meter gate posts on the server (internal/website/gate): text a reader may not see never reaches their browser, the feed, the sitemap or the search index.
  • Members sign in with a link and a 6-digit code (System stream, the contact's language); sessions are a first-party cookie on the site.
  • Views are counted on the server without cookies: one per visitor, page and day, from a hash with a salt that changes daily.

The public pages themselves are rendered by internal/publicpages with the site's frame (templates/site); this package gives them their data.

Index

Constants

View Source
const (
	AsVisitor     = "visitor"
	AsFree        = "free"
	AsFreeUsedUp  = "free_used"
	AsPaid        = "paid"
	AsVisitorUsed = "visitor_used"
)

Preview readers ("Preview on web as …").

View Source
const (
	KindCampaign = "campaign"
	KindWeb      = "web"
)

Post kinds.

View Source
const (
	PostDraft       = "draft"
	PostScheduled   = "scheduled"
	PostPublished   = "published"
	PostUnpublished = "unpublished"
)

Post statuses.

View Source
const (
	WhenWithSend = "with_send"
	WhenAt       = "at"
	WhenNow      = "now"
)

Publish modes.

View Source
const (
	// SessionCookie holds a member's session token.
	SessionCookie = "rc_member"
	// MeterCookie is a visitor's meter key (members-only posts read
	// without signing in), enough for a soft limit.
	MeterCookie = "rc_meter"
	// BrowserCookie names the browser that asked for a sign-in link, so its
	// code is typed where it was asked for.
	BrowserCookie = "rc_signin"
)

Cookies of the site: first-party, on the site's own host and path.

View Source
const (
	StatusOff       = "off"
	StatusTurningOn = "turning_on"
	StatusOn        = "on"
)

Website statuses.

View Source
const (
	LayoutFeatured = "featured"
	LayoutList     = "list"
	LayoutGrid     = "grid"
)

Home layouts.

View Source
const (
	SectionSubscribe = "subscribe"
	SectionFeatured  = "featured"
	SectionLatest    = "latest"
	SectionTag       = "tag"
	SectionAbout     = "about"
	SectionTiers     = "tiers"
)

Home section kinds.

View Source
const (
	NavHome    = "home"
	NavTag     = "tag"
	NavPage    = "page"
	NavArchive = "archive"
	NavURL     = "url"
)

Navigation link kinds.

View Source
const (
	PurposeSignin = "signin"
	PurposeSignup = "signup"
	PurposeEmail  = "email"
)

Link purposes.

View Source
const (
	MaxLinksPerHour = 5
	CodeTries       = 3
	// SignupLinkDays is how long a sign-up's confirmation link works.
	SignupLinkDays = 7
	// ResendAfter is how long "Send again" waits.
	ResendAfter = 60 * time.Second
)

Limits of sign-in links.

View Source
const (
	SigninSent      = "sent"
	SigninInvalid   = "invalid"
	SigninLimited   = "limited"
	SigninChallenge = "challenge"
	SigninOff       = "off"
)

Sign-in outcomes.

View Source
const (
	CodeOK      = "ok"
	CodeWrong   = "wrong"
	CodeExpired = "expired"
)

Code outcomes.

View Source
const (
	LinkOK       = "ok"
	LinkExpired  = "expired"
	LinkUsed     = "used"
	LinkReplaced = "replaced"
	LinkUnknown  = "unknown"
)

Link states.

View Source
const (
	PagePost    = "post"
	PageHome    = "home"
	PageArchive = "archive"
	PageTag     = "tag"
	PagePage    = "page"
)

Page kinds whose views are counted.

View Source
const KindDomainProblem = notify.KindWebsiteDomain

KindDomainProblem notifies the people who manage the website that its custom domain stopped checking out or its certificate is failing.

View Source
const MaxFeatured = 3

MaxFeatured is how many posts the home page features.

View Source
const MaxHeaderLinks = 6

MaxHeaderLinks is how many links the header holds.

View Source
const MaxTags = 5

MaxTags is how many tags a post has.

Variables

View Source
var HomeID = uuid.Nil

HomeID stands for the home page and the archive in the view counts.

Functions

func AccountQueries

func AccountQueries(ctx context.Context) *store.Queries

AccountQueries are the queries an account section reads its data with (nil outside Account).

func BrowserKey

func BrowserKey(cookie string) string

BrowserKey is a visitor's meter key: the hash of their meter cookie.

func CheckText

func CheckText(ctx context.Context, c WebsiteWebCheck) (title, detail string)

CheckText is a web check in words, as Review & send lists it.

func CodeText

func CodeText(code string) string

CodeText is a code as the email shows it ("482 913").

func Erasure

func Erasure() erasure.Source

Erasure is the contact's membership of the publication website: sign-ins, sessions and pending sign-in links (review 2026-11 DP-1).

func Has

func Has(key string) bool

Has reports whether the catalog has a key.

func Money

func Money(cents int64, currency string) string

Money writes a price in minor units the design's way: "$8", "$8.50", "¥1,200".

func PostHash

func PostHash(p store.WebsitePost, src string) string

PostHash is what an approval of a post covers, for a post and its content (the demo's request for Daniel's post).

func Register

func Register(h huma.API, s *Service)

Register adds the website's operations: the Website tab (its states, posts, home and navigation, access), the composer's Web tab, the Campaigns list's Web column, the report's Web section and the contact profile's Website card. Publishing and unpublishing need website:publish (or an approval); turning the site on or off, home, navigation, tags and who can read what need website:manage.

func RegisterAccountSection

func RegisterAccountSection(f AccountSectionFunc)

RegisterAccountSection adds a section to the account page (Purchases, Gifts, Referrals…), after the built-in ones, in registration order.

func RegisterJobs

func RegisterJobs(reg *jobs.Registry, s *Service)

RegisterJobs adds the website's workers and periodic jobs.

func RegisterPageNames

func RegisterPageNames(f PageNames)

RegisterPageNames lets the page builder name the pages of header links.

func SafeReturn

func SafeReturn(p string) string

SafeReturn keeps a return path on the site: a root-relative path, not another host.

func TierLabel

func TierLabel(name string) string

TierLabel is the quiet label of a tier on posts: its last word unless that word is generic ("Weekly Digest Insider" → "Insider"; "Founding member" → "Founding member").

func Token

func Token() string

Token makes a random cookie value.

Types

type Account

type Account struct {
	ContactID   uuid.UUID
	Email       string
	FirstName   string
	LastName    string
	Since       time.Time
	Tiers       []string
	Plan        *earn.PreferencesPaid
	Meter       *AccountMeter
	Lists       []AccountList
	Frequency   string
	PausedUntil *time.Time
	Sessions    []AccountSession
	SessionDays int
	// Sections are the later phases' sections, in their order.
	Sections []AccountSection
}

Account is the member's account page.

type AccountList

type AccountList struct {
	ID          uuid.UUID
	Name        string
	Description string
	Subscribed  bool
	Pending     bool
}

AccountList is a newsletter on the account page.

type AccountMeter

type AccountMeter struct {
	Used  int
	Limit int
	// Reads are the posts it counted ("the runbook, 13 Oct").
	Reads []AccountRead
	Next  time.Time
}

AccountMeter is what the member meter used this month.

type AccountRead

type AccountRead struct {
	Title string
	At    time.Time
}

AccountRead is a post the meter counted.

type AccountSection

type AccountSection struct {
	ID    string
	Title string
	HTML  string
}

AccountSection is a section another part of ReputeCast adds to the account page: its id, title and body (HTML the section draws itself).

type AccountSectionFunc

type AccountSectionFunc func(ctx context.Context, ws *store.Workspace, contactID uuid.UUID, l i18n.Lang) (AccountSection, bool, error)

AccountSectionFunc draws a section for a member (ok false: none).

type AccountSession

type AccountSession struct {
	ID        uuid.UUID
	Current   bool
	Method    string
	CreatedAt time.Time
	LastSeen  time.Time
	ExpiresAt time.Time
}

AccountSession is one of the member's sessions.

type Approvals

type Approvals interface {
	PostDecision(ctx context.Context, ws *store.Workspace, p *authz.Principal, req PostApprovalRequest) (PostApprovalDecision, error)
	RequestPost(ctx context.Context, ws *store.Workspace, p *authz.Principal, req PostApprovalRequest, note string) (uuid.UUID, error)
	// PostPublished settles the approval a publish relied on.
	PostPublished(ctx context.Context, ws *store.Workspace, postID uuid.UUID, hash string) error
	// PostChanged invalidates requests for the post as it was (hash is the
	// post as it is now).
	PostChanged(ctx context.Context, ws *store.Workspace, p *authz.Principal, postID uuid.UUID, title, hash string) error
}

Approvals is the approval rule for publishing posts (internal/approvals): whether a person may publish a post as it is, and asking for approval.

type CampaignDrafts

type CampaignDrafts interface {
	DraftFromPost(ctx context.Context, ws *store.Workspace, p *authz.Principal, name, subject, preheader, mjml string) (uuid.UUID, error)
}

CampaignDrafts makes a campaign draft from a web-only post ("Send as a campaign"), returning its id.

type CertChecker

type CertChecker interface {
	Check(ctx context.Context, domain string) CertInfo
}

CertChecker checks the certificate a domain serves.

type CertInfo

type CertInfo struct {
	// Status is valid, failing or unknown (the check couldn't connect).
	Status   string
	Issuer   string
	NotAfter time.Time
	// Detail says why a certificate fails, in English from the TLS stack.
	Detail    string
	CheckedAt time.Time
}

CertInfo is what a check of the site's certificate found.

type CodeOutcome

type CodeOutcome struct {
	Status    string
	TriesLeft int
	Email     string
	Done      *SigninDone
}

CodeOutcome is the answer to a typed code.

type FeedItem

type FeedItem struct {
	Post PublicPost
	// HTML is the post's body for a public post, else its free preview ("").
	HTML string
	// Gated: a members-only or paid post.
	Gated bool
}

FeedItem is a post in a feed: public posts whole, gated posts only as far as anyone may read them.

type FrameLink struct {
	Kind  string
	Label string
	// Path is a path on the site ("/", "/tag/engineering", "/about"), or
	// URL an outside address.
	Path string
	URL  string
	// Key identifies the page the link opens ("tag:<slug>", "page:<slug>",
	// "home", "archive") so the current page can mark it.
	Key string
}

FrameLink is a header link.

type Home

type Home struct {
	Layout   string
	Sections []HomeSection
	// Total is every published post ("All 190 posts in the archive").
	Total int64
	// Tiers are the paid tiers (for labels).
	Tiers []gate.Tier
}

Home is the home page's data, section by section in their order.

type HomeSection

type HomeSection struct {
	Kind string
	// Subscribe: the hero's note under the form.
	Note string
	// Featured, latest and tag rows: their posts.
	Posts []PublicPost
	// A tag row: the tag and its posts' count.
	Tag      *TagRef
	TagCount int64
	// About: its title, text and link (a path on the site or an address).
	AboutTitle, AboutText, AboutLink string
	// Tiers: the upgrade page's cards (nil without paid tiers or payments).
	Upgrade *earn.UpgradeView
}

HomeSection is one shown section of the home page.

type HourlyArgs

type HourlyArgs struct{}

HourlyArgs is the hourly job: views past their keeping, used sign-in links, and the custom domain's certificate.

func (HourlyArgs) InsertOpts

func (HourlyArgs) InsertOpts() river.InsertOpts

InsertOpts runs on the maintenance queue.

func (HourlyArgs) Kind

func (HourlyArgs) Kind() string

Kind implements river.JobArgs.

type Inserter

type Inserter interface {
	Insert(ctx context.Context, args river.JobArgs, opts *river.InsertOpts) (*rivertype.JobInsertResult, error)
}

Inserter enqueues River jobs (the job client).

type JoinInput

type JoinInput struct {
	Email string
	// Lists are the newsletters ticked, among the offered ones.
	Lists     []uuid.UUID
	ReturnTo  string
	Browser   string
	IP        *netip.Addr
	UserAgent string
	Turnstile string
	Verify    func(answer string) bool
	// Page is the address the reader signed up on (consent evidence).
	Page string
	// Language is the page's language.
	Language string
}

JoinInput signs a reader up from the site: the paywall of a post, or the sign-in page.

type LinkState

type LinkState struct {
	Status   string
	Email    string
	Purpose  string
	ReturnTo string
	Minutes  int
	// SameBrowser: opened where it was asked for.
	SameBrowser bool
}

LinkState is what a sign-in link can do. Reading it uses nothing up.

type PageLinkState

type PageLinkState struct {
	// Linked: the header links to the page.
	Linked bool
	// Full: the header has no room for another link.
	Full bool
}

PageLinkState is a page's place in the header.

type PageNames

type PageNames func(ctx context.Context, q *store.Queries, workspaceID uuid.UUID, slugs []string) (map[string]string, error)

PageNames resolves the custom pages header links point at (the page builder registers it, design expansion phase 7 M29): a page's title by its slug, ok false when it doesn't exist or isn't published.

type Payments

type Payments struct {
	Provider string
	Mode     string
}

Payments is the payment provider the site sells through ("" when none is connected).

type PaywallTier

type PaywallTier struct {
	ID        uuid.UUID
	Name      string
	Label     string
	Monthly   string
	Yearly    string
	TrialDays int
	Benefits  []string
	// Includes is the label of the lower tier it includes ("Insider").
	Includes string
}

PaywallTier is a tier on the paywall card: "Weekly Digest Insider · $8 a month or $80 a year · 14 days free".

type PostAddress

type PostAddress struct {
	// Post is the published post at the address.
	Post *store.WebsitePost
	// RedirectTo is a path on the site: a renamed post's new address, an
	// old archive address, or where an unpublished post now leads.
	RedirectTo string
	// Gone: the post was taken off the site or deleted (410).
	Gone bool
}

PostAddress is what an address under /posts/ leads to.

type PostApprovalDecision

type PostApprovalDecision struct {
	Allowed bool
	// NeedsApproval: Publish becomes Request approval, for Reason, with the
	// rule that matched ("author_lacks_send", "post_publish").
	NeedsApproval bool
	Rule          string
	Reason        string
	Approvers     []string
	// Pending is an open request for this post (its id), Approved one that
	// covers the post as it is.
	Pending  string
	Approved string
	// RequestedBy and RequestedAt describe the pending request.
	RequestedBy string
	RequestedAt *time.Time
}

PostApprovalDecision is whether a person may publish a post as it is.

type PostApprovalRequest

type PostApprovalRequest struct {
	PostID     uuid.UUID
	Title      string
	Kind       string // web or campaign
	Slug       string
	Path       string // "/posts/q4-roadmap-deep-dive"
	Visibility string
	// VisibilityLabel says the visibility in words ("Members", "Paid · all tiers").
	VisibilityLabel string
	// When: now, at (PublishAt), with_send.
	When      string
	PublishAt *time.Time
	// Hash covers the content and the settings above: a change after
	// approval needs a new one.
	Hash string
	// Excerpt and Preview are what the approval review shows (the web preview).
	Excerpt string
}

PostApprovalRequest is what an approval of a post covers: the content (its hash), the address, the visibility and when it goes live.

type PostLabel

type PostLabel struct {
	Kind string
	Text string
}

PostLabel is a post's visibility label on the site: Kind is "members" or "paid" ("" for public posts), Text says it ("Members", "Insider").

type PostView

type PostView struct {
	Post     PublicPost
	Decision gate.Decision
	// Body is what the reader gets: the whole post, or the free preview
	// ("" without a marker: the title, the cover and the excerpt).
	Body string
	// Readers are the tiers that read the post, lowest first (the paywall
	// offers them); Rules the site's access rules.
	Readers []gate.Tier
	Rules   gate.Rules
	Paywall WebsitePaywall
	// SignupOn: readers can sign up from the paywall; Offers are its lists.
	SignupOn bool
	Offers   []SignupOffer
	// Month is the meter's month; Next the first day of the next one.
	Month, Next time.Time
	// More are other posts of the post's first tag.
	More      []PublicPost
	MoreTag   *TagRef
	MoreTotal int64
	SEO       WebsitePostSEO
	Minutes   int
	// BandText is the subscribe band's line under the post (Home &
	// navigation's subscribe section).
	BandText string
	// SessionDays is how long members stay signed in.
	SessionDays int
}

PostView is a published post as one reader gets it. Text the reader may not read isn't in it: the preview stops at the marker, paid blocks they don't hold are a card.

type PublicPost

type PublicPost struct {
	ID          uuid.UUID
	Kind        string
	CampaignID  *uuid.UUID
	Slug        string
	Title       string
	Excerpt     string
	CoverURL    string
	CoverAlt    string
	PublishedAt time.Time
	UpdatedAt   time.Time
	Visibility  gate.Visibility
	// Tags are the post's tags in order; the first names it in lists.
	Tags []TagRef
	// Label is the visibility label: "Members", or a tier's ("Insider").
	Label     PostLabel
	Words     int
	HideIndex bool
	// PreviewText is the text before the free preview marker (search).
	PreviewText string
	BodyText    string
	Byline      string
	BylineColor string
}

PublicPost is a published post as the site lists it: what an anonymous visitor may see of it (never its gated text).

type PublicQuery

type PublicQuery struct {
	Tag     *uuid.UUID
	Search  string
	Exclude []uuid.UUID
	Limit   int
	Offset  int
	// IDs lists exactly these posts, in this order (featured posts).
	IDs []uuid.UUID
}

PublicQuery filters the site's lists of posts.

type PublicTag

type PublicTag struct {
	TagRef
	Description string
	Posts       int64
}

PublicTag is a tag's page: its name, description and number of posts.

type ReadOptions

type ReadOptions struct {
	Lang i18n.Lang
	// Preview reads it for the app: nothing is recorded, and Meter, when
	// set, stands in for the reader's month.
	Preview bool
	Meter   *gate.MeterState
}

ReadOptions are how a post is read.

type RedrawArgs

type RedrawArgs struct{}

RedrawArgs is the daily job (and one at start) that draws again the posts RedrawPollPosts finds.

func (RedrawArgs) InsertOpts

func (RedrawArgs) InsertOpts() river.InsertOpts

InsertOpts runs on the maintenance queue, once at a time.

func (RedrawArgs) Kind

func (RedrawArgs) Kind() string

Kind implements river.JobArgs.

type Service

type Service struct {
	Pool  *pgxpool.Pool
	Q     *store.Queries
	Audit *audit.Logger
	Log   *slog.Logger
	Now   func() time.Time
	URLs  publicurl.Builder
	// Forms holds the branding, the custom domain and the archive.
	Forms *forms.Service
	// Audience signs readers up and changes their newsletters.
	Audience *audience.Service
	// Earn gives the paid tiers, their prices and the billing links (nil
	// without payments).
	Earn func() *earn.Service
	// Mail sends the sign-in emails on the System stream.
	Mail      func() mailer.Sender
	Jobs      func() Inserter
	Approvals func() Approvals
	Campaigns func() CampaignDrafts
	// Certs checks the certificate the custom domain serves (nil: unknown).
	Certs func() CertChecker
	// contains filtered or unexported fields
}

Service is the website domain.

func (*Service) Access

Access returns Website › Access.

func (*Service) Account

func (s *Service) Account(ctx context.Context, ws *store.Workspace, sess *Session, l i18n.Lang) (Account, error)

Account builds the account page of a signed-in member.

func (*Service) CampaignReport

func (s *Service) CampaignReport(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID) (*WebsiteCampaignReport, error)

CampaignReport is the Web section of a campaign's report (nil when the campaign has no post on the site).

func (*Service) CampaignWeb

func (s *Service) CampaignWeb(ctx context.Context, ws *store.Workspace, p *authz.Principal, campaignID uuid.UUID) (WebsiteCampaignWeb, error)

CampaignWeb returns a campaign's Web tab.

func (*Service) CampaignWebStates

func (s *Service) CampaignWebStates(ctx context.Context, ws *store.Workspace, ids []uuid.UUID) ([]WebsiteCampaignWebState, error)

CampaignWebStates are the Web column of campaigns: their posts' states (campaigns without one aren't listed).

func (*Service) ChangeEmail

func (s *Service) ChangeEmail(ctx context.Context, ws *store.Workspace, sess *Session, newEmail, browser string) (SigninOutcome, error)

ChangeEmail sends a confirmation link to a member's new address; the change happens when it is opened. A taken or suppressed address gets no link, and the answer is the same.

func (*Service) CheckDomains

func (s *Service) CheckDomains(ctx context.Context) error

CheckDomains looks at the custom domain of every site that is on: when it stops checking out or its certificate fails, the people with website:manage are told once per problem, until it is fine again.

func (*Service) ContactCard

func (s *Service) ContactCard(ctx context.Context, ws *store.Workspace, p *authz.Principal, contactID uuid.UUID) (WebsiteContactCard, error)

ContactCard returns a contact's Website card.

func (*Service) CountView

func (s *Service) CountView(ctx context.Context, ws *store.Workspace, r *http.Request, kind string, page uuid.UUID)

CountView counts a page view. It never fails a page: errors are logged.

func (*Service) CreatePost

CreatePost starts a web-only post in the composer's post mode, with the workspace's default visibility, its writer as the byline.

func (*Service) CreateTag

CreateTag makes a tag.

func (*Service) DeletePost

func (s *Service) DeletePost(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) error

DeletePost deletes a post: it leaves the site (its address answers 410).

func (*Service) DeleteTag

func (s *Service) DeleteTag(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) error

DeleteTag deletes a tag; its posts lose it and the header its link.

func (*Service) Feed

func (s *Service) Feed(ctx context.Context, ws *store.Workspace, tag *uuid.UUID, limit int) ([]FeedItem, error)

Feed lists the newest posts for the site's feed (or a tag's).

func (*Service) FindPost

func (s *Service) FindPost(ctx context.Context, ws *store.Workspace, ref string) (uuid.UUID, error)

FindPost finds a post by its id or its address (the slug after /posts/).

func (*Service) Frame

func (s *Service) Frame(ctx context.Context, ws *store.Workspace, set *forms.Settings) (SiteFrame, error)

Frame returns the site's frame for a workspace.

func (*Service) Home

func (s *Service) Home(ctx context.Context, ws *store.Workspace, l i18n.Lang, period string) (Home, error)

Home builds the home page. period is the tiers band's Monthly · Yearly pick.

func (*Service) HomeNav

HomeNav returns Website › Home & navigation.

func (*Service) IsOn

func (s *Service) IsOn(ctx context.Context, ws *store.Workspace) (bool, error)

IsOn reports whether a workspace's website is on.

func (*Service) Join

Join signs a reader up: one email, "Confirm your email and continue reading", confirms the newsletters they ticked and signs them in. The page, the time, the IP address and the exact consent text are kept.

func (*Service) Label

func (s *Service) Label(v gate.Visibility, tiers []gate.Tier, l i18n.Lang) PostLabel

Label is a post's visibility label in a language.

func (s *Service) Link(ctx context.Context, ws *store.Workspace, token, browser string) (LinkState, error)

Link describes a sign-in link (the page it opens).

func (*Service) MemberCount

func (s *Service) MemberCount(ctx context.Context, ws *store.Workspace) (int64, error)

MemberCount is how many contacts signed in to the website (the contacts filter "Signed in to the website").

func (*Service) Overview

func (s *Service) Overview(ctx context.Context, ws *store.Workspace, p *authz.Principal) (WebsiteOverview, error)

Overview returns the Website tab's header and states.

func (s *Service) PageLink(ctx context.Context, q *store.Queries, ws *store.Workspace, slug string) (PageLinkState, error)

PageLink says whether the header links to a page's address.

func (*Service) PastCampaigns

func (s *Service) PastCampaigns(ctx context.Context, ws *store.Workspace) ([]WebsitePastCampaign, error)

PastCampaigns lists the sent campaigns that aren't posts yet, newest first.

func (*Service) PaywallTiers

func (s *Service) PaywallTiers(ctx context.Context, ws *store.Workspace, readers []gate.Tier) ([]PaywallTier, Payments, error)

PaywallTiers are the tiers a reader can buy to read a post, lowest first, with their current prices; nil when nothing can be bought.

func (*Service) Post

Post returns one post.

func (*Service) Posts

Posts lists the posts of Website › Posts with their 30-day numbers.

func (*Service) PreviewPost

func (s *Service) PreviewPost(ctx context.Context, ws *store.Workspace, id uuid.UUID, as, tier string, l i18n.Lang) (store.WebsitePost, PostView, gate.Reader, error)

PreviewPost reads a post as one kind of reader for the app, from its content as it is now (published or not). tier is a paid reader's tier ("" for the highest).

func (*Service) PublicPosts

func (s *Service) PublicPosts(ctx context.Context, ws *store.Workspace, f PublicQuery, l i18n.Lang) ([]PublicPost, int64, error)

PublicPosts lists the site's published posts (the archive, a tag page, feeds), newest first, with the total. Their labels are in l.

func (*Service) Publish

Publish publishes a post now, or schedules it.

func (*Service) PublishApproved

func (s *Service) PublishApproved(ctx context.Context, ws *store.Workspace, postID uuid.UUID, approvalID string, approverName string) error

PublishApproved goes ahead with a post once its approval came: now, or at its time. The approver's decision is the authority.

func (*Service) PublishDue

func (s *Service) PublishDue(ctx context.Context) (int, error)

PublishDue publishes the posts whose time came: scheduled at a time, or set to go live with their campaign's send once it started. The minute job runs it.

func (*Service) PublishPast

PublishPast makes posts of sent campaigns, live at their send dates, in the site's theme, with the tags of their lists.

func (s *Service) PurgeLinks(ctx context.Context) error

PurgeLinks deletes sign-in links a day after they could last be used.

func (*Service) PurgeViews

func (s *Service) PurgeViews(ctx context.Context) error

PurgeViews deletes the hashes and salts of the days before today: run by the nightly job.

func (*Service) ReadPost

func (s *Service) ReadPost(ctx context.Context, ws *store.Workspace, p store.WebsitePost, reader gate.Reader, o ReadOptions) (PostView, error)

ReadPost decides a published post for a reader and records the meter's read when it counts (never for previews).

func (*Service) Reader

func (s *Service) Reader(ctx context.Context, ws *store.Workspace, sess *Session, meterCookie string) (gate.Reader, error)

Reader is who reads a page: the member of a session (with the paid tiers they hold) or a visitor with their meter cookie.

func (*Service) RedrawPollPosts

func (s *Service) RedrawPollPosts(ctx context.Context) (int, error)

RedrawPollPosts draws again the published posts whose web version still shows a poll's answers: drawn before a poll stayed in the inbox, those answers led to /0, /1 … on the site. Each is drawn from the content it was published with, so its version, hash and publication stay; once drawn, its notes list the poll, and it isn't picked again. It returns how many posts it drew.

func (*Service) RequestApproval

func (s *Service) RequestApproval(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in WebsiteApprovalInput) (WebsitePost, error)

RequestApproval asks the workspace's approvers to approve publishing a post as it is.

func (*Service) RequestSignin

func (s *Service) RequestSignin(ctx context.Context, ws *store.Workspace, in SigninInput) (SigninOutcome, error)

RequestSignin sends a sign-in link and code when the address belongs to a member who can get one. The answer is the same either way.

func (*Service) ResolveIssue

func (s *Service) ResolveIssue(ctx context.Context, ws *store.Workspace, slug string) (PostAddress, error)

ResolveIssue is where an archive issue's old address leads once the website is on: its post (a zero PostAddress: the archive shows it).

func (*Service) ResolvePost

func (s *Service) ResolvePost(ctx context.Context, ws *store.Workspace, slug string) (PostAddress, error)

ResolvePost finds the post at /posts/{slug} while the website is on (a zero PostAddress: nothing there, 404).

func (*Service) Rules

func (s *Service) Rules(ctx context.Context, ws *store.Workspace) (gate.Rules, []gate.Tier, error)

Rules are the site's access rules and every paid tier, for pages that gate themselves (gate.Page).

func (*Service) RunTurnOn

func (s *Service) RunTurnOn(ctx context.Context, wsID uuid.UUID) error

RunTurnOn makes the posts, tags and redirects of a website being turned on, then puts it on. It resumes where it stopped.

func (*Service) SaveAccess

SaveAccess saves Website › Access, with an audit entry per part changed.

func (*Service) SaveCampaignWeb

func (s *Service) SaveCampaignWeb(ctx context.Context, ws *store.Workspace, p *authz.Principal, campaignID uuid.UUID, in WebsitePostInput) (WebsiteCampaignWeb, error)

SaveCampaignWeb saves a campaign's Web tab: its post is made on the first save.

func (*Service) SaveHomeNav

SaveHomeNav saves Website › Home & navigation, with an audit entry per part changed: the home page, the navigation, the site's identity.

func (*Service) SaveName

func (s *Service) SaveName(ctx context.Context, ws *store.Workspace, sess *Session, first, last string) error

SaveName changes the member's name.

func (*Service) SaveNewsletters

func (s *Service) SaveNewsletters(ctx context.Context, ws *store.Workspace, sess *Session, in audience.PreferencesInput, ev audience.PublicEvidence) error

SaveNewsletters applies the account page's newsletters, as the preference center does: joining needs no confirmation (the member's session proves the address), leaving is immediate.

func (*Service) SavePostContent

func (s *Service) SavePostContent(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in WebsitePostContent) (WebsitePostSaved, error)

SavePostContent saves a web-only post's content (autosave, Save, a template or a restored version).

func (*Service) SendAsCampaign

func (s *Service) SendAsCampaign(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) (WebsiteSentAsCampaign, error)

SendAsCampaign makes a campaign draft of a web-only post: its title as the subject, its excerpt as the preheader and its blocks as the email. The audience is left to pick in the composer.

func (*Service) SessionFor

func (s *Service) SessionFor(ctx context.Context, ws *store.Workspace, cookie string) (*Session, error)

SessionFor reads a member's session from its cookie (nil when there is none, it ended or expired, or the contact is gone). A session is touched at most every ten minutes.

func (s *Service) SetPageLink(ctx context.Context, q *store.Queries, ws *store.Workspace, by *uuid.UUID, from, slug, label string, on bool) (bool, error)

SetPageLink adds, updates or removes the header link of a page, in the caller's transaction. from is the address the link pointed at before (a page that moved); label overrides the page's name ("Field Guide"). It reports whether the header changed.

func (*Service) SetRedirect

SetRedirect changes where an unpublished post's address sends readers.

func (*Service) SignOut

func (s *Service) SignOut(ctx context.Context, ws *store.Workspace, sess *Session) error

SignOut ends the session of a cookie.

func (*Service) SignOutEverywhere

func (s *Service) SignOutEverywhere(ctx context.Context, ws *store.Workspace, p *authz.Principal, contactID uuid.UUID) (WebsiteSignedOut, error)

SignOutEverywhere ends every session of a member, from their contact profile (subscribers:edit). It is audited and on their timeline.

func (*Service) SignOutEverywhereSelf

func (s *Service) SignOutEverywhereSelf(ctx context.Context, ws *store.Workspace, sess *Session) error

SignOutEverywhereSelf ends every session of the member, from their account page.

func (*Service) SigninWithCode

func (s *Service) SigninWithCode(ctx context.Context, ws *store.Workspace, browser, code string, ev audience.PublicEvidence) (CodeOutcome, error)

SigninWithCode checks a code typed in the browser that asked for it.

func (s *Service) SigninWithLink(ctx context.Context, ws *store.Workspace, token, browser string, ev audience.PublicEvidence) (LinkState, *SigninDone, error)

SigninWithLink uses a link (the Continue of the page it opens).

func (*Service) SiteTags

func (s *Service) SiteTags(ctx context.Context, ws *store.Workspace) ([]PublicTag, error)

SiteTags are the tags with published posts, most posts first (the archive's filter).

func (*Service) Sitemap

func (s *Service) Sitemap(ctx context.Context, ws *store.Workspace) ([]SitemapEntry, error)

Sitemap lists the site's posts (but those hidden from search) and tags.

func (*Service) TagBySlug

func (s *Service) TagBySlug(ctx context.Context, ws *store.Workspace, slug string) (*PublicTag, error)

TagBySlug finds a tag of the site while it is on (nil: none).

func (*Service) Tags

func (s *Service) Tags(ctx context.Context, ws *store.Workspace) ([]WebsiteTag, error)

Tags lists the website's tags.

func (*Service) TurnOff

TurnOff turns the website off: the home page, web-only posts, sign-in, the account page and the paywall go offline; the archive comes back. Every post and setting is kept for next time.

func (*Service) TurnOn

TurnOn starts turning the website on. A certificate that fails stops it; a domain that isn't verified yet runs the site at the instance's address until it is.

func (*Service) UndoPublish

func (s *Service) UndoPublish(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) (WebsitePost, error)

UndoPublish takes back a publish within 10 seconds ("Undo" on the toast): the post goes back to where it was.

func (*Service) Unpublish

Unpublish takes a post off the site: the home page, tags, the archive, feeds and the sitemap. Its address answers 410, or redirects.

func (*Service) UnsubscribeAll

func (s *Service) UnsubscribeAll(ctx context.Context, ws *store.Workspace, sess *Session, ev audience.PublicEvidence) error

UnsubscribeAll takes the member off every newsletter; they stay a member.

func (*Service) UpdatePost

UpdatePost saves a post's settings. A changed address keeps the old one as a redirect once the post was published.

func (*Service) UpdateTag

func (s *Service) UpdateTag(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in WebsiteTagInput) (WebsiteTag, error)

UpdateTag changes a tag.

func (*Service) WithHomeNavDraft

func (s *Service) WithHomeNavDraft(ctx context.Context, ws *store.Workspace, in WebsiteHomeNavInput) (context.Context, error)

WithHomeNavDraft returns ctx with unsaved Home & navigation settings laid over the saved ones: the site's pages built in it (the tab's live preview) read them. Nothing is saved; settings that wouldn't save are refused the same way.

type Session

type Session struct {
	ID        uuid.UUID
	ContactID uuid.UUID
	Email     string
	FirstName string
	LastName  string
	Method    string
	CreatedAt time.Time
	ExpiresAt time.Time
}

Session is a member's signed-in session.

func (*Session) FirstOrName

func (m *Session) FirstOrName() string

FirstOrName is what the header pill says ("Sam").

func (*Session) Name

func (m *Session) Name() string

Name is the member's name, else the part of their address before @.

type SigninDone

type SigninDone struct {
	Token     string
	ExpiresAt time.Time
	Email     string
	ReturnTo  string
	Purpose   string
	// Lists were confirmed by a sign-up.
	Lists []uuid.UUID
	// SameBrowser: the link was opened where it was asked for.
	SameBrowser bool
	// Taken: an email change whose new address another contact holds.
	Taken bool
}

SigninDone is a reader just signed in: the session's cookie and where they go next.

type SigninInput

type SigninInput struct {
	Email    string
	ReturnTo string
	// Browser is the browser's sign-in cookie (the code is typed there).
	Browser   string
	IP        *netip.Addr
	Turnstile string
	// Verify checks a Turnstile answer (nil: Turnstile isn't set up).
	Verify func(answer string) bool
}

SigninInput asks for a sign-in link.

type SigninOutcome

type SigninOutcome struct {
	Status  string
	Email   string
	RetryIn time.Duration
	// Minutes is how long links work.
	Minutes int
	Message string
}

SigninOutcome is the answer to "send me a link".

type SignupOffer

type SignupOffer struct {
	ID      uuid.UUID
	Name    string
	Consent string
	Checked bool
}

SignupOffer is a newsletter the paywall and the sign-up form offer.

type SiteFrame

type SiteFrame struct {
	// On is the website being on: the navigation, Subscribe and Sign in.
	// Off, public pages and the shop keep the logo in place of the
	// navigation.
	On bool
	// SigninOn is "Members can sign in" (Sign in in the header).
	SigninOn bool
	// Title is the site's title ("The Acme newsletter") and Short the
	// publisher's name for phones ("Acme"); Tagline is under the title.
	Title   string
	Short   string
	Tagline string
	// Description is the site's description (search engines, link previews).
	Description string
	SocialImage string
	Index       bool
	// Nav are the header links, resolved: a path on the site ("/tag/engineering")
	// or an outside address.
	Nav    []FrameLink
	Footer WebsiteFooter
}

SiteFrame is what every page of the site shows around its content (the header, the navigation and the footer): the frame the pages of later phases share (internal/publicpages/templates/site/frame.html).

type SitemapEntry

type SitemapEntry struct {
	Path    []string
	LastMod time.Time
}

SitemapEntry is an address of the site for search engines.

type TLSChecker

type TLSChecker struct {
	Policy  netguard.Policy
	Timeout time.Duration
	Now     func() time.Time
}

TLSChecker connects to the domain on port 443 through the outbound guard.

func (TLSChecker) Check

func (c TLSChecker) Check(ctx context.Context, domain string) CertInfo

Check implements CertChecker.

type TagRef

type TagRef struct {
	ID   uuid.UUID
	Name string
	Slug string
}

TagRef is a tag of a post.

type TickArgs

type TickArgs struct{}

TickArgs is the minute job: posts whose time came, and posts of the campaigns the archive filed since.

func (TickArgs) InsertOpts

func (TickArgs) InsertOpts() river.InsertOpts

InsertOpts runs once at a time.

func (TickArgs) Kind

func (TickArgs) Kind() string

Kind implements river.JobArgs.

type TurnOnArgs

type TurnOnArgs struct {
	WorkspaceID uuid.UUID `json:"workspace_id"`
}

TurnOnArgs runs turning a website on: tags from the archived lists, a post for every archived campaign, the redirects of their old addresses.

func (TurnOnArgs) InsertOpts

func (TurnOnArgs) InsertOpts() river.InsertOpts

InsertOpts runs one at a time per workspace.

func (TurnOnArgs) Kind

func (TurnOnArgs) Kind() string

Kind implements river.JobArgs.

type WebsiteAbout

type WebsiteAbout struct {
	Title string `json:"title" maxLength:"80"`
	Text  string `json:"text" maxLength:"1200"`
	// Link is a path on the site ("/about") or an address.
	Link string `json:"link" maxLength:"500"`
}

WebsiteAbout is the home page's about section.

type WebsiteAccess

type WebsiteAccess struct {
	SigninOn    bool `json:"signinOn"`
	LinkMinutes int  `json:"linkMinutes"`
	SessionDays int  `json:"sessionDays"`
	// The sign-in email's sender and stream (the workspace default, System).
	SenderName  string `json:"senderName"`
	SenderEmail string `json:"senderEmail"`
	// SystemProvider names the System stream's provider ("Postmark").
	SystemProvider     string                 `json:"systemProvider"`
	SignupOn           bool                   `json:"signupOn"`
	Lists              []WebsiteAccessList    `json:"lists"`
	DefaultVisibility  string                 `json:"defaultVisibility" enum:"public,members,paid"`
	CampaignVisibility string                 `json:"campaignVisibility" enum:"audience,public,members,paid"`
	MeterVisitorsOn    bool                   `json:"meterVisitorsOn"`
	MeterVisitors      int                    `json:"meterVisitors"`
	MeterMembersOn     bool                   `json:"meterMembersOn"`
	MeterMembers       int                    `json:"meterMembers"`
	NeverFree          []WebsiteNeverFreePost `json:"neverFree"`
	Paywall            WebsitePaywall         `json:"paywall"`
	Tiers              []WebsiteTierOption    `json:"tiers"`
	Payments           WebsitePayments        `json:"payments"`
	Members            WebsiteMembersFacts    `json:"members"`
	// Gated are the published members-only and paid posts (turning
	// sign-in off makes them unreadable on the web).
	MembersOnlyPosts int64     `json:"membersOnlyPosts"`
	PaidPosts        int64     `json:"paidPosts"`
	Since            time.Time `json:"since"`
	UpdatedAt        time.Time `json:"updatedAt"`
	UpdatedBy        string    `json:"updatedBy,omitempty"`
}

WebsiteAccess is Website › Access.

type WebsiteAccessInput

type WebsiteAccessInput struct {
	SigninOn           bool                `json:"signinOn"`
	LinkMinutes        int                 `json:"linkMinutes" enum:"10,15,30,60"`
	SessionDays        int                 `json:"sessionDays" minimum:"7" maximum:"365"`
	SignupOn           bool                `json:"signupOn"`
	Lists              []WebsiteSignupList `json:"lists" maxItems:"50"`
	DefaultVisibility  string              `json:"defaultVisibility" enum:"public,members,paid"`
	CampaignVisibility string              `json:"campaignVisibility" enum:"audience,public,members,paid"`
	MeterVisitorsOn    bool                `json:"meterVisitorsOn"`
	MeterVisitors      int                 `json:"meterVisitors" minimum:"0" maximum:"100"`
	MeterMembersOn     bool                `json:"meterMembersOn"`
	MeterMembers       int                 `json:"meterMembers" minimum:"0" maximum:"100"`
	// NeverFree are the posts left out of the meter.
	NeverFree []string       `json:"neverFree" maxItems:"200"`
	Paywall   WebsitePaywall `json:"paywall"`
}

WebsiteAccessInput saves Website › Access.

type WebsiteAccessList

type WebsiteAccessList struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Public  bool   `json:"public"`
	Offered bool   `json:"offered"`
	Checked bool   `json:"checked"`
	// Consent is the consent text shown with it (kept with every sign-up).
	Consent string `json:"consent"`
}

WebsiteAccessList is a list as Website › Access offers it on sign-up.

type WebsiteAddress

type WebsiteAddress struct {
	// Domain is the custom domain as typed (any status).
	Domain       string     `json:"domain"`
	DomainStatus string     `json:"domainStatus" enum:"none,pending,verified,failed"`
	DomainDetail string     `json:"domainDetail"`
	CheckedAt    *time.Time `json:"checkedAt,omitempty"`
	VerifiedAt   *time.Time `json:"verifiedAt,omitempty"`
	// Target is the host the domain's CNAME must point at.
	Target string `json:"target"`
	// Host is the site's address without the scheme: the custom domain
	// once verified, else the instance's /p/<workspace>.
	Host string `json:"host"`
	URL  string `json:"url"`
	// Fallback is the instance's address of the site (until the domain checks out).
	Fallback    string             `json:"fallback"`
	Certificate WebsiteCertificate `json:"certificate"`
}

WebsiteAddress is where the site runs.

type WebsiteApprovalInput

type WebsiteApprovalInput struct {
	Note string `json:"note,omitempty" maxLength:"1000"`
}

WebsiteApprovalInput asks for approval to publish a post.

type WebsiteArchiveFacts

type WebsiteArchiveFacts struct {
	Enabled bool                 `json:"enabled"`
	Index   bool                 `json:"index"`
	Issues  int64                `json:"issues"`
	Since   int                  `json:"since"`
	URL     string               `json:"url"`
	Feed    string               `json:"feed"`
	Lists   []WebsiteArchiveList `json:"lists"`
	// Tags are the lists with archived campaigns: the tags turning on makes.
	Tags []string `json:"tags"`
}

WebsiteArchiveFacts are the archive as it stands: what turning the website on makes of it.

type WebsiteArchiveList

type WebsiteArchiveList struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Issues   int64  `json:"issues"`
	Public   bool   `json:"public"`
	Archived bool   `json:"archived"`
}

WebsiteArchiveList is a list in the archive.

type WebsiteByline

type WebsiteByline struct {
	UserID string `json:"userId,omitempty"`
	Name   string `json:"name"`
	Color  string `json:"color,omitempty"`
}

WebsiteByline is who a post is by: a member of the workspace or a written name.

type WebsiteCampaignPath

type WebsiteCampaignPath struct {
	api.WorkspaceInput
	CampaignID string `path:"campaignId" format:"uuid" doc:"The campaign's id"`
}

WebsiteCampaignPath is a campaign's path.

type WebsiteCampaignReport

type WebsiteCampaignReport struct {
	PostID      string     `json:"postId"`
	Title       string     `json:"title"`
	URL         string     `json:"url"`
	Status      string     `json:"status" enum:"draft,scheduled,published,unpublished"`
	PublishedAt *time.Time `json:"publishedAt,omitempty"`
	// Views are the last 30 days; ViewsAllTime every view.
	Views        int64 `json:"views"`
	ViewsAllTime int64 `json:"viewsAllTime"`
	// Signups are members who joined from the post, Upgrades readers who
	// upgraded to a paid tier from it (30 days).
	Signups   int64           `json:"signups"`
	Upgrades  int64           `json:"upgrades"`
	Referrers []WebsiteSource `json:"referrers"`
	UTM       []WebsiteSource `json:"utm"`
	From      time.Time       `json:"from"`
	Until     time.Time       `json:"until"`
}

WebsiteCampaignReport is the Web section of a campaign's report.

type WebsiteCampaignReportView

type WebsiteCampaignReportView struct {
	// Report is nil when the campaign has no post on the site.
	Report *WebsiteCampaignReport `json:"report,omitempty"`
}

WebsiteCampaignReportView is the Web section of a campaign's report.

type WebsiteCampaignStates

type WebsiteCampaignStates struct {
	SiteOn bool                      `json:"siteOn"`
	States []WebsiteCampaignWebState `json:"states"`
}

WebsiteCampaignStates are the Web column of the Campaigns list.

type WebsiteCampaignWeb

type WebsiteCampaignWeb struct {
	// SiteOn: the website is on (off, the tab says so and offers nothing).
	SiteOn bool   `json:"siteOn"`
	Host   string `json:"host"`
	// Chip is the composer header's Web chip.
	Chip string `json:"chip" enum:"off,with_send,scheduled,published,unpublished"`
	// Post is the campaign's post: saved settings, or the defaults (ID "").
	Post WebsitePost `json:"post"`
	// CampaignStatus, ScheduledAt and SentAt say when "with the send" is.
	CampaignStatus string     `json:"campaignStatus"`
	ScheduledAt    *time.Time `json:"scheduledAt,omitempty"`
	SentAt         *time.Time `json:"sentAt,omitempty"`
	// FollowsAudience is the visibility rule for posts from campaigns
	// ("Follows the audience: the Weekly Digest is free.").
	FollowsAudience bool     `json:"followsAudience"`
	AudienceLists   []string `json:"audienceLists"`
}

WebsiteCampaignWeb is a campaign's Web tab in the composer: whether it goes on the website and how.

type WebsiteCampaignWebState

type WebsiteCampaignWebState struct {
	CampaignID  string     `json:"campaignId"`
	PostID      string     `json:"postId,omitempty"`
	Chip        string     `json:"chip" enum:"off,with_send,scheduled,published,unpublished"`
	Slug        string     `json:"slug,omitempty"`
	URL         string     `json:"url,omitempty"`
	Visibility  string     `json:"visibility,omitempty"`
	Featured    bool       `json:"featured"`
	PublishAt   *time.Time `json:"publishAt,omitempty"`
	PublishedAt *time.Time `json:"publishedAt,omitempty"`
	// UnpublishedAt is when a published post was taken down.
	UnpublishedAt *time.Time `json:"unpublishedAt,omitempty"`
}

WebsiteCampaignWebState is a campaign's post in the Campaigns list's Web column and in Review & send.

type WebsiteCertificate

type WebsiteCertificate struct {
	Status   string     `json:"status" enum:"valid,failing,pending,unknown,none"`
	Issuer   string     `json:"issuer,omitempty"`
	RenewsAt *time.Time `json:"renewsAt,omitempty"`
	Detail   string     `json:"detail,omitempty"`
}

WebsiteCertificate is the certificate the custom domain serves.

type WebsiteContactCard

type WebsiteContactCard struct {
	SiteOn bool   `json:"siteOn"`
	Host   string `json:"host"`
	// Member: they signed in to the website at least once.
	Member bool       `json:"member"`
	Since  *time.Time `json:"since,omitempty"`
	// Plan is free, or the paid tiers they hold.
	Paid       bool       `json:"paid"`
	Tiers      []string   `json:"tiers"`
	LastSignIn *time.Time `json:"lastSignIn,omitempty"`
	LastMethod string     `json:"lastMethod,omitempty" enum:"link,code,signup,"`
	SignIns    int        `json:"signIns"`
	// Sessions are active; SessionEnds is when the latest one ends.
	Sessions    int        `json:"sessions"`
	SessionEnds *time.Time `json:"sessionEnds,omitempty"`
	// Meter is the paid posts a free member read for free this month
	// (when that meter is on).
	Meter  *WebsiteMeterUse     `json:"meter,omitempty"`
	Events []WebsiteMemberEvent `json:"events"`
	// CanSignOut: holds subscribers:edit; Reason says why not.
	CanSignOut bool   `json:"canSignOut"`
	Reason     string `json:"reason,omitempty"`
}

WebsiteContactCard is the Website card of a contact's profile.

type WebsiteContactPath

type WebsiteContactPath struct {
	api.WorkspaceInput
	ContactID string `path:"contactId" format:"uuid" doc:"The contact's id"`
}

WebsiteContactPath is a contact's path.

type WebsiteFallback

type WebsiteFallback struct {
	Token    string `json:"token"`
	Fallback string `json:"fallback"`
	// Source is the token as written with the word before it ("Hi {{
	// first_name | default: "there" }}"), Sample how the web reads it.
	Source string `json:"source"`
	Sample string `json:"sample"`
}

WebsiteFallback is a personalization token the web shows with its fallback.

type WebsiteFeaturedPost

type WebsiteFeaturedPost struct {
	ID          string     `json:"id"`
	Title       string     `json:"title"`
	Tag         string     `json:"tag,omitempty"`
	Visibility  string     `json:"visibility"`
	Tiers       []string   `json:"tiers"`
	Status      string     `json:"status"`
	PublishedAt *time.Time `json:"publishedAt,omitempty"`
}

WebsiteFeaturedPost is a featured post in Home & navigation.

type WebsiteFeedURLs

type WebsiteFeedURLs struct {
	Sitemap     string `json:"sitemap"`
	Feed        string `json:"feed"`
	TagFeed     string `json:"tagFeed"`
	ArchiveFeed string `json:"archiveFeed"`
}

WebsiteFeedURLs are the site's sitemap and feed addresses.

type WebsiteFooter

type WebsiteFooter struct {
	Archive     bool `json:"archive"`
	RSS         bool `json:"rss"`
	Preferences bool `json:"preferences"`
}

WebsiteFooter are the footer's switches. Privacy and "Sent with ReputeCast" follow the branding.

type WebsiteHelpers

type WebsiteHelpers struct {
	Manage  []string `json:"manage"`
	Publish []string `json:"publish"`
}

WebsiteHelpers are the members holding website:manage and website:publish.

type WebsiteHiddenBlock

type WebsiteHiddenBlock struct {
	// ID is the block's Visibility id (the composer selects it).
	ID string `json:"id,omitempty"`
	// Name is the block's own name; Kind a well-known block (view_online,
	// footer, referral, header, poll) or block.
	Name      string `json:"name,omitempty"`
	Kind      string `json:"kind" enum:"view_online,footer,referral,header,poll,block"`
	Reason    string `json:"reason" enum:"email_only,conditional,hidden"`
	Condition string `json:"condition,omitempty"`
	Line      int    `json:"line"`
}

WebsiteHiddenBlock is a block left out of a post's web version.

type WebsiteHomeNav

type WebsiteHomeNav struct {
	Layout   string                `json:"layout" enum:"featured,list,grid"`
	Featured []WebsiteFeaturedPost `json:"featured"`
	Sections []WebsiteHomeSection  `json:"sections"`
	About    WebsiteAbout          `json:"about"`
	Header   []WebsiteNavItem      `json:"header"`
	Footer   WebsiteFooter         `json:"footer"`
	// PrivacyURL and PoweredBy are the branding's (Forms & pages ›
	// Branding & domain), shown and changed here too.
	PrivacyURL string              `json:"privacyUrl"`
	PoweredBy  bool                `json:"poweredBy"`
	Identity   WebsiteIdentity     `json:"identity"`
	Index      bool                `json:"index"`
	URLs       WebsiteFeedURLs     `json:"urls"`
	Tags       []WebsiteTag        `json:"tags"`
	Pages      []WebsitePageOption `json:"pages"`
	// Logo is the branding's logo (the favicon), "" for the initial.
	Initial   string    `json:"initial"`
	UpdatedAt time.Time `json:"updatedAt"`
	UpdatedBy string    `json:"updatedBy,omitempty"`
}

WebsiteHomeNav is Website › Home & navigation.

type WebsiteHomeNavInput

type WebsiteHomeNavInput struct {
	Layout     string               `json:"layout" enum:"featured,list,grid"`
	Featured   []string             `json:"featured" maxItems:"3"`
	Sections   []WebsiteHomeSection `json:"sections" maxItems:"30"`
	About      WebsiteAbout         `json:"about"`
	Header     []WebsiteNavLink     `json:"header" maxItems:"12"`
	Footer     WebsiteFooter        `json:"footer"`
	PrivacyURL string               `json:"privacyUrl" maxLength:"500"`
	PoweredBy  bool                 `json:"poweredBy"`
	Identity   WebsiteIdentity      `json:"identity"`
	Index      bool                 `json:"index"`
}

WebsiteHomeNavInput saves Website › Home & navigation.

type WebsiteHomeSection

type WebsiteHomeSection struct {
	Kind string `json:"kind" enum:"subscribe,featured,latest,tag,about,tiers"`
	On   bool   `json:"on"`
	// Count is how many posts the latest posts and tag rows show.
	Count int `json:"count,omitempty" minimum:"0" maximum:"24"`
	// Tag is a tag row's tag.
	Tag string `json:"tag,omitempty"`
	// Note is the subscribe band's line under its form ("Free, every
	// Tuesday. Unsubscribe any time with one click.").
	Note string `json:"note,omitempty" maxLength:"200"`
	// Text is the subscribe band's line under every post ("The Weekly
	// Digest, every Tuesday.").
	Text string `json:"text,omitempty" maxLength:"300"`
}

WebsiteHomeSection is one section of the home page, in its order.

type WebsiteIdentity

type WebsiteIdentity struct {
	Title       string `json:"title" maxLength:"80"`
	Tagline     string `json:"tagline" maxLength:"160"`
	Description string `json:"description" maxLength:"300"`
	SocialImage string `json:"socialImage" maxLength:"1000"`
}

WebsiteIdentity is the site's title, tagline, description and images.

type WebsiteMemberEvent

type WebsiteMemberEvent struct {
	ID   string    `json:"id"`
	Kind string    `json:"kind" enum:"signed_in,link_refused,signed_out_everywhere,joined,email_changed"`
	At   time.Time `json:"at"`
	// Method is how they signed in (link, code, signup).
	Method      string `json:"method,omitempty"`
	SameBrowser *bool  `json:"sameBrowser,omitempty"`
	// Actor is the person who signed them out everywhere.
	Actor  string `json:"actor,omitempty"`
	Detail string `json:"detail,omitempty"`
}

WebsiteMemberEvent is one of a member's website events (the contact's timeline).

type WebsiteMembersFacts

type WebsiteMembersFacts struct {
	SigninOn    bool                `json:"signinOn"`
	SessionDays int                 `json:"sessionDays"`
	LinkMinutes int                 `json:"linkMinutes"`
	SignupOn    bool                `json:"signupOn"`
	SignupLists []WebsiteAccessList `json:"signupLists"`
	// SignedIn are members who signed in since the website was turned on;
	// LastWeek in the last 7 days; Paid the paid members.
	SignedIn int64 `json:"signedIn"`
	LastWeek int64 `json:"lastWeek"`
	Paid     int64 `json:"paid"`
}

WebsiteMembersFacts are the members and sign-up settings in short.

type WebsiteMeterUse

type WebsiteMeterUse struct {
	Used  int64 `json:"used"`
	Limit int   `json:"limit"`
	// Month is the first day of the calendar month.
	Month time.Time `json:"month"`
}

WebsiteMeterUse is how much of the meter a member used this month.

type WebsiteNavItem

type WebsiteNavItem struct {
	WebsiteNavLink
	// Name is the tag's or page's name; Detail what it is ("Tag", 143
	// posts; a page's address).
	Name  string `json:"name"`
	Posts int64  `json:"posts"`
	Path  string `json:"path"`
}

WebsiteNavItem is a header link with what it opens.

type WebsiteNavLink struct {
	Kind string `json:"kind" enum:"home,tag,page,archive,url"`
	// Ref is a tag's id or a page's slug.
	Ref string `json:"ref,omitempty" maxLength:"120"`
	// Label overrides the tag's or page's name (an outside address needs one).
	Label string `json:"label,omitempty" maxLength:"40"`
	URL   string `json:"url,omitempty" maxLength:"500"`
}

WebsiteNavLink is a link of the header.

type WebsiteNeverFreePost

type WebsiteNeverFreePost struct {
	ID          string     `json:"id"`
	Title       string     `json:"title"`
	Visibility  string     `json:"visibility"`
	Tiers       []string   `json:"tiers"`
	Status      string     `json:"status"`
	PublishAt   *time.Time `json:"publishAt,omitempty"`
	PublishedAt *time.Time `json:"publishedAt,omitempty"`
}

WebsiteNeverFreePost is a post left out of the meter.

type WebsiteNumbers

type WebsiteNumbers struct {
	Views    int64     `json:"views"`
	Visitors int64     `json:"visitors"`
	Signups  int64     `json:"signups"`
	Upgrades int64     `json:"upgrades"`
	From     time.Time `json:"from"`
	Until    time.Time `json:"until"`
}

WebsiteNumbers are the site's numbers for the last 30 days.

type WebsiteOffFacts

type WebsiteOffFacts struct {
	WebOnly     int64 `json:"webOnly"`
	PaidMembers int64 `json:"paidMembers"`
	// PublicPages and Shop stay online (the page builder fills them).
	PublicPages int64 `json:"publicPages"`
	Shop        bool  `json:"shop"`
}

WebsiteOffFacts are what goes offline when the website is turned off.

type WebsiteOverview

type WebsiteOverview struct {
	Status     string              `json:"status" enum:"off,turning_on,on"`
	Address    WebsiteAddress      `json:"address"`
	TurnedOnAt *time.Time          `json:"turnedOnAt,omitempty"`
	TurnedOnBy string              `json:"turnedOnBy,omitempty"`
	Progress   *WebsiteProgress    `json:"progress,omitempty"`
	Numbers    WebsiteNumbers      `json:"numbers"`
	Posts      WebsitePostCounts   `json:"posts"`
	Archive    WebsiteArchiveFacts `json:"archive"`
	Members    WebsiteMembersFacts `json:"members"`
	Off        WebsiteOffFacts     `json:"off"`
	HomeLayout string              `json:"homeLayout" enum:"featured,list,grid"`
	Title      string              `json:"title"`
	UpdatedAt  time.Time           `json:"updatedAt"`
	UpdatedBy  string              `json:"updatedBy,omitempty"`
	// Helpers are whom to ask for what the caller's role lacks ("Ask Sofia
	// Rossi, Marcus Chen or Linh Nguyen"); empty for what it holds.
	Helpers WebsiteHelpers `json:"helpers"`
}

WebsiteOverview is the Website tab's header and its off and turning-on states.

type WebsitePageOption

type WebsitePageOption struct {
	Slug  string `json:"slug"`
	Title string `json:"title"`
}

WebsitePageOption is a page header links can point at (the page builder's).

type WebsitePastCampaign

type WebsitePastCampaign struct {
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	Subject    string    `json:"subject"`
	Lists      []string  `json:"lists"`
	SentAt     time.Time `json:"sentAt"`
	Recipients int64     `json:"recipients"`
	// Note says why it isn't on the web yet: left out of the archive by
	// hand, or its list isn't public ("" when it simply wasn't archived).
	Note string `json:"note" enum:"archive_hidden,list_private,"`
	// Visibility is what "Follow the audience" gives it.
	Visibility string `json:"visibility" enum:"public,members,paid"`
}

WebsitePastCampaign is a sent campaign that isn't a post yet ("Publish past campaigns").

type WebsitePayments

type WebsitePayments struct {
	Connected bool   `json:"connected"`
	Mode      string `json:"mode" enum:"live,test,"`
	Account   string `json:"account"`
}

WebsitePayments is the payment connection the paid tiers sell through.

type WebsitePaywall

type WebsitePaywall struct {
	Heading string `json:"heading" maxLength:"120"`
	Text    string `json:"text" maxLength:"400"`
	// Tiers are the tiers to show, in order (empty: every public tier).
	Tiers []string `json:"tiers" maxItems:"10"`
	// Upgrade and Signup are the button labels; Free is the free row.
	Upgrade string `json:"upgrade" maxLength:"40"`
	Signup  string `json:"signup" maxLength:"40"`
	Free    string `json:"free" maxLength:"200"`
}

WebsitePaywall is the paywall card's text and the tiers it offers.

func DefaultPaywall

func DefaultPaywall() WebsitePaywall

DefaultPaywall is the paywall card before anyone edits it, in English.

func DefaultPaywallIn

func DefaultPaywallIn(l i18n.Lang) WebsitePaywall

DefaultPaywallIn is the paywall card before anyone edits it, in a language.

type WebsitePost

type WebsitePost struct {
	WebsitePostRow
	CoverURL      string         `json:"coverUrl"`
	CoverAlt      string         `json:"coverAlt"`
	TitleEdited   bool           `json:"titleEdited"`
	ExcerptEdited bool           `json:"excerptEdited"`
	WebOn         bool           `json:"webOn"`
	SEO           WebsitePostSEO `json:"seo"`
	// MJML is a web-only post's content; Version its saved version and
	// PublishedVersion the one live on the site (lower: unpublished changes).
	MJML             string     `json:"mjml"`
	Version          int        `json:"version"`
	PublishedVersion int        `json:"publishedVersion"`
	AutosavedAt      *time.Time `json:"autosavedAt,omitempty"`
	// Base is the address before the slug ("news.acme.io/posts/").
	Base           string              `json:"base"`
	Words          int                 `json:"words"`
	ReadingMinutes int                 `json:"readingMinutes"`
	Checks         []WebsiteWebCheck   `json:"checks"`
	Publish        WebsitePublishState `json:"publish"`
	// Bylines are the workspace's members a byline can name.
	Bylines []WebsiteByline `json:"bylines"`
}

WebsitePost is one post: its settings, its content (web-only posts), its web checks and whether the person may publish it.

type WebsitePostApproval

type WebsitePostApproval struct {
	ID          string    `json:"id"`
	Status      string    `json:"status" enum:"pending,approved,changes_requested,rejected"`
	RequestedBy string    `json:"requestedBy"`
	RequestedAt time.Time `json:"requestedAt"`
	Approvers   []string  `json:"approvers"`
	Rule        string    `json:"rule"`
	Note        string    `json:"note,omitempty"`
}

WebsitePostApproval is a post's open approval request.

type WebsitePostCampaign

type WebsitePostCampaign struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	Status      string     `json:"status"`
	SentAt      *time.Time `json:"sentAt,omitempty"`
	ScheduledAt *time.Time `json:"scheduledAt,omitempty"`
}

WebsitePostCampaign is the campaign a post comes from.

type WebsitePostContent

type WebsitePostContent struct {
	MJML string `json:"mjml" maxLength:"2000000"`
	// BaseVersion is the version the edit started from: another save since
	// then is a conflict (409) unless Force.
	BaseVersion int    `json:"baseVersion" minimum:"0"`
	Force       bool   `json:"force,omitempty"`
	Source      string `json:"source,omitempty" enum:"autosave,manual,import,template,restore,"`
	Label       string `json:"label,omitempty" maxLength:"80"`
}

WebsitePostContent is an autosave or a save of a web-only post's content.

type WebsitePostCounts

type WebsitePostCounts struct {
	All           int64 `json:"all"`
	Published     int64 `json:"published"`
	FromCampaigns int64 `json:"fromCampaigns"`
	WebOnly       int64 `json:"webOnly"`
	Scheduled     int64 `json:"scheduled"`
	Draft         int64 `json:"draft"`
	Unpublished   int64 `json:"unpublished"`
	MembersOnly   int64 `json:"membersOnly"`
	Paid          int64 `json:"paid"`
}

WebsitePostCounts are the posts by status.

type WebsitePostCreate

type WebsitePostCreate struct {
	Title string `json:"title,omitempty" maxLength:"200"`
	// MJML is the post's starting content (empty: the composer's gallery).
	MJML string `json:"mjml,omitempty" maxLength:"2000000"`
}

WebsitePostCreate starts a web-only post.

type WebsitePostFilter

type WebsitePostFilter struct {
	Status     string `query:"status" enum:"all,published,scheduled,draft,unpublished," doc:"A status (all by default)"`
	Visibility string `query:"visibility" enum:"public,members,paid,"`
	Tag        string `query:"tag" doc:"A tag's id"`
	Source     string `query:"source" enum:"campaign,web,"`
	Search     string `query:"q" maxLength:"200" doc:"Search by title"`
	Page       int    `query:"page" minimum:"0" maximum:"10000"`
	PageSize   int    `query:"pageSize" minimum:"0" maximum:"100"`
}

WebsitePostFilter narrows Website › Posts.

type WebsitePostInput

type WebsitePostInput struct {
	Title   string `json:"title" maxLength:"200"`
	Slug    string `json:"slug" maxLength:"120"`
	Excerpt string `json:"excerpt" maxLength:"400"`
	// UseSubject and UsePreheader go back to the campaign's subject and
	// preheader (posts from campaigns).
	UseSubject   bool   `json:"useSubject,omitempty"`
	UsePreheader bool   `json:"usePreheader,omitempty"`
	CoverURL     string `json:"coverUrl" maxLength:"1000"`
	CoverAlt     string `json:"coverAlt" maxLength:"300"`
	// The byline: a member, or a written name.
	BylineUserID string `json:"bylineUserId,omitempty" maxLength:"64"`
	BylineName   string `json:"bylineName,omitempty" maxLength:"120"`
	// Tags are tag ids, in order (up to 5).
	Tags       []string       `json:"tags" maxItems:"5"`
	Visibility string         `json:"visibility" enum:"public,members,paid"`
	Tiers      []string       `json:"tiers" maxItems:"10" doc:"A paid post's tiers; empty for every paid tier"`
	NeverFree  bool           `json:"neverFree"`
	Featured   bool           `json:"featured"`
	SEO        WebsitePostSEO `json:"seo"`
	// WebOn is a campaign's "Publish to <domain>" switch.
	WebOn bool `json:"webOn"`
	// When a post goes live: with the campaign's send, at a time, or now
	// (a sent campaign; web-only posts publish with Publish).
	PublishMode string     `json:"publishMode" enum:"with_send,at,now"`
	PublishAt   *time.Time `json:"publishAt,omitempty"`
	PublishTZ   string     `json:"publishTz,omitempty" maxLength:"64"`
}

WebsitePostInput saves a post's settings: the Web tab of the composer.

type WebsitePostList

type WebsitePostList struct {
	Posts    []WebsitePostRow  `json:"posts"`
	Total    int64             `json:"total"`
	Counts   WebsitePostCounts `json:"counts"`
	Page     int               `json:"page"`
	PageSize int               `json:"pageSize"`
	// From and Until are the 30 days of the numbers.
	From  time.Time `json:"from"`
	Until time.Time `json:"until"`
}

WebsitePostList is a page of Website › Posts.

type WebsitePostPath

type WebsitePostPath struct {
	api.WorkspaceInput
	Post string `path:"post" format:"uuid" doc:"The post's id"`
}

WebsitePostPath is a post's path (exported: Huma reads embedded path structs only when their type is exported).

type WebsitePostRow

type WebsitePostRow struct {
	ID      string `json:"id"`
	Kind    string `json:"kind" enum:"campaign,web"`
	Title   string `json:"title"`
	Excerpt string `json:"excerpt"`
	Slug    string `json:"slug"`
	// URL is the post's address on the site.
	URL string `json:"url"`
	// Status is draft, scheduled (a time, or with a scheduled send),
	// published or unpublished.
	Status          string               `json:"status" enum:"draft,scheduled,published,unpublished"`
	PublishMode     string               `json:"publishMode" enum:"with_send,at,now"`
	PublishAt       *time.Time           `json:"publishAt,omitempty"`
	PublishTZ       string               `json:"publishTz,omitempty"`
	PublishedAt     *time.Time           `json:"publishedAt,omitempty"`
	UnpublishedAt   *time.Time           `json:"unpublishedAt,omitempty"`
	UnpublishedBy   string               `json:"unpublishedBy,omitempty"`
	UnpublishReason string               `json:"unpublishReason,omitempty"`
	RedirectTo      string               `json:"redirectTo,omitempty"`
	Campaign        *WebsitePostCampaign `json:"campaign,omitempty"`
	Byline          WebsiteByline        `json:"byline"`
	Visibility      string               `json:"visibility" enum:"public,members,paid"`
	Tiers           []WebsiteTierRef     `json:"tiers"`
	NeverFree       bool                 `json:"neverFree"`
	HasMarker       bool                 `json:"hasMarker"`
	MarkerAfter     int                  `json:"markerAfter"`
	Featured        bool                 `json:"featured"`
	Tags            []WebsiteTagRef      `json:"tags"`
	// Views, Signups and Upgrades are the last 30 days; ViewsAllTime is
	// every view (an unpublished post's views before it was taken down).
	Views        int64                `json:"views"`
	ViewsAllTime int64                `json:"viewsAllTime"`
	Signups      int64                `json:"signups"`
	Upgrades     int64                `json:"upgrades"`
	Approval     *WebsitePostApproval `json:"approval,omitempty"`
	CreatedBy    string               `json:"createdBy"`
	UpdatedAt    time.Time            `json:"updatedAt"`
}

WebsitePostRow is a post in Website › Posts.

type WebsitePostSEO

type WebsitePostSEO struct {
	Title          string `json:"title" maxLength:"120"`
	Description    string `json:"description" maxLength:"300"`
	SocialImage    string `json:"socialImage" maxLength:"500"`
	CanonicalURL   string `json:"canonicalUrl" maxLength:"500"`
	HideFromSearch bool   `json:"hideFromSearch"`
}

WebsitePostSEO are a post's search and social settings.

type WebsitePostSaved

type WebsitePostSaved struct {
	Version int       `json:"version"`
	SavedAt time.Time `json:"savedAt"`
}

WebsitePostSaved is a saved version.

type WebsiteProgress

type WebsiteProgress struct {
	StartedAt  *time.Time          `json:"startedAt,omitempty"`
	FinishedAt *time.Time          `json:"finishedAt,omitempty"`
	Tags       WebsiteProgressStep `json:"tags"`
	Posts      WebsiteProgressStep `json:"posts"`
	Redirects  WebsiteProgressStep `json:"redirects"`
	// Pages is the home page, sign-in and the account: waiting or done.
	Pages string `json:"pages" enum:"waiting,done"`
}

WebsiteProgress is turning the website on, step by step.

type WebsiteProgressStep

type WebsiteProgressStep struct {
	Done  int64    `json:"done"`
	Total int64    `json:"total"`
	Names []string `json:"names,omitempty"`
}

WebsiteProgressStep is one step of turning the website on.

type WebsitePublishInput

type WebsitePublishInput struct {
	When string     `json:"when" enum:"now,at"`
	At   *time.Time `json:"at,omitempty"`
	TZ   string     `json:"tz,omitempty" maxLength:"64"`
}

WebsitePublishInput publishes a post now or at a time.

type WebsitePublishPastInput

type WebsitePublishPastInput struct {
	Campaigns []string `json:"campaigns" minItems:"1" maxItems:"100"`
	// Visibility: audience follows each campaign's audience (public, or
	// paid for a paid-only send).
	Visibility string `json:"visibility" enum:"audience,public,members"`
}

WebsitePublishPastInput publishes sent campaigns as posts.

type WebsitePublishPastResult

type WebsitePublishPastResult struct {
	Published int `json:"published"`
}

WebsitePublishPastResult is how many posts went live.

type WebsitePublishState

type WebsitePublishState struct {
	// CanPublish: holds website:publish and nothing blocks (or the post
	// is approved as it is).
	CanPublish bool `json:"canPublish"`
	// NeedsApproval: Publish becomes Request approval, for Rule.
	NeedsApproval bool     `json:"needsApproval"`
	Rule          string   `json:"rule,omitempty" enum:"author_lacks_send,post_publish,"`
	Approvers     []string `json:"approvers"`
	// Pending is an open request for this post.
	Pending     *WebsitePostApproval `json:"pending,omitempty"`
	ApprovedID  string               `json:"approvedId,omitempty"`
	Blocked     bool                 `json:"blocked"`
	BlockReason string               `json:"blockReason,omitempty"`
}

WebsitePublishState says whether the person may publish the post as it is.

type WebsiteSentAsCampaign

type WebsiteSentAsCampaign struct {
	CampaignID string `json:"campaignId"`
}

WebsiteSentAsCampaign is the campaign draft made from a post.

type WebsiteSignedOut

type WebsiteSignedOut struct {
	Sessions int64 `json:"sessions"`
}

WebsiteSignedOut is how many sessions signing out everywhere ended.

type WebsiteSignupList

type WebsiteSignupList struct {
	ListID  string `json:"listId" format:"uuid"`
	Checked bool   `json:"checked"`
	Consent string `json:"consent,omitempty" maxLength:"300"`
}

WebsiteSignupList is a list offered on sign-up, whether it's checked, and the consent text shown with it (kept with each sign-up).

type WebsiteSlugOwner

type WebsiteSlugOwner struct {
	ID     string    `json:"id"`
	Title  string    `json:"title"`
	Status string    `json:"status"`
	Since  time.Time `json:"since"`
}

WebsiteSlugOwner is the post that holds, or once held, an address.

type WebsiteSource

type WebsiteSource struct {
	// Key is the referring domain ("" for email clients and direct, "other"
	// for the rest) or the utm_source value.
	Key   string `json:"key"`
	Label string `json:"label"`
	Views int64  `json:"views"`
}

WebsiteSource is one row of a post's sources: a referrer or a UTM source.

type WebsiteTag

type WebsiteTag struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
	// Posts are its published posts; Unpublished its posts taken down
	// ("its only post is unpublished").
	Posts       int64 `json:"posts"`
	Unpublished int64 `json:"unpublished"`
	// InNav is "Show in navigation": the tag is one of the header links.
	InNav bool `json:"inNav"`
	// URL and Feed are its page and its feed.
	URL  string `json:"url"`
	Feed string `json:"feed"`
	// List is the list it was made from when the website was turned on.
	List string `json:"list,omitempty"`
}

WebsiteTag is a tag with its posts and its place in the navigation.

type WebsiteTagInput

type WebsiteTagInput struct {
	Name        string `json:"name" minLength:"1" maxLength:"60"`
	Slug        string `json:"slug,omitempty" maxLength:"80"`
	Description string `json:"description,omitempty" maxLength:"300"`
	InNav       bool   `json:"inNav"`
}

WebsiteTagInput creates or changes a tag.

type WebsiteTagPath

type WebsiteTagPath struct {
	api.WorkspaceInput
	Tag string `path:"tag" format:"uuid" doc:"The tag's id"`
}

WebsiteTagPath is a tag's path.

type WebsiteTagRef

type WebsiteTagRef struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

WebsiteTagRef is a tag of a post.

type WebsiteTierOption

type WebsiteTierOption struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Label string `json:"label"`
	// Monthly and Yearly are the current prices in cents (0: none), with
	// their currency; TrialDays the free days.
	Monthly   int64  `json:"monthly"`
	Yearly    int64  `json:"yearly"`
	Currency  string `json:"currency"`
	TrialDays int    `json:"trialDays"`
	// Includes names the lower tier whose content it includes ("Insider").
	Includes string `json:"includes,omitempty"`
	Public   bool   `json:"public"`
}

WebsiteTierOption is a paid tier as the paywall card can offer it.

type WebsiteTierRef

type WebsiteTierRef struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	// Label is the tier's quiet label on posts ("Insider").
	Label string `json:"label"`
}

WebsiteTierRef is a paid tier a post is for.

type WebsiteTurnOffInput

type WebsiteTurnOffInput struct {
	Confirm string `json:"confirm" maxLength:"300"`
}

WebsiteTurnOffInput turns the website off: the site's address, typed.

type WebsiteTurnOnInput

type WebsiteTurnOnInput struct {
	Layout   string              `json:"layout" enum:"featured,list,grid"`
	SigninOn bool                `json:"signinOn"`
	Lists    []WebsiteSignupList `json:"lists,omitempty" maxItems:"50"`
}

WebsiteTurnOnInput turns the website on, with the home layout and the members' settings of the turn-on page.

type WebsiteUnpublishInput

type WebsiteUnpublishInput struct {
	Reason string `json:"reason,omitempty" maxLength:"300"`
	// RedirectTo is a path on the site the post's address sends readers
	// to ("/posts/…", "/archive"); empty answers 410.
	RedirectTo string `json:"redirectTo,omitempty" maxLength:"300"`
}

WebsiteUnpublishInput takes a post off the site.

type WebsiteWebCheck

type WebsiteWebCheck struct {
	Key    string `json:"key" enum:"address,cover,tokens,hidden"`
	Status string `json:"status" enum:"pass,warn,info,block"`
	// Address: the path; Taken: who holds it; Suggestion: a free slug.
	Path       string               `json:"path,omitempty"`
	Taken      *WebsiteSlugOwner    `json:"taken,omitempty"`
	Suggestion string               `json:"suggestion,omitempty"`
	Fallbacks  []WebsiteFallback    `json:"fallbacks"`
	Hidden     []WebsiteHiddenBlock `json:"hidden"`
}

WebsiteWebCheck is one of a post's web checks.

type Words

type Words struct{ L i18n.Lang }

Words are the site's built-in words (header, footer, paywall, sign-in, account) in one language: this package's catalog, English until a language ships them. The publisher's own text (titles, the paywall's heading) is content and isn't translated.

func WordsIn

func WordsIn(l i18n.Lang) Words

WordsIn returns the site's words in a language.

func (Words) HTML

func (w Words) HTML(key string, args i18n.Args, tags i18n.Tags) string

HTML is a sentence with markup: values are escaped, tags go through tags.

func (Words) Text

func (w Words) Text(key string, args i18n.Args) string

Text is a word or sentence as plain text.

Directories

Path Synopsis
Package gate decides what a reader of the publication website may read (design expansion phase 7, brief §3.3): a post's or a page's visibility (Public, Members, Paid for every tier or chosen tiers), the meter (N free posts per calendar month for visitors and for free members) and "Never free".
Package gate decides what a reader of the publication website may read (design expansion phase 7, brief §3.3): a post's or a page's visibility (Public, Members, Paid for every tier or chosen tiers), the meter (N free posts per calendar month for visitors and for free members) and "Never free".
Package render draws a post's web version from its MJML (design expansion phase 7, brief §3.1): the email's blocks in the site's theme and its 680 px reading column, not the email's tables.
Package render draws a post's web version from its MJML (design expansion phase 7, brief §3.1): the email's blocks in the site's theme and its 680 px reading column, not the email's tables.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL