@frank-auth/react
Version:
Flexible and customizable React UI components for Frank Authentication
73 lines (72 loc) • 3.09 kB
TypeScript
'use client';
import { default as React } from 'react';
import { FrankAuthUIConfig } from '../config';
/**
* @frank-auth/react - Provider Index
*
* Main entry point for all authentication providers. Exports all provider
* components, hooks, and types for easy importing.
*/
export { AuthProvider, useAuth, useAuthGuard } from './auth-provider';
export { ConfigProvider, useConfig, useFeatures, useOrganizationConfig, useComponentOverrides, withConfig, } from './config-provider';
export { ThemeProvider, useTheme, useThemeMode, useOrganizationBranding, useThemeVariables, withTheme, ThemeSwitcher, } from './theme-provider';
export type { AuthState, AuthContextValue, AuthProviderProps, AuthError, AuthFeatures, OrganizationMembership, SignInParams, SignInResult, SignUpParams, SignUpResult, SetActiveParams, UpdateUserParams, ConfigState, ConfigContextValue, ConfigProviderProps, ThemeState, ThemeContextValue, ThemeProviderProps, OrganizationBranding, SessionState, SessionContextMethods, SessionContextValue, OrganizationState, OrganizationInvitation, OrganizationContextMethods, OrganizationContextValue, CreateOrganizationParams, UpdateOrganizationParams, InviteMemberParams, PermissionState, PermissionContext, PermissionContextMethods, PermissionContextValue, AuthContextMethods, ConfigContextMethods, ThemeContextMethods, } from './types';
/**
* Combined provider props for convenience
*/
export interface FrankAuthProviderProps {
children: React.ReactNode;
config: Partial<FrankAuthUIConfig>;
onError?: (error: any) => void;
onSignIn?: (user: any) => void;
onSignOut?: () => void;
onConfigChange?: (config: FrankAuthUIConfig) => void;
onThemeChange?: (theme: any) => void;
}
/**
* Combined Frank Auth provider that wraps all necessary providers
*
* @example
* ```tsx
* import { FrankAuthProvider } from '@frank-auth/react';
*
* function App() {
* return (
* <FrankAuthProvider config={{
* publishableKey: 'pk_test_...',
* userType: 'external',
* theme: { mode: 'dark' }
* }}>
* <YourApp />
* </FrankAuthProvider>
* );
* }
* ```
*/
export declare function FrankAuthProvider({ children, config, onError, onSignIn, onSignOut, onConfigChange, onThemeChange, }: FrankAuthProviderProps): import("react/jsx-runtime").JSX.Element;
/**
* Check if all required providers are available
*/
export declare function useProviderStatus(): {
auth: boolean;
config: boolean;
theme: boolean;
allAvailable: boolean;
};
/**
* Higher-order component that ensures all providers are available
*/
export declare function withProviders<T extends object>(Component: React.ComponentType<T>): {
(props: T): import("react/jsx-runtime").JSX.Element;
displayName: string;
};
/**
* Hook that provides all provider contexts
*/
export declare function useAllProviders(): {
auth: import('./types').AuthContextValue;
config: import('./types').ConfigContextValue;
theme: import('./types').ThemeContextValue;
};
export default FrankAuthProvider;
//# sourceMappingURL=index.d.ts.map