import { type Operation, type PushPolicy } from "../ir/operations.js"; import { type FieldDefinition, type DesignParameter } from "../schema/recipe.js"; import { type CompileContext } from "./shared.js"; export interface BuildFieldOpInput { recipeHandle: string; fieldRefKey: string; fieldPath: string; parentRefKey: string; labelPrefix: string; field: FieldDefinition | DesignParameter; zeroBasedIndex: number; /** * Offset added to the auto-assigned `(zeroBasedIndex + 1) * 100` when * the field has no explicit `sitecore.sortOrder`. Default 0. * * Used by rendering parameters templates: the SXA Headless params base * templates ship `RenderingIdentifier`, `Styles`, `GridParameters`, etc. * at sortOrder values in the low hundreds. Inline `params:` would tie * or interleave with those on the inherited fields' `__Sortorder`, * making the Pages parameters dialog render custom params mixed in * between `id` and `css styles`. Passing a high base (e.g. `1000`) * pushes synthesised params cleanly below the inherited standards. */ sortOrderBase?: number; policy: PushPolicy; /** * Site name the recipe set is being compiled under. Threaded through to * `resolveFieldSource` so the emitted `ref-source-fields` value carries * the site — the executor's resolver needs it to derive `templateId(site, * handle)` for handle references in `sourceTypes`. */ site: string; /** * Compile context — used by `resolveFieldSource` to look up * `sitecore.enumHandle` references against `enumsByHandle` and emit * the enum's tenant content path as the Droplink Source value. * Standalone callers can omit it, but any field with * `sitecore.enumHandle` will then throw INPUT_INVALID since the path * can't be resolved. */ context?: CompileContext; } /** * Build the CreateItem op for a single field definition. * * Always returns exactly one op — the field-definition item itself. * Backing storage for enum-shaped fields is decided by the field's * `sitecore.type` / `sitecore.enumHandle` and resolved into the * `Source` field via `resolveFieldSource`: * - `sitecore.type: "droplist"` + inline `values: [...]` → Source is * a pipe-separated literal; Sitecore enumerates the string directly, * no value items needed. * - `sitecore.enumHandle: ""` (Droplink default) → Source is * the EnumerationRecipe's folder path on the tenant; the picker * enumerates that path's children at editor time. The values live * under the `EnumerationRecipe`'s folder item, emitted by * `compileEnumerationRecipe`. * * Inline Droplink (`shape: "enum"` + inline `values` + no `enumHandle` * + no `sitecore.type` override) is rejected by `resolveFieldSource` * with INPUT_INVALID — it never reliably worked in SXA Headless's * rendering parameters dialog (the picker couldn't enumerate the * per-field folder), so authors must commit to one of the two * supported shapes. */ export declare function buildFieldOp(input: BuildFieldOpInput): Operation[]; /** * Map a recipe-level rendering-parameter VALUE to the wire form the * parameter's Sitecore field type stores — the form XM Cloud Pages' * properties panel reads back (operator-verified against working tenant * pages, where enum params ride as `%7BGUID%7D` and checkboxes as `1`): * * - **checkbox** — `"true"`/`"1"` → `"1"`, anything else → `""`. * A checkbox field holding the literal `true` displays as unchecked. * - **enum-backed Droplink** (`shape: "enum"` + `sitecore.enumHandle`, * not overridden to droplist) — the value NAME becomes the enum * value item's curly-braced refKey GUID (`enumValueId` under * `enumerationFolderId`), which plan-time captured-id substitution * resolves to the real tenant item. A Droplink holding a raw name * displays as unset and Edge's params resolution can't map it. * - **droplist** (pipe-list Source) — stores the raw name; no mapping. * - anything else — `undefined` (caller keeps the raw value). */ export declare function paramWireValue(param: DesignParameter, raw: string, site: string): string | undefined;