UNPKG

@droppii-org/chat-sdk

Version:

Droppii React Chat SDK

29 lines 1.37 kB
import { MessageType } from "@openim/wasm-client-sdk"; export declare function renderFileSize(bytes: number): string; export declare const generateContentBasedOnMessageType: (contentType: MessageType, plainText?: string) => string; export declare const parseLatestMessage: (latestMsg: string, currentUserId?: string, t?: any) => string | undefined; export declare const highlightSearch: (text: string, keyword: string, maxLength?: number) => string; interface FormatOptions { hasTime?: boolean; dateMonthFormat?: string; } export declare function formatTimestamp(timestamp: number, options?: FormatOptions): string; export declare const urlRegex: RegExp; export declare function extractLinks(text: string): string[]; export declare function wrapLinksInHtml(htmlContent: string): string; export declare const getHostFromUrl: (url: string) => string | null; /** * Sanitizes HTML content to prevent XSS attacks * Uses DOMPurify to remove all potentially malicious code * * @param html - Raw HTML content that may contain malicious scripts * @returns Sanitized HTML safe for rendering * * @example * const userInput = '<img src=x onerror=alert("XSS")>'; * const safe = sanitizeHtml(userInput); * // Returns: '<img src="x">' (onerror removed) */ export declare function sanitizeHtml(html: string): string; export {}; //# sourceMappingURL=common.d.ts.map