import { HistoryAction } from '@tanstack/history'; import { AnyRoute, AnyRouter, ParseRoute, RegisteredRouter } from '@tanstack/router-core'; import * as React from 'react'; interface ShouldBlockFnLocation { routeId: TRouteId; fullPath: TFullPath; pathname: string; params: TAllParams; search: TFullSearchSchema; } type MakeShouldBlockFnLocationUnion> = TRoute extends any ? ShouldBlockFnLocation : never; type BlockerResolver = { status: 'blocked'; current: MakeShouldBlockFnLocationUnion; next: MakeShouldBlockFnLocationUnion; action: HistoryAction; proceed: () => void; reset: () => void; } | { status: 'idle'; current: undefined; next: undefined; action: undefined; proceed: undefined; reset: undefined; }; type ShouldBlockFnArgs = { current: MakeShouldBlockFnLocationUnion; next: MakeShouldBlockFnLocationUnion; action: HistoryAction; }; export type ShouldBlockFn = (args: ShouldBlockFnArgs) => boolean | Promise; export type UseBlockerOpts = { shouldBlockFn: ShouldBlockFn; enableBeforeUnload?: boolean | (() => boolean); disabled?: boolean; withResolver?: TWithResolver; }; type LegacyBlockerFn = () => Promise | any; type LegacyBlockerOpts = { blockerFn?: LegacyBlockerFn; condition?: boolean | any; }; export declare function useBlocker(opts: UseBlockerOpts): TWithResolver extends true ? BlockerResolver : void; /** * @deprecated Use the shouldBlockFn property instead */ export declare function useBlocker(blockerFnOrOpts?: LegacyBlockerOpts): BlockerResolver; /** * @deprecated Use the UseBlockerOpts object syntax instead */ export declare function useBlocker(blockerFn?: LegacyBlockerFn, condition?: boolean | any): BlockerResolver; export declare function Block(opts: PromptProps): React.ReactNode; /** * @deprecated Use the UseBlockerOpts property instead */ export declare function Block(opts: LegacyPromptProps): React.ReactNode; type LegacyPromptProps = { blockerFn?: LegacyBlockerFn; condition?: boolean | any; children?: React.ReactNode | ((params: BlockerResolver) => React.ReactNode); }; type PromptProps : void> = UseBlockerOpts & { children?: React.ReactNode | ((params: TParams) => React.ReactNode); }; export {};