import { ThreadData } from '@liveblocks/client'; import { COABalanceTimeFrame, COABalanceType, COABalancesRange, ID, ReportFormat, ReportID, TimeframeTick } from '@zeniai/client-epic-state'; import { ReportTreeNode } from '../../reportTree/reportTreeTypes'; import { ThreadMetadata } from './CollaborationTypes'; import { RequestToOpenThreadType } from './ThreadsProvider'; export interface ReportThreadNavigationOptions { allThreads: ThreadData[]; requestToOpenThread: RequestToOpenThreadType | null; /** Currently selected Add Columns balances (to restore calculated-column threads). */ additionalBalances?: COABalanceType[]; /** All period ticks available for the current timeframe (full data range). */ allTimeframeTicks?: TimeframeTick[]; /** When true, the report data is still loading — navigation waits instead of timing out. */ isReportLoading?: boolean; /** * True when the pending request targets a thread another page owns (e.g. a * forecast_report thread while this page renders standard reports). The * hook then leaves the request untouched instead of consuming/clearing it. */ isRequestForeign?: boolean; nodeCollapseState?: Record; /** Current Report View format; navigation escalates it so the cell's row shows. */ reportFormat?: ReportFormat; reportTreeRootNodes?: ReportTreeNode[]; /** The visible period window (anchor period + number of periods). */ selectedCOABalancesRange?: COABalancesRange; selectedReport?: ReportID; selectedTimeframe?: COABalanceTimeFrame; setOpenThread: (id: ID | null) => void; setRequestToOpenThread: (data: RequestToOpenThreadType | null) => void; /** Bails out when a thread targets a reportId the host page can't render. */ isReportIdSupported?: (reportId: ReportID) => boolean; /** Adds the calculated column a thread targets to the Add Columns selection. */ onAdditionalBalanceForThread?: (balanceType: COABalanceType) => void; onExpandNode?: (reportId: ReportID, nodeId: ID, isOpen: boolean) => void; /** Re-anchors the period range so the thread's column enters the visible window. */ onPeriodAnchorChangeForThread?: (thisPeriod: TimeframeTick) => void; /** Updates the selected Report View format when navigation expands beyond it. */ onReportFormatChangeForThread?: (format: ReportFormat) => void; onReportSelectionChanged?: (reportId: ReportID) => void; /** Switches the "View Columns By" granularity to the thread column's timeframe. */ onTimeframeChangeForThread?: (timeframe: COABalanceTimeFrame) => void; scrollToNode?: (nodeId: ID) => void; } /** * Shared hook that orchestrates navigating to a report cell comment: * 1. Switch report tab if needed (P&L / BS / CF / Classes) * 2. Switch the "View Columns By" granularity to the column's timeframe * 3. Re-anchor the period range when the column is outside the visible window * 4. Expand collapsed ancestor rows in the tree * 5. Scroll the virtualized tree (via DOM polling) * 6. Scroll horizontally to the target column * 7. Open the thread popover once the cell is visible */ export declare function useReportThreadNavigation({ requestToOpenThread, setRequestToOpenThread, setOpenThread, allThreads, selectedReport, onReportSelectionChanged, reportTreeRootNodes, nodeCollapseState, isReportIdSupported, onExpandNode, scrollToNode, additionalBalances, allTimeframeTicks, isReportLoading, isRequestForeign, reportFormat, selectedCOABalancesRange, selectedTimeframe, onAdditionalBalanceForThread, onPeriodAnchorChangeForThread, onReportFormatChangeForThread, onTimeframeChangeForThread, }: ReportThreadNavigationOptions): void;