naim-firebase-auth-wrapper
Version:
React components and hooks for Firebase Authentication and Firestore with Mantine UI
141 lines • 4.01 kB
TypeScript
export interface FirebaseConfig {
apiKey: string;
authDomain: string;
projectId: string;
storageBucket: string;
messagingSenderId: string;
appId: string;
measurementId?: string;
}
export interface ThemeColors {
primary?: string;
secondary?: string;
accent?: string;
error?: string;
warning?: string;
info?: string;
success?: string;
}
export interface AuthProviderProps {
config?: FirebaseConfig;
colors?: ThemeColors;
children: React.ReactNode;
}
export interface AuthComponentProps {
onSuccess?: () => void;
onError?: (error: Error) => void;
logo?: React.ReactNode;
}
export interface AuthContextType {
user: any;
loading: boolean;
error: Error | null;
auth: any;
app: any;
db: any;
signInWithGoogle: () => Promise<any>;
signInWithEmail: (email: string, password: string) => Promise<any>;
signUp: (email: string, password: string, displayName?: string) => Promise<any>;
signOut: () => Promise<void>;
forgotPassword?: (email: string) => Promise<void>;
organizations: Organization[];
loadOrganizations: () => Promise<void>;
currentOrganization?: string | null;
setCurrentOrganization?: (orgId: string) => Promise<void>;
}
export interface UserProfile {
uid: string;
email: string;
displayName?: string;
phoneNumber?: string;
photoURL?: string;
dateOfBirth?: string;
address?: string;
organizations: {
orgId: string;
role: 'owner' | 'admin' | 'member' | 'guest';
}[];
currentOrganization?: string;
role?: string;
disabled?: boolean;
createdAt: Date | string;
}
export interface UserRegistration {
email: string;
password: string;
displayName?: string;
phoneNumber?: string;
}
export interface Organization {
id: string;
name: string;
createdAt: Date | string;
ownerId: string;
members: OrganizationMember[];
settings?: Record<string, any>;
}
export interface OrganizationMember {
userId: string;
role: 'owner' | 'admin' | 'member' | 'guest';
joinedAt: Date | string;
}
export interface OrganizationSelectorProps {
onSelect?: (orgId: string) => void;
}
export interface CreateOrganizationProps {
onSuccess?: (orgId: string) => void;
onError?: (error: Error) => void;
}
export interface UserSession {
id: string;
userId: string;
deviceInfo: string;
ipAddress?: string;
location?: string;
lastActive: Date | string;
createdAt: Date | string;
expiresAt?: Date | string;
}
export interface SessionManagerProps {
onTerminateSuccess?: () => void;
onError?: (error: Error) => void;
}
export interface Invitation {
id: string;
email: string;
orgId: string;
orgName: string;
role: 'admin' | 'member' | 'guest';
invitedBy: string;
inviterName?: string;
status: 'pending' | 'accepted' | 'declined';
createdAt: Date | string;
expiresAt: Date | string;
token: string;
}
export interface InviteUserFormProps {
orgId: string;
onSuccess?: (token: string, email: string, orgName: string, inviterName: string) => void;
onError?: (error: Error) => void;
onInvitationCreated?: (invitation: Invitation) => void;
}
export interface InvitationListProps {
orgId: string;
onResendSuccess?: (token: string, email: string, orgName: string, inviterName: string) => void;
onCancelSuccess?: () => void;
onError?: (error: Error) => void;
onInvitationResent?: (invitation: Invitation) => void;
}
export interface AcceptInvitationProps {
token: string;
onAcceptSuccess?: () => void;
onDeclineSuccess?: () => void;
onError?: (error: Error) => void;
}
export interface InvitationServiceCallbacks {
onInvitationCreated?: (invitation: Invitation) => void;
onInvitationResent?: (invitation: Invitation) => void;
onSuccess?: (invitationId: string) => void;
onError?: (error: Error) => void;
}
//# sourceMappingURL=types.d.ts.map