/** * `createSiteBinding` — the reusable, CLI-free core of `scai deploy site bind`. * * Populates the SXA Site Grouping fields the Cloud Portal Pages / Channels app * needs for a site to surface — `HostName`, `StartItem`, `RenderingHost`. SXA's * Create Site wizard sets these automatically; sites created via other paths * (custom provisioning, site-template clone) often leave them blank and the * Pages app silently filters them out. * * `RenderingHost` is a string-keyed lookup — Sitecore resolves the value (the * editing host name) against `/sitecore/system/Settings/Services/Rendering * Hosts/` at request time, so the field can be written before the * rendering-host item exists. * * Takes an already-built Authoring client (host resolution differs by context — * CLI config vs a Deploy-API lookup), so this stays a pure bind shared by the * `scai deploy site bind` CLI (`./tasks/site-bind`) and SDK consumers * (`@sitecoreai-labs/sitecoreai-cli/deploy`). This module imports no CLI/logger * code, keeping the `./deploy` subpath export bundle-safe. */ import type { AuthoringApiClient } from "../authoring/index.js"; export type SiteBindingInput = { /** SXA site name (e.g. `e2e`). */ siteName: string; /** SXA SiteCollection (Headless Tenant) the site lives under. */ siteCollection: string; /** `RenderingHost` field value; defaults to `siteName` (the editing-host slug). */ renderingHostName?: string; /** Start Item page name under the site root; defaults to `Home`. */ startItemName?: string; /** `HostName` field pattern; defaults to `*` (matches any hostname). */ hostNamePattern?: string; }; export type SiteBindingStatus = "applied" | "no-op" | "plan"; export interface SiteBindingResult { siteGroupingPath: string; siteGroupingItemId: string; startItemPath: string; startItemId: string; applied: boolean; status: SiteBindingStatus; fields: { HostName: string; StartItem: string; RenderingHost: string; }; } /** * Bind a site's SXA Site Grouping using an Authoring client bound to the CM env. * * - `apply: true` writes the fields, but is idempotent — skips the write when * the three fields already carry the target values (`status: "no-op"`). * - `apply: false` (default) computes the plan — reads the items, never writes * (`status: "plan"`). * - Throws `INPUT_INVALID` for blank input or a missing Site Grouping / Start * Item. */ export declare const createSiteBinding: (client: AuthoringApiClient, input: SiteBindingInput, options?: { apply?: boolean; }) => Promise;