import { default as React, ReactNode } from 'react'; import { RBACConfig, RBACContextValue, Permission, PermissionAction } from './types'; import { User } from '../types'; /** * RBAC Context for React applications. */ export declare const RBACContext: React.Context; /** * RBAC Provider props. */ export interface RBACProviderProps { /** RBAC configuration */ config: RBACConfig; /** Child components */ children: ReactNode; /** Current user */ user?: User | null; /** User's assigned roles */ userRoles?: string[]; /** User's direct permissions */ userPermissions?: Permission[]; /** Callback to fetch permissions from server */ fetchPermissions?: () => Promise<{ roles: string[]; permissions: Permission[]; }>; /** Loading component */ loadingComponent?: ReactNode; /** Callback when permission check occurs */ onPermissionCheck?: (permission: Permission, granted: boolean) => void; /** Callback when access check occurs */ onAccessCheck?: (resource: string, action: PermissionAction, granted: boolean) => void; } /** * RBAC Provider Component. * * Provides RBAC functionality to child components through React context. * * @example * ```tsx * import { RBACProvider } from '@/lib/auth/rbac'; * * const rbacConfig = { * roles: [ * { id: 'admin', name: 'Admin', permissions: ['*'], priority: 100 }, * { id: 'user', name: 'User', permissions: ['read:*'], priority: 10 }, * ], * defaultDecision: 'deny', * enableCaching: true, * }; * * function App() { * const { user } = useAuth(); * * return ( * * * * ); * } * ``` */ export declare function RBACProvider({ config, children, user, userRoles, userPermissions, fetchPermissions, loadingComponent, onPermissionCheck, onAccessCheck, }: RBACProviderProps): React.ReactElement;