import { type AnalyticsCallback, type ErrorCallback, type InfoCallback, type InviteFlow, type MentionContextIdentifier, type MentionDescription, type MentionDisabledState, type MentionDisabledStateInput, type MentionNameDetails, type MentionProvider, type MentionResourceConfig, type MentionsResult, type MentionStats, type ResourceProvider, type ResultCallback, type UserRole } from '../types'; export type { MentionStats, ResultCallback, ErrorCallback, InfoCallback, MentionResourceConfig, ResourceProvider, MentionContextIdentifier, MentionProvider, } from '../types'; /** * Configuration for the TeamMentionResource, which extends {@link MentionResourceConfig} * to support fetching team mentions from a separate team search service endpoint. * * Used as the second argument when constructing a {@link TeamMentionResource}, alongside * a standard `MentionResourceConfig` for user mentions. */ export interface TeamMentionResourceConfig extends MentionResourceConfig { /** * A custom resolver function to generate the URL for a team's profile page. * If not provided, a default link of `{window.location.origin}/people/team/{teamId}` is used. * * @param teamId - The ID of the team (with any ARI prefix already trimmed). * @returns The full URL to the team's profile page. */ teamLinkResolver?: (teamId: string) => string; } /** * Support */ export interface ResolvingMentionProvider extends MentionProvider { cacheMentionName(id: string, mentionName: string): void; resolveMentionName(id: string): Promise | MentionNameDetails; supportsMentionNameResolving(): boolean; } declare class AbstractResource implements ResourceProvider { protected changeListeners: Map>; protected errListeners: Map; protected infoListeners: Map; protected allResultsListeners: Map>; protected analyticsListeners: Map; constructor(); subscribe(key: string, callback?: ResultCallback, errCallback?: ErrorCallback, infoCallback?: InfoCallback, allResultsCallback?: ResultCallback, analyticsListeners?: AnalyticsCallback): void; unsubscribe(key: string): void; } declare class AbstractMentionResource extends AbstractResource implements MentionProvider { shouldHighlightMention(_mention: MentionDescription): boolean; filter(query?: string): void; recordMentionSelection(_mention: MentionDescription): void; isFiltering(_query: string): boolean; protected _notifyListeners(mentionsResult: MentionsResult, stats?: MentionStats): void; protected _notifyAllResultsListeners(mentionsResult: MentionsResult): void; protected _notifyErrorListeners(error: Error, query?: string): void; protected _notifyInfoListeners(info: string): void; protected _notifyAnalyticsListeners(event: string, actionSubject: string, action: string, attributes?: { [key: string]: any; }): void; } /** * Provides a Javascript API */ export declare class MentionResource extends AbstractMentionResource implements ResolvingMentionProvider { private config; private lastReturnedSearch; private activeSearches; productName?: string; shouldEnableInvite: boolean; userRole: UserRole; onInviteItemClick?: (flow: InviteFlow) => void; inviteXProductUser?: (userId: string, mentionName: string) => Promise; constructor(config: MentionResourceConfig); shouldHighlightMention(mention: MentionDescription): boolean; getMentionDisabledState(mention: MentionDisabledStateInput): MentionDisabledState | undefined; notify(searchTime: number, mentionResult: MentionsResult, query?: string): void; notifyError(error: Error, query?: string): void; filter(query?: string, contextIdentifier?: MentionContextIdentifier): Promise; isFiltering(query: string): boolean; resolveMentionName(id: string): Promise | MentionNameDetails; cacheMentionName(id: string, mentionName: string): void; supportsMentionNameResolving(): boolean; protected updateActiveSearches(query: string): void; protected verifyMentionConfig(config: MentionResourceConfig): void; private initialState; /** * Clear a context object to generate query params by removing empty * strings, `undefined` and empty values. * * @param contextIdentifier the current context identifier * @returns a safe context for query encoding */ private clearContext; private getQueryParams; /** * Returns the initial mention display list before a search is performed for the specified * container. * * @param contextIdentifier * @returns Promise */ protected remoteInitialState(contextIdentifier?: MentionContextIdentifier): Promise; private search; protected remoteSearch(query: string, contextIdentifier?: MentionContextIdentifier): Promise; private transformServiceResponse; } export declare class HttpError implements Error { name: string; message: string; statusCode: number; stack?: string; constructor(statusCode: number, statusMessage: string); } export declare const isResolvingMentionProvider: (p: any) => p is ResolvingMentionProvider; export { AbstractResource, AbstractMentionResource }; export default MentionResource;