import type { InitialInputSelections } from "../../stores/inputValidation"; import type { UIConfig } from "../../types/ui-config"; import type { CustomVariables, VariableDictionary } from "../../types/variables"; import type { PaywallContext as BridgePaywallContext, PaywallOffering, PaywallPackage, PaywallWorkflow } from "@revenuecat/workflow-web-components-sdk"; export type BridgeCustomValues = Record; export type BridgeInputs = Record; export interface BuildPaywallContextParams { /** Pre-merged custom values. When set, `customVariables` / `uiConfig` are ignored. */ custom?: BridgeCustomValues; customVariables?: CustomVariables; uiConfig?: UIConfig; offering?: PaywallOffering | null; packages?: PaywallPackage[]; packageIdsInDisplayOrder?: string[]; selectedPackageId?: string; enclosingPackageId?: string; inputs?: BridgeInputs; initialInputSelections?: InitialInputSelections; globalVariables?: VariableDictionary; workflow?: PaywallWorkflow; locale?: string; darkMode?: boolean; isPreview?: boolean; updatedAt?: number; } /** Merge dashboard custom-variable defaults with typed runtime overrides. */ export declare function typedCustomVariables(customVariables: CustomVariables | undefined, uiConfig: UIConfig | undefined): BridgeCustomValues; /** * Bare field ids. Host `inputs` win, then current-screen selections, then * `input.*` keys from global variables (stringly, from earlier steps). */ export declare function buildBridgeInputs({ inputs, initialInputSelections, globalVariables, }: Pick): BridgeInputs; /** Normalize a stored input to a choice-field `string[]`. */ export declare function asBridgeInputArray(value: string | string[] | null | undefined): string[]; /** * Apply an `onInputChanged` payload to `bridgeInputs`. * Choice options emit a single `option_id`: toggle when the field is already * a `string[]` (multi-choice), otherwise replace (text / single-choice). */ export declare function applyBridgeInputChange(current: BridgeInputs, fieldId: string, value: string): BridgeInputs; /** Paywall-tree order, dropping offering packages that never appear on the paywall. */ export declare function orderPackagesForPaywall(packages: PaywallPackage[], packageIdsInDisplayOrder: string[]): PaywallPackage[]; export declare function buildPaywallContext(params: BuildPaywallContextParams): BridgePaywallContext; /** Snapshot identity ignoring `updated_at`, so init is not also sent as `context`. */ export declare function contextFingerprint(context: BridgePaywallContext): string;