UNPKG

matrix-react-sdk

Version:
59 lines (58 loc) 2.58 kB
import { Room } from "matrix-js-sdk/src/models/room"; import { PermalinkParts } from "./PermalinkConstructor"; export declare class RoomPermalinkCreator { private room; private roomId; private highestPlUserId; private populationMap; private bannedHostsRegexps; private allowedHostsRegexps; private _serverCandidates; private started; constructor(room: Room, roomId?: string); load(): void; start(): void; stop(): void; get serverCandidates(): string[]; isStarted(): boolean; forEvent(eventId: string): string; forShareableRoom(): string; forRoom(): string; private onRoomState; private onMembership; private updateHighestPlUser; private updateAllowedServers; private updatePopulationMap; private updateServerCandidates; } export declare function makeGenericPermalink(entityId: string): string; export declare function makeUserPermalink(userId: string): string; export declare function makeRoomPermalink(roomId: string): string; export declare function makeGroupPermalink(groupId: string): string; export declare function isPermalinkHost(host: string): boolean; /** * Transforms an entity (permalink, room alias, user ID, etc) into a local URL * if possible. If the given entity is not found to be valid enough to be converted * then a null value will be returned. * @param {string} entity The entity to transform. * @returns {string|null} The transformed permalink or null if unable. */ export declare function tryTransformEntityToPermalink(entity: string): string; /** * Transforms a permalink (or possible permalink) into a local URL if possible. If * the given permalink is found to not be a permalink, it'll be returned unaltered. * @param {string} permalink The permalink to try and transform. * @returns {string} The transformed permalink or original URL if unable. */ export declare function tryTransformPermalinkToLocalHref(permalink: string): string; export declare function getPrimaryPermalinkEntity(permalink: string): string; export declare function parsePermalink(fullUrl: string): PermalinkParts; /** * Parses an app local link (`#/(user|room|group)/identifer`) to a Matrix entity * (room, user, group). Such links are produced by `HtmlUtils` when encountering * links, which calls `tryTransformPermalinkToLocalHref` in this module. * @param {string} localLink The app local link * @returns {PermalinkParts} */ export declare function parseAppLocalLink(localLink: string): PermalinkParts; export declare const calculateRoomVia: (room: any) => string[];