import type { Component } from "../types/component.js"; import type { Overrides } from "../types/overrides.js"; import type { RootPaywall } from "../types/paywall.js"; import type { StateValue } from "../types/state.js"; import type { PackageInfo, VariableDictionary } from "../types/variables.js"; import type { WindowSize } from "../stores/window-size.js"; /** * Given an instance of PaywallData, returns the id of the first package marked as `is_selected_by_default` if any. * If none are marked, returns the first package encountered in traversal order (root stack, then sticky footer). * @param paywallData * @returns the id of the first package marked as `is_selected_by_default`, otherwise the first package id, or undefined */ export declare function findSelectedPackageId({ stack, sticky_footer, }: RootPaywall): string | undefined; /** Package ids under `root` in depth-first order, duplicates included. */ export declare function collectPackageIds(root: Component): string[]; /** * Package ids in paywall display order (root stack, then sticky footer). * Duplicates keep the first occurrence. Unselected tabs still count. */ export declare function collectPackageIdsInDisplayOrder({ stack, sticky_footer, }: RootPaywall): string[]; export type PackagePlacement = { index: number; inTabs: boolean; }; /** * Each package component's place in display order (root stack, then sticky * footer) and whether it sits inside tabs, by component id. */ export declare function collectPackagePlacements({ stack, sticky_footer, }: RootPaywall): Map; export type ConditionContext = { selectedPackageId: string | undefined; packageInfo: PackageInfo | undefined; variables: VariableDictionary; /** Current state values; optional so existing call sites compile unchanged. */ stateValues?: Record; /** Declared state defaults; optional so existing call sites compile unchanged. */ stateDefaults?: Record; /** The paywall's measured box; absent until measured, so window rules don't match. */ windowSize?: WindowSize | null; /** Interaction pseudo-state flags; absent means "not in that state". */ selected?: boolean; hover?: boolean; focus?: boolean; error?: boolean; }; /** * Returns the overrides (in array order) whose conditions all match (AND) the * given context, without merging their properties. */ export declare const filterMatchingOverrides: (context: ConditionContext, overrides?: Overrides) => Overrides; /** * Merges the properties of every override whose conditions all match (AND), * applying them in override-array order (later overrides overwrite earlier ones). * Pseudo-state conditions (selected, hover, focus, error, intro/promo offer) * evaluate from the context flags, so mixed pseudo + rule/state overrides get * the same all-conditions-AND-ed semantics as iOS's buildPartial. * * An override may both hide (`visible: false`) and reveal (`visible: true`) a * component, regardless of which condition types it carries, matching iOS's * buildPartial. Components derive `isVisible` from the merged result * (`actualProps.visible !== false`). */ export declare const resolveOverrideProperties: (context: ConditionContext, overrides?: Overrides) => Partial;