import { NavigationAdapter, VowelRoute } from '../../types'; /** * React Router location interface (simplified) */ export interface ReactRouterLocation { pathname: string; search?: string; hash?: string; state?: any; key?: string; } /** * React Router navigate function type */ export type ReactRouterNavigateFunction = (to: string | number, options?: { replace?: boolean; state?: any; preventScrollReset?: boolean; relative?: 'route' | 'path'; }) => void; /** * Options for ReactRouterNavigationAdapter */ export interface ReactRouterNavigationAdapterOptions { /** * Navigate function from useNavigate() hook */ navigate: ReactRouterNavigateFunction; /** * Location object from useLocation() hook */ location: ReactRouterLocation; /** * Optional: Array of routes to provide to the AI * Since React Router doesn't expose route configuration at runtime, * you should provide this manually */ routes?: VowelRoute[]; /** * Optional: Whether to use replace instead of push for navigation * Default: false */ useReplace?: boolean; } /** * React Router Navigation Adapter * * Provides seamless integration with React Router, including: * - Navigation using useNavigate() hook * - Current path tracking using useLocation() hook * - Support for manual route configuration * * Note: Unlike TanStack Router, React Router doesn't expose route configuration * at runtime, so routes should be provided manually via the routes option. */ export declare class ReactRouterNavigationAdapter implements NavigationAdapter { private navigateFunction; private location; private routes?; private useReplace; constructor(options: ReactRouterNavigationAdapterOptions); /** * Navigate to a path using React Router */ navigate(path: string): Promise; /** * Get current path from React Router location */ getCurrentPath(): string; /** * Get routes (if provided during initialization) */ getRoutes(): Promise; /** * Get additional context from React Router */ getContext(): any; /** * Update the location reference * Call this when the location changes to keep the adapter in sync * * @param location - New location object from useLocation() */ updateLocation(location: ReactRouterLocation): void; /** * Update the routes configuration * Useful if routes are loaded dynamically * * @param routes - New routes array */ updateRoutes(routes: VowelRoute[]): void; } /** * Create a React Router adapter using navigation hooks * This is a convenience function for quick setup * * @param navigate - navigate function from useNavigate() hook * @param location - location object from useLocation() hook * @param routes - Optional array of routes * @returns NavigationAdapter * * @example * ```tsx * import { useNavigate, useLocation } from 'react-router-dom'; * import { createReactRouterAdapter } from '@vowel.to/client/adapters/navigation'; * * function App() { * const navigate = useNavigate(); * const location = useLocation(); * * const navigationAdapter = useMemo( * () => createReactRouterAdapter(navigate, location, [ * { path: '/', description: 'Home page' }, * { path: '/about', description: 'About page' }, * { path: '/products', description: 'Products listing' } * ]), * [navigate, location] * ); * * return ; * } * ``` */ export declare function createReactRouterAdapter(navigate: ReactRouterNavigateFunction, location: ReactRouterLocation, routes?: VowelRoute[]): NavigationAdapter; /** * Create a React Router adapter with just pathname (simpler version) * * @param navigate - navigate function from useNavigate() hook * @param pathname - current pathname from useLocation().pathname * @param routes - Optional array of routes * @returns NavigationAdapter * * @example * ```tsx * import { useNavigate, useLocation } from 'react-router-dom'; * import { createReactRouterHookAdapter } from '@vowel.to/client/adapters/navigation'; * * function App() { * const navigate = useNavigate(); * const { pathname } = useLocation(); * * const navigationAdapter = useMemo( * () => createReactRouterHookAdapter(navigate, pathname), * [navigate, pathname] * ); * * return ; * } * ``` */ export declare function createReactRouterHookAdapter(navigate: ReactRouterNavigateFunction, pathname: string, routes?: VowelRoute[]): NavigationAdapter; //# sourceMappingURL=react-router-navigation-adapter.d.ts.map