@frank-auth/react
Version:
Flexible and customizable React UI components for Frank Authentication
340 lines • 17.8 kB
TypeScript
import { useAuth, useAuthActions, useAuthOrganization, useAuthState, useAuthStatus } from './use-auth';
import { useUser, useUserActions, useUserProfile, useUserVerification } from './use-user';
import { useMultiSession, useSession, useSessionExpiry, useSessionSecurity, useSessionStatus } from './use-session';
import { useOrganization, useOrganizationInvitations, useOrganizationMembership, useOrganizationSwitcher } from './use-organization';
import { useComponentConfiguration, useConfig, useConfigValidation, useFeatureFlags, useLocalizationConfig, useOrganizationConfiguration, useThemeConfig } from './use-config';
import { useTheme, useThemeColors, useThemeLayout, useThemeStyles, useThemeTypography } from './use-theme';
import { useOrganizationPermissions, usePermissionGuard, usePermissions, useSystemPermissions } from './use-permissions';
import { useBackupCodes, useMFA, useSMSMFA, useTOTP } from './use-mfa';
import { usePasskeyAuthentication, usePasskeyRegistration, usePasskeys } from './use-passkeys';
import { useOAuth, useOAuthCallback, useOAuthProvider } from './use-oauth';
import { useMagicLink, useMagicLinkPasswordReset, useMagicLinkSignIn, useMagicLinkVerification } from './use-magic-link';
export { useAuth, useAuthState, useAuthActions, useAuthOrganization, useAuthStatus, } from './use-auth';
export { useUser, useUserProfile, useUserVerification, useUserActions, } from './use-user';
export { useSession, useSessionStatus, useMultiSession, useSessionSecurity, useSessionExpiry, } from './use-session';
export { useOrganization, useOrganizationMembership, useOrganizationInvitations, useOrganizationSwitcher, } from './use-organization';
export { useConfig, useFeatureFlags, useThemeConfig, useLocalizationConfig, useOrganizationConfiguration, useComponentConfiguration, useConfigValidation, } from './use-config';
export { useTheme, useThemeColors, useThemeTypography, useThemeLayout, useThemeStyles, } from './use-theme';
export { usePermissions, useOrganizationPermissions, useSystemPermissions, usePermissionGuard, PERMISSION_ACTIONS, PERMISSION_RESOURCES, SYSTEM_ROLES, ORGANIZATION_ROLES, } from './use-permissions';
export { useMFA, useTOTP, useSMSMFA, useBackupCodes, MFA_METHOD_CONFIGS, } from './use-mfa';
export { usePasskeys, usePasskeyRegistration, usePasskeyAuthentication, } from './use-passkeys';
export { useOAuth, useOAuthProvider, useOAuthCallback, OAUTH_PROVIDERS, } from './use-oauth';
export { useMagicLink, useMagicLinkSignIn, useMagicLinkVerification, useMagicLinkPasswordReset, MAGIC_LINK_CONFIG, } from './use-magic-link';
export type { AuthError, AuthFeatures, AuthState, OrganizationMembership, SignInParams, SignInResult, SignUpParams, SignUpResult, SetActiveParams, UpdateUserParams, SessionState, SessionContextMethods, SessionContextValue, OrganizationState, OrganizationInvitation, OrganizationContextMethods, OrganizationContextValue, CreateOrganizationParams, UpdateOrganizationParams, InviteMemberParams, PermissionState, PermissionContext, PermissionContextMethods, PermissionContextValue, ThemeState, ThemeContextValue, OrganizationBranding, ConfigState, ConfigContextValue, } from '../provider/types';
export type { User, Session, Organization, OrganizationSettings, AuthStatus, UserType, AuthProvider, MFAMethod, PasskeySummary, } from '@frank-auth/client';
/**
* Collection of all core authentication hooks
* Useful for understanding what's available or for testing
*/
export declare const CORE_AUTH_HOOKS: {
readonly useAuth: typeof useAuth;
readonly useUser: typeof useUser;
readonly useSession: typeof useSession;
readonly useOrganization: typeof useOrganization;
readonly useConfig: typeof useConfig;
readonly useTheme: typeof useTheme;
readonly usePermissions: typeof usePermissions;
};
/**
* Collection of all authentication method hooks
* For different authentication strategies
*/
export declare const AUTH_METHOD_HOOKS: {
readonly useMFA: typeof useMFA;
readonly usePasskeys: typeof usePasskeys;
readonly useOAuth: typeof useOAuth;
readonly useMagicLink: typeof useMagicLink;
};
/**
* Collection of all specialized hooks
* For specific use cases and advanced functionality
*/
export declare const SPECIALIZED_HOOKS: {
readonly useAuthState: typeof useAuthState;
readonly useAuthActions: typeof useAuthActions;
readonly useAuthOrganization: typeof useAuthOrganization;
readonly useAuthStatus: typeof useAuthStatus;
readonly useUserProfile: typeof useUserProfile;
readonly useUserVerification: typeof useUserVerification;
readonly useUserActions: typeof useUserActions;
readonly useSessionStatus: typeof useSessionStatus;
readonly useMultiSession: typeof useMultiSession;
readonly useSessionSecurity: typeof useSessionSecurity;
readonly useSessionExpiry: typeof useSessionExpiry;
readonly useOrganizationMembership: typeof useOrganizationMembership;
readonly useOrganizationInvitations: typeof useOrganizationInvitations;
readonly useOrganizationSwitcher: typeof useOrganizationSwitcher;
readonly useFeatureFlags: typeof useFeatureFlags;
readonly useThemeConfig: typeof useThemeConfig;
readonly useLocalizationConfig: typeof useLocalizationConfig;
readonly useOrganizationConfiguration: typeof useOrganizationConfiguration;
readonly useComponentConfiguration: typeof useComponentConfiguration;
readonly useConfigValidation: typeof useConfigValidation;
readonly useThemeColors: typeof useThemeColors;
readonly useThemeTypography: typeof useThemeTypography;
readonly useThemeLayout: typeof useThemeLayout;
readonly useThemeStyles: typeof useThemeStyles;
readonly useOrganizationPermissions: typeof useOrganizationPermissions;
readonly useSystemPermissions: typeof useSystemPermissions;
readonly usePermissionGuard: typeof usePermissionGuard;
readonly useTOTP: typeof useTOTP;
readonly useSMSMFA: typeof useSMSMFA;
readonly useBackupCodes: typeof useBackupCodes;
readonly usePasskeyRegistration: typeof usePasskeyRegistration;
readonly usePasskeyAuthentication: typeof usePasskeyAuthentication;
readonly useOAuthProvider: typeof useOAuthProvider;
readonly useOAuthCallback: typeof useOAuthCallback;
readonly useMagicLinkSignIn: typeof useMagicLinkSignIn;
readonly useMagicLinkVerification: typeof useMagicLinkVerification;
readonly useMagicLinkPasswordReset: typeof useMagicLinkPasswordReset;
};
/**
* Authentication hooks for sign-in/sign-up flows
*/
export declare const AUTHENTICATION_HOOKS: {
readonly useAuth: typeof useAuth;
readonly useOAuth: typeof useOAuth;
readonly useMagicLink: typeof useMagicLink;
readonly usePasskeys: typeof usePasskeys;
readonly useMFA: typeof useMFA;
};
/**
* User management hooks for profile and account management
*/
export declare const USER_MANAGEMENT_HOOKS: {
readonly useUser: typeof useUser;
readonly useSession: typeof useSession;
readonly usePermissions: typeof usePermissions;
};
/**
* Organization management hooks for multi-tenant applications
*/
export declare const ORGANIZATION_HOOKS: {
readonly useOrganization: typeof useOrganization;
readonly useOrganizationPermissions: typeof useOrganizationPermissions;
readonly useOrganizationConfiguration: typeof useOrganizationConfiguration;
};
/**
* UI customization hooks for theming and configuration
*/
export declare const UI_CUSTOMIZATION_HOOKS: {
readonly useTheme: typeof useTheme;
readonly useConfig: typeof useConfig;
readonly useFeatureFlags: typeof useFeatureFlags;
readonly useComponentConfiguration: typeof useComponentConfiguration;
};
/**
* Security hooks for advanced security features
*/
export declare const SECURITY_HOOKS: {
readonly usePermissions: typeof usePermissions;
readonly useMFA: typeof useMFA;
readonly usePasskeys: typeof usePasskeys;
readonly useSessionSecurity: typeof useSessionSecurity;
};
/**
* Get all available hooks as an array
* Useful for debugging or documentation
*/
export declare function getAllHooks(): (typeof useConfig | typeof useTheme | typeof useOrganization | typeof useSession | typeof usePermissions | typeof useMFA | typeof usePasskeys | typeof useOAuth | typeof useMagicLink | typeof useAuthState | typeof useAuthActions | typeof useAuthOrganization | typeof useAuthStatus | typeof useUserProfile | typeof useUserVerification | typeof useUserActions | typeof useSessionStatus | typeof useMultiSession | typeof useSessionSecurity | typeof useSessionExpiry | typeof useOrganizationMembership | typeof useOrganizationInvitations | typeof useOrganizationSwitcher | typeof useFeatureFlags | typeof useThemeConfig | typeof useLocalizationConfig | typeof useOrganizationConfiguration | typeof useComponentConfiguration | typeof useConfigValidation | typeof useThemeColors | typeof useThemeTypography | typeof useThemeLayout | typeof useThemeStyles | typeof useOrganizationPermissions | typeof useSystemPermissions | typeof usePermissionGuard | typeof useTOTP | typeof useSMSMFA | typeof useBackupCodes | typeof usePasskeyRegistration | typeof usePasskeyAuthentication | typeof useOAuthProvider | typeof useOAuthCallback | typeof useMagicLinkSignIn | typeof useMagicLinkVerification | typeof useMagicLinkPasswordReset)[];
declare const HOOK_CATEGORIES: {
authentication: {
readonly useAuth: typeof useAuth;
readonly useOAuth: typeof useOAuth;
readonly useMagicLink: typeof useMagicLink;
readonly usePasskeys: typeof usePasskeys;
readonly useMFA: typeof useMFA;
};
userManagement: {
readonly useUser: typeof useUser;
readonly useSession: typeof useSession;
readonly usePermissions: typeof usePermissions;
};
organization: {
readonly useOrganization: typeof useOrganization;
readonly useOrganizationPermissions: typeof useOrganizationPermissions;
readonly useOrganizationConfiguration: typeof useOrganizationConfiguration;
};
uiCustomization: {
readonly useTheme: typeof useTheme;
readonly useConfig: typeof useConfig;
readonly useFeatureFlags: typeof useFeatureFlags;
readonly useComponentConfiguration: typeof useComponentConfiguration;
};
security: {
readonly usePermissions: typeof usePermissions;
readonly useMFA: typeof useMFA;
readonly usePasskeys: typeof usePasskeys;
readonly useSessionSecurity: typeof useSessionSecurity;
};
};
/**
* Get hooks by category
* Useful for conditional loading or feature detection
*/
export declare function getHooksByCategory(category: keyof typeof HOOK_CATEGORIES): {
readonly useAuth: typeof useAuth;
readonly useOAuth: typeof useOAuth;
readonly useMagicLink: typeof useMagicLink;
readonly usePasskeys: typeof usePasskeys;
readonly useMFA: typeof useMFA;
} | {
readonly useUser: typeof useUser;
readonly useSession: typeof useSession;
readonly usePermissions: typeof usePermissions;
} | {
readonly useOrganization: typeof useOrganization;
readonly useOrganizationPermissions: typeof useOrganizationPermissions;
readonly useOrganizationConfiguration: typeof useOrganizationConfiguration;
} | {
readonly useTheme: typeof useTheme;
readonly useConfig: typeof useConfig;
readonly useFeatureFlags: typeof useFeatureFlags;
readonly useComponentConfiguration: typeof useComponentConfiguration;
} | {
readonly usePermissions: typeof usePermissions;
readonly useMFA: typeof useMFA;
readonly usePasskeys: typeof usePasskeys;
readonly useSessionSecurity: typeof useSessionSecurity;
};
/**
* Check if a hook is available
* Useful for feature detection
*/
export declare function isHookAvailable(hookName: string): boolean;
/**
* Hook metadata for development and documentation
*/
export declare const HOOK_METADATA: {
readonly useAuth: {
readonly description: "Main authentication hook providing access to auth state and methods";
readonly category: "core";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseAuthReturn";
};
readonly useUser: {
readonly description: "User management hook for profile operations and verification";
readonly category: "core";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseUserReturn";
};
readonly useSession: {
readonly description: "Session management hook for multi-session and security features";
readonly category: "core";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseSessionReturn";
};
readonly useOrganization: {
readonly description: "Organization management hook for multi-tenant operations";
readonly category: "core";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseOrganizationReturn";
};
readonly useConfig: {
readonly description: "Configuration hook for UI settings and feature flags";
readonly category: "core";
readonly dependencies: readonly ["ConfigProvider"];
readonly returnType: "UseConfigReturn";
};
readonly useTheme: {
readonly description: "Theme management hook for styling and customization";
readonly category: "core";
readonly dependencies: readonly ["ThemeProvider"];
readonly returnType: "UseThemeReturn";
};
readonly usePermissions: {
readonly description: "Permission and authorization hook for role-based access control";
readonly category: "security";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UsePermissionsReturn";
};
readonly useMFA: {
readonly description: "Multi-factor authentication hook for TOTP, SMS, and other MFA methods";
readonly category: "security";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseMFAReturn";
};
readonly usePasskeys: {
readonly description: "Passkeys (WebAuthn) hook for passwordless authentication";
readonly category: "authentication";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UsePasskeysReturn";
};
readonly useOAuth: {
readonly description: "OAuth authentication hook for social sign-in providers";
readonly category: "authentication";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseOAuthReturn";
};
readonly useMagicLink: {
readonly description: "Magic link authentication hook for passwordless email authentication";
readonly category: "authentication";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseMagicLinkReturn";
};
};
/**
* Get hook metadata
*/
export declare function getHookMetadata(hookName: keyof typeof HOOK_METADATA): {
readonly description: "Main authentication hook providing access to auth state and methods";
readonly category: "core";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseAuthReturn";
} | {
readonly description: "User management hook for profile operations and verification";
readonly category: "core";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseUserReturn";
} | {
readonly description: "Session management hook for multi-session and security features";
readonly category: "core";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseSessionReturn";
} | {
readonly description: "Organization management hook for multi-tenant operations";
readonly category: "core";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseOrganizationReturn";
} | {
readonly description: "Configuration hook for UI settings and feature flags";
readonly category: "core";
readonly dependencies: readonly ["ConfigProvider"];
readonly returnType: "UseConfigReturn";
} | {
readonly description: "Theme management hook for styling and customization";
readonly category: "core";
readonly dependencies: readonly ["ThemeProvider"];
readonly returnType: "UseThemeReturn";
} | {
readonly description: "Permission and authorization hook for role-based access control";
readonly category: "security";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UsePermissionsReturn";
} | {
readonly description: "Multi-factor authentication hook for TOTP, SMS, and other MFA methods";
readonly category: "security";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseMFAReturn";
} | {
readonly description: "Passkeys (WebAuthn) hook for passwordless authentication";
readonly category: "authentication";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UsePasskeysReturn";
} | {
readonly description: "OAuth authentication hook for social sign-in providers";
readonly category: "authentication";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseOAuthReturn";
} | {
readonly description: "Magic link authentication hook for passwordless email authentication";
readonly category: "authentication";
readonly dependencies: readonly ["AuthProvider"];
readonly returnType: "UseMagicLinkReturn";
};
/**
* Get hooks by category from metadata
*/
export declare function getHooksByMetadataCategory(category: string): string[];
export { useAuth as default } from './use-auth';
//# sourceMappingURL=index.d.ts.map