import type { PaywallData } from "./paywall"; /** * Represents a screen/paywall configuration in a workflow. * Extends core PaywallData with workflow-specific metadata. */ export interface WorkflowScreen extends PaywallData { asset_base_url: string; config: Record; localized_strings: Record>; localized_strings_by_tier: Record>; name: string; offering_id: string | null; revision: number; template_name: string; } /** * A trigger action that navigates directly to another step. */ export interface WorkflowStepTriggerAction { type: "step"; step_id: string; } /** * An entry in a step's `triggers` array that maps a component interaction * (e.g. button press) to a named action_id, which in turn maps to a * `trigger_actions` entry. */ export interface WorkflowStepTrigger { /** The action ID to look up in `trigger_actions`. */ action_id: string; /** The component (e.g. button) id that fires this trigger. */ component_id: string; /** The interaction type, e.g. "on_press". */ type: string; name?: string; } /** * A single step in a workflow, referencing a screen by ID. * Aligns with the SDK response shape from khepri. */ export interface WorkflowStep { id: string; screen_id?: string; type: string; /** Editor step name from the published SDK payload (khepri #24244). */ name?: string | null; /** * Editor screen-type classification from the published SDK payload * (khepri #24244). Missing on unre-published funnels; treat as `[]`. * Distinct from `metadata.screen_type` (native fallback-paywall contract). */ screen_type?: string[]; param_values: Record; /** * Maps action IDs (from `triggers[].action_id`) to the next step to navigate * to. Currently only `type: "step"` is supported for client-side resolution; * condition-based actions are ignored. */ trigger_actions: Record>; /** * Array of trigger entries mapping component interactions to action IDs. * Resolve a button press by matching its component `id` against * `component_id`, then use the entry's `action_id` to look up * `trigger_actions`. */ triggers: WorkflowStepTrigger[]; outputs: Record; metadata: Record | null; } /** * The full workflow payload returned by the RevenueCat SDK. * Aligns with rc-workflows' WorkflowData type — rc-workflows imports * WorkflowScreen from this package and can import WorkflowData here too. */ export interface WorkflowData { id: string; display_name: string; initial_step_id: string; steps: Record; screens: Record; ui_config: Record; content_max_width: number | null; metadata?: Record | null; }