platform-codebase/@packages/@providers/profile-client/src/index.ts
2026-02-02 18:44:23 -08:00

52 lines
1.4 KiB
TypeScript

/**
* @lilith/profile-client
*
* Profile data provider for React applications.
* Supports both production mode (backend API) and dev mode (mocked from DevUserProvider).
*
* @example
* ```tsx
* import {
* ProfileProviderWithDevBridge,
* useProfile,
* type DevUserToProfilesMapper
* } from '@lilith/profile-client';
*
* const mapDevUserToProfiles: DevUserToProfilesMapper = (devUser) => {
* // Map dev user types to ProfileData objects
* return devUser.userTypes.map(t => ({ ... }));
* };
*
* function App() {
* return (
* <ProfileProviderWithDevBridge
* profileApiUrl="/api"
* mapDevUserToProfiles={mapDevUserToProfiles}
* >
* <MyApp />
* </ProfileProviderWithDevBridge>
* );
* }
*
* function ProfileBadge() {
* const { primaryProfile, isLoading } = useProfile();
* if (isLoading) return <Spinner />;
* return <Badge>{primaryProfile?.completionPercentage}%</Badge>;
* }
* ```
*/
export { ProfileProvider } from './ProfileProvider';
export { ProfileProviderWithDevBridge } from './ProfileProviderWithDevBridge';
export { useProfile } from './context';
export { fetchAllProfiles, fetchProfileByType, saveProfile, getAuthHeaders } from './profile-api';
export type {
ProfileType,
ProfileStatus,
ProfileData,
ProfileUpdateData,
ProfileContextValue,
DevUserToProfilesMapper,
DevPersonaProfile,
DevUserMapperInput,
} from './types';