import { type SiteAccessMode, type SiteHostnameAvailability, type SiteLimits, type SitePlatformMeter, type SitePublication, type SitePublishWarning, type UpsertSitePublicationRequest } from "@opengeni/contracts"; /** * Optional deployment facts about Sites publishing on the client config. * Older APIs omit them; the page then learns the domain from the API's * hostname answers and leaves the choices open for the server to refuse. */ export type SitesClientConfig = { domain?: string | null | undefined; publicEnabled?: boolean | undefined; publicAgentsEnabled?: boolean | undefined; loginOnly?: boolean | undefined; forceNoindex?: boolean | undefined; }; export declare function sitesClientConfig(config: unknown): SitesClientConfig; /** Where a publication stands, from the API's answer. */ export type SitePublicationLoad = { state: "loading"; } | { state: "unavailable"; } | { state: "forbidden"; } | { state: "none"; } | { state: "error"; error: unknown; } | { state: "ready"; publication: SitePublication; }; export declare function sitePublicationLoadFromError(error: unknown): SitePublicationLoad; /** A random four-character suffix for a suggested label. */ export declare function randomLabelSuffix(): string; export declare function suggestedLabel(title: string, suffix?: string): string; /** Lowercase and trim what someone types, so the check matches what is saved. */ export declare function normalizeLabelInput(value: string): string; /** The label's own problem in words, before asking the API. */ export declare function labelProblemMessage(label: string): string | null; /** What the API said about a label, in words. */ export declare function availabilityMessage(availability: SiteHostnameAvailability): string | null; /** The Sites domain from any hostname the API returned for a label. */ export declare function domainFromHostname(hostname: string | null | undefined, label: string): string | null; export declare function invitedEmailProblem(email: string): string | undefined; export declare const ACCESS_CHOICES: readonly { value: SiteAccessMode; title: string; description: (facts: { workspaceName: string; loginOnly: boolean; }) => string; }[]; export declare function formatUsdMicros(micros: number): string; export declare function limitFieldText(value: number | null | undefined, money: boolean): string; /** A field's text as a limit: null for empty, undefined for something that isn't a number. */ export declare function parseLimitField(text: string, money: boolean): number | null | undefined; /** "Limit: [$10] per [month]" and "[amount] per [day]": the two spend periods a limit can use. */ export type SpendPeriod = "day" | "month"; export declare const SPEND_PERIOD_OPTIONS: readonly { value: SpendPeriod; label: string; }[]; /** Invited and public Sites have people outside the workspace; members-only Sites don't. */ export declare function hasOutsideViewers(access: SiteAccessMode): boolean; export type SitePublishDraft = { label: string; access: SiteAccessMode; invitedEmails: string[]; agentEnabled: boolean; /** null uses the workspace default model. */ agentModel: string | null; /** "Agent for people outside the workspace" (members always keep the agent). */ outsideAgent: boolean; /** The Site limit for everyone outside the workspace together, dollars as typed. */ siteLimit: string; sitePeriod: SpendPeriod; /** The optional limit for each person or visitor outside the workspace. */ personLimitOn: boolean; personLimit: string; personPeriod: SpendPeriod; noindex: boolean; }; /** The spend limits a Site applies to people outside the workspace. */ export type OutsideSpendLimits = Pick; /** The Site limit's period and amount: per day only when that is the one set. */ export declare function siteSpendLimit(limits: OutsideSpendLimits): { period: SpendPeriod; micros: number | null; }; /** The per-person limit's period and amount, or null when it is off. */ export declare function personSpendLimit(limits: OutsideSpendLimits): { period: SpendPeriod; micros: number; } | null; export declare function draftFromPublication(publication: SitePublication | null, fallbackLabel: string, forceNoindex?: boolean): SitePublishDraft; /** * The outside spend limits from the typed fields, or which field isn't a * dollar amount. An empty Site limit means no Site limit. */ export declare function outsideLimitsFromDraft(draft: SitePublishDraft): { limits: OutsideSpendLimits; } | { invalid: "siteLimit" | "personLimit"; }; /** "$1.20 of $10 used this month": the Site's outside spend in its limit's period. */ export declare function outsideUsageLine(publication: SitePublication): string; /** "$10" for whole dollars, "$1.20" otherwise (credits are dollar amounts). */ export declare function formatLimitAmount(micros: number): string; /** * The PUT body for a draft: the fields that differ from the saved * publication (every field on a first publish), plus `status: "active"` * when publishing. Changed outside spend limits are saved as overrides on the * Site's profile, keeping its kind and any other overrides. */ export declare function publicationRequest(draft: SitePublishDraft, saved: SitePublication | null, options: { publish: boolean; canChangeLimits?: boolean | undefined; }): UpsertSitePublicationRequest; export declare function abuseCategoryLabel(category: string): string; export declare function suspendedByLabel(by: SitePublication["moderation"]["suspendedBy"]): string; /** Free text as one sentence: trimmed and ending with punctuation. */ export declare function sentence(text: string): string; /** The specific error code (`details.code`) of an API error, else its code. */ export declare function siteErrorCode(error: unknown): string | undefined; /** "2 things won't work for public visitors". */ export declare function readinessTitle(warnings: readonly SitePublishWarning[], access: SiteAccessMode): string; /** The published Site opened as the role its visitors have ("View as visitor"). */ export declare function viewAsVisitorUrl(publication: Pick): string | null; /** A platform refusal (Opengeni-wide brake or the workspace's allowance), in words. */ export declare function platformRefusal(error: unknown): { title: string; body: string; } | null; export declare const PLATFORM_METER_LABELS: Record; /** "1.2M", "640K", "980" for counts; "1.4 GB" for storage (GB = 10^9 bytes). */ export declare function formatPlatformAmount(meter: SitePlatformMeter, value: number): string;