import { GlobalStore } from './GlobalStore'; export type ActionDrawerTrigger = 'primaryCta' | 'secondaryCta' | 'chartBar' | 'inDescriptionCta'; export interface ActionDrawerState { isDrawerOpen: boolean; trigger: ActionDrawerTrigger; guid: string; /** * Block-specific drilldown data for the current drawer SESSION, opaque to the * store. Each action block defines and reads its own shape (via * useActionContext()). Chart drilldowns put `{ chartBarIndex, tabIndex }` * here; CTAs carry none. * * This is an accumulating bag, not a single owner's value: a nested drawer * (e.g. TransactionDetailsBlock opened from a row inside TransactionHistory * Block) adds its own key via `setActionContext` ON TOP of whatever the outer * drawer already put here, so the outer block's own context survives while the * nested block is open. It resets to a clean slate only when a NEW drawer * session starts (`openActionDrawer`/`openCtaDrawer`, which fully replace the * envelope) — not on every `setActionContext` call. */ context: unknown; } export declare const CLOSED_ACTION_DRAWER: ActionDrawerState; interface OpenActionDrawerArgs { guid: string; trigger: ActionDrawerTrigger; context?: unknown; } /** Lifecycle of a beat's CTA action (see insights-v2/ctaActions), keyed by beat guid. */ export type CtaStatus = 'pending' | 'done' | 'error'; /** * UI state shared across the insights-v2 widget tree. Owns the action drawer so * cards, charts, and action blocks coordinate through the store instead of prop * drilling. The drawer state is a fixed envelope (isDrawerOpen/guid/trigger) plus * an opaque `context` bag, so per-block drilldown data never leaks into this shape. */ export declare class InsightsV2Store { globalStore: GlobalStore; actionDrawer: ActionDrawerState; /** * CTA action status per beat guid. Keyed by guid (not block) so a block shared by many * insights never reflects another card's pending or error state. */ ctaStatus: Record; /** * Per-beat scratch input collected on the card or in its blocks (e.g. the account a user * picked before pressing Save), keyed by beat guid. Unlike `actionDrawer.context`, which is * replaced whenever any drawer session starts, this survives other cards' drawers opening. * CTA steps read it via `disabledWhen` and their `params` callback (`beatContextOf`). Ships * ahead of its first block writer (Designate's account picker) on purpose: it is the layer's * only way to keep a pick alive across other cards' drawer sessions. */ beatContext: Record>; constructor(globalStore: GlobalStore); setCtaStatus: (guid: string, status: CtaStatus) => void; /** Merges `values` into the beat's scratch input. */ setBeatContext: (guid: string, values: Record) => void; /** * Merges keys into the current drawer session's context bag — it does NOT * replace it. A nested drawer (e.g. a row click inside TransactionHistoryBlock * opening TransactionDetailsBlock) calls this to layer its own key (e.g. * `transaction_guid`) on top of whatever context the outer drawer already set * (e.g. `chartBarIndex`), so the outer block keeps reading its own keys via * useActionContext while the nested block is open. The bag only returns to a * clean slate when a new drawer session starts via `openActionDrawer`/ * `openCtaDrawer`, which fully replace the envelope. */ setActionContext: (context: Record) => void; /** * Generic drawer opener — the only opener a new action block needs. Pass the * beat guid, the CTA/source that triggered it, and (optionally) a block-specific * context object the block reads back via useActionContext. */ openActionDrawer: ({ guid, trigger, context }: OpenActionDrawerArgs) => void; /** Convenience opener for CTA drawers (no drilldown context). */ openCtaDrawer: (guid: string, trigger: "primaryCta" | "secondaryCta") => void; closeActionDrawer: () => void; } export {};