analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
36 lines • 1.62 kB
TypeScript
import { PROFILE_ROLES } from '../../types/chat';
import { type ProfileLabelsMap } from '../../types/profileLabels';
import type { BaseApiClient } from '../../types/api';
export interface UseProfileLabelsConfig {
apiClient: Pick<BaseApiClient, 'get'>;
}
export interface UseProfileLabelsReturn {
/** Full resolved label map (custom labels merged over the defaults). */
labels: Record<PROFILE_ROLES, string>;
/**
* Only the institution's explicit overrides (the raw feature flag `version`),
* with no defaults merged in. Use this when a consumer has its own fallback
* label and only wants to replace it when the institution customized it.
*/
customLabels: ProfileLabelsMap;
/** Resolve a single role's display label using the resolved map. */
getProfileLabel: (role: PROFILE_ROLES | string) => string;
loading: boolean;
}
/**
* Resolve the institution's custom profile nomenclatura (PROFILE_LABELS feature
* flag) and expose a label map + resolver. Falls back to DEFAULT_PROFILE_LABELS
* when the institution has no custom labels, so apps render correctly even
* without the flag.
*
* Mirrors `useSupportFeatureFlag`: `institutionId` comes from `useAppStore` and
* the HTTP client is injected so each app passes its authenticated instance.
*
* @example
* ```tsx
* const { getProfileLabel } = useProfileLabels({ apiClient });
* <span>{getProfileLabel(PROFILE_ROLES.STUDENT)}</span> // "Estudante"
* ```
*/
export declare const useProfileLabels: (config: UseProfileLabelsConfig) => UseProfileLabelsReturn;
//# sourceMappingURL=useProfileLabels.d.ts.map