UNPKG

@atlaskit/profilecard

Version:

A React component to display a card with user information.

685 lines (620 loc) 16.8 kB
<!-- API Report Version: 2.3 --> ## API Report File for "@atlaskit/profilecard" > Do not edit this file. This report is auto-generated using > [API Extractor](https://api-extractor.com/). > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports) ### Table of contents - [Main Entry Types](#main-entry-types) - [Peer Dependencies](#peer-dependencies) ### Main Entry Types <!--SECTION START: Main Entry Types--> ```ts /// <reference types="react" /> import { AnalyticsEventPayload } from '@atlaskit/analytics-next'; import { ComponentType } from 'react'; import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next'; import { IntlShape } from 'react-intl-next'; import { LRUMap } from 'lru_map'; import { default as React_2 } from 'react'; import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next'; // @public (undocumented) type AnalyticsFromDuration = (duration: number) => AnalyticsEventPayload; // @public (undocumented) type AnalyticsFunction = (generator: AnalyticsFromDuration) => void; // @public (undocumented) interface AnalyticsProps { // (undocumented) createAnalyticsEvent?: CreateUIAnalyticsEvent; } // @public (undocumented) export interface ApiClientResponse { // (undocumented) User: { id: string; isBot: boolean; isCurrentUser: boolean; avatarUrl: null | string; email: null | string; fullName: null | string; location: null | string; meta: null | string; nickname: null | string; companyName: null | string; remoteTimeString: null | string; remoteWeekdayIndex: null | string; remoteWeekdayString: null | string; status: StatusType; statusModifiedDate: null | number; }; } // @public (undocumented) interface CacheConfig { // (undocumented) cacheMaxAge?: number; // (undocumented) cacheSize?: number; } // @public (undocumented) interface CachedData<T> { // (undocumented) expire: number; // (undocumented) profile: T; } // @public (undocumented) class CachingClient<T> { constructor(config: CacheConfig); // (undocumented) cache: LRUMap<string, CachedData<T>> | null; // (undocumented) config: Required<CacheConfig>; // (undocumented) flushCache(): void; // (undocumented) getCachedProfile(cacheIdentifier: string): T | null; // (undocumented) setCachedProfile(cacheIdentifier: string, profile: T): void; } // @public (undocumented) interface ClientOverrides { // (undocumented) teamCentralClient?: TeamCentralCardClient; // (undocumented) teamClient?: TeamProfileClient; // (undocumented) userClient?: UserProfileClient; } // @public (undocumented) const _default: React_2.ForwardRefExoticComponent< Pick<Omit<ProfileCardResourcedProps & AnalyticsProps, keyof WithAnalyticsEventsProps>, never> & Partial< Pick< Omit<ProfileCardResourcedProps & AnalyticsProps, keyof WithAnalyticsEventsProps>, keyof ProfileCardResourcedProps > > & Partial<Pick<Partial<ProfileCardResourcedProps>, never>> & React_2.RefAttributes<any> >; export default _default; // @public (undocumented) export const DELAY_MS_HIDE = 200; // @public (undocumented) export const DELAY_MS_SHOW = 800; // @public (undocumented) type FeatureFlagExtraContext = { key: string; value: string; }; // @public (undocumented) type LozengeColor = 'default' | 'inprogress' | 'moved' | 'new' | 'removed' | 'success'; // @public (undocumented) interface LozengeProps { // (undocumented) appearance?: LozengeColor; // (undocumented) isBold?: boolean; // (undocumented) text: React_2.ReactNode; } // @public (undocumented) export interface MessageIntlProviderProps { // (undocumented) children: React_2.ReactNode; // (undocumented) intl: IntlShape; } // @public export const modifyResponse: (response: ApiClientResponse) => ProfileCardClientData; // @public (undocumented) export const ProfileCard: React_2.ForwardRefExoticComponent< Omit<ProfilecardProps & AnalyticsProps, keyof WithAnalyticsEventsProps> & React_2.RefAttributes<any> >; // @public (undocumented) export interface ProfileCardAction { // (undocumented) callback?: (...args: any[]) => any; // (undocumented) id?: string; // (undocumented) label: React_2.ReactNode; // (undocumented) link?: string; // (undocumented) shouldRender?: (data: any) => boolean; } // @public (undocumented) export interface ProfileCardClientData { // (undocumented) avatarUrl?: string; // (undocumented) companyName?: string; // (undocumented) customLozenges?: LozengeProps[]; // (undocumented) email?: string; // (undocumented) fullName?: string; // (undocumented) isBot: boolean; // (undocumented) isCurrentUser: boolean; // (undocumented) location?: string; // (undocumented) meta?: string; // (undocumented) nickname?: string; // (undocumented) status: StatusType; // (undocumented) statusModifiedDate?: null | number; // (undocumented) timestring?: string; } // @public (undocumented) export type ProfileCardErrorType = null | { reason: 'NotFound' | 'default'; }; // @public (undocumented) export interface ProfilecardProps { // (undocumented) actions?: ProfileCardAction[]; // (undocumented) addFlag?: (flag: any) => void; // (undocumented) avatarUrl?: string; // (undocumented) clientFetchProfile?: () => void; // (undocumented) cloudId?: string; // (undocumented) companyName?: string; // (undocumented) customLozenges?: LozengeProps[]; // (undocumented) disabledAccountMessage?: React_2.ReactNode; // (undocumented) email?: string; // (undocumented) errorType?: ProfileCardErrorType; // (undocumented) fullName?: string; // (undocumented) hasDisabledAccountLozenge?: boolean; // (undocumented) hasError?: boolean; // (undocumented) isBot?: boolean; // (undocumented) isCurrentUser?: boolean; // (undocumented) isKudosEnabled?: boolean; // (undocumented) isLoading?: boolean; // (undocumented) location?: string; // (undocumented) meta?: string; // (undocumented) nickname?: string; onReportingLinesClick?: (user: ReportingLinesUser) => void; // (undocumented) openKudosDrawer?: () => void; reportingLines?: TeamCentralReportingLinesData; reportingLinesProfileUrl?: string; // (undocumented) status?: StatusType; // (undocumented) statusModifiedDate?: null | number; // (undocumented) teamCentralBaseUrl?: string; // (undocumented) timestring?: string; // (undocumented) userId?: string; // (undocumented) withoutElevation?: boolean; } // @public (undocumented) export interface ProfileCardResourcedProps { // (undocumented) actions?: ProfileCardAction[]; // (undocumented) addFlag?: (flag: any) => void; // (undocumented) children?: React_2.ReactNode; // (undocumented) cloudId: string; // (undocumented) onReportingLinesClick?: (user: ReportingLinesUser) => void; // (undocumented) position?: ProfilecardTriggerPosition; // (undocumented) reportingLinesProfileUrl?: string; // (undocumented) resourceClient: ProfileClient_2; // (undocumented) trigger?: TriggerType; // (undocumented) userId: string; } // @public (undocumented) export interface ProfileCardResourcedState { // (undocumented) data: ProfileCardClientData | null; // (undocumented) error?: ProfileCardErrorType; // (undocumented) hasError: boolean; // (undocumented) isKudosEnabled?: boolean; // (undocumented) isLoading?: boolean; // (undocumented) kudosDrawerOpen: boolean; // (undocumented) reportingLinesData?: TeamCentralReportingLinesData; // (undocumented) visible?: boolean; } // @public (undocumented) export const ProfileCardTrigger: React_2.ForwardRefExoticComponent< Pick<Omit<ProfileCardTriggerProps & AnalyticsProps, keyof WithAnalyticsEventsProps>, never> & Partial< Pick< Omit<ProfileCardTriggerProps & AnalyticsProps, keyof WithAnalyticsEventsProps>, keyof ProfileCardTriggerProps > > & Partial<Pick<Partial<ProfileCardTriggerProps>, never>> & React_2.RefAttributes<any> >; // @public (undocumented) export type ProfilecardTriggerPosition = | 'bottom' | 'bottom-end' | 'bottom-start' | 'left' | 'left-end' | 'left-start' | 'right' | 'right-end' | 'right-start' | 'top' | 'top-end' | 'top-start'; // @public (undocumented) export interface ProfileCardTriggerProps { // (undocumented) actions?: ProfileCardAction[]; // (undocumented) addFlag?: (flag: any) => void; // (undocumented) children?: React_2.ReactNode; cloudId?: string; // (undocumented) onReportingLinesClick?: (user: ReportingLinesUser) => void; // (undocumented) position?: ProfilecardTriggerPosition; // (undocumented) reportingLinesProfileUrl?: string; // (undocumented) resourceClient: ProfileClient_2; // (undocumented) testId?: string; // (undocumented) trigger?: TriggerType; // (undocumented) userId: string; } // @public (undocumented) export interface ProfileCardTriggerState { // (undocumented) data: ProfileCardClientData | null; // (undocumented) error?: ProfileCardErrorType; // (undocumented) hasError: boolean; // (undocumented) isLoading?: boolean; // (undocumented) kudosDrawerOpen: boolean; // (undocumented) reportingLinesData?: TeamCentralReportingLinesData; // (undocumented) shouldShowGiveKudos?: boolean; // (undocumented) teamCentralBaseUrl?: string; // (undocumented) visible?: boolean; } // @public (undocumented) export class ProfileClient { constructor(config: ProfileClientOptions, clients?: ClientOverrides); // (undocumented) flushCache(): void; // (undocumented) getProfile( cloudId: string, userId: string, analytics?: (event: AnalyticsEventPayload) => void, ): Promise<any>; // (undocumented) getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>; // (undocumented) getTeamCentralBaseUrl(): string | undefined; // (undocumented) getTeamProfile( teamId: string, orgId?: string, analytics?: (event: AnalyticsEventPayload) => void, ): Promise<Team>; // (undocumented) shouldShowGiveKudos(): Promise<boolean>; // (undocumented) tcClient?: TeamCentralCardClient; // (undocumented) teamClient: TeamProfileClient; // (undocumented) userClient: UserProfileClient; } // @public (undocumented) interface ProfileClient_2 { // (undocumented) flushCache: () => void; // (undocumented) getProfile: ( cloudId: string, userId: string, analytics?: (event: AnalyticsEventPayload) => void, ) => Promise<ProfileCardClientData>; // (undocumented) getReportingLines: (userId: string) => Promise<TeamCentralReportingLinesData>; // (undocumented) getTeamCentralBaseUrl: () => string | undefined; // (undocumented) getTeamProfile: ( teamId: string, orgId?: string, fireAnalytics?: (event: AnalyticsEventPayload) => void, ) => Promise<Team>; // (undocumented) shouldShowGiveKudos: () => Promise<boolean>; } // @public (undocumented) export interface ProfileClientOptions { // (undocumented) cacheMaxAge?: number; // (undocumented) cacheSize?: number; // (undocumented) cloudId?: string; // (undocumented) gatewayGraphqlUrl?: string; productIdentifier?: string; teamCentralBaseUrl?: string; teamCentralUrl?: string; // (undocumented) url: string; } // @public (undocumented) export type RelativeDateKeyType = | 'AFewMonths' | 'LastMonth' | 'MoreThanAYear' | 'SeveralMonths' | 'ThisMonth' | 'ThisWeek' | null; // @public (undocumented) interface ReportingLinesUser { // (undocumented) accountIdentifier: string; // (undocumented) identifierType: 'ATLASSIAN_ID' | 'BASE64_HASH' | 'UNKNOWN'; // (undocumented) pii?: ReportingLinesUserPII; } // @public (undocumented) interface ReportingLinesUserPII { // (undocumented) name: string; // (undocumented) picture?: string; } // @public (undocumented) export type StatusModifiedDateType = | 'aFewMonths' | 'lastMonth' | 'moreThanAYear' | 'noDate' | 'severalMonths' | 'thisMonth' | 'thisWeek'; // @public (undocumented) export type StatusType = 'active' | 'closed' | 'inactive'; // @public (undocumented) export interface Team { // (undocumented) description: string; // (undocumented) displayName: string; // (undocumented) id: string; // (undocumented) largeAvatarImageUrl?: string; // (undocumented) largeHeaderImageUrl?: string; // (undocumented) members?: { id: string; fullName: string; avatarUrl: string; }[]; // (undocumented) organizationId?: string; // (undocumented) smallAvatarImageUrl?: string; // (undocumented) smallHeaderImageUrl?: string; } // @public (undocumented) class TeamCentralCardClient extends CachingClient<TeamCentralReportingLinesData> { constructor(options: TeamCentralCardClientOptions); bypassOnFailure: boolean; // (undocumented) checkWorkspaceExists(): Promise<boolean>; // (undocumented) createTcReadyPromise(config: ProfileClientOptions): Promise<boolean>; // (undocumented) featureFlagKeys: Map<string, boolean>; // (undocumented) getFlagEnabled(featureKey: string, productIdentifier?: string): Promise<boolean>; // (undocumented) getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>; // (undocumented) isTCReadyPromise: Promise<boolean>; // (undocumented) makeFeatureFlagCheckRequest( featureKey: string, context?: FeatureFlagExtraContext[], ): Promise<boolean>; // (undocumented) makeRequest(userId: string): Promise<TeamCentralReportingLinesData>; // (undocumented) options: TeamCentralCardClientOptions; } // @public (undocumented) type TeamCentralCardClientOptions = ProfileClientOptions & { teamCentralUrl: string; }; // @public (undocumented) interface TeamCentralReportingLinesData { // (undocumented) managers?: ReportingLinesUser[]; // (undocumented) reports?: ReportingLinesUser[]; } // @public (undocumented) export const TeamProfileCard: (props: TeamProfilecardProps) => JSX.Element | null; // @public (undocumented) interface TeamProfilecardCoreProps { actions?: ProfileCardAction[]; generateUserLink?: (userId: string) => string; onUserClick?: (userId: string, event: React_2.MouseEvent<Element>) => void; viewingUserId?: string; viewProfileLink: string; viewProfileOnClick?: (event?: React_2.MouseEvent<Element>) => void; } // @public (undocumented) type TeamProfileCardErrorType = null | { reason: 'NotFound' | 'TEAMS_FORBIDDEN' | 'default'; }; // @public (undocumented) interface TeamProfilecardProps extends TeamProfilecardCoreProps { analytics: AnalyticsFunction; clientFetchProfile?: () => void; errorType?: TeamProfileCardErrorType; hasError?: boolean; isLoading?: boolean; team?: Team; } // @public (undocumented) export const TeamProfileCardTrigger: React_2.ForwardRefExoticComponent< Pick<Omit<TeamProfileCardTriggerProps & AnalyticsProps, keyof WithAnalyticsEventsProps>, never> & Partial< Pick< Omit<TeamProfileCardTriggerProps & AnalyticsProps, keyof WithAnalyticsEventsProps>, keyof TeamProfileCardTriggerProps > > & Partial<Pick<Partial<TeamProfileCardTriggerProps>, never>> & React_2.RefAttributes<any> >; // @public (undocumented) interface TeamProfileCardTriggerProps extends TeamProfilecardCoreProps { addFlag?: (flag: any) => void; children?: React_2.ReactNode; cloudId?: string; orgId: string; position?: ProfilecardTriggerPosition; resourceClient: ProfileClient_2; teamId: string; trigger?: 'click' | 'hover' | 'hover-click'; triggerLinkType?: 'clickable-link' | 'link' | 'none'; } // @public (undocumented) export class TeamProfileClient extends CachingClient<Team> { constructor(options: ProfileClientOptions); // (undocumented) getProfile( teamId: string, orgId: string | undefined, analytics?: (event: AnalyticsEventPayload) => void, ): Promise<Team>; // (undocumented) makeRequest(teamId: string, _orgId: string | undefined): Promise<Team>; // (undocumented) options: ProfileClientOptions; } // @public (undocumented) export type TriggerType = 'click' | 'hover'; // @public (undocumented) export class UserProfileClient extends CachingClient<any> { constructor(options: ProfileClientOptions); // (undocumented) getProfile( cloudId: string, userId: string, analytics?: (event: AnalyticsEventPayload) => void, ): Promise<any>; // (undocumented) makeRequest(cloudId: string, userId: string): Promise<ProfileCardClientData>; // (undocumented) options: ProfileClientOptions; } // @public (undocumented) export function withOuterListeners<P>( Component: ComponentType<P>, ): React_2.ComponentClass<P & WithOuterListenersProps>; // @public (undocumented) export interface WithOuterListenersProps { // (undocumented) handleClickOutside?: () => void; // (undocumented) handleEscapeKeydown?: () => void; } // (No @packageDocumentation comment for this package) ``` <!--SECTION END: Main Entry Types--> ### Peer Dependencies <!--SECTION START: Peer Dependencies--> ```json { "react": "^16.8.0", "react-dom": "^16.8.0" } ``` <!--SECTION END: Peer Dependencies-->